On Wed, 17 Jan 2007, paul.mcilfatrick@??? wrote:
> discard condition = ${if match
> {${lc:$mime_filename}} {[.] *(gif|jpg|jpeg|png|bmp)\$}}
> set acl_m2 = $1
> !sender_domains = +ok_domains
> logwrite = External e-mail from
> '$sender_address' with invalid attached file type ($acl_m2)
> '$mime_filename' - discard!
>
>
> No value is printed for $acl_m2 in the logwrite.
>
>
> I presume that if $1 contains a value then the 'set acl_m2' would copy
> it into the acl_m2 variable.
>
> So if nothing is being printed in the logwrite then this would mean that
> the $1 is being unset after a string expansion?
OK, OK, I'll do a real test instead of just eyeballing the code. Maybe
my first statement that they are reset after the expansion is true after
all, or maybe they are getting reset after each ACL condition and I
missed seeing that. But it will be a while before I can do a test.
Oh, just had another thought, ... I've a vague memory that all the
numerical variables are saved and restored over an ${if item so that you
can nest them in a reasonable way. I bet that's it... ah yes, here's the
documentation paragraph that is part of the ${if description:
At the start of an if expansion the values of the numeric variable
substitutions $1 etc. are remembered. Obeying a match condition that
succeeds causes them to be reset to the substrings of that condition
and they will have these values during the expansion of the success
string. At the end of the if expansion, the previous values are
restored. After testing a combination of conditions using or, the
subsequent values of the numeric variables are those of the
condition that succeeded.
So I don't need to do a test after all.
--
Philip Hazel University of Cambridge Computing Service
Get the Exim 4 book: http://www.uit.co.uk/exim-book