From eba0c039a556478f50aa1e4839684027746197f7 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 15 Nov 2005 09:44:33 +0000 Subject: [PATCH 1/1] Discard the values of the numeric variables after a wildlsearch lookup. --- doc/doc-txt/ChangeLog | 6 +++++- src/src/lookups/lsearch.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 3693efbc1..050fa034b 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.260 2005/11/14 16:09:54 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.261 2005/11/15 09:44:33 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -122,6 +122,10 @@ PH/11 Added "${if def:sender_address {(envelope-from <$sender_address>)\n\t}}" PH/12 Added log selector acl_warn_skipped (default on). +PH/13 After a successful wildlsearch lookup, discard the values of numeric + variables because (a) they are in the wrong storage pool and (b) even if + they were copied, it wouldn't work properly because of the caching. + Exim version 4.54 ----------------- diff --git a/src/src/lookups/lsearch.c b/src/src/lookups/lsearch.c index c5e75dfdd..1acfd7494 100644 --- a/src/src/lookups/lsearch.c +++ b/src/src/lookups/lsearch.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/lookups/lsearch.c,v 1.4 2005/06/27 14:29:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/lsearch.c,v 1.5 2005/11/15 09:44:33 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -197,7 +197,16 @@ for (last_was_eol = TRUE; if (rc == FAIL) continue; if (rc == DEFER) return DEFER; } - break; /* Key matched */ + + /* The key has matched. If the search involved a regular expression, it + might have caused numerical variables to be set. However, their values will + be in the wrong storage pool for external use. Copying them to the standard + pool is not feasible because of the caching of lookup results - a repeated + lookup will not match the regular expression again. Therefore, we flatten + all numeric variables at this point. */ + + expand_nmax = -1; + break; /* Compare an ip address against a list of network/ip addresses. We have to allow for the "*" case specially. */ -- 2.30.2