diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2016-11-22 07:28:43 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2016-11-22 07:28:43 +0000 |
commit | 35462f20f08762826cc9a8f60809f327d1c803d0 (patch) | |
tree | 36075b4af55514d46c7215b90c43efdbc87bdea0 | |
parent | 1fccb34bf05da41363a4397298714c21cb8e9de4 (diff) |
Normalize the io input buffer internally when reinstalling the io event, so
the caller doesn't have to bother with this.
ok gilles@ sunil@
-rw-r--r-- | usr.sbin/smtpd/bounce.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/filter.c | 3 | ||||
-rw-r--r-- | usr.sbin/smtpd/ioev.c | 5 | ||||
-rw-r--r-- | usr.sbin/smtpd/mta_session.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 8 |
5 files changed, 11 insertions, 19 deletions
diff --git a/usr.sbin/smtpd/bounce.c b/usr.sbin/smtpd/bounce.c index 92fe56283be..152e1500695 100644 --- a/usr.sbin/smtpd/bounce.c +++ b/usr.sbin/smtpd/bounce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bounce.c,v 1.75 2016/11/21 13:00:43 eric Exp $ */ +/* $OpenBSD: bounce.c,v 1.76 2016/11/22 07:28:42 eric Exp $ */ /* * Copyright (c) 2009 Gilles Chehade <gilles@poolp.org> @@ -728,10 +728,8 @@ bounce_io(struct io *io, int evt, void *arg) return; } - if (line == NULL) { - iobuf_normalize(&s->iobuf); + if (line == NULL) break; - } log_trace(TRACE_BOUNCE, "bounce: %p: <<< %s", s, line); diff --git a/usr.sbin/smtpd/filter.c b/usr.sbin/smtpd/filter.c index f8682455e52..4fb1a20a378 100644 --- a/usr.sbin/smtpd/filter.c +++ b/usr.sbin/smtpd/filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filter.c,v 1.22 2016/11/21 13:00:43 eric Exp $ */ +/* $OpenBSD: filter.c,v 1.23 2016/11/22 07:28:42 eric Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org> @@ -706,7 +706,6 @@ filter_tx_io(struct io *io, int evt, void *arg) } s->idatalen += n; io_drop(&s->iev, n); - iobuf_normalize(&s->ibuf); return; case IO_DISCONNECTED: diff --git a/usr.sbin/smtpd/ioev.c b/usr.sbin/smtpd/ioev.c index ab4aec07258..1c72ee45873 100644 --- a/usr.sbin/smtpd/ioev.c +++ b/usr.sbin/smtpd/ioev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioev.c,v 1.30 2016/11/20 08:43:36 eric Exp $ */ +/* $OpenBSD: ioev.c,v 1.31 2016/11/22 07:28:42 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -465,6 +465,9 @@ io_reload(struct io *io) if (io->flags & IO_HELD) return; + if (io->iobuf) + iobuf_normalize(io->iobuf); + #ifdef IO_SSL if (io->ssl) { io_reload_ssl(io); diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c index 0ea8a09e3c0..75589e88e46 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.88 2016/11/21 13:00:43 eric Exp $ */ +/* $OpenBSD: mta_session.c,v 1.89 2016/11/22 07:28:42 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -1182,10 +1182,8 @@ mta_io(struct io *io, int evt, void *arg) if (io_datalen(&s->io) >= LINE_MAX) { mta_error(s, "Input too long"); mta_free(s); - return; } - iobuf_normalize(&s->iobuf); - break; + return; } log_trace(TRACE_MTA, "mta: %p: <<< %s", s, line); @@ -1264,8 +1262,6 @@ mta_io(struct io *io, int evt, void *arg) return; } - iobuf_normalize(&s->iobuf); - if (io_datalen(&s->io)) { log_debug("debug: mta: remaining data in input buffer"); mta_error(s, "Remote host sent too much data"); diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index f9cb5ee0f1e..85017d791db 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.294 2016/11/21 13:00:43 eric Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.295 2016/11/22 07:28:42 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -1310,10 +1310,8 @@ smtp_io(struct io *io, int evt, void *arg) } /* No complete line received */ - if (line == NULL) { - iobuf_normalize(&s->iobuf); + if (line == NULL) return; - } /* Message body */ if (s->state == STATE_BODY && strcmp(line, ".")) { @@ -1338,7 +1336,6 @@ smtp_io(struct io *io, int evt, void *arg) rfc2822_parser_flush(&s->tx->rfc2822_parser); - iobuf_normalize(&s->iobuf); io_set_write(io); s->tx->dataeom = 1; @@ -1353,7 +1350,6 @@ smtp_io(struct io *io, int evt, void *arg) (void)strlcpy(s->cmd, line, sizeof s->cmd); io_set_write(io); smtp_command(s, line); - iobuf_normalize(&s->iobuf); break; case IO_LOWAT: |