aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilles Chehade <gilles@poolp.org>2015-06-30 10:10:57 +0200
committerGilles Chehade <gilles@poolp.org>2015-06-30 10:13:34 +0200
commitc0b5fdd35b335fa3d9d4b0852783f7c9b0601c48 (patch)
treec8e7ab58bd8bc1dec6b01f2e436033bb5ca7de0e
parentMerge branch 'branch-opensmtpd-5.7.1' into branch-opensmtpd-5.7.1p1 (diff)
downloadOpenSMTPD-opensmtpd-5.7.1p1.tar.xz
OpenSMTPD-opensmtpd-5.7.1p1.zip
fix show queue for systems where struct envelope exceeds lenght of max imsgopensmtpd-5.7.1p1
-rw-r--r--smtpd/queue.c6
-rw-r--r--smtpd/smtpctl.c10
2 files changed, 14 insertions, 2 deletions
diff --git a/smtpd/queue.c b/smtpd/queue.c
index 8ae81bc9..bfa3d537 100644
--- a/smtpd/queue.c
+++ b/smtpd/queue.c
@@ -78,6 +78,7 @@ queue_imsg(struct mproc *p, struct imsg *imsg)
time_t nexttry;
size_t 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) {
@@ -332,8 +333,11 @@ queue_imsg(struct mproc *p, struct imsg *imsg)
*/
evp.lasttry = nexttry;
}
+
+ (void)memcpy(buf, &evp.id, sizeof evp.id);
+ envelope_dump_buffer(&evp, buf+8, sizeof(buf)-8);
m_compose(p_control, IMSG_CTL_LIST_ENVELOPES,
- imsg->hdr.peerid, 0, -1, &evp, sizeof evp);
+ imsg->hdr.peerid, 0, -1, buf, 8 + strlen(buf+8) + 1);
return;
}
}
diff --git a/smtpd/smtpctl.c b/smtpd/smtpctl.c
index 6766ec39..7baa2760 100644
--- a/smtpd/smtpctl.c
+++ b/smtpd/smtpctl.c
@@ -272,6 +272,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)
@@ -304,7 +307,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++;