ph10 2004/12/20 15:24:28 GMT
Modified files:
exim-doc/doc-txt ChangeLog NewStuff
exim-src ACKNOWLEDGMENTS
exim-src/src/lookups dnsdb.c
exim-test-orig/AutoTest/scripts 082
exim-test-orig/AutoTest/stdout 082
Log:
Added Tony's defer_foo patch to dnsdb lookups.
Revision Changes Path
1.47 +2 -1 exim/exim-doc/doc-txt/ChangeLog
1.21 +15 -3 exim/exim-doc/doc-txt/NewStuff
1.9 +1 -0 exim/exim-src/ACKNOWLEDGMENTS
1.6 +47 -5 exim/exim-src/src/lookups/dnsdb.c
1.9 +7 -0 exim/exim-test-orig/AutoTest/scripts/082
1.9 +7 -0 exim/exim-test-orig/AutoTest/stdout/082
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- ChangeLog 20 Dec 2004 14:57:05 -0000 1.46
+++ ChangeLog 20 Dec 2004 15:24:27 -0000 1.47
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.46 2004/12/20 14:57:05 ph10 Exp $
+$Cambridge: exim/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 @@
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.
Index: NewStuff
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- NewStuff 17 Dec 2004 14:52:44 -0000 1.20
+++ NewStuff 20 Dec 2004 15:24:27 -0000 1.21
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.20 2004/12/17 14:52:44 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.21 2004/12/20 15:24:27 ph10 Exp $
New Features in Exim
--------------------
@@ -152,9 +152,21 @@
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
Index: ACKNOWLEDGMENTS
===================================================================
RCS file: /home/cvs/exim/exim-src/ACKNOWLEDGMENTS,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ACKNOWLEDGMENTS 20 Dec 2004 14:57:05 -0000 1.8
+++ ACKNOWLEDGMENTS 20 Dec 2004 15:24:28 -0000 1.9
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-src/ACKNOWLEDGMENTS,v 1.8 2004/12/20 14:57:05 ph10 Exp $
+$Cambridge: exim/exim-src/ACKNOWLEDGMENTS,v 1.9 2004/12/20 15:24:28 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
@@ -123,6 +123,7 @@
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
Index: dnsdb.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/lookups/dnsdb.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dnsdb.c 25 Nov 2004 14:31:28 -0000 1.5
+++ dnsdb.c 20 Dec 2004 15:24:28 -0000 1.6
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/lookups/dnsdb.c,v 1.5 2004/11/25 14:31:28 ph10 Exp $ */
+/* $Cambridge: exim/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 @@
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 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 @@
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 @@
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 */
Index: 082
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/scripts/082,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- 082 25 Nov 2004 14:31:28 -0000 1.8
+++ 082 20 Dec 2004 15:24:28 -0000 1.9
@@ -459,6 +459,13 @@
ten-1:bad ${lookup dnsdb{ a = ten-1.test.ex:badbad.test.ex}{$value}{FAILED}}
bad:bad ${lookup dnsdb{ a = <; badbad.test.ex ; badbad.test.ex}{$value}{FAILED}}
+defer:defer ${lookup dnsdb{a=test.again.dns:test.again.dns}}
+defer_lax:ten-1 ${lookup dnsdb{a=test.again.dns:ten-1.test.ex}}
+defer_lax:ten-1 ${lookup dnsdb{defer_lax,a=test.again.dns:ten-1.test.ex}}
+defer_never:ten-1 ${lookup dnsdb{defer_never,a=test.again.dns:ten-1.test.ex}}
+defer_never:defer ${lookup dnsdb{defer_never,a=test.again.dns:test.again.dns}}
+defer_strict:ten-1 ${lookup dnsdb{defer_strict,a=test.again.dns:ten-1.test.ex}}
+
# Extract
${extract{B}{A=1 B=2 C=3}}
Index: 082
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/stdout/082,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- 082 25 Nov 2004 14:31:28 -0000 1.8
+++ 082 20 Dec 2004 15:24:28 -0000 1.9
@@ -459,6 +459,13 @@
> ten-1:bad 10.0.0.1
> bad:bad FAILED
>
+> Failed: lookup of "a=test.again.dns:test.again.dns" gave DEFER:
+> defer_lax:ten-1 10.0.0.1
+> defer_lax:ten-1 10.0.0.1
+> defer_never:ten-1 10.0.0.1
+> defer_never:defer
+> Failed: lookup of "defer_strict,a=test.again.dns:ten-1.test.ex" gave DEFER:
+>
> # Extract
>
> 2