[exim] match_domain and named list with query style lookup

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Jakob Hirsch
Fecha:  
A: 'Exim-users'
Temas nuevos: [exim] Patch to fix fclose() errors?
Asunto: [exim] match_domain and named list with query style lookup
Hi,

according to the spec, match_domain can be used with named domain lists,
like "${if match_domain{$domain}{+local_domains}{..."
But what happens, if the named list has a query style lookup, like

> domainlist virtual_domains = mysql;SELECT name FROM domain WHERE name='${quote_mysql:$domain}'


This should always work, as the spec also says: "... , whenever a domain
list is being scanned, $domain contains the subject domain."

So I have this in my ehlo ACL:

> accept
>     condition = ${if !eq {$interface_address}{$sender_host_address}}
>     condition = ${if match_domain {$sender_helo_name}{+virtual_domains}}
>     set ACL_C_HELO = $sender_helo_name is _my_ domain


When testing, it looks good:

> # exim -d+expand -bh 10.0.1.1

...
> ehlo example.com

...
> expanding: $sender_helo_name
>    result: example.com
> expanding: +virtual_domains
>    result: +virtual_domains
> expanding: $domain
>    result: example.com
> expanding: mysql;SELECT name FROM domain WHERE name='${quote_mysql:$domain}'
>    result: mysql;SELECT name FROM domain WHERE name='example.com'

...

Everything ok here. But look here:

> # exim -d+expand+acl -be

...
>> ${if match_domain {example.com}{+virtual_domains}}
> expanding: example.com
>    result: example.com
> expanding: +virtual_domains
>    result: +virtual_domains
> expanding: $domain
>    result:
> expanding: mysql;SELECT name FROM domain WHERE name='${quote_mysql:$domain}'
>    result: mysql;SELECT name FROM domain WHERE name=''

...
As you can see, $domain is empty, so the lookup gets no result.

The same happens when running as a daemon:

> # exim -d+expand+acl -bd

...
> 29691 SMTP<< ehlo example.com

...
> 29691 expanding: $sender_helo_name
> 29691    result: example.com
> 29691 expanding: +virtual_domains
> 29691    result: +virtual_domains
> 29691 expanding: $domain
> 29691    result:


So now I'm wondering: Is it me getting crazy, or is Exim really doing
strange things here? (Sorry, I'm too tired and lazy right now to look
into the code... maybe tomorrow.)