Re: [Exim] Possible bug in regular expression matching with …

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Andreas Metzler
Fecha:  
A: exim-users
Asunto: Re: [Exim] Possible bug in regular expression matching with ${eval:..}
On 2004-03-04 Ralf Ertzinger <ralf@???> wrote:
[...]
>           set acl_m1    = ${if match{$local_part}{^usenet-\N(\d{4})(\d{2})\N}\
>                             {${eval:($1*12)+$2}}{0}}

[...]
> This works fine. Most of the time.


> The strange bug is that it does work as long as the month is not 08 or 09.
> Example:

[...]
> 2004-03-04 16:04:50 H=[xxx.xxx.xxx.xxx] F=<ralf@???> temporarily
> rejected RCPT <usenet-20020904@???>: failed to expand ACL string
> "${if match{$local_part}{^usenet-\N(\d{4})(\d{2})\N}{${eval:($1*12)+$2}}{0}}":
> error in expression evaluation: expecting + or - (after processing "(2002*12)+0")


> So it seems exim fails to expand $2 for some strange reason. This
> just happens if $2 ought to be 08 or 09 (19, for example, works
> fine).


Stripped down example shows that regex is not involved:
:~> /usr/sbin/exim4 -be '${eval:07}'
7
:~> /usr/sbin/exim4 -be '${eval:08}'
Failed: error in expression evaluation: expecting + or - (after
processing "0")

... and documentation says:
| This item supports simple arithmetic in expansion strings. [...]
| Numbers may be decimal, octal (starting with `0') or hexadecimal


So exim interprets 08 as octal and realizes it is invalid.

You have to strip the leading zero before $eval.
              cu andreas
--
"See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf,
fuhggvat qbja gur juveyvat tha.
Neal Stephenson in "Snow Crash"