summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-01-13 14:27:56 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-01-13 14:27:56 +0000
commit6c724df16d4da44d9f0a2ef71699b47f99a1ae3e (patch)
treeaf5e5c0876b101bfbab8f56a2e8eda2c4fa31224 /usr.sbin/smtpd
parent733650270f69b47100609088319104f2abffbb58 (diff)
remove the status field from struct envelope, move it to the smtp
session, and cleanup the DS_* flags. ok gilles@ chl@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/smtp.c4
-rw-r--r--usr.sbin/smtpd/smtp_session.c24
-rw-r--r--usr.sbin/smtpd/smtpd.h11
3 files changed, 18 insertions, 21 deletions
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index e6af36df5af..dcc3ac222ac 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.97 2012/01/12 18:06:18 eric Exp $ */
+/* $OpenBSD: smtp.c,v 1.98 2012/01/13 14:27:55 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -130,7 +130,7 @@ smtp_imsg(struct imsgev *iev, struct imsg *imsg)
fatalx("smtp: session is gone");
if (s->s_flags & F_WRITEONLY)
/* session is write-only, must not destroy it. */
- s->s_msg.status |= DS_TEMPFAILURE;
+ s->s_dstatus |= DS_TEMPFAILURE;
else
fatalx("smtp: corrupt session");
return;
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index 28c4e66de40..fd037c06732 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.152 2012/01/12 12:57:26 eric Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.153 2012/01/13 14:27:55 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -595,7 +595,7 @@ session_pickup(struct session *s, struct submit_status *ss)
fatal("session_pickup: desynchronized");
if ((ss != NULL && ss->code == 421) ||
- (s->s_msg.status & DS_TEMPFAILURE)) {
+ (s->s_dstatus & DS_TEMPFAILURE)) {
session_respond(s, "421 Service temporarily unavailable");
env->stats->smtp.tempfail++;
s->s_flags |= F_QUIT;
@@ -728,7 +728,7 @@ session_pickup(struct session *s, struct submit_status *ss)
case S_DATACONTENT:
if (ss->code != 250)
- s->s_msg.status |= DS_PERMFAILURE;
+ s->s_dstatus |= DS_PERMFAILURE;
session_read_data(s, ss->u.dataline);
break;
@@ -803,14 +803,14 @@ session_read(struct bufferevent *bev, void *p)
switch (s->s_state) {
case S_AUTH_INIT:
- if (s->s_msg.status & DS_TEMPFAILURE)
+ if (s->s_dstatus & DS_TEMPFAILURE)
goto tempfail;
session_rfc4954_auth_plain(s, line);
break;
case S_AUTH_USERNAME:
case S_AUTH_PASSWORD:
- if (s->s_msg.status & DS_TEMPFAILURE)
+ if (s->s_dstatus & DS_TEMPFAILURE)
goto tempfail;
session_rfc4954_auth_login(s, line);
break;
@@ -819,7 +819,7 @@ session_read(struct bufferevent *bev, void *p)
case S_HELO:
case S_MAIL:
case S_RCPT:
- if (s->s_msg.status & DS_TEMPFAILURE)
+ if (s->s_dstatus & DS_TEMPFAILURE)
goto tempfail;
session_command(s, line);
break;
@@ -876,13 +876,13 @@ session_read_data(struct session *s, char *line)
if (strcmp(line, ".") == 0) {
s->s_datalen = ftell(s->datafp);
if (! safe_fclose(s->datafp))
- s->s_msg.status |= DS_TEMPFAILURE;
+ s->s_dstatus |= DS_TEMPFAILURE;
s->datafp = NULL;
- if (s->s_msg.status & DS_PERMFAILURE) {
+ if (s->s_dstatus & DS_PERMFAILURE) {
session_respond(s, "554 5.0.0 Transaction failed");
session_enter_state(s, S_HELO);
- } else if (s->s_msg.status & DS_TEMPFAILURE) {
+ } else if (s->s_dstatus & DS_TEMPFAILURE) {
session_respond(s, "421 4.0.0 Temporary failure");
s->s_flags |= F_QUIT;
env->stats->smtp.tempfail++;
@@ -895,7 +895,7 @@ session_read_data(struct session *s, char *line)
}
/* Don't waste resources on message if it's going to bin anyway. */
- if (s->s_msg.status & (DS_PERMFAILURE|DS_TEMPFAILURE))
+ if (s->s_dstatus & (DS_PERMFAILURE|DS_TEMPFAILURE))
goto end;
/* "If the first character is a period and there are other characters
@@ -912,7 +912,7 @@ session_read_data(struct session *s, char *line)
datalen = ftell(s->datafp);
if (SIZE_MAX - datalen < len + 1 ||
datalen + len + 1 > env->sc_maxsize) {
- s->s_msg.status |= DS_PERMFAILURE;
+ s->s_dstatus |= DS_PERMFAILURE;
goto end;
}
@@ -923,7 +923,7 @@ session_read_data(struct session *s, char *line)
}
if (fprintf(s->datafp, "%s\n", line) != (int)len + 1) {
- s->s_msg.status |= DS_TEMPFAILURE;
+ s->s_dstatus |= DS_TEMPFAILURE;
goto end;
}
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 27a7696a890..89da6c667db 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.277 2012/01/13 14:01:58 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.278 2012/01/13 14:27:55 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -342,10 +342,8 @@ enum delivery_type {
};
enum delivery_status {
- DS_PERMFAILURE = 0x2,
- DS_TEMPFAILURE = 0x4,
- DS_REJECTED = 0x8,
- DS_ACCEPTED = 0x10
+ DS_PERMFAILURE = 0x1,
+ DS_TEMPFAILURE = 0x2,
};
enum delivery_flags {
@@ -429,8 +427,6 @@ struct envelope {
time_t expire;
u_int8_t retry;
enum delivery_flags flags;
- enum delivery_status status;
-
};
TAILQ_HEAD(deliverylist, envelope);
@@ -569,6 +565,7 @@ struct session {
long s_datalen;
struct auth s_auth;
+ int s_dstatus;
FILE *datafp;
int mboxfd;