summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2004-12-20 15:24:27 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2004-12-20 15:24:27 +0000
commitff4dbb191fab3d0bc10b82bb6d59898d03c2b50d (patch)
treecc0ce5db63a89d3844d024decac6f921525c9af3
parentb1206957506a8d30e54c3d76c3ada5f247118666 (diff)
Added Tony's defer_foo patch to dnsdb lookups.
-rw-r--r--doc/doc-txt/ChangeLog5
-rw-r--r--doc/doc-txt/NewStuff20
-rw-r--r--src/ACKNOWLEDGMENTS3
-rw-r--r--src/src/lookups/dnsdb.c54
4 files changed, 69 insertions, 13 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 6774dad4a..a12145aeb 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.46 2004/12/20 14:57:05 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.47 2004/12/20 15:24:27 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -157,7 +157,8 @@ Exim version 4.50
just the host names, not the priorities.
(3) It is now possible to give a list of domains (or IP addresses) to be
- looked up.
+ looked up. The behaviour when one of the lookups defers can be
+ controlled by a keyword.
(4) It is now possible to specify the separator character for use when
multiple records are returned.
diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff
index 16c9c4653..3109ea96f 100644
--- a/doc/doc-txt/NewStuff
+++ b/doc/doc-txt/NewStuff
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.20 2004/12/17 14:52:44 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.21 2004/12/20 15:24:27 ph10 Exp $
New Features in Exim
--------------------
@@ -152,9 +152,21 @@ Version 4.50
single item are handled.
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.
+ temporary DNS error for any of them, the behaviour is controlled by
+ an optional keyword followed by a comma that may appear before the record
+ type. The possible keywords are "defer_strict", "defer_never", and
+ "defer_lax". With "strict" behaviour, any temporary DNS error causes the
+ whole lookup to defer. With "never" behaviour, a temporary DNS error is
+ ignored, and the behaviour is as if the DNS lookup failed to find anything.
+ With "lax" behaviour, all the queries are attempted, but a temporary DNS
+ error causes the whole lookup to defer only if none of the other lookups
+ succeed. The default is "lax", so the following lookups are equivalent:
+
+ ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
+ ${lookup dnsdb{a=one.host.com:two.host.com}}
+
+ Thus, in the default case, 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
diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS
index a914262c7..3c591fb9c 100644
--- a/src/ACKNOWLEDGMENTS
+++ b/src/ACKNOWLEDGMENTS
@@ -1,4 +1,4 @@
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.8 2004/12/20 14:57:05 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.9 2004/12/20 15:24:28 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
@@ -123,6 +123,7 @@ Tony Finch Expansion extensions
Patch for more daemon exiwhat information
Patch for -dd
Patch for mxh lookup type in dnsdb
+ Patch for defer_foo in dndsb
Giuliano Gavazzi Patches for OSX compilation
Dominic Germain Patch for exiqgrep MacOS X bug
Oliver Gorwits $load_average patch
diff --git a/src/src/lookups/dnsdb.c b/src/src/lookups/dnsdb.c
index 3f9dc8e78..9cd8612b1 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.5 2004/11/25 14:31:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/lookups/dnsdb.c,v 1.6 2004/12/20 15:24:28 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -86,11 +86,17 @@ consist of a number of parts.
separator character that is used when multiple records are found. The default
separator is newline.
-(b) If the next sequence of characters is a sequence of letters and digits
+(b) If the next sequence of characters is 'defer_FOO' followed by a comma,
+the defer behaviour is set to FOO. The possible behaviours are: 'strict', where
+any defer causes the whole lookup to defer; 'lax', where a defer causes the
+whole lookup to defer only if none of the DNS queries succeeds; and 'never',
+where all defers are as if the lookup failed. The default is 'lax'.
+
+(c) If the next sequence of characters is a sequence of letters and digits
followed by '=', it is interpreted as the name of the DNS record type. The
-default is "A".
+default is "TXT".
-(c) Then there follows list of domain names. This is a generalized Exim list,
+(d) Then there follows list of domain names. This is a generalized Exim list,
which may start with '<' in order to set a specific separator. The default
separator, as always, is colon. */
@@ -102,6 +108,7 @@ int rc;
int size = 256;
int ptr = 0;
int sep = 0;
+int defer_mode = PASS;
int type = T_TXT;
int failrc = FAIL;
uschar *outsep = US"\n";
@@ -132,6 +139,40 @@ if (*keystring == '>')
while (isspace(*keystring)) keystring++;
}
+/* Check for a defer behaviour keyword. */
+
+if (strncmpic(keystring, US"defer_", 6) == 0)
+ {
+ keystring += 6;
+ if (strncmpic(keystring, US"strict", 6) == 0)
+ {
+ defer_mode = DEFER;
+ keystring += 6;
+ }
+ else if (strncmpic(keystring, US"lax", 3) == 0)
+ {
+ defer_mode = PASS;
+ keystring += 3;
+ }
+ else if (strncmpic(keystring, US"never", 5) == 0)
+ {
+ defer_mode = OK;
+ keystring += 5;
+ }
+ else
+ {
+ *errmsg = US"unsupported dnsdb defer behaviour";
+ return DEFER;
+ }
+ while (isspace(*keystring)) keystring++;
+ if (*keystring++ != ',')
+ {
+ *errmsg = US"dnsdb defer behaviour syntax error";
+ return DEFER;
+ }
+ while (isspace(*keystring)) keystring++;
+ }
+
/* If the keystring contains an = this must be preceded by a valid type name. */
if ((equals = Ustrchr(keystring, '=')) != NULL)
@@ -214,8 +255,9 @@ while ((domain = string_nextinlist(&keystring, &sep, buffer, sizeof(buffer)))
if (rc == DNS_NOMATCH || rc == DNS_NODATA) continue;
if (rc != DNS_SUCCEED)
{
- failrc = DEFER;
- continue;
+ if (defer_mode == DEFER) return DEFER; /* always defer */
+ else if (defer_mode == PASS) failrc = DEFER; /* defer only if all do */
+ continue; /* treat defer as fail */
}
/* Search the returned records */