summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2009-08-08 23:02:43 +0000
committergilles <gilles@openbsd.org>2009-08-08 23:02:43 +0000
commitc05efc29b6a9440d497ef3186a0d42b3c5cf2bf6 (patch)
tree3cc10131b27cb4e02d3f8bec3b186ff9739c51fd
parentUse a temporary variable for strdup of const char *. (diff)
downloadwireguard-openbsd-c05efc29b6a9440d497ef3186a0d42b3c5cf2bf6.tar.xz
wireguard-openbsd-c05efc29b6a9440d497ef3186a0d42b3c5cf2bf6.zip
- 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.
-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;
}