diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-11-21 13:42:23 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-11-21 13:42:23 +0000 |
commit | 8a40d1224b99e08385e16451a62564abcf81f42e (patch) | |
tree | ad33c6f93808f938b66821a989e73371fed37bca | |
parent | e258c9b166ad18f72b4de6aceaf48ecad9427434 (diff) |
In smtpd enable fdpassing on all imsgbufs apart from the one in mproc.c
that was specially handled before. On the control socket fdpassing needs
to be enabled when a IMSG_CTL_SMTP_SESSION message is received.
OK tb@
-rw-r--r-- | usr.sbin/smtpd/control.c | 3 | ||||
-rw-r--r-- | usr.sbin/smtpd/mproc.c | 7 | ||||
-rw-r--r-- | usr.sbin/smtpd/queue_proc.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/scheduler_proc.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 6 |
5 files changed, 19 insertions, 9 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index 89c8c43f9c1..b114f60b745 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.131 2024/01/20 09:01:03 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.132 2024/11/21 13:42:22 claudio Exp $ */ /* * Copyright (c) 2012 Gilles Chehade <gilles@poolp.org> @@ -435,6 +435,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) switch (imsg->hdr.type) { case IMSG_CTL_SMTP_SESSION: + imsgbuf_allow_fdpass(&p->imsgbuf); if (env->sc_flags & SMTPD_SMTP_PAUSED) { m_compose(p, IMSG_CTL_FAIL, 0, 0, -1, NULL, 0); return; diff --git a/usr.sbin/smtpd/mproc.c b/usr.sbin/smtpd/mproc.c index 7fa058374a0..c463730c87b 100644 --- a/usr.sbin/smtpd/mproc.c +++ b/usr.sbin/smtpd/mproc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mproc.c,v 1.46 2024/11/21 13:32:02 claudio Exp $ */ +/* $OpenBSD: mproc.c,v 1.47 2024/11/21 13:42:22 claudio Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@faurot.net> @@ -65,7 +65,10 @@ err: void mproc_init(struct mproc *p, int fd) { - imsgbuf_init(&p->imsgbuf, fd); + if (imsgbuf_init(&p->imsgbuf, fd) == -1) + fatal("mproc_init: imsgbuf_init"); + if (p->proc != PROC_CLIENT) + imsgbuf_allow_fdpass(&p->imsgbuf); } void diff --git a/usr.sbin/smtpd/queue_proc.c b/usr.sbin/smtpd/queue_proc.c index f406693b12f..255624f70a2 100644 --- a/usr.sbin/smtpd/queue_proc.c +++ b/usr.sbin/smtpd/queue_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_proc.c,v 1.13 2024/11/21 13:22:21 claudio Exp $ */ +/* $OpenBSD: queue_proc.c,v 1.14 2024/11/21 13:42:22 claudio Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -291,7 +291,9 @@ queue_proc_init(struct passwd *pw, int server, const char *conf) if (fd == -1) fatalx("queue-proc: exiting"); - imsgbuf_init(&ibuf, fd); + if (imsgbuf_init(&ibuf, fd) == -1) + fatal("queue-proc: exiting"); + imsgbuf_allow_fdpass(&ibuf); version = PROC_QUEUE_API_VERSION; imsg_compose(&ibuf, PROC_QUEUE_INIT, 0, 0, -1, diff --git a/usr.sbin/smtpd/scheduler_proc.c b/usr.sbin/smtpd/scheduler_proc.c index 7be5ded442c..f16ac343582 100644 --- a/usr.sbin/smtpd/scheduler_proc.c +++ b/usr.sbin/smtpd/scheduler_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler_proc.c,v 1.12 2024/11/21 13:22:21 claudio Exp $ */ +/* $OpenBSD: scheduler_proc.c,v 1.13 2024/11/21 13:42:22 claudio Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -104,7 +104,9 @@ scheduler_proc_init(const char *conf) if (fd == -1) fatalx("scheduler-proc: exiting"); - imsgbuf_init(&ibuf, fd); + if (imsgbuf_init(&ibuf, fd) == -1) + fatal("scheduler-proc: exiting"); + imsgbuf_allow_fdpass(&ibuf); version = PROC_SCHEDULER_API_VERSION; imsg_compose(&ibuf, PROC_SCHEDULER_INIT, 0, 0, -1, diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index fb3d3f3714b..faecc946067 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.175 2024/11/21 13:26:25 claudio Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.176 2024/11/21 13:42:22 claudio Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -118,7 +118,9 @@ srv_connect(void) } ibuf = xcalloc(1, sizeof(struct imsgbuf)); - imsgbuf_init(ibuf, ctl_sock); + if (imsgbuf_init(ibuf, ctl_sock) == -1) + err(1, "imsgbuf_init"); + imsgbuf_allow_fdpass(ibuf); return (1); } |