summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-05-25 11:17:33 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-05-25 11:17:33 +0000
commit8930faf8045c905333e092cf7b11a9dbef81b47f (patch)
tree8b899854f0ee9308cfbbeaf18a40c7cf5d6249bd
parentce539ea343056dedf5337fa5e29ea5fa1214475e (diff)
Disallow submission using /usr/sbin/sendmail while the server is
paused, configuring, or exiting; ok gilles@
-rw-r--r--usr.sbin/smtpd/control.c8
-rw-r--r--usr.sbin/smtpd/enqueue.c11
2 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c
index 43a1ed5a795..a81e7aa39a8 100644
--- a/usr.sbin/smtpd/control.c
+++ b/usr.sbin/smtpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.30 2009/05/24 14:38:56 jacekm Exp $ */
+/* $OpenBSD: control.c,v 1.31 2009/05/25 11:17:32 jacekm Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -316,6 +316,12 @@ control_dispatch_ext(int fd, short event, void *arg)
switch (imsg.hdr.type) {
case IMSG_SMTP_ENQUEUE:
+ if (env->sc_flags & (SMTPD_SMTP_PAUSED |
+ SMTPD_CONFIGURING | SMTPD_EXITING)) {
+ imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
+ NULL, 0);
+ break;
+ }
imsg_compose(env->sc_ibufs[PROC_SMTP],
IMSG_SMTP_ENQUEUE, 0, 0, -1, &fd, sizeof(fd));
break;
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index ed172abad9f..eadcfb5e0d6 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enqueue.c,v 1.15 2009/05/14 15:05:12 eric Exp $ */
+/* $OpenBSD: enqueue.c,v 1.16 2009/05/25 11:17:32 jacekm Exp $ */
/*
* Copyright (c) 2005 Henning Brauer <henning@bulabula.org>
@@ -531,6 +531,15 @@ open_connection(void)
if (n == 0)
continue;
+ switch (imsg.hdr.type) {
+ case IMSG_CTL_OK:
+ break;
+ case IMSG_CTL_FAIL:
+ errx(1, "server disallowed submission request");
+ default:
+ errx(1, "unexpected imsg reply type");
+ }
+
fd = imsg_get_fd(ibuf, &imsg);
imsg_free(&imsg);