summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2020-04-22 11:35:35 +0000
committerEric Faurot <eric@cvs.openbsd.org>2020-04-22 11:35:35 +0000
commite8e2372ee1630daf19a53954467793e285958188 (patch)
treeb9417ae32cbb20cebcafe117efde385f7924faf7 /usr.sbin/smtpd
parentf0e4b6e2b072c7b70908f315db7a661e97bfd74d (diff)
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@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/queue.c11
-rw-r--r--usr.sbin/smtpd/queue_backend.c5
2 files changed, 5 insertions, 11 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index 8380c7b5ea5..3739fe22750 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -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/usr.sbin/smtpd/queue_backend.c b/usr.sbin/smtpd/queue_backend.c
index 5e7c38fa712..a33f91f45f4 100644
--- a/usr.sbin/smtpd/queue_backend.c
+++ b/usr.sbin/smtpd/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;
}