diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/ioev.c | 18 | ||||
-rw-r--r-- | usr.sbin/smtpd/mta_session.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 26 |
3 files changed, 17 insertions, 33 deletions
diff --git a/usr.sbin/smtpd/ioev.c b/usr.sbin/smtpd/ioev.c index 1c72ee45873..146c7f18b86 100644 --- a/usr.sbin/smtpd/ioev.c +++ b/usr.sbin/smtpd/ioev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioev.c,v 1.31 2016/11/22 07:28:42 eric Exp $ */ +/* $OpenBSD: ioev.c,v 1.32 2016/11/24 07:57:48 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -370,13 +370,25 @@ io_set_write(struct io *io) int io_write(struct io *io, const void *buf, size_t len) { - return iobuf_queue(io->iobuf, buf, len); + int r; + + r = iobuf_queue(io->iobuf, buf, len); + + io_reload(io); + + return r; } int io_writev(struct io *io, const struct iovec *iov, int iovcount) { - return iobuf_queuev(io->iobuf, iov, iovcount); + int r; + + r = iobuf_queuev(io->iobuf, iov, iovcount); + + io_reload(io); + + return r; } int diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c index 75589e88e46..595657720da 100644 --- a/usr.sbin/smtpd/mta_session.c +++ b/usr.sbin/smtpd/mta_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta_session.c,v 1.89 2016/11/22 07:28:42 eric Exp $ */ +/* $OpenBSD: mta_session.c,v 1.90 2016/11/24 07:57:48 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -280,7 +280,6 @@ mta_session_imsg(struct mproc *p, struct imsg *imsg) mta_flush_task(s, IMSG_MTA_DELIVERY_TEMPFAIL, "Could not get message fd", 0, 0); mta_enter_state(s, MTA_READY); - io_reload(&s->io); return; } @@ -289,7 +288,6 @@ mta_session_imsg(struct mproc *p, struct imsg *imsg) fatal("mta: fdopen"); mta_enter_state(s, MTA_MAIL); - io_reload(&s->io); return; case IMSG_MTA_DNS_PTR: @@ -366,7 +364,6 @@ mta_session_imsg(struct mproc *p, struct imsg *imsg) mta_tls_verified(s); io_resume(&s->io, IO_PAUSE_IN); - io_reload(&s->io); return; case IMSG_MTA_LOOKUP_HELO: @@ -456,7 +453,6 @@ mta_on_timeout(struct runq *runq, void *arg) s->hangon++; mta_enter_state(s, MTA_READY); - io_reload(&s->io); } static void diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 85017d791db..733eaeeb1f6 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.295 2016/11/22 07:28:42 eric Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.296 2016/11/24 07:57:48 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -738,14 +738,12 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) smtp_filter_tx_rollback(s); smtp_tx_free(s->tx); smtp_reply(s, "%d %s", 530, "Sender rejected"); - io_reload(&s->io); break; case LKA_TEMPFAIL: smtp_filter_tx_rollback(s); smtp_tx_free(s->tx); smtp_reply(s, "421 %s: Temporary Error", esc_code(ESC_STATUS_TEMPFAIL, ESC_OTHER_MAIL_SYSTEM_STATUS)); - io_reload(&s->io); break; } return; @@ -766,7 +764,6 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) case LKA_TEMPFAIL: smtp_reply(s, "%s", line); } - io_reload(&s->io); return; case IMSG_SMTP_LOOKUP_HELO: @@ -802,7 +799,6 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) smtp_enter_state(s, STATE_QUIT); } m_end(&m); - io_reload(&s->io); return; case IMSG_SMTP_MESSAGE_OPEN: @@ -818,7 +814,6 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) smtp_reply(s, "421 %s: Temporary Error", esc_code(ESC_STATUS_TEMPFAIL, ESC_OTHER_MAIL_SYSTEM_STATUS)); smtp_enter_state(s, STATE_QUIT); - io_reload(&s->io); return; } @@ -872,7 +867,6 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) esc_code(ESC_STATUS_OK, ESC_DESTINATION_ADDRESS_VALID), esc_description(ESC_DESTINATION_ADDRESS_VALID)); } - io_reload(&s->io); return; case IMSG_SMTP_MESSAGE_COMMIT: @@ -887,7 +881,6 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) smtp_reply(s, "421 %s: Temporary failure", esc_code(ESC_STATUS_TEMPFAIL, ESC_OTHER_MAIL_SYSTEM_STATUS)); smtp_enter_state(s, STATE_QUIT); - io_reload(&s->io); return; } @@ -915,7 +908,6 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) smtp_tx_free(s->tx); s->mailcount++; smtp_enter_state(s, STATE_HELO); - io_reload(&s->io); return; case IMSG_SMTP_AUTHENTICATE: @@ -955,7 +947,6 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) fatalx("bad lka response"); smtp_enter_state(s, STATE_HELO); - io_reload(&s->io); return; case IMSG_SMTP_TLS_INIT: @@ -1045,7 +1036,6 @@ smtp_filter_response(uint64_t id, int query, int status, uint32_t code, line = line ? line : "Temporary failure"; smtp_reply(s, "%d %s", code, line); smtp_enter_state(s, STATE_QUIT); - io_reload(&s->io); return; } @@ -1085,7 +1075,6 @@ smtp_filter_response(uint64_t id, int query, int status, uint32_t code, code = code ? code : 530; line = line ? line : "Hello rejected"; smtp_reply(s, "%d %s", code, line); - io_reload(&s->io); return; } @@ -1108,7 +1097,6 @@ smtp_filter_response(uint64_t id, int query, int status, uint32_t code, smtp_reply(s, "250-AUTH PLAIN LOGIN"); smtp_reply(s, "250 HELP"); } - io_reload(&s->io); return; case QUERY_MAIL: @@ -1118,7 +1106,6 @@ smtp_filter_response(uint64_t id, int query, int status, uint32_t code, code = code ? code : 530; line = line ? line : "Sender rejected"; smtp_reply(s, "%d %s", code, line); - io_reload(&s->io); return; } @@ -1141,7 +1128,6 @@ smtp_filter_response(uint64_t id, int query, int status, uint32_t code, code = code ? code : 530; line = line ? line : "Recipient rejected"; smtp_reply(s, "%d %s", code, line); - io_reload(&s->io); return; } @@ -1157,7 +1143,6 @@ smtp_filter_response(uint64_t id, int query, int status, uint32_t code, code = code ? code : 530; line = line ? line : "Message rejected"; smtp_reply(s, "%d %s", code, line); - io_reload(&s->io); return; } smtp_queue_open_message(s); @@ -1173,7 +1158,6 @@ smtp_filter_response(uint64_t id, int query, int status, uint32_t code, line = line ? line : "Message rejected"; smtp_reply(s, "%d %s", code, line); smtp_enter_state(s, STATE_HELO); - io_reload(&s->io); return; } smtp_message_end(s); @@ -1198,7 +1182,6 @@ smtp_filter_fd(uint64_t id, int fd) smtp_reply(s, "421 %s: Temporary Error", esc_code(ESC_STATUS_TEMPFAIL, ESC_OTHER_MAIL_SYSTEM_STATUS)); smtp_enter_state(s, STATE_QUIT); - io_reload(&s->io); return; } @@ -1257,7 +1240,6 @@ smtp_filter_fd(uint64_t id, int fd) " on a line by itself"); tree_xset(&wait_filter_data, s->id, s); - io_reload(&s->io); } static void @@ -1341,8 +1323,6 @@ smtp_io(struct io *io, int evt, void *arg) s->tx->dataeom = 1; if (io_queued(&s->tx->oev) == 0) smtp_data_io_done(s); - else - io_reload(&s->tx->oev); return; } @@ -1547,7 +1527,6 @@ smtp_data_io_done(struct smtp_session *s) smtp_reply(s, "421 Internal server error"); smtp_tx_free(s->tx); smtp_enter_state(s, STATE_HELO); - io_reload(&s->io); } else { smtp_filter_eom(s); @@ -2137,7 +2116,6 @@ static void smtp_send_banner(struct smtp_session *s) { smtp_reply(s, "220 %s ESMTP %s", s->smtpname, SMTPD_NAME); - io_reload(&s->io); } void @@ -2466,7 +2444,6 @@ smtp_auth_failure_resume(int fd, short event, void *p) smtp_reply(s, "535 Authentication failed"); smtp_enter_state(s, STATE_HELO); - io_reload(&s->io); } static void @@ -2662,7 +2639,6 @@ smtp_filter_dataline(struct smtp_session *s, const char *line) log_debug("debug: smtp: %p: filter congestion over: pausing session", s); io_pause(&s->io, IO_PAUSE_IN); } - io_reload(&s->tx->oev); } #define CASE(x) case x : return #x |