summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2022-12-03 23:13:53 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2022-12-04 00:07:55 +0000
commit44b6e099b76f403a55e77650821f8a69e9d2682e (patch)
tree3602c491e296f08041849d5ecfe675e8bf0e3c0a /src
parent0da41dc541d0f2536f9d2afc7188e9dfb97b0c09 (diff)
downloadexim4-44b6e099b76f403a55e77650821f8a69e9d2682e.tar.gz
Fix ${run } arg parsing
Broken-by: cfe6acff2ddc
Diffstat (limited to 'src')
-rw-r--r--src/src/expand.c13
-rw-r--r--src/src/transport.c4
2 files changed, 13 insertions, 4 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index 57ad76f77..7bb2e4274 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -5614,7 +5614,7 @@ while (*s)
const uschar * arg, ** argv;
BOOL late_expand = TRUE;
- if ((expand_forbid & RDO_RUN) != 0)
+ if (expand_forbid & RDO_RUN)
{
expand_string_message = US"running a command is not permitted";
goto EXPAND_FAILED;
@@ -5645,13 +5645,20 @@ while (*s)
s++;
if (late_expand) /* this is the default case */
- { /*{*/
- int n = Ustrcspn(s, "}");
+ {
+ int n;
+ const uschar * t;
+ /* Locate the end of the args */
+ (void) expand_string_internal(s,
+ ESI_BRACE_ENDS | ESI_HONOR_DOLLAR | ESI_SKIPPING, &t, NULL, NULL);
+ n = t - s;
arg = flags & ESI_SKIPPING ? NULL : string_copyn(s, n);
s += n;
}
else
{
+ DEBUG(D_expand)
+ debug_printf_indent("args string for ${run} expand before split\n");
if (!(arg = expand_string_internal(s,
ESI_BRACE_ENDS | ESI_HONOR_DOLLAR | flags, &s, &resetok, NULL)))
goto EXPAND_FAILED;
diff --git a/src/src/transport.c b/src/src/transport.c
index d04ea516a..d6cedf911 100644
--- a/src/src/transport.c
+++ b/src/src/transport.c
@@ -2190,6 +2190,8 @@ if (expand_arguments)
for (int i = 0; argv[i]; i++)
{
+ DEBUG(D_expand) debug_printf_indent("arg %d\n", i);
+
/* Handle special fudge for passing an address list */
if (addr &&
@@ -2364,7 +2366,7 @@ if (expand_arguments)
return FALSE;
}
- if ( f.running_in_test_harness && is_tainted(expanded_arg)
+ if ( f.running_in_test_harness && is_tainted(expanded_arg)
&& Ustrcmp(etext, "queryprogram router") == 0)
{ /* hack, would be good to not need it */
DEBUG(D_transport)