diff options
author | Sunil Nimmagadda <sunil@cvs.openbsd.org> | 2015-12-14 10:38:41 +0000 |
---|---|---|
committer | Sunil Nimmagadda <sunil@cvs.openbsd.org> | 2015-12-14 10:38:41 +0000 |
commit | 92ff74cb2783c0b25203b672563f290f0519c2d9 (patch) | |
tree | b6f7410d42a7ef7d783c4673372cb2cb2ebf496c /usr.sbin/smtpd | |
parent | f2a1def1f33a5f531f113adf11ab938338dc00e3 (diff) |
Wrap long lines.
Ok gilles@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/mda.c | 77 |
1 files changed, 51 insertions, 26 deletions
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c index 606c42e2d4c..932d1abc152 100644 --- a/usr.sbin/smtpd/mda.c +++ b/usr.sbin/smtpd/mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda.c,v 1.114 2015/11/30 13:10:13 gilles Exp $ */ +/* $OpenBSD: mda.c,v 1.115 2015/12/14 10:38:40 sunil Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -88,11 +88,13 @@ static void mda_io(struct io *, int); static int mda_check_loop(FILE *, struct mda_envelope *); static int mda_getlastline(int, char *, size_t); static void mda_done(struct mda_session *); -static void mda_fail(struct mda_user *, int, const char *, enum enhanced_status_code); +static void mda_fail(struct mda_user *, int, const char *, + enum enhanced_status_code); static void mda_drain(void); static void mda_log(const struct mda_envelope *, const char *, const char *); static void mda_queue_ok(uint64_t); -static void mda_queue_tempfail(uint64_t, const char *, enum enhanced_status_code); +static void mda_queue_tempfail(uint64_t, const char *, + enum enhanced_status_code); static void mda_queue_permfail(uint64_t, const char *, enum enhanced_status_code); static void mda_queue_loop(uint64_t); static struct mda_user *mda_user(const struct envelope *); @@ -178,7 +180,8 @@ mda_imsg(struct mproc *p, struct imsg *imsg) if (u->flags & USER_ONHOLD) { u->flags |= USER_HOLDQ; - m_create(p_queue, IMSG_MDA_DELIVERY_HOLD, 0, 0, -1); + m_create(p_queue, IMSG_MDA_DELIVERY_HOLD, + 0, 0, -1); m_add_evpid(p_queue, evp.id); m_add_id(p_queue, u->id); m_close(p_queue); @@ -209,7 +212,8 @@ mda_imsg(struct mproc *p, struct imsg *imsg) if (imsg->fd == -1) { log_debug("debug: mda: cannot get message fd"); - mda_queue_tempfail(e->id, "Cannot get message fd", + mda_queue_tempfail(e->id, + "Cannot get message fd", ESC_OTHER_MAIL_SYSTEM_STATUS); mda_log(e, "TempFail", "Cannot get message fd"); mda_done(s); @@ -240,23 +244,33 @@ mda_imsg(struct mproc *p, struct imsg *imsg) } n = 0; - /* prepend "From " separator ... for A_MDA and A_FILENAME backends only */ + /* + * prepend "From " separator ... for + * A_MDA and A_FILENAME backends only + */ if (e->method == A_MDA || e->method == A_FILENAME) { time(&now); if (e->sender[0]) n = iobuf_fqueue(&s->iobuf, - "From %s %s", e->sender, ctime(&now)); + "From %s %s", e->sender, + ctime(&now)); else n = iobuf_fqueue(&s->iobuf, - "From MAILER-DAEMON@%s %s", env->sc_hostname, ctime(&now)); + "From MAILER-DAEMON@%s %s", + env->sc_hostname, ctime(&now)); } if (n != -1) { /* start queueing delivery headers */ if (e->sender[0]) - /* XXX: remove existing Return-Path, if any */ + /* + * XXX: remove existing Return-Path, + * if any + */ n = iobuf_fqueue(&s->iobuf, - "Return-Path: %s\nDelivered-To: %s\n", - e->sender, e->rcpt ? e->rcpt : e->dest); + "Return-Path: %s\nDelivered-To:" + "%s\n", + e->sender, + e->rcpt ? e->rcpt : e->dest); else n = iobuf_fqueue(&s->iobuf, "Delivered-To: %s\n", @@ -295,8 +309,9 @@ mda_imsg(struct mproc *p, struct imsg *imsg) break; case A_MBOX: - /* MBOX is a special case as we MUST deliver as root, - * just override the uid. + /* + * MBOX is a special case as we MUST + * deliver as root, just override the uid. */ deliver.mode = A_MBOX; deliver.userinfo = *userinfo; @@ -449,7 +464,8 @@ mda_imsg(struct mproc *p, struct imsg *imsg) if (error) { mda_queue_tempfail(e->id, error, ESC_OTHER_MAIL_SYSTEM_STATUS); - (void)snprintf(buf, sizeof buf, "Error (%s)", error); + (void)snprintf(buf, sizeof buf, + "Error (%s)", error); mda_log(e, "TempFail", buf); } else { @@ -491,8 +507,8 @@ mda_io(struct io *io, int evt) switch (evt) { case IO_LOWAT: - /* done */ - done: + /* done */ + done: if (s->datafp == NULL) { log_debug("debug: mda: all data sent for session" " %016"PRIx64 " evpid %016"PRIx64, @@ -540,7 +556,7 @@ mda_io(struct io *io, int evt) s->id, s->evp->id); fclose(s->datafp); s->datafp = NULL; - if (iobuf_queued(&s->iobuf) == 0) + if (iobuf_queued(&s->iobuf) == 0) goto done; } return; @@ -634,7 +650,8 @@ mda_getlastline(int fd, char *dst, size_t dstsz) } static void -mda_fail(struct mda_user *user, int permfail, const char *error, enum enhanced_status_code code) +mda_fail(struct mda_user *user, int permfail, const char *error, + enum enhanced_status_code code) { struct mda_envelope *e; @@ -696,12 +713,14 @@ mda_drain(void) if (u->evpcount == env->sc_mda_task_lowat) { if (u->flags & USER_ONHOLD) { - log_debug("debug: mda: down to lowat for user \"%s\": releasing", + log_debug("debug: mda: down to lowat for user " + "\"%s\": releasing", mda_user_to_text(u)); u->flags &= ~USER_ONHOLD; } if (u->flags & USER_HOLDQ) { - m_create(p_queue, IMSG_MDA_HOLDQ_RELEASE, 0, 0, -1); + m_create(p_queue, IMSG_MDA_HOLDQ_RELEASE, + 0, 0, -1); m_add_id(p_queue, u->id); m_add_int(p_queue, env->sc_mda_task_release); m_close(p_queue); @@ -787,7 +806,8 @@ mda_queue_ok(uint64_t evpid) } static void -mda_queue_tempfail(uint64_t evpid, const char *reason, enum enhanced_status_code code) +mda_queue_tempfail(uint64_t evpid, const char *reason, + enum enhanced_status_code code) { m_create(p_queue, IMSG_MDA_DELIVERY_TEMPFAIL, 0, 0, -1); m_add_evpid(p_queue, evpid); @@ -797,7 +817,8 @@ mda_queue_tempfail(uint64_t evpid, const char *reason, enum enhanced_status_code } static void -mda_queue_permfail(uint64_t evpid, const char *reason, enum enhanced_status_code code) +mda_queue_permfail(uint64_t evpid, const char *reason, + enum enhanced_status_code code) { m_create(p_queue, IMSG_MDA_DELIVERY_PERMFAIL, 0, 0, -1); m_add_evpid(p_queue, evpid); @@ -849,10 +870,12 @@ mda_user(const struct envelope *evp) stat_increment("mda.user", 1); if (evp->agent.mda.delivery_user[0]) - log_debug("mda: new user %016" PRIx64 " for \"%s\" delivering as \"%s\"", + log_debug("mda: new user %016" PRIx64 + " for \"%s\" delivering as \"%s\"", u->id, mda_user_to_text(u), evp->agent.mda.delivery_user); else - log_debug("mda: new user %016" PRIx64 " for \"%s\"", u->id, mda_user_to_text(u)); + log_debug("mda: new user %016" PRIx64 + " for \"%s\"", u->id, mda_user_to_text(u)); return (u); } @@ -897,9 +920,11 @@ mda_envelope(const struct envelope *evp) (void)snprintf(buf, sizeof buf, "%s@%s", evp->sender.user, evp->sender.domain); e->sender = xstrdup(buf, "mda_envelope:sender"); - (void)snprintf(buf, sizeof buf, "%s@%s", evp->dest.user, evp->dest.domain); + (void)snprintf(buf, sizeof buf, "%s@%s", evp->dest.user, + evp->dest.domain); e->dest = xstrdup(buf, "mda_envelope:dest"); - (void)snprintf(buf, sizeof buf, "%s@%s", evp->rcpt.user, evp->rcpt.domain); + (void)snprintf(buf, sizeof buf, "%s@%s", evp->rcpt.user, + evp->rcpt.domain); if (strcmp(buf, e->dest)) e->rcpt = xstrdup(buf, "mda_envelope:rcpt"); e->method = evp->agent.mda.method; |