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

Pàgina inicial
Delete this message
Reply to this message
Autor: Tore Anderson
Data:  
A: exim-users
Assumpte: Re: [Exim] net-lsearch not available in expansion lookups?
* Philip Hazel

> net-lsearch is a fudge for host lists where the key that is to be
> looked up is implicit. It says "use the IP address as the implicit
> key instead of the host name". This is for use in constructions such
> as
>
> hosts = net-lsearch;/some/file


Right.

> What you are doing here is a normal lookup, where the key is
> explicit - namely, $sender_host_address. So just use "lsearch".


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.

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.

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?

--
Tore Anderson