fix descriptor leak in the smtp congestion mechanism
authorgilles <gilles@openbsd.org>
Mon, 19 Jun 2017 08:35:56 +0000 (08:35 +0000)
committergilles <gilles@openbsd.org>
Mon, 19 Jun 2017 08:35:56 +0000 (08:35 +0000)
diff from Henri Kemppainen; ok gilles@ eric@

usr.sbin/smtpd/smtp_session.c

index 7790a3b..7060b80 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: smtp_session.c,v 1.303 2017/05/17 14:00:06 deraadt Exp $      */
+/*     $OpenBSD: smtp_session.c,v 1.304 2017/06/19 08:35:56 gilles Exp $       */
 
 /*
  * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1474,12 +1474,12 @@ smtp_data_io(struct io *io, int evt, void *arg)
                break;
 
        case IO_LOWAT:
-               if (s->tx->dataeom && io_queued(s->tx->oev) == 0) {
-                       smtp_data_io_done(s);
-               } else if (io_paused(s->io, IO_IN)) {
+               if (io_paused(s->io, IO_IN)) {
                        log_debug("debug: smtp: %p: filter congestion over: resuming session", s);
                        io_resume(s->io, IO_IN);
                }
+               if (s->tx->dataeom && io_queued(s->tx->oev) == 0)
+                       smtp_data_io_done(s);
                break;
 
        default: