diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-10-13 08:06:23 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-10-13 08:06:23 +0000 |
commit | 638e3086fc6366b892a7eb0d3184a86f4609a45f (patch) | |
tree | d93b984c8f6705f5be8affb39162aca2651990ca /usr.sbin | |
parent | bdabc7146b259cb3e4ff70e44c8490908a2d76ed (diff) |
let the enqueuer pledge() in both online and offline modes
ok deraadt@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/enqueue.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c index 7d8c3fd5d0f..a6fbd9df7a8 100644 --- a/usr.sbin/smtpd/enqueue.c +++ b/usr.sbin/smtpd/enqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enqueue.c,v 1.99 2015/10/12 21:32:27 millert Exp $ */ +/* $OpenBSD: enqueue.c,v 1.100 2015/10/13 08:06:22 gilles Exp $ */ /* * Copyright (c) 2005 Henning Brauer <henning@bulabula.org> @@ -286,12 +286,18 @@ enqueue(int argc, char *argv[], FILE *ofp) /* check if working in offline mode */ /* If the server is not running, enqueue the message offline */ - if (!srv_connected()) + if (!srv_connected()) { + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); return (enqueue_offline(save_argc, save_argv, fp, ofp)); + } if ((msg.fd = open_connection()) == -1) errx(EX_UNAVAILABLE, "server too busy"); + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); + fout = fdopen(msg.fd, "a+"); if (fout == NULL) err(EX_UNAVAILABLE, "fdopen"); diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 27e454eca39..725c66c4efd 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.129 2015/10/12 07:58:19 deraadt Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.130 2015/10/13 08:06:22 gilles Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -931,6 +931,10 @@ main(int argc, char **argv) if (setresgid(gid, gid, gid) == -1) err(1, "setresgid"); + /* we'll reduce further down the road */ + if (pledge("stdio rpath tmppath getpw recvfd", NULL) == -1) + err(1, "pledge"); + sendmail = 1; return (enqueue(argc, argv, offlinefp)); } |