From 93655c46a6d1c1931c50fe6e17fd711578d4f07e Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Thu, 14 Jun 2007 14:18:19 +0000 Subject: [PATCH] Added $dnslist_matched. --- doc/doc-txt/ChangeLog | 4 +++- doc/doc-txt/NewStuff | 21 +++++++++++++++++++-- src/ACKNOWLEDGMENTS | 5 +++-- src/src/expand.c | 3 ++- src/src/globals.c | 3 ++- src/src/globals.h | 3 ++- src/src/verify.c | 4 +++- test/confs/0023 | 1 + test/confs/0139 | 4 ++-- test/mail/0139.userx | 4 ++-- test/stderr/0139 | 4 ++-- test/stdout/0023 | 2 ++ 12 files changed, 43 insertions(+), 15 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 099f5e0ea..6a8e4d1e1 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -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 ------------------------------------------- @@ -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/04 Added the $dnslist_matched variable. + Exim version 4.67 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 3de7f6366..a63027364 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -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 -------------------- @@ -14,6 +14,23 @@ Version 4.68 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 ------------ @@ -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" - 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 diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS index 899c346b0..3eb64b9aa 100644 --- a/src/ACKNOWLEDGMENTS +++ b/src/ACKNOWLEDGMENTS @@ -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 @@ -20,7 +20,7 @@ relatively small patches. Philip Hazel Lists created: 20 November 2002 -Last updated: 13 March 2007 +Last updated: 14 June 2007 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 +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 diff --git a/src/src/expand.c b/src/src/expand.c index 1fdb93218..abff94996 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -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 * @@ -414,6 +414,7 @@ static var_entry var_table[] = { { "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 }, diff --git a/src/src/globals.c b/src/src/globals.c index 83c37b09e..7b14f7b93 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -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 * @@ -521,6 +521,7 @@ uschar *dns_ipv4_lookup = 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; diff --git a/src/src/globals.h b/src/src/globals.h index e8bcdec88..ce43922c0 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -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 * @@ -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 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 */ diff --git a/src/src/verify.c b/src/src/verify.c index 23f63d803..4b4044507 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -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 * @@ -3031,6 +3031,7 @@ while ((domain = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL 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); } @@ -3065,6 +3066,7 @@ while ((domain = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL 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; diff --git a/test/confs/0023 b/test/confs/0023 index 17c88ff6a..4f79a87b5 100644 --- a/test/confs/0023 +++ b/test/confs/0023 @@ -156,6 +156,7 @@ acl_29_29_29: 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 diff --git a/test/confs/0139 b/test/confs/0139 index 2f844b5f0..5327de987 100644 --- a/test/confs/0139 +++ b/test/confs/0139 @@ -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 - 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 - add_header = DNSlist: $dnslist_domain $dnslist_text + add_header = DNSlist: $dnslist_domain $dnslist_text $dnslist_matched accept check_recipient: diff --git a/test/mail/0139.userx b/test/mail/0139.userx index f527841d2..cf8d04bff 100644 --- a/test/mail/0139.userx +++ b/test/mail/0139.userx @@ -7,8 +7,8 @@ Received: from [V4NET.11.12.22] (ident=CALLER) (envelope-from ) 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 diff --git a/test/stderr/0139 b/test/stderr/0139 index 42ebd686d..00e8d2645 100644 --- a/test/stderr/0139 +++ b/test/stderr/0139 @@ -205,8 +205,8 @@ LOG: H=[V4NET.11.12.15] F= rejected RCPT >> 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 diff --git a/test/stdout/0023 b/test/stdout/0023 index 266184af0..74ef7a0f6 100644 --- a/test/stdout/0023 +++ b/test/stdout/0023 @@ -322,6 +322,7 @@ 250 OK 550-domain=test.ex 550-value=V4NET.0.0.1 +550-matched=ten-1 550 text="" 250 Reset OK 250 OK @@ -330,6 +331,7 @@ 250 OK 550-domain=test.ex 550-value=127.0.0.2 +550-matched=13.12.11.V4NET.rbl 550 text="This is a test blacklisting message" 221 myhost.test.ex closing connection -- 2.25.1