git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0da41dc
)
Fix ${run } arg parsing
author
Jeremy Harris
<jgh146exb@wizmail.org>
Sat, 3 Dec 2022 23:13:53 +0000
(23:13 +0000)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Sun, 4 Dec 2022 00:07:55 +0000
(
00:07
+0000)
Broken-by: cfe6acff2ddc
doc/doc-txt/ChangeLog
patch
|
blob
|
history
src/src/expand.c
patch
|
blob
|
history
src/src/transport.c
patch
|
blob
|
history
test/scripts/0000-Basic/0002
patch
|
blob
|
history
test/stdout/0002
patch
|
blob
|
history
diff --git
a/doc/doc-txt/ChangeLog
b/doc/doc-txt/ChangeLog
index 5f2cff6f5a1f7150aadc8e89d8c3cbdad7792fcc..5ac91dc998334622ccb8a03cd652a2ab28601fc5 100644
(file)
--- a/
doc/doc-txt/ChangeLog
+++ b/
doc/doc-txt/ChangeLog
@@
-62,6
+62,10
@@
JH/14 Bug 2933: Fix regex substring match variables for null matches. Since 4.96
occurrences) could cause a segfault if the corresponding $<n> was
expanded.
occurrences) could cause a segfault if the corresponding $<n> was
expanded.
+JH/15 Fix argument parsing for ${run } expansion. Previously, when an argument
+ included a close-brace character (eg. it itself used an expansion) an
+ error occurred.
+
Exim version 4.96
-----------------
Exim version 4.96
-----------------
diff --git
a/src/src/expand.c
b/src/src/expand.c
index 57ad76f777c46d90a36406c493a172a6ba0f1097..7bb2e42740a3f4ddb3baec7a1b77a7625ca4c0e1 100644
(file)
--- a/
src/src/expand.c
+++ b/
src/src/expand.c
@@
-5614,7
+5614,7
@@
while (*s)
const uschar * arg, ** argv;
BOOL late_expand = TRUE;
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;
{
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 */
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
{
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;
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 d04ea516a5c4e3bc59366ed619393cf2160c0385..d6cedf91171eea5a1f93ecd880a9c6ee9ba912cb 100644
(file)
--- a/
src/src/transport.c
+++ b/
src/src/transport.c
@@
-2190,6
+2190,8
@@
if (expand_arguments)
for (int i = 0; argv[i]; i++)
{
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 &&
/* Handle special fudge for passing an address list */
if (addr &&
@@
-2364,7
+2366,7
@@
if (expand_arguments)
return FALSE;
}
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)
&& Ustrcmp(etext, "queryprogram router") == 0)
{ /* hack, would be good to not need it */
DEBUG(D_transport)
diff --git
a/test/scripts/0000-Basic/0002
b/test/scripts/0000-Basic/0002
index 1efcb2adc4af1f2fdc010eb11bc24973298002db..5ddc9b678f878e89528047dbb86c7ebcf8cca721 100644
(file)
--- a/
test/scripts/0000-Basic/0002
+++ b/
test/scripts/0000-Basic/0002
@@
-808,6
+808,8
@@
${if eq{1}{2}{${run{/non/exist}}}{1!=2}}
rc=$runrc
${run,preexpand {DIR/aux-fixed/0002.runfile 0}}
rc=$runrc
rc=$runrc
${run,preexpand {DIR/aux-fixed/0002.runfile 0}}
rc=$runrc
+${run{DIR/aux-fixed/0002.runfile ${quote:1}}{$value}{2}}
+rc=$runrc
# PRVS
# PRVS
diff --git
a/test/stdout/0002
b/test/stdout/0002
index 835d00528d9e43242d9987b7b1bf57a7bdd44ab9..d7e76e6c4be47ccd90fba5387e737af8ed269d96 100644
(file)
--- a/
test/stdout/0002
+++ b/
test/stdout/0002
@@
-783,6
+783,8
@@
xyz
1234
> rc=0
1234
> rc=0
+> 2
+> rc=1
>
> # PRVS
>
>
> # PRVS
>