diff options
author | Philip Hazel <ph10@hermes.cam.ac.uk> | 2004-11-25 14:31:28 +0000 |
---|---|---|
committer | Philip Hazel <ph10@hermes.cam.ac.uk> | 2004-11-25 14:31:28 +0000 |
commit | c38d6da94aa327f7c42a90b50508c62702412fef (patch) | |
tree | 39f41da327184db4b531700d42f4170102ca31c8 /src | |
parent | f05da2e8b55f18554ebbcf97523fd54fb03d071e (diff) |
Don't defer for lists of domains (in dnsdb and dnslists sublists) if any
of the other items is actually found.
Diffstat (limited to 'src')
-rw-r--r-- | src/src/lookups/dnsdb.c | 14 | ||||
-rw-r--r-- | src/src/verify.c | 11 |
2 files changed, 19 insertions, 6 deletions
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 */ |