summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2010-12-19 11:24:18 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2010-12-19 11:24:18 +0000
commite3f79ad526b63b3fa970a2d27322ecbececc6004 (patch)
tree21d652e527e5ea937b39906851a07d93c8f5f889
parent19c8230805acc8b2e956650431373bd6b2b8880c (diff)
If MX lookup fails, fallback to using the host itself. This has always been
the behavior but I introduced a regression when switching to ASR. bug reported by jmc@, bugfix tested by jmc@ and I
-rw-r--r--usr.sbin/smtpd/dns.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c
index 7c9ca8d5cce..1599281bd1b 100644
--- a/usr.sbin/smtpd/dns.c
+++ b/usr.sbin/smtpd/dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dns.c,v 1.27 2010/12/12 22:29:39 jsg Exp $ */
+/* $OpenBSD: dns.c,v 1.28 2010/12/19 11:24:17 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -262,6 +262,18 @@ dns_asr_handler(int fd, short event, void *arg)
goto err;
if (h.ancount == 0) {
+ if (query->type == IMSG_DNS_MX) {
+ /* we were looking for MX and got no answer,
+ * fallback to host.
+ */
+ query->type = IMSG_DNS_HOST;
+ dnssession->aq = asr_query_host(asr, query->host,
+ AF_UNSPEC);
+ if (dnssession->aq == NULL)
+ goto err;
+ dns_asr_handler(-1, -1, dnssession);
+ return;
+ }
query->error = EAI_NONAME;
goto err;
}