Re: [EXIM] $1 $2 expansions in filters

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Nick Waterman
CC: exim-users
Subject: Re: [EXIM] $1 $2 expansions in filters
On Tue, 27 Jan 1998, Nick Waterman wrote:

> Testing a filter file...
>
> # Exim Filter file - see documentation.
>
> if ($local_part_suffix matches "^-test-(.*)-(.*)" ) then
>    save "$home/tmp/test-1$1-2$2"
>    pipe "$home/tmp/foo 1$1 2$2"
> else
> [etc etc]

>
> now if I mail nick-test-foo-bar-baz, I find that...
>
> $home/nick/tmp/test-1foo-bar-2baz is created as expected
>
> $home/tmp/foo is run, but with arguments "1" and "2". The $1 and $2
> expansion variables have vanished.
>
> Is this a deliberate security thing to stop me accidentally running
> strange commands I wasn't expecting to run, or is it one of those
> unintentional "features" ? :-)


Both! It's unintentional, and a timing error. For pipes, the expansion
of the string is done at delivery time, using the code in the pipe
transport to split the string up into arguments, and then expand each
argument (as normally happens in the pipe transport). Unfortunately, $1
and $2 have long since been lost. Damn.

I will have to think about that one. Can't at the moment see any easy
fix. Sorry.

-- 
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714



--
*** Exim information can be found at http://www.exim.org/ ***