summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2009-08-08 23:02:44 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2009-08-08 23:02:44 +0000
commit463154e5e1c26625acf99f41dc49b7d9160b04c2 (patch)
tree917db32616195b29d65adb0e41797d4d448be146 /usr.sbin/smtpd
parentc3e5fdbe01381d7e3f7bb7f98e28c249464835ea (diff)
- simplify a bit queue_message_update()
- make sure queue_message_update() creates bounces using bounce_record() - when mta sends update to queue and it sees that batch is flagged with F_BATCH_PERMFAIL, only update the envelope error message if it doesn't have F_MESSAGE_PERMFAIL set, otherwise we may lose the real reason why we failed for that recipient. There's cleanup to do around that old code, i'm sure we can get it simpler. this commit fixes a bug pea@ spotted where a bounce message would not display the reason of a failure when we generated it after failing to deliver a relayed message.
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/mta.c9
-rw-r--r--usr.sbin/smtpd/queue_shared.c18
2 files changed, 11 insertions, 16 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index 7b1012da00b..0cc9cc0ac01 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.66 2009/08/07 21:47:07 gilles Exp $ */
+/* $OpenBSD: mta.c,v 1.67 2009/08/08 23:02:43 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -819,6 +819,7 @@ mta_reply_handler(struct bufferevent *bev, void *arg)
case 550:
if (sessionp->s_state == S_RCPT) {
batchp->messagep->status = (S_MESSAGE_REJECTED|S_MESSAGE_PERMFAILURE);
+ log_debug("DOES NOT EXIST !!!: %s", line);
message_set_errormsg(batchp->messagep, "%s", line);
break;
}
@@ -1019,8 +1020,10 @@ mta_batch_update_queue(struct batch *batchp)
while ((messagep = TAILQ_FIRST(&batchp->messages)) != NULL) {
if (batchp->status == S_BATCH_PERMFAILURE) {
- messagep->status |= S_MESSAGE_PERMFAILURE;
- message_set_errormsg(messagep, "%s", batchp->errorline);
+ if ((messagep->status & S_MESSAGE_PERMFAILURE) == 0) {
+ messagep->status |= S_MESSAGE_PERMFAILURE;
+ message_set_errormsg(messagep, "%s", batchp->errorline);
+ }
}
if (batchp->status == S_BATCH_TEMPFAILURE) {
diff --git a/usr.sbin/smtpd/queue_shared.c b/usr.sbin/smtpd/queue_shared.c
index 1c579487b31..75425d2b1a5 100644
--- a/usr.sbin/smtpd/queue_shared.c
+++ b/usr.sbin/smtpd/queue_shared.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_shared.c,v 1.21 2009/08/06 16:46:57 gilles Exp $ */
+/* $OpenBSD: queue_shared.c,v 1.22 2009/08/08 23:02:43 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -445,18 +445,10 @@ queue_message_update(struct message *messagep)
messagep->retry++;
if (messagep->status & S_MESSAGE_PERMFAILURE) {
- if (messagep->type == T_BOUNCE_MESSAGE ||
- (messagep->sender.user[0] == '\0' && messagep->sender.domain[0] == '\0'))
- queue_remove_envelope(messagep);
- else {
- messagep->id = queue_generate_id();
- messagep->type = T_BOUNCE_MESSAGE;
- messagep->status &= ~S_MESSAGE_PERMFAILURE;
- messagep->lasttry = 0;
- messagep->retry = 0;
- messagep->creation = time(NULL);
- queue_update_envelope(messagep);
- }
+ if (messagep->type != T_BOUNCE_MESSAGE &&
+ messagep->sender.user[0] != '\0')
+ bounce_record_message(messagep);
+ queue_remove_envelope(messagep);
return;
}