From: Philip Hazel Date: Fri, 12 Nov 2004 15:03:40 +0000 (+0000) Subject: (a) Allow an empty sender to be matched against a lookup in an address list. X-Git-Tag: exim-4_50~105 X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=commitdiff_plain;h=90af77f47744f5fe03bd887a1a4bae9ca175afd9 (a) Allow an empty sender to be matched against a lookup in an address list. Previously the only cases considered were a regular expression, or an empty pattern. (b) Fixed typo in the FAQ ("prefix" should have been "local_part_prefix"). --- diff --git a/doc/doc-src/FAQ.src b/doc/doc-src/FAQ.src index a90f03586..3d5c1a444 100644 --- a/doc/doc-src/FAQ.src +++ b/doc/doc-src/FAQ.src @@ -1,4 +1,4 @@ -## $Cambridge: exim/doc/doc-src/FAQ.src,v 1.4 2004/11/12 14:42:04 nm4 Exp $ +## $Cambridge: exim/doc/doc-src/FAQ.src,v 1.5 2004/11/12 15:03:40 ph10 Exp $ ## ## This file is processed by Perl scripts to produce an ASCII and an HTML ## version. Lines starting with ## are omitted. The markup used with paragraphs @@ -2756,7 +2756,7 @@ A0413: Setting \skip_syntax_errors\ on the redirect router causes syntax driver = accept check_local_user transport = local_delivery - prefix = real- + local_part_prefix = real- before the \%redirect%\ router that handles \(.forward)\ files. This will do an ordinary local delivery without \(.forward)\ processing, if the diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 3b001000c..dba38e56f 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.26 2004/11/12 12:01:52 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.27 2004/11/12 15:03:40 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -104,6 +104,15 @@ Exim version 4.44 28. Installed the latest version of exipick from John Jetmore. +29. In an address list, if the pattern was not a regular expression, an empty + subject address (from a bounce message) matched only if the pattern was an + empty string. Non-empty patterns were not even tested. This was the wrong + because it is perfectly reasonable to use an empty address as part of a + database query. An empty address is now tested by patterns that are + lookups. However, all the other forms of pattern expect the subject to + contain a local part and a domain, and therefore, for them, an empty + address still always fails if the pattern is not itself empty. + Exim version 4.43 ----------------- diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS index 91a0cf066..e6af9f53e 100644 --- a/src/ACKNOWLEDGMENTS +++ b/src/ACKNOWLEDGMENTS @@ -1,4 +1,4 @@ -$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.4 2004/11/10 14:15:20 ph10 Exp $ +$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.5 2004/11/12 15:03:40 ph10 Exp $ EXIM ACKNOWLEDGEMENTS @@ -90,8 +90,9 @@ John Dalbec Patch for quota_warn_threshold bug Vivek Dasmohapatra Suggested patch for CRL support Andrew Doran Patch for NetBSD configuration files Patch for ifreq alignment and size problems -Michael Deutschman Suggested patch for treating bind() failure like connect() +Michael Deutschmann Suggested patch for treating bind() failure like connect() Patch for $sender_data and $recipient_data + Suggested patch for null address match lookup bug Oliver Eikemeier Patch to skip Received: if expansion is empty Patch for "eqi" Nico Erfurth Fix for bug in ${readfile} diff --git a/src/src/match.c b/src/src/match.c index 9d2a1c0bd..eb54f232a 100644 --- a/src/src/match.c +++ b/src/src/match.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/match.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */ +/* $Cambridge: exim/src/src/match.c,v 1.2 2004/11/12 15:03:40 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -932,32 +932,24 @@ error = error; /* Keep clever compilers from complaining */ DEBUG(D_lists) debug_printf("address match: subject=%s pattern=%s\n", subject, pattern); -/* Handle a regular expression, which must match the entire incoming address. */ +/* Handle a regular expression, which must match the entire incoming address. +This may be the empty address. */ if (*pattern == '^') return match_check_string(subject, pattern, cb->expand_setup, TRUE, cb->caseless, FALSE, NULL); -/* If the subject is the empty string, the only pattern it can match (other -than a regular expression) is the empty pattern. */ - -if (*subject == 0) return (*pattern == 0)? OK : FAIL; - -/* Find the domain in the subject */ - -sdomain = Ustrrchr(subject, '@'); - -/* Handle the case of a pattern that is just a lookup. Skip over possible -lookup names (letters, digits, hyphens). Skip over a possible * or *@ at -the end. Then we must have a semicolon for it to be a lookup. */ +/* Handle a pattern that is just a lookup. Skip over possible lookup names +(letters, digits, hyphens). Skip over a possible * or *@ at the end. Then we +must have a semicolon for it to be a lookup. */ for (s = pattern; isalnum(*s) || *s == '-'; s++); if (*s == '*') s++; if (*s == '@') s++; -/* If it is a straight lookup, do a lookup for the whole address. Partial -matching doesn't make sense here, so we ignore it, but write a panic log entry. -However, *@ matching will be honoured. */ +/* If it is a straight lookup, do a lookup for the whole address. This may be +the empty address. Partial matching doesn't make sense here, so we ignore it, +but write a panic log entry. However, *@ matching will be honoured. */ if (*s == ';') { @@ -968,6 +960,16 @@ if (*s == ';') valueptr); } +/* For the remaining cases, an empty subject matches only an empty pattern, +because other patterns expect to have a local part and a domain to match +against. */ + +if (*subject == 0) return (*pattern == 0)? OK : FAIL; + +/* Find the subject's domain */ + +sdomain = Ustrrchr(subject, '@'); + /* If the pattern starts with "@@" we have a split lookup, where the domain is looked up to obtain a list of local parts. If the subject's local part is just "*" (called from retry) the match always fails. */