diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2009-11-05 12:11:54 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2009-11-05 12:11:54 +0000 |
commit | 906dfa15288823abe5b13a3024f601bbadeca35f (patch) | |
tree | b21d6a6915f15455eec4fa91dcae2edd5b865106 /usr.sbin | |
parent | a2bec193380129f6f7d32837affcba8603408df9 (diff) |
Consider DNS lookups that result in NXDOMAIN to be a permanent failure.
ok gilles@ jacekm@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/dns.c | 5 | ||||
-rw-r--r-- | usr.sbin/smtpd/mta.c | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c index 300b7aa3eb1..749c0280902 100644 --- a/usr.sbin/smtpd/dns.c +++ b/usr.sbin/smtpd/dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dns.c,v 1.17 2009/11/05 12:05:47 jsing Exp $ */ +/* $OpenBSD: dns.c,v 1.18 2009/11/05 12:11:53 jsing Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -367,9 +367,10 @@ again: switch (h_errno) { case TRY_AGAIN: return (EAI_AGAIN); + case HOST_NOT_FOUND: + return (EAI_NONAME); case NO_RECOVERY: return (EAI_FAIL); - case HOST_NOT_FOUND: case NO_DATA: *res = NULL; return (0); diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index 4eb65020a53..1f73f677eb6 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.73 2009/11/05 12:05:47 jsing Exp $ */ +/* $OpenBSD: mta.c,v 1.74 2009/11/05 12:11:53 jsing Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -752,8 +752,17 @@ mta_pickup(struct mta_session *s, void *p) case MTA_MX: /* LKA responded to DNS lookup. */ error = *(int *)p; - if (error) { - mta_status(s, "100 MX lookup failed"); + if (error == EAI_AGAIN) { + /* Temporary failure. */ + mta_status(s, "100 MX lookup failed temporarily"); + mta_enter_state(s, MTA_DONE, NULL); + } else if (error == EAI_NONAME) { + /* No such domain. */ + mta_status(s, "600 Domain does not exist"); + mta_enter_state(s, MTA_DONE, NULL); + } else if (error) { + /* Permanent failure. */ + mta_status(s, "600 Unable to resolve DNS for domain"); mta_enter_state(s, MTA_DONE, NULL); } else mta_enter_state(s, MTA_DATA, NULL); |