diff options
author | eric <eric@openbsd.org> | 2020-04-22 11:35:34 +0000 |
---|---|---|
committer | eric <eric@openbsd.org> | 2020-04-22 11:35:34 +0000 |
commit | 525c74d08a3e98ae22de0d6b43a7da3bb6bfd6ca (patch) | |
tree | debfe0f69c0de5e4685aa4614f90bde5582234ca | |
parent | switch email and result fields in mail-from/rcpt-to event reports (diff) | |
download | OpenSMTPD-525c74d08a3e98ae22de0d6b43a7da3bb6bfd6ca.tar.xz OpenSMTPD-525c74d08a3e98ae22de0d6b43a7da3bb6bfd6ca.zip |
Check for the dispatcher name in the envelope validation function.
Fixes a possible crash and caching issue when manually moving an
envelope to the queue with smtpctl discover.
ok millert@
-rw-r--r-- | queue.c | 11 | ||||
-rw-r--r-- | queue_backend.c | 5 |
2 files changed, 5 insertions, 11 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.189 2018/12/30 23:09:58 guenther Exp $ */ +/* $OpenBSD: queue.c,v 1.190 2020/04/22 11:35:34 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -686,7 +686,6 @@ static void queue_timeout(int fd, short event, void *p) { static uint32_t msgid = 0; - struct dispatcher *dsp; struct envelope evp; struct event *ev = p; struct timeval tv; @@ -705,13 +704,6 @@ queue_timeout(int fd, short event, void *p) } if (r) { - dsp = dict_get(env->sc_dispatchers, evp.dispatcher); - if (dsp == NULL) { - log_warnx("warn: queue: missing dispatcher \"%s\"" - " for envelope %016"PRIx64", ignoring", - evp.dispatcher, evp.id); - goto reset; - } if (msgid && evpid_to_msgid(evp.id) != msgid) { m_create(p_scheduler, IMSG_QUEUE_MESSAGE_COMMIT, 0, 0, -1); @@ -724,7 +716,6 @@ queue_timeout(int fd, short event, void *p) m_close(p_scheduler); } -reset: tv.tv_sec = 0; tv.tv_usec = 10; evtimer_add(ev, &tv); diff --git a/queue_backend.c b/queue_backend.c index 5e7c38fa..a33f91f4 100644 --- a/queue_backend.c +++ b/queue_backend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_backend.c,v 1.65 2018/12/30 23:09:58 guenther Exp $ */ +/* $OpenBSD: queue_backend.c,v 1.66 2020/04/22 11:35:34 eric Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org> @@ -730,6 +730,9 @@ envelope_validate(struct envelope *ep) if (memchr(ep->errorline, '\0', sizeof(ep->errorline)) == NULL) return "invalid error line"; + if (dict_get(env->sc_dispatchers, ep->dispatcher) == NULL) + return "unknown dispatcher"; + return NULL; } |