Mailing List Archive

run{} string builder buggy?
Exim: 4.96 Fedorabuild

Hi,

I have this acl condition in use for years and it worked, but nowadays
it seems to fail:

  deny
    ...
    set acl_m9  = ${run{/usr/share/doc/perl-Mail-SPF/bin/spfquery $acl_m9}}
    condition   = ${if eq{$runrc}{1}{true}{false}}

for debugging I added

  warn log_message = "SPF TEST für --scope mfrom --id $sender_address
--ip $sender_host_address
  warn set acl_m9  = --scope mfrom --id $sender_address --ip
$sender_host_address
           set acl_m9  =
${run{/usr/share/doc/perl-Mail-SPF/bin/spfquery $acl_m9}}
           log_message = returncode {$runrc}

which gives us:

 Warning: "SPF TEST f\303\274r --scope mfrom --id X --ip Y
 Warning: returncode {255}

Wenn i run the resulting command in bash as exim I get:

# echo $?
1

which is the expected code for a spf fail, but in exim it is 255 because
of this:

 /usr/share/doc/perl-Mail-SPF/bin/spfquery "--scope mfrom --id X --ip Y"

instead of :

 /usr/share/doc/perl-Mail-SPF/bin/spfquery --scope mfrom --id X --ip Y

changing the config from:

  warn set acl_m9  = --scope mfrom --id $sender_address --ip
$sender_host_address
           set acl_m9  =
${run{/usr/share/doc/perl-Mail-SPF/bin/spfquery $acl_m9}}

to

  warn set acl_m9  = ${run{/usr/share/doc/perl-Mail-SPF/bin/spfquery
--scope mfrom --id '$sender_address' --ip '$sender_host_address'}}

Solved it.

The thought here is: Why was $acl_m9 escaped as it was inserted into
itself and i.e. $sender_address was not, when it was used in a string?








best regards,
Marius
Re: run{} string builder buggy? [ In reply to ]
On 14/11/2022 12:31, Cyborg via Exim-users wrote:
> The thought here is: Why was $acl_m9 escaped as it was inserted into itself and i.e. $sender_address was not, when it was used in a string?

https://exim.org/exim-html-current/doc/html/spec_html/ch-string_expansions.html#vi184

"If the option preexpand is not used, the command string is split into individual arguments by spaces and then each argument is expanded. Then the command is run"
--
Cheers,
Jeremy


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/