summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2012-10-03 21:44:35 +0000
committergilles <gilles@openbsd.org>2012-10-03 21:44:35 +0000
commit1a86e40e45c5527d4bc2ffec897bdd0f201cbcbc (patch)
tree2ba1ca40277b37aeb09bdeb063e8322b518f6c7f
parentDon't include <mips64/archtype.h> when you don't need it. (diff)
downloadwireguard-openbsd-1a86e40e45c5527d4bc2ffec897bdd0f201cbcbc.tar.xz
wireguard-openbsd-1a86e40e45c5527d4bc2ffec897bdd0f201cbcbc.zip
when requesting MX entries, the result can be appear in random orders.
the logic for inserting them in a lka session when acting as backup MX did not take account for one specific case that could lead to an early exit without smtpd getting a chance to detect the entry corrsponds to itself. in such case, a backup MX woud try to connect to itself and bounce in the loop detection code ... or it would sometimes work.
-rw-r--r--usr.sbin/smtpd/dns.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c
index 7dd13b49761..b9be2835ffb 100644
--- a/usr.sbin/smtpd/dns.c
+++ b/usr.sbin/smtpd/dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dns.c,v 1.58 2012/09/27 17:47:49 chl Exp $ */
+/* $OpenBSD: dns.c,v 1.59 2012/10/03 21:44:35 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -396,12 +396,13 @@ dnssession_mx_insert(struct dnssession *s, const char *host, int preference)
TAILQ_FOREACH(e, &s->mx, entry) {
if (mx->preference <= e->preference) {
TAILQ_INSERT_BEFORE(e, mx, entry);
- return;
+ goto end;
}
}
TAILQ_INSERT_TAIL(&s->mx, mx, entry);
+end:
if (s->preference == -1 && s->query.backup[0]
&& !strcasecmp(host, s->query.backup)) {
log_debug("dns: found our backup preference");