Re: [Exim] $recipients in a system filter doesn't seem to wo…

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: support-reply-kai
CC: exim-users
Subject: Re: [Exim] $recipients in a system filter doesn't seem to work?!
On Tue, 9 May 2000, Kai Henningsen wrote:

> # exim filter
>
> if $received_protocol is not "scanmails" and first_delivery
> then
>    if "$sender_address" is "" then
>       pipe "/usr/sbin/scanmails -oMr scanmails -f '<>' -bm $recipients"
>    else
>       pipe "/usr/sbin/scanmails -oMr scanmails -f $sender_address -bm $recipients"
>    endif
> endif

>
> Here's the debug output:


> shell pipe command before expansion:
> /usr/sbin/scanmails -oMr scanmails -f $sender_address -bm $recipients
> address_pipe transport returned FAIL
> post-process |/usr/sbin/scanmails -oMr scanmails -f $sender_address -bm $recipients
> LOG: 0 MAIN
> ** |/usr/sbin/scanmails -oMr scanmails -f $sender_address -bm $recipients

<message filter> T=address_pipe: Expansion of command
"/usr/sbin/scanmails -oMr scanmails -f $sender_address -bm $recipients"
in address_pipe transport failed: unknown variable name "recipients"

The problem is that $recipients is available only in the system filter,
but the "pipe" command does not expand its argument in the filter. It
saves it up and expands it later when it is about to run the pipe.

You must have set use_shell in your address_pipe transport. It turns out
that I have overlooked that case. When use_shell is false (the default),
each argument is expanded separately, and there is special code to allow
for $recipients when the pipe came from a system filter. I obviously
must have forgetten about use_shell (not surprising, I don't recommend
it!) because the special checking for $recipients is missing in that
case.

I have made a note to fix this in due course. Meanwhile, if you turn off
use_shell it should work - but then $recipients will be all one argument
instead of many. (However, if it did work, you could have problems with
recipients that contain shell metacharacters.)





-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.