summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2012-10-03 21:44:36 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2012-10-03 21:44:36 +0000
commit52847c02f8b94d0e86a2848eebf1cb011f4aab0f (patch)
treeb9f5ceb8c56c25ecde90e3f27addbbbb7928a87f /usr.sbin/smtpd
parent4593c0d6ed0962fcf0ab2e61235a7fcf58495a6a (diff)
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.
Diffstat (limited to 'usr.sbin/smtpd')
-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");