Re: [Exim] regexp, match, start of string (^) weirdness

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Nico Erfurth
Date:  
À: Christian Balzer
CC: exim-users
Sujet: Re: [Exim] regexp, match, start of string (^) weirdness
Christian Balzer wrote:
> Hello,
>
> I'm stumped, confused and utterly sure there is a very simple explanation
> for this which will make me look quite silly, but that's OK as long as
> I stop wasting time figuring it out. ;)
>
> I'm trying to move the bogus/spam sign helo traps from the central
> filter to the new acl_smtp_helo, based on the example by William Thompson
> from the start of this month.
>
> 2 sample lines from the ACL, I copied William's one match verbatim to
> make sure I'm not seeing pink elephants:
> ---
> {match{lc:$sender_helo_name}{\N^gol.com$\N}}\

         ^^^^^^^^^^^^^^^^^^^^^^^
         Check your syntax.

> {match{lc:$sender_helo_name}{\N^\[?\d+\.\d+\.\d+\.\d+\]?$\N}}\

         ^^^^^^^^^^^^^^^^^^^^^^
          same here


>
> If I feed a helo of "gol.com" or "[33.33.33.33]" (w/o the double quotes of
> course) to that ACL respectively, it does NOT match. However if I remove
> the "^" it does, but of course matches more than I want it to.
> So where is my error here, it shouldn't need any further escaping asides
> from \N, does $sender_helo_name have some extra characters at the start?
> It obviously has nothing extraneous at the end.


because what you currently do is
{match{lc:gol.com}{\N^gol.com$\N}}
        ^^^^^^^^^^^This is just a simple string


what you really want is
{match{${lc:$sender_helo_name}}{\N^gol.com$\N}}
        ^^                    ^
        See the difference :)


Next time, use exim -be for testing, or exim -d+expand for more infos.

Nico