From: Philip Hazel Date: Mon, 4 Dec 2006 15:00:19 +0000 (+0000) Subject: Give an error for the use of * and *@ with a query-style lookup. X-Git-Tag: exim-4_64~13 X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=commitdiff_plain;h=d78371933afdcbdb420e40a2855b548a4673dc3d Give an error for the use of * and *@ with a query-style lookup. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 2629276fe..f429b15d8 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.439 2006/11/20 14:29:31 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.440 2006/12/04 15:00:19 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -334,6 +334,10 @@ PH/48 When a host name was looked up from an IP address, and the subsequent forward lookup of the name timed out, the host name was left in $sender_host_name, contrary to the specification. +PH/49 Although default lookup types such as lsearch* or cdb*@ have always been + restricted to single-key lookups, Exim was not diagnosing an error if + * or *@ was used with a query-style lookup. + Exim version 4.63 ----------------- diff --git a/src/src/search.c b/src/src/search.c index 364cb3cb7..3dac52eaf 100644 --- a/src/src/search.c +++ b/src/src/search.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/search.c,v 1.3 2006/02/07 11:19:00 ph10 Exp $ */ +/* $Cambridge: exim/src/src/search.c,v 1.4 2006/12/04 15:00:20 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -184,18 +184,26 @@ else if (len >= 1 && ss[len-1] == '*') } /* Check for the individual search type. Only those that are actually in the -binary are valid. For query-style types, "partial" is an error. */ +binary are valid. For query-style types, "partial" and default types are +erroneous. */ stype = search_findtype(ss, len); -if (pv >= 0 && mac_islookup(stype, lookup_querystyle)) +if (stype >= 0 && mac_islookup(stype, lookup_querystyle)) { - search_error_message = string_sprintf("\"partial\" is not permitted " - "for lookup type \"%s\"", ss); - return -1; + if (pv >= 0) + { + search_error_message = string_sprintf("\"partial\" is not permitted " + "for lookup type \"%s\"", ss); + return -1; + } + if ((*starflags & (SEARCH_STAR|SEARCH_STARAT)) != 0) + { + search_error_message = string_sprintf("defaults using \"*\" or \"*@\" are " + "not permitted for lookup type \"%s\"", ss); + return -1; + } } -/* All is well; pass back the partial type and return the lookup type. */ - *ptypeptr = pv; return stype; } diff --git a/test/scripts/3200-testdb/3200 b/test/scripts/3200-testdb/3200 index cd02ab5bc..f5b12972d 100644 --- a/test/scripts/3200-testdb/3200 +++ b/test/scripts/3200-testdb/3200 @@ -1,6 +1,11 @@ # testdb lookups - +1 exim -be match_ip: 12 ${if match_ip{10.11.12.13}{testdb;something}} match_ip: 13 ${if match_ip{10.11.12.13}{testdb;fail}} +match_domain: 14 ${if match_domain{a.b.c.d}{testdb*;fail}} +bad default: ${lookup testdb*{abcd}} +bad default: ${lookup testdb*@{abcd}} +bad default: ${lookup testdb*{fail}} +bad default: ${lookup testdb*@{fail}} **** diff --git a/test/stderr/3200 b/test/stderr/3200 new file mode 100644 index 000000000..2f416adf5 --- /dev/null +++ b/test/stderr/3200 @@ -0,0 +1 @@ +1999-03-02 09:44:33 defaults using "*" or "*@" are not permitted for lookup type "testdb*" diff --git a/test/stdout/3200 b/test/stdout/3200 index 8c3398326..04ff51884 100644 --- a/test/stdout/3200 +++ b/test/stdout/3200 @@ -1,3 +1,3 @@ > match_ip: 12 true > match_ip: 13 -> +> \ No newline at end of file