On Tue, 10 Aug 1999, Bernard Stern wrote:
> And a customer-networks file which looks like this:
>
> xxx.xxx.0.0/16
> yyy.yyy.yyy.0/24
> zzz.zzz.0.0/16
[snip]
> if (${lookup{$sender_host_name}partial-lsearch{/home/exim/cfg/customer-domains}{yes}{no}} is "yes")
> or (${lookup{$sender_host_address}lsearch{/home/exim/cfg/customer-networks}{yes}{no}} is "yes")
> then
> The first sub-condition works perfectly, but never the second.
Remember, all this lookup stuff is purely textual. It doesn't know that
$sender_host_address is actually an IP address.
In the second condition, you are using $sender_host_address as the key.
This is the actual address of the sending host, e.g. 10.9.8.7. You are
doing an exact lookup for the host, not a masked network match.
Masked network lookups of the type you want are available only in host
lists (section 7.16) , not in general string lookups. Maybe they should
be, but that's a different point...
It would be possible to create such a thing using a regular expression.
For example, instead of $sender_host_address, you would have
${if match {$sender_host_address}{^(\\d+\\.\\d\\.)}{$1.0.0/16}fail}
to do a /16 lookup, and another similar thing for a /24 lookup.
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.