diff options
author | Philip Hazel <ph10@hermes.cam.ac.uk> | 2004-11-12 15:03:40 +0000 |
---|---|---|
committer | Philip Hazel <ph10@hermes.cam.ac.uk> | 2004-11-12 15:03:40 +0000 |
commit | 90af77f47744f5fe03bd887a1a4bae9ca175afd9 (patch) | |
tree | cc9dad37b4ab62cb443f038eacc50e1e49a0c907 /src | |
parent | fcb4c2551d9188d885f7ba045b189a657ec56f0c (diff) |
(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").
Diffstat (limited to 'src')
-rw-r--r-- | src/ACKNOWLEDGMENTS | 5 | ||||
-rw-r--r-- | src/src/match.c | 36 |
2 files changed, 22 insertions, 19 deletions
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. */ |