diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2008-12-04 04:09:56 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2008-12-04 04:09:56 +0000 |
commit | 1f240ee281e8301156b2398f3756517e2f758744 (patch) | |
tree | 2416321730a7f9859d499155f7f06aac256df423 | |
parent | bb81289ec52773b6463b22b555d99ef8f0f6c353 (diff) |
- when in state S_DATACONTENT, do not disable EV_READ if the last line we
read is empty, instead return and only disable EV_READ when we read
"."
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index dcaade0c444..c7f0366a001 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.16 2008/12/04 02:04:50 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.17 2008/12/04 04:09:55 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -723,17 +723,20 @@ read: s->s_tm = time(NULL); line = evbuffer_readline(bev->input); if (line == NULL) { - bufferevent_disable(s->s_bev, EV_READ); + if (s->s_state != S_DATACONTENT) + bufferevent_disable(s->s_bev, EV_READ); return; } if (s->s_state == S_DATACONTENT) { line[strcspn(line, "\r")] = '\0'; - /* log_debug("content: %s", line);*/ + /*log_debug("content: %s", line);*/ if (strcmp(line, ".") == 0) { s->s_state = S_DONE; fclose(s->s_msg.datafp); + bufferevent_disable(s->s_bev, EV_READ); + if (s->s_msg.status & S_MESSAGE_PERMFAILURE) { evbuffer_add_printf(s->s_bev->output, "554 Transaction failed\r\n"); @@ -745,7 +748,6 @@ read: free(line); return; } - bufferevent_disable(s->s_bev, EV_READ); session_msg_submit(s); free(line); return; |