From 467c84b2115a098caeaf044fcd4d2473f236edb6 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Thu, 11 Jul 2019 23:35:20 +0100 Subject: [PATCH] Router variables: local visibiliity --- src/src/route.c | 5 +++++ test/confs/0620 | 6 ++++-- test/mail/0620.b | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/src/route.c b/src/src/route.c index 0817a4eda..416effd41 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -1436,6 +1436,8 @@ for (uschar * ele; (ele = string_nextinlist(&varlist, &sep, NULL, 0)); ) return FAIL; name += 2; + while (isspace(*assignment)) assignment++; + if (!(val = expand_string(US assignment))) if (f.expand_string_forcedfail) { @@ -1475,6 +1477,9 @@ for (uschar * ele; (ele = string_nextinlist(&varlist, &sep, NULL, 0)); ) } node->data.ptr = US val; DEBUG(D_route) debug_printf("set r_%s = '%s'\n", name, val); + + /* All expansions after this point need visibility of that variable */ + router_var = *root; } return OK; } diff --git a/test/confs/0620 b/test/confs/0620 index 61f577417..15e31f1c5 100644 --- a/test/confs/0620 +++ b/test/confs/0620 @@ -23,7 +23,9 @@ alias: driver = redirect debug_print = DEBUG: $r_r1 $r_r2 data = b - set = <; r_r1 = $local_part aaa:bbb bar=baz + set = <; r_r1 = <$local_part> aaa:bbb bar=baz + set = r_local = check + errors_to = bad_$r_local user: driver = accept @@ -43,7 +45,7 @@ local_delivery: file = DIR/test-mail/$local_part user = CALLER debug_print = DEBUG: $r_r1 $r_r2 - headers_add = X-r1: $r_r1\nX-r2: $r_r2 + headers_add = X-r1: <$r_r1>\nX-r2: <$r_r2> # End diff --git a/test/mail/0620.b b/test/mail/0620.b index a30deb558..5840bc90a 100644 --- a/test/mail/0620.b +++ b/test/mail/0620.b @@ -1,4 +1,4 @@ -From CALLER@test.ex Tue Mar 02 09:44:33 1999 +From bad_check@test.ex Tue Mar 02 09:44:33 1999 Envelope-to: a@test.ex Received: from CALLER by the.local.host.name with local (Exim x.yz) (envelope-from ) @@ -7,7 +7,7 @@ Received: from CALLER by the.local.host.name with local (Exim x.yz) Message-Id: From: CALLER_NAME Date: Tue, 2 Mar 1999 09:44:33 +0000 -X-r1: b -X-r2: b 2a00:1940:100::ff:0:1 foo=bar +X-r1: +X-r2: -- 2.30.2