diff options
Diffstat (limited to 'usr.sbin/smtpd/control.c')
-rw-r--r-- | usr.sbin/smtpd/control.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index 362a8f9787d..2a0dec52f8c 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.106 2015/10/13 10:59:04 gilles Exp $ */ +/* $OpenBSD: control.c,v 1.107 2015/10/29 10:25:36 sunil Exp $ */ /* * Copyright (c) 2012 Gilles Chehade <gilles@poolp.org> @@ -116,6 +116,8 @@ control_imsg(struct mproc *p, struct imsg *imsg) if (p->proc == PROC_QUEUE) { switch (imsg->hdr.type) { case IMSG_CTL_LIST_ENVELOPES: + case IMSG_CTL_DISCOVER_EVPID: + case IMSG_CTL_DISCOVER_MSGID: c = tree_get(&ctl_conns, imsg->hdr.peerid); if (c == NULL) return; @@ -471,6 +473,8 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) char *key; struct stat_value val; size_t len; + uint64_t evpid; + uint32_t msgid; c = p->data; @@ -793,6 +797,32 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; + case IMSG_CTL_DISCOVER_EVPID: + if (c->euid) + goto badcred; + + if (imsg->hdr.len - IMSG_HEADER_SIZE != sizeof evpid) + goto invalid; + + memmove(&evpid, imsg->data, sizeof evpid); + m_create(p_queue, imsg->hdr.type, c->id, 0, -1); + m_add_evpid(p_queue, evpid); + m_close(p_queue); + return; + + case IMSG_CTL_DISCOVER_MSGID: + if (c->euid) + goto badcred; + + if (imsg->hdr.len - IMSG_HEADER_SIZE != sizeof msgid) + goto invalid; + + memmove(&msgid, imsg->data, sizeof msgid); + m_create(p_queue, imsg->hdr.type, c->id, 0, -1); + m_add_msgid(p_queue, msgid); + m_close(p_queue); + return; + default: log_debug("debug: control_dispatch_ext: " "error handling %s imsg", |