Re: [exim] problem to concate variable with text

Top Page
Delete this message
Reply to this message
Author: Костырев Александр Алексеевич
Date:  
To: exim-users
Subject: Re: [exim] problem to concate variable with text
Thank you very much for your help and support!
It was exactly what I was looking for.


--
С уважением,
Костырев Александр
системный администратор


-----Original Message-----
From: exim-users-bounces+a.kostyrev=serverc.ru@??? [mailto:exim-users-bounces+a.kostyrev=serverc.ru@exim.org] On Behalf Of Phil Pennock
Sent: Wednesday, November 14, 2012 6:09 PM
To: Костырев Александр Алексеевич
Cc: exim-users@???
Subject: 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

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/