From: Philip Hazel Date: Thu, 25 Nov 2004 14:31:28 +0000 (+0000) Subject: Don't defer for lists of domains (in dnsdb and dnslists sublists) if any X-Git-Tag: exim-4_50~83 X-Git-Url: https://git.exim.org/users/jgh/exim.git/commitdiff_plain/c38d6da94aa327f7c42a90b50508c62702412fef?ds=inline Don't defer for lists of domains (in dnsdb and dnslists sublists) if any of the other items is actually found. --- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index f8e31469d..b4fda862d 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.18 2004/11/25 13:54:31 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.19 2004/11/25 14:31:28 ph10 Exp $ New Features in Exim -------------------- @@ -151,9 +151,10 @@ Version 4.44 default - see 14 below), in the same way that multiple DNS records for a single item are handled. - The lookup fails only if all the DNS lookups fail. As long as at least one - of them yields some data, the lookup succeeds. However, if there is a - temporary DNS error for any of them, the lookup defers. + The dnsdb lookup fails only if all the DNS lookups fail. If there is a + temporary DNS error for any of them, the remaining lookups are still done, + and only if none of them succeed does the dnsdb lookup defer. As long as at + least one of the DNS lookups yields some data, the dnsdb lookup succeeds. 15. It is now possible to specify the character to be used as a separator when a dnsdb lookup returns data from more than one DNS record. The default is a @@ -198,7 +199,11 @@ Version 4.44 2.1.168.192.black.list.tld and a.domain.black.list.tld Once a DNS record has been found (that matches a specific IP return - address, if specified), no further lookups are done. + address, if specified), no further lookups are done. If there is a + temporary DNS error, the rest of the sublist of domains or IP addresses is + tried. The dnslists item itself defers only if none of the other DNS + lookups in this sublist succeeds. In other words, a successful lookup for + any of the items in the sublist overrides a defer for a previous item. 17. The log selector queue_time_overall causes Exim to output the time spent on the queue as an addition to the "Completed" message. Like queue_time (which diff --git a/src/src/lookups/dnsdb.c b/src/src/lookups/dnsdb.c index 29a36081e..3f9dc8e78 100644 --- a/src/src/lookups/dnsdb.c +++ b/src/src/lookups/dnsdb.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/lookups/dnsdb.c,v 1.4 2004/11/24 15:43:36 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/dnsdb.c,v 1.5 2004/11/25 14:31:28 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -103,6 +103,7 @@ int size = 256; int ptr = 0; int sep = 0; int type = T_TXT; +int failrc = FAIL; uschar *outsep = US"\n"; uschar *equals, *domain; uschar buffer[256]; @@ -205,12 +206,17 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer))) lookup function so that the facility could be used from other parts of the Exim code. The latter affects only what happens later on in this function, but for tidiness it is handled in a similar way. If the lookup fails, - continue with the next domain. */ + continue with the next domain. In the case of DEFER, adjust the final + "nothing found" result, but carry on to the next domain. */ rc = dns_special_lookup(&dnsa, domain, type, NULL); if (rc == DNS_NOMATCH || rc == DNS_NODATA) continue; - if (rc != DNS_SUCCEED) return DEFER; + if (rc != DNS_SUCCEED) + { + failrc = DEFER; + continue; + } /* Search the returned records */ @@ -301,7 +307,7 @@ store_reset(yield + ptr + 1); /* If ptr == 0 we have not found anything. Otherwise, insert the terminating zero and return the result. */ -if (ptr == 0) return FAIL; +if (ptr == 0) return failrc; yield[ptr] = 0; *result = yield; return OK; diff --git a/src/src/verify.c b/src/src/verify.c index 0c1d6b0eb..54a8b2b65 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/verify.c,v 1.7 2004/11/22 11:30:04 ph10 Exp $ */ +/* $Cambridge: exim/src/src/verify.c,v 1.8 2004/11/25 14:31:28 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2593,6 +2593,7 @@ while ((domain = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL else { int keysep = 0; + BOOL defer = FALSE; uschar *keydomain; uschar keybuffer[256]; @@ -2625,11 +2626,17 @@ while ((domain = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL dnslist_domain = string_copy(domain); HDEBUG(D_dnsbl) debug_printf("=> that means %s is listed at %s\n", keydomain, domain); + return OK; } - if (rc != FAIL) return rc; /* OK or DEFER */ + /* If the lookup deferred, remember this fact. We keep trying the rest + of the list to see if we get a useful result, and if we don't, we return + DEFER at the end. */ + if (rc == DEFER) defer = TRUE; } /* continue with next keystring domain/address */ + + if (defer) return DEFER; } } /* continue with next dnsdb outer domain */