Auteur: W B Hacker Date: À: exim users Sujet: Re: [exim] DBM Lookup Question
Marc Perkel wrote: > Trying to do a DBM lookup.
>
> condition =
> ${lookup{$domain}dbm{/etc/exim/control/run/alllocal.db}{yes}{no}}
>
> But - if example.com is in the file it will also match xxx.example.com
>
> How do I do a lookup where xxx.example.com won't match if example.com is
> in the file but will match if xxx.example.com is in the file.
>
> Thanks in advance.
>
>
Marc,
AFAIK the crux of it is that the Exim variable '$domain' actually
matches <domain>.<tld>, and parses for that, ignoring any and all
prefixes (unless otherwise directed - for which Exim DOES already have
tools).
I haven't looked at the code, but the action appears to be to take the
two fields from the 'rightmost' end of the string (only).
If a more specific match is what you seek, the simplest way may be to
dump the contents of $domain into an acl_c|acl_m variable, then do a
straight string match wherein the inherent <domain<.<tld> portion
slicing is no longer in effect.
Note that I am after a different goal than what you mention - going for
EITHER all-inclusive prefixes, (if any), OR ONLY the prefixed version -
and to have it all maintained in one place so it catches either a
careless network or a 'bot forging a distinctive HELO.
Note too that I do NOT want to trigger a DNS call, hence the use of a
plain string tool vs a 'hostlist' structure.
A CDB or cousin would be faster.
But ..
The flatfile is easier to maintain or eyeball, and ours are small enough
the efficiency loss is 'de minimus'.
For a multiple-server operation, I'd be inclined to maintain all the
lists in PostgreSQL, have it spit out and emplace 'fresh' CDB for Exim's
best speed AND avoidance of reliance on PostgreSQL being up and
available 24 X 7.