summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2016-05-16 19:25:06 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2016-05-16 19:25:06 +0000
commitad9e01054310fa109d342f7565eba91eef3afd94 (patch)
tree470382a775b8e7238afc5aee7d29a5aeda8936da /usr.sbin
parentf8b1c9c32f2a1c6aac2a5a171fa76a7f481da963 (diff)
fix logic in error code path of smtp state machine that can lead to an
invalid state ending in fatal(), while at it plug a file pointer leak. ok eric@, millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/filter.c4
-rw-r--r--usr.sbin/smtpd/smtp_session.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/filter.c b/usr.sbin/smtpd/filter.c
index c927e855046..bc880ee4cf1 100644
--- a/usr.sbin/smtpd/filter.c
+++ b/usr.sbin/smtpd/filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filter.c,v 1.17 2016/03/25 15:06:58 krw Exp $ */
+/* $OpenBSD: filter.c,v 1.18 2016/05/16 19:25:05 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
@@ -297,6 +297,8 @@ filter_event(uint64_t id, int event)
if (event == EVENT_DISCONNECT) {
io_clear(&s->iev);
iobuf_clear(&s->ibuf);
+ if (s->ofile)
+ fclose(s->ofile);
free(s);
}
}
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index 2146037c532..f08af48206c 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.270 2016/05/08 20:24:01 millert Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.271 2016/05/16 19:25:05 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1144,6 +1144,7 @@ smtp_filter_response(uint64_t id, int query, int status, uint32_t code,
case QUERY_EOM:
if (status != FILTER_OK) {
+ tree_pop(&wait_filter_data, s->id);
smtp_filter_rollback(s);
code = code ? code : 530;
line = line ? line : "Message rejected";
@@ -1450,6 +1451,8 @@ smtp_data_io_done(struct smtp_session *s)
if (s->msgflags & MF_ERROR) {
+ tree_pop(&wait_filter_data, s->id);
+
smtp_filter_rollback(s);
smtp_queue_rollback(s);