summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2021-01-29 19:54:02 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2021-01-29 19:54:02 +0000
commit2a57e7407905349ba3bdc6358333f4c120be136f (patch)
tree60fadd9c8b94572bc20cb2d2473b257361b1185d
parentd2e88d0371ae8f8eebd23f56684e65f1146fcb90 (diff)
downloadexim4-2a57e7407905349ba3bdc6358333f4c120be136f.tar.gz
Lookups: fix $local_part_data for a match on a filename list element. Bug 2691
(cherry picked from commit 0c70e694cf1a703798c0778a3236079e1b25c91d)
-rw-r--r--doc/doc-txt/ChangeLog4
-rw-r--r--src/src/match.c5
-rw-r--r--test/confs/013415
-rw-r--r--test/log/01343
-rw-r--r--test/scripts/0000-Basic/01344
5 files changed, 31 insertions, 0 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index d5a98071b..b7e310f04 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -138,6 +138,10 @@ JH/36 Bug 2687: Fix interpretation of multiple ^ chars in a plaintext
documentation. There is still no way to get a leading ^ immediately
after a NUL (ie. for the password of a PLAIN method authenticator.
+JH/39 Bug 2691: fix $local_part_data. When the matching list element
+ referred to a file, bad data was returned. This likely also affected
+ $domain_part_data.
+
Exim version 4.94
-----------------
diff --git a/src/src/match.c b/src/src/match.c
index 53cd22353..dfb4b5148 100644
--- a/src/src/match.c
+++ b/src/src/match.c
@@ -850,6 +850,11 @@ while ((sss = string_nextinlist(&list, &sep, NULL, 0)))
(void)fclose(f);
HDEBUG(D_lists) debug_printf("%s %s (matched \"%s\" in %s)\n", ot,
yield == OK ? "yes" : "no", sss, filename);
+
+ /* The "pattern" being matched came from the file; we use a stack-local.
+ Copy it to allocated memory now we know it matched. */
+
+ if (valueptr) *valueptr = string_copy(ss);
return file_yield;
case DEFER:
diff --git a/test/confs/0134 b/test/confs/0134
index 9530df652..3376f05f3 100644
--- a/test/confs/0134
+++ b/test/confs/0134
@@ -45,6 +45,14 @@ smartuser:
retry_use_local_part
transport = appendfile
+smartuser_direct:
+ driver = accept
+ domains = test.ex
+ headers_add = "smartuser: dd=$domain_data lpd=$local_part_data"
+ local_parts = DIR/aux-fixed/TESTNUM.listL
+ retry_use_local_part
+ transport = directfile
+
default2:
driver = accept
headers_add = router: defaulted
@@ -71,6 +79,13 @@ appendfile:
${if eq {$local_part}{userx}{lc-userx}{\
$local_part}}}}}}
+directfile:
+ driver = appendfile
+ user = CALLER
+ headers_add = "domain_data: $domain_data\n\
+ local_part_data: $local_part_data"
+ file = DIR/test-mail/directfile
+
pipe:
driver = pipe
command = /bin/sh -c "echo $local_part $domain >DIR/test-mail/$local_part"
diff --git a/test/log/0134 b/test/log/0134
index 1d4707f39..956558fa6 100644
--- a/test/log/0134
+++ b/test/log/0134
@@ -23,3 +23,6 @@
1999-03-02 09:44:33 10HmbE-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmbE-0005vi-00 => PIPE <PIPE@PIPE.DOMAIN> R=topipe T=pipe
1999-03-02 09:44:33 10HmbE-0005vi-00 Completed
+1999-03-02 09:44:33 10HmbF-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmbF-0005vi-00 => direct_file_user <direct_file_user@test.ex> R=smartuser_direct T=directfile
+1999-03-02 09:44:33 10HmbF-0005vi-00 Completed
diff --git a/test/scripts/0000-Basic/0134 b/test/scripts/0000-Basic/0134
index 76c1f8206..15f3b05b2 100644
--- a/test/scripts/0000-Basic/0134
+++ b/test/scripts/0000-Basic/0134
@@ -31,3 +31,7 @@ exim -odi PIPE@PIPE.DOMAIN
Test to uppercased piped address.
.
****
+exim -odi direct_file_user@test.ex
+Test use of filename in local_part list
+.
+****