Added $dnslist_matched.
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Thu, 14 Jun 2007 14:18:19 +0000 (14:18 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Thu, 14 Jun 2007 14:18:19 +0000 (14:18 +0000)
12 files changed:
doc/doc-txt/ChangeLog
doc/doc-txt/NewStuff
src/ACKNOWLEDGMENTS
src/src/expand.c
src/src/globals.c
src/src/globals.h
src/src/verify.c
test/confs/0023
test/confs/0139
test/mail/0139.userx
test/stderr/0139
test/stdout/0023

index 099f5e0eac15ac4bd683758a6323f4ede363a5b3..6a8e4d1e1d2ee020b5367bf20eebe343b7df0f25 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.511 2007/06/14 13:27:11 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.512 2007/06/14 14:18:19 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -48,6 +48,8 @@ MH/02 The dsearch lookup now uses lstat(2) instead of stat(2) to look for
 PH/03 The body_linecount and body_zerocount variables are now exported in the
       local_scan API.
 
 PH/03 The body_linecount and body_zerocount variables are now exported in the
       local_scan API.
 
+PH/04 Added the $dnslist_matched variable.
+
 
 Exim version 4.67
 -----------------
 
 Exim version 4.67
 -----------------
index 3de7f6366b6ebf0cd11da4e51547c0a84d346d44..a630273648deae137d72bdebc8b016b902f819a6 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.147 2007/06/14 13:27:11 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.148 2007/06/14 14:18:19 ph10 Exp $
 
 New Features in Exim
 --------------------
 
 New Features in Exim
 --------------------
@@ -14,6 +14,23 @@ Version 4.68
  1. The body_linecount and body_zerocount C variables are now exported in the
     local_scan API.
 
  1. The body_linecount and body_zerocount C variables are now exported in the
     local_scan API.
 
+ 2. When a dnslists lookup succeeds, the key that was looked up is now placed
+    in $dnslist_matched. When the key is an IP address, it is not reversed in
+    this variable (though it is, of course, in the actual lookup). In simple
+    cases, for example:
+
+      deny dnslists = spamhaus.example
+
+    the key is also available in another variable (in this case,
+    $sender_host_address). In more complicated cases, however, this is not
+    true. For example, using a data lookup might generate a dnslists lookup
+    like this:
+
+      deny dnslists = spamhaus.example/<|192.168.1.2|192.168.6.7|...
+
+    If this condition succeeds, the value in $dnslist_matched might be
+    192.168.6.7 (for example).
+
 
 Version 4.67
 ------------
 
 Version 4.67
 ------------
@@ -26,7 +43,7 @@ Version 4.67
  2. When an item in a dnslists list is followed by = and & and a list of IP
     addresses, the behaviour was not clear when the lookup returned more than
     one IP address. This has been solved by the addition of == and =& for "all"
  2. When an item in a dnslists list is followed by = and & and a list of IP
     addresses, the behaviour was not clear when the lookup returned more than
     one IP address. This has been solved by the addition of == and =& for "all"
-    rather than the defaule "any" matching.
+    rather than the default "any" matching.
 
  3. Up till now, the only control over which cipher suites GnuTLS uses has been
     for the cipher algorithms. New options have been added to allow some of the
 
  3. Up till now, the only control over which cipher suites GnuTLS uses has been
     for the cipher algorithms. New options have been added to allow some of the
index 899c346b0b225fbc5f5615835de6e1bd8f274d3b..3eb64b9aab2a49cdb5592ddded17740749ad6579 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.76 2007/03/13 11:06:48 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.77 2007/06/14 14:18:19 ph10 Exp $
 
 EXIM ACKNOWLEDGEMENTS
 
 
 EXIM ACKNOWLEDGEMENTS
 
@@ -20,7 +20,7 @@ relatively small patches.
 Philip Hazel
 
 Lists created: 20 November 2002
 Philip Hazel
 
 Lists created: 20 November 2002
-Last updated:  13 March 2007
+Last updated:  14 June 2007
 
 
 THE OLD LIST
 
 
 THE OLD LIST
@@ -67,6 +67,7 @@ THE NEW LIST
 Alexander Alekseev        Use of function attribute checks in gcc
 Justo Alonso              Suggested patch for maildir++ maildirsize file support
 Anton Altaparmakov        Patches to get cyrus_sasl fully working
 Alexander Alekseev        Use of function attribute checks in gcc
 Justo Alonso              Suggested patch for maildir++ maildirsize file support
 Anton Altaparmakov        Patches to get cyrus_sasl fully working
+Simon Arlott              Patch for $dnslist_matched.
 Claus Assmann             Example code for OpenSSL CRL support
 Robert Bannocks           Patch for LDAP reference problem on Solaris
 Ian Bell                  Analysis of a bug and an infelicity in clock tick code
 Claus Assmann             Example code for OpenSSL CRL support
 Robert Bannocks           Patch for LDAP reference problem on Solaris
 Ian Bell                  Analysis of a bug and an infelicity in clock tick code
index 1fdb93218bebd765825b850bbd207425f4f09e8c..abff94996f9fc3e54954251af1bd933df156a0ef 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.85 2007/05/11 08:48:31 tom Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.86 2007/06/14 14:18:19 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -414,6 +414,7 @@ static var_entry var_table[] = {
   { "dk_testing",          vtype_dk_verify,   NULL },
 #endif
   { "dnslist_domain",      vtype_stringptr,   &dnslist_domain },
   { "dk_testing",          vtype_dk_verify,   NULL },
 #endif
   { "dnslist_domain",      vtype_stringptr,   &dnslist_domain },
+  { "dnslist_matched",     vtype_stringptr,   &dnslist_matched },
   { "dnslist_text",        vtype_stringptr,   &dnslist_text },
   { "dnslist_value",       vtype_stringptr,   &dnslist_value },
   { "domain",              vtype_stringptr,   &deliver_domain },
   { "dnslist_text",        vtype_stringptr,   &dnslist_text },
   { "dnslist_value",       vtype_stringptr,   &dnslist_value },
   { "domain",              vtype_stringptr,   &deliver_domain },
index 83c37b09ed1063c0e4137def607e4f9f79525d58..7b14f7b933f12826c0fc1e38ead6a51af4c5615f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.c,v 1.72 2007/04/13 15:13:47 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.73 2007/06/14 14:18:19 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -521,6 +521,7 @@ uschar *dns_ipv4_lookup        = NULL;
 int     dns_retrans            = 0;
 int     dns_retry              = 0;
 uschar *dnslist_domain         = NULL;
 int     dns_retrans            = 0;
 int     dns_retry              = 0;
 uschar *dnslist_domain         = NULL;
+uschar *dnslist_matched        = NULL;
 uschar *dnslist_text           = NULL;
 uschar *dnslist_value          = NULL;
 tree_node *domainlist_anchor   = NULL;
 uschar *dnslist_text           = NULL;
 uschar *dnslist_value          = NULL;
 tree_node *domainlist_anchor   = NULL;
index e8bcdec88f21a2c5a513e8648bd5ab8359b91e79..ce43922c01b3edf8bb5d3caf4f3f7bfc22956228 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.h,v 1.53 2007/06/14 13:27:11 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.h,v 1.54 2007/06/14 14:18:19 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -298,6 +298,7 @@ extern uschar *dns_ipv4_lookup;        /* For these domains, don't look for AAAA
 extern int     dns_retrans;            /* Retransmission time setting */
 extern int     dns_retry;              /* Number of retries */
 extern uschar *dnslist_domain;         /* DNS (black) list domain */
 extern int     dns_retrans;            /* Retransmission time setting */
 extern int     dns_retry;              /* Number of retries */
 extern uschar *dnslist_domain;         /* DNS (black) list domain */
+extern uschar *dnslist_matched;        /* DNS (black) list matched key */
 extern uschar *dnslist_text;           /* DNS (black) list text message */
 extern uschar *dnslist_value;          /* DNS (black) list IP address */
 extern tree_node *domainlist_anchor;   /* Tree of defined domain lists */
 extern uschar *dnslist_text;           /* DNS (black) list text message */
 extern uschar *dnslist_value;          /* DNS (black) list IP address */
 extern tree_node *domainlist_anchor;   /* Tree of defined domain lists */
index 23f63d803b997dcdcf2cd3631fc47be64940a88c..4b40445075e5e0444244f2e9ccfcf6da9e3dfbac 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/verify.c,v 1.50 2007/05/08 13:08:22 ph10 Exp $ */
+/* $Cambridge: exim/src/src/verify.c,v 1.51 2007/06/14 14:18:19 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -3031,6 +3031,7 @@ while ((domain = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL
     if (rc == OK)
       {
       dnslist_domain = string_copy(domain_txt);
     if (rc == OK)
       {
       dnslist_domain = string_copy(domain_txt);
+      dnslist_matched = string_copy(sender_host_address);
       HDEBUG(D_dnsbl) debug_printf("=> that means %s is listed at %s\n",
         sender_host_address, dnslist_domain);
       }
       HDEBUG(D_dnsbl) debug_printf("=> that means %s is listed at %s\n",
         sender_host_address, dnslist_domain);
       }
@@ -3065,6 +3066,7 @@ while ((domain = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL
       if (rc == OK)
         {
         dnslist_domain = string_copy(domain_txt);
       if (rc == OK)
         {
         dnslist_domain = string_copy(domain_txt);
+        dnslist_matched = string_copy(keydomain);
         HDEBUG(D_dnsbl) debug_printf("=> that means %s is listed at %s\n",
           keydomain, dnslist_domain);
         return OK;
         HDEBUG(D_dnsbl) debug_printf("=> that means %s is listed at %s\n",
           keydomain, dnslist_domain);
         return OK;
index 17c88ff6a79f6b18b42f467eaab09afc4c192a0e..4f79a87b57cae9a6d02da5456a1437b1c0dd70e3 100644 (file)
@@ -156,6 +156,7 @@ acl_29_29_29:
 acl_30_30_30:
   deny    message  = domain=$dnslist_domain\n\
                      value=$dnslist_value\n\
 acl_30_30_30:
   deny    message  = domain=$dnslist_domain\n\
                      value=$dnslist_value\n\
+                     matched=$dnslist_matched\n\
                      text="$dnslist_text"
           dnslists = test.ex=V4NET.0.0.1,127.0.0.2/$sender_address_domain
   accept
                      text="$dnslist_text"
           dnslists = test.ex=V4NET.0.0.1,127.0.0.2/$sender_address_domain
   accept
index 2f844b5f019513dfd0fb436ffd3fd1b89fd40298..5327de987a3356dc352aace506875863bd60d668 100644 (file)
@@ -41,9 +41,9 @@ check_mail:
   warn    dnslists = rbl4.test.ex&0.0.0.6
   warn    dnslists = rbl4.test.ex&127.0.0.3
   warn    dnslists = rbl4.test.ex!&0.0.0.7
   warn    dnslists = rbl4.test.ex&0.0.0.6
   warn    dnslists = rbl4.test.ex&127.0.0.3
   warn    dnslists = rbl4.test.ex!&0.0.0.7
-          add_header = DNSlist: $dnslist_domain $dnslist_text
+          add_header = DNSlist: $dnslist_domain $dnslist_text $dnslist_matched
   warn    dnslists = rbl5.test.ex,rbl4.test.ex=127.0.0.128
   warn    dnslists = rbl5.test.ex,rbl4.test.ex=127.0.0.128
-          add_header = DNSlist: $dnslist_domain $dnslist_text
+          add_header = DNSlist: $dnslist_domain $dnslist_text $dnslist_matched
   accept
 
 check_recipient:
   accept
 
 check_recipient:
index f527841d2abfc2fe5e9b63934c5f173737f2e454..cf8d04bff37ba7e04ac879d99e01ac1308d98647 100644 (file)
@@ -7,8 +7,8 @@ Received: from [V4NET.11.12.22] (ident=CALLER)
        (envelope-from <postmaster@exim.test.ex>)
        id 10HmaX-0005vi-00
        for userx@exim.test.ex; Tue, 2 Mar 1999 09:44:33 +0000
        (envelope-from <postmaster@exim.test.ex>)
        id 10HmaX-0005vi-00
        for userx@exim.test.ex; Tue, 2 Mar 1999 09:44:33 +0000
-DNSlist: rbl4.test.ex This is a test blacklisting4 message
-DNSlist: rbl5.test.ex This is a test blacklisting5 message
+DNSlist: rbl4.test.ex This is a test blacklisting4 message V4NET.11.12.22
+DNSlist: rbl5.test.ex This is a test blacklisting5 message V4NET.11.12.22
 
 test data
 
 
 test data
 
index 42ebd686d9fc93a3153105967d6c0f58313e0db4..00e8d2645f245da33a9c374139eff943f909e216 100644 (file)
@@ -205,8 +205,8 @@ LOG: H=[V4NET.11.12.15] F=<postmaster@exim.test.ex> rejected RCPT <userx@exim.te
 >>> using result of previous DNS lookup
 >>> DNS lookup for 20.12.11.V4NET.rbl4.test.ex succeeded (yielding 127.0.0.6)
 >>> => that means V4NET.11.12.20 is listed at rbl4.test.ex
 >>> using result of previous DNS lookup
 >>> DNS lookup for 20.12.11.V4NET.rbl4.test.ex succeeded (yielding 127.0.0.6)
 >>> => that means V4NET.11.12.20 is listed at rbl4.test.ex
->>> check add_header = DNSlist: $dnslist_domain $dnslist_text
->>>                  = DNSlist: rbl4.test.ex 
+>>> check add_header = DNSlist: $dnslist_domain $dnslist_text $dnslist_matched
+>>>                  = DNSlist: rbl4.test.ex  V4NET.11.12.20
 >>> warn: condition test succeeded
 >>> processing "warn"
 >>> check dnslists = rbl5.test.ex,rbl4.test.ex=127.0.0.128
 >>> warn: condition test succeeded
 >>> processing "warn"
 >>> check dnslists = rbl5.test.ex,rbl4.test.ex=127.0.0.128
index 266184af0a6406216504cbf784c90a3e45dab721..74ef7a0f6a62436d3ee5d037427ef96dbf23a01e 100644 (file)
 250 OK\r
 550-domain=test.ex\r
 550-value=V4NET.0.0.1\r
 250 OK\r
 550-domain=test.ex\r
 550-value=V4NET.0.0.1\r
+550-matched=ten-1\r
 550 text=""\r
 250 Reset OK\r
 250 OK\r
 550 text=""\r
 250 Reset OK\r
 250 OK\r
 250 OK\r
 550-domain=test.ex\r
 550-value=127.0.0.2\r
 250 OK\r
 550-domain=test.ex\r
 550-value=127.0.0.2\r
+550-matched=13.12.11.V4NET.rbl\r
 550 text="This is a test blacklisting message"\r
 221 myhost.test.ex closing connection\r
 
 550 text="This is a test blacklisting message"\r
 221 myhost.test.ex closing connection\r