Re: [exim] Match_address matches domain - should it?

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Dean Brooks
Fecha:  
A: exim-users
Asunto: Re: [exim] Match_address matches domain - should it?
On Mon, Oct 01, 2012 at 06:07:22PM +0100, John Horne wrote:
> Using exim 4.80 it seems that the 'match_address' condition will match
> against just the domain part if necessary:
>
> ============================
> exim -be '${if match_address{jh@???}{foo.abc.com}{true}{false}}'
> true
> ============================
>
> My understanding was that match_address would match against the whole
> address, not just the domain part.
> As expected, the match_domain condition fails unless the domain part of
> the address is used.
>
> My question is whether match_address is supposed to match against only
> the domain or should it be checking against just the whole address?
>
> The manual does not mention that only the domain may match.


It is correct behavior, and is documented though perhaps not as explicitly
for this exact combination.

>From spec.txt, section 11.7 underneath the definition of match_local_part:


    This condition, together with match_address and match_domain, make it
    possible to test domain, address, and local part lists within expansions.
    Each condition requires two arguments: an item and a list to match.


    ...


    In each case, the second argument may contain any of the allowable items
    for a list of the appropriate type. Also, because the second argument
    (after expansion) is a standard form of list, it is possible to refer to a
    named list. ...


The idea is that match_address may contain any of the allowable items
for an "address list". Address lists, defined in section 10.19, can
contain full addresses, domains, etc. There are a number of examples
of what can be included in 10.19.

If you really need to match an address exactly but are concerned about
the allowable formats in an address list, you could use either an
exact comparison or perhaps a regex match:

${if eqi{${address:jh@???}}{jh@???}{true}{false}}

${if match{${address:jh@???}}{\N^jh@???$\N}{true}{false}}

If you are pulling an address out of a From: or other header, be sure
to use the ${address:XXX} tag, as shown above, to strip the email
address out of RFC2822 address format.

Hope this helps.

--
Dean Brooks
dean@???