summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2009-11-05 12:05:48 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2009-11-05 12:05:48 +0000
commita83a23cbf8a464d34ac2a9b720ec05c388aeeeef (patch)
tree141a4a9d1ec0f4f4b230d2e7cf6d626c3dadd425 /usr.sbin
parentef15b0d921140a942200e931b61dc9ecac63cbf9 (diff)
Introduce a 6yz status code, used internally to report permanent errors.
The 1yz and 6yz status codes are now removed prior to reporting the status message in bounce messages, which provides an easy way to distinguish between local and remote status messages. Initial diff from jacekm@ ok gilles@ jacekm@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/bounce.c10
-rw-r--r--usr.sbin/smtpd/dns.c2
-rw-r--r--usr.sbin/smtpd/mta.c9
3 files changed, 15 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/bounce.c b/usr.sbin/smtpd/bounce.c
index 91c3d67749f..56f8d78d3da 100644
--- a/usr.sbin/smtpd/bounce.c
+++ b/usr.sbin/smtpd/bounce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bounce.c,v 1.9 2009/09/16 15:33:06 jacekm Exp $ */
+/* $OpenBSD: bounce.c,v 1.10 2009/11/05 12:05:47 jsing Exp $ */
/*
* Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org>
@@ -55,6 +55,7 @@ bounce_session(struct smtpd *env, int fd, struct message *messagep)
{
struct client_ctx *cc = NULL;
int msgfd = -1;
+ char *reason;
/* init smtp session */
if ((cc = calloc(1, sizeof(*cc))) == NULL)
@@ -71,6 +72,11 @@ bounce_session(struct smtpd *env, int fd, struct message *messagep)
messagep->sender.domain) < 0)
goto fail;
+ /* Construct an appropriate reason line. */
+ reason = messagep->session_errorline;
+ if (strlen(reason) > 4 && (*reason == '1' || *reason == '6'))
+ reason += 4;
+
/* create message header */
if (client_data_printf(cc->sp,
"Subject: Delivery status notification\n"
@@ -91,7 +97,7 @@ bounce_session(struct smtpd *env, int fd, struct message *messagep)
env->sc_hostname,
messagep->sender.user, messagep->sender.domain,
messagep->recipient.user, messagep->recipient.domain,
- messagep->session_errorline) < 0)
+ reason) < 0)
goto fail;
/* append original message */
diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c
index b61346789d6..300b7aa3eb1 100644
--- a/usr.sbin/smtpd/dns.c
+++ b/usr.sbin/smtpd/dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dns.c,v 1.16 2009/09/03 08:19:13 jacekm Exp $ */
+/* $OpenBSD: dns.c,v 1.17 2009/11/05 12:05:47 jsing Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index 11297a869ab..4eb65020a53 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.72 2009/09/15 16:50:06 jacekm Exp $ */
+/* $OpenBSD: mta.c,v 1.73 2009/11/05 12:05:47 jsing Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -659,7 +659,8 @@ mta_enter_state(struct mta_session *s, int newstate, void *p)
/* set envelope recipients */
TAILQ_FOREACH(m, &s->recipients, entry) {
if (m->session_errorline[0] == '2' ||
- m->session_errorline[0] == '5')
+ m->session_errorline[0] == '5' ||
+ m->session_errorline[0] == '6')
continue;
if (client_rcpt(s->smtp_state, "%s@%s", m->recipient.user,
m->recipient.domain) < 0)
@@ -683,6 +684,7 @@ mta_enter_state(struct mta_session *s, int newstate, void *p)
/* update queue status */
while ((m = TAILQ_FIRST(&s->recipients))) {
switch (m->session_errorline[0]) {
+ case '6':
case '5':
m->status = S_MESSAGE_PERMFAILURE;
break;
@@ -902,7 +904,8 @@ mta_todo(struct mta_session *s)
TAILQ_FOREACH(m, &s->recipients, entry)
if (m->session_errorline[0] != '2' &&
- m->session_errorline[0] != '5')
+ m->session_errorline[0] != '5' &&
+ m->session_errorline[0] != '6')
n++;
return (n);
}