summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2008-11-10 02:34:51 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2008-11-10 02:34:51 +0000
commit37293caabd161ed1fe9fa185a86d19b0325690da (patch)
tree2a5f7e11dd0b91f65f7f64633ae99062c5efdf63 /usr.sbin
parent4cc54b7acdab8e3e14d2f7a5824345095c1ab501 (diff)
- plug a descriptor leak when session is aborted by a server error instead
of a client QUIT or client timeout
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/mta.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index fa117e63380..e7b828c4f68 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.2 2008/11/05 12:14:45 sobrado Exp $ */
+/* $OpenBSD: mta.c,v 1.3 2008/11/10 02:34:50 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -710,6 +710,7 @@ mta_write_handler(struct bufferevent *bev, void *arg)
if (batchp->state == S_QUIT) {
bufferevent_disable(bev, EV_READ|EV_WRITE);
+ log_debug("closing connection because of QUIT");
close(batchp->peerfd);
return;
}
@@ -747,6 +748,7 @@ mta_error_handler(struct bufferevent *bev, short error, void *arg)
struct batch *batchp = arg;
if (error & (EVBUFFER_TIMEOUT|EVBUFFER_EOF)) {
bufferevent_disable(bev, EV_READ|EV_WRITE);
+ log_debug("closing connection because of an error");
close(batchp->peerfd);
return;
}
@@ -784,5 +786,8 @@ mta_batch_update_queue(struct batch *batchp)
if (batchp->bev)
bufferevent_free(batchp->bev);
+ if (batchp->peerfd != -1)
+ close(batchp->peerfd);
+
free(batchp);
}