Re: [exim] problem to concate variable with text

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Phil Pennock
Dátum:  
Címzett: Костырев Александр Алексеевич
CC: exim-users
Tárgy: Re: [exim] problem to concate variable with text
On 2012-11-14 at 16:49 +1100, Костырев Александр Алексеевич wrote:
> >>> check set acl_m55 = ${lookup mysql{SELECT src_domain FROM EXIM.whitelist_domains WHERE src_domain='${lc:$sender_address_domain}'}{$value}{0}}
> >>>                   = rt.ru

>
> now I'd like to use it with regex to block some hosts
> just like this:
>
> exim -be '${if match{mailer.smart.ru}{\N\.rt.ru$\N}{1}}' #<-- yields nothing and this is what I want
>
> but without using regex it yeilds 1:
> exim -be '${if match{mailer.smart.ru}{rt.ru}{1}}'
> 1


Right, "smart.ru" matches "rt.ru" after the "sma".

Perhaps:
${if match{$sender_host_name}{\N(?:^|\.)\N${sg{$acl_m55}{\N\.\N}{\N\\.\N}}\N$\N}}
is what you want?

It used to be that match_domain gave you what you wanted, but this
proved to be too vulnerable to insecure configurations being created, so
we stopped expanding the right-hand-side. :-(

The above ${sg...} assumes that the results of the database lookup can
only match legitimate Internet domain-names, so the "." is the only
regexp special character that can occur.

> Is it possible to achieve this kind of behavior with something like this (not working as I want - yields nothing):
> warn       condition    = ${if match{$$sender_host_name}{\N\.$acl_m55$\N}{1}}


The $sender_host_name should not have $$ doubled, you're causing an
expansion failure there.

Is the above what you wanted, or have I misunderstood?

Regards,
-Phil