diff options
author | Sunil Nimmagadda <sunil@cvs.openbsd.org> | 2015-12-10 07:49:59 +0000 |
---|---|---|
committer | Sunil Nimmagadda <sunil@cvs.openbsd.org> | 2015-12-10 07:49:59 +0000 |
commit | 6e5336b1ba17cac7536cd919a7fab5607aec4696 (patch) | |
tree | d85b6faf6af3bc688dd14f849cfa2269b4ab80ce /usr.sbin | |
parent | dab147b29cfe5df31a6f56ffbd80d90ebae3f3e4 (diff) |
While listing envelopes using mailq(or smtpctl show queue), pass
the data between processes by dumping to and loading from a buffer
which is shorter compared to transferring a structure. Also fixes
mailq on platforms where PATH_MAX is way larger than on OpenBSD
thus exceeding max imsg.
Ok jung@ millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/queue.c | 12 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 12 |
2 files changed, 19 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index 83624dc79d7..44a3acba7d0 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.172 2015/11/23 06:54:21 sunil Exp $ */ +/* $OpenBSD: queue.c,v 1.173 2015/12/10 07:49:58 sunil Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -72,8 +72,9 @@ queue_imsg(struct mproc *p, struct imsg *imsg) uint64_t reqid, evpid, holdq; uint32_t msgid; time_t nexttry; - size_t n_evp; + size_t buflen, id_sz, n_evp; int fd, mta_ext, ret, v, flags, code; + char buf[sizeof(evp)]; memset(&bounce, 0, sizeof(struct delivery_bounce)); if (p->proc == PROC_PONY) { @@ -328,8 +329,13 @@ queue_imsg(struct mproc *p, struct imsg *imsg) */ evp.lasttry = nexttry; } + + id_sz = sizeof evp.id; + (void)memcpy(buf, &evp.id, id_sz); + buflen = envelope_dump_buffer(&evp, buf + id_sz, + sizeof(buf) - id_sz); m_compose(p_control, IMSG_CTL_LIST_ENVELOPES, - imsg->hdr.peerid, 0, -1, &evp, sizeof evp); + imsg->hdr.peerid, 0, -1, buf, id_sz + buflen + 1); return; } } diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index e5414340bf5..8757518ae60 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.138 2015/12/07 12:29:19 sunil Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.139 2015/12/10 07:49:58 sunil Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -293,6 +293,9 @@ srv_iter_envelopes(uint32_t msgid, struct envelope *evp) static uint32_t currmsgid = 0; static uint64_t from = 0; static int done = 0, need_send = 1, found; + char buf[sizeof(*evp)]; + size_t buflen; + uint64_t evpid; if (currmsgid != msgid) { if (currmsgid != 0 && !done) @@ -325,7 +328,12 @@ srv_iter_envelopes(uint32_t msgid, struct envelope *evp) goto again; } - srv_read(evp, sizeof(*evp)); + srv_read(&evpid, sizeof evpid); + buflen = rlen; + srv_read(buf, rlen); + envelope_load_buffer(evp, buf, buflen - 1); + evp->id = evpid; + srv_end(); from = evp->id + 1; found++; |