Re: [Exim] Condition to match against address list

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Philip Hazel
Fecha:  
A: Brian Candler
Cc: exim-users
Asunto: Re: [Exim] Condition to match against address list
On Wed, 17 Jul 2002, Brian Candler wrote:

> This may be a stupid question, but I can't work it out.


Hello Brian,

Seems a reasonable question to me...

> Is it possible to match an address against an address list (or a hostname
> against a domain list) as part of a condition?
>
> What I want to do is:
>
> smtp_accept_max_per_host = ${if <condition> {val1}{val2}}
>
> where <condition> is 'if $sender_host_address matches address list X'. This
> is more flexible than a ${lookup{$mask{...}} since the address list can
> contain networks of different sizes.


(Just to be clear: I use "address list" to mean "email address list".
A list of IP addresses is a special case of a "host list". Terminology
is always tricky...)

I'm afraid the answer is no, but I've added this idea to the Wish List.
It would be a bit tricky for host lists, because you'd need to pass both
the IP address and the host name, since a host list might require either
or both of them. Consider things like

  ${if matchhostlist {$sender_host_name}{$sender_host_address}\
                     {a.b.c:*.e.f:1.2.3.4:...}...


The problem here is that Exim may not have looked up the host name. When
it's processing a host list, the identity of the host is implicit, so it
knows to find the name from $sender_host_address if it needs it.


For the moment, the only possibility is "mask", as you say. If your list
is inline and consists of IP networks, the different is only syntactic
sugar:

  ${if or
       {
       {eq {${mask:$sender_host_address/24}}{1.2.3.0/24}}
       {eq {${mask:$sender_host_address/16}}{1.2.0.0/16}}
       ...
       }
    ...


Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.