Re: [Exim] net-lsearch not available in expansion lookups?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: exim-users
Tárgy: Re: [Exim] net-lsearch not available in expansion lookups?
On Sat, 17 Apr 2004, Tore Anderson wrote:

> Well, the key I'm looking up with is explicit, what I'm looking for is
> not. To clarify:
>
>     $ echo 1.2.3.0/24 > /tmp/foo
>     $ exim -be '${lookup {1.2.3.4} lsearch {/tmp/foo}  {found}{not found}}'
>     not found

>
> As I understand it, "lsearch" provides only exact string matching, while
> "net-lsearch", similar to the "hosts" ACL statement, understand network
> declarations and would have returned "found" above, if I could've used it
> instead of "lsearch" in some way during string +expansion.


No, I'm afraid you have misunderstood. ALL that net-lsearch does is, in
a host list, is to use the IP address of the host instead of the host
name. The search is still an exact string match search.

> As "net-lsearch" obviously isn't what I'm looking for, is there any other
> way to check if a specific IP address is found in a given host list when
> expanding a string?


Not straightforwardly. You can, of course, do multiple probes of an
lsearch (or any other single-key lookup type) file for all the different
network sizes you have. I realize that this isn't nice if you use more
than one or two.

> It is of course possible for me to make my relayhosts file a long list
> of IP addresses instead of a list of network declarations, and then use
> "lsearch", but in my case that would make the file contain well over
> 25000 entries instead of 10-15 - which is exactly what I wanted to avoid.


You could, of course, write a script that turns your 10-15 entries into
the 25000 entries, and then turn that into a cdb file. That would give
you the best performance.

I suppose what is needed is something like "wildlsearch", which I
eventually implemented (after resisting it for some time, because it is
not the same as the other single-key lookups). The new thing would do
exactly what you want. Better not call it "netlsearch" because that
would confuse; perhaps cidrlsearch?

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book