diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-03-03 23:33:53 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-03-03 23:33:53 +0000 |
commit | 14062b2781531b3796d251b9ff8835ab2ee48fd7 (patch) | |
tree | c5d39491e05de353c9e53983e6ff5c35576684f5 /usr.sbin | |
parent | b62af95fa98188118939cff3b1d5d942bb20b934 (diff) |
when forwards/aliases expansion fails in an lka session, make sure that mfa
is notified so that the session does not hang
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/lka.c | 25 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 3 |
2 files changed, 22 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 1de64937c12..57cec6569af 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.29 2009/03/03 23:23:52 gilles Exp $ */ +/* $OpenBSD: lka.c,v 1.30 2009/03/03 23:33:52 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -133,18 +133,23 @@ lka_dispatch_parent(int sig, short event, void *p) if (! lkasession->pending && lkasession->flags & F_ERROR) { log_debug("error in lka session"); /* we detected an error and this is last imsg */ - //XXXXX clear aliaseslist and return temp fail + imsg_compose(ibuf, IMSG_LKA_RCPT, 0, 0, + -1, lkasession->ss, sizeof(*lkasession->ss)); break; } if (fd == -1) { if (fwreq->pw_name[0] != '\0') { - log_debug("error in forward open"); /* error id local, return a temporary fail */ + log_debug("error in forward open"); + lkasession->ss->code = 421; + imsg_compose(ibuf, IMSG_LKA_RCPT, 0, 0, + -1, lkasession->ss, sizeof(*lkasession->ss)); break; } } else if (! forwards_get(fd, &lkasession->aliaseslist)) { + lkasession->ss->code = 530; lkasession->flags |= F_ERROR; } @@ -153,8 +158,10 @@ lka_dispatch_parent(int sig, short event, void *p) ++lkasession->iterations; ret = lka_expand_aliases(env, &lkasession->aliaseslist, lkasession); if (lkasession->pending) { - if (ret == -1) + if (ret == -1) { + lkasession->ss->code = 530; lkasession->flags |= F_ERROR; + } break; } @@ -171,6 +178,8 @@ lka_dispatch_parent(int sig, short event, void *p) TAILQ_REMOVE(&lkasession->aliaseslist, alias, entry); free(alias); } + imsg_compose(ibuf, IMSG_LKA_RCPT, 0, 0, + -1, lkasession->ss, sizeof(*lkasession->ss)); break; } @@ -308,6 +317,7 @@ lka_dispatch_mfa(int sig, short event, void *p) lkasession->id = queue_generate_id(); lkasession->path = ss->u.path; lkasession->message = ss->msg; + lkasession->ss = ss; TAILQ_INIT(&lkasession->aliaseslist); SPLAY_INSERT(lkatree, &env->lka_sessions, lkasession); @@ -345,8 +355,10 @@ lka_dispatch_mfa(int sig, short event, void *p) ++lkasession->iterations; ret = lka_expand_aliases(env, &lkasession->aliaseslist, lkasession); if (lkasession->pending) { - if (ret == -1) + if (ret == -1) { + lkasession->ss->code = 530; lkasession->flags |= F_ERROR; + } break; } @@ -363,6 +375,9 @@ lka_dispatch_mfa(int sig, short event, void *p) TAILQ_REMOVE(&lkasession->aliaseslist, alias, entry); free(alias); } + ss->code = 530; + imsg_compose(ibuf, IMSG_LKA_RCPT, 0, 0, + -1, ss, sizeof(*ss)); break; } diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index b0b4dd425c2..6788f4286a4 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.81 2009/03/03 23:23:52 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.82 2009/03/03 23:33:52 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -639,6 +639,7 @@ struct lkasession { u_int32_t pending; enum lkasession_flags flags; struct message message; + struct submit_status *ss; }; struct smtpd { |