[exim] Extracting values from a wildlsearch

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Todd Lyons
Date:  
À: exim-users
Sujet: [exim] Extracting values from a wildlsearch
A guy came in to the #exim IRC channel today and asked what seemed
like a simple question, but I couldn't figure out a way to make it
work.

He has a file that's used for mapping domain names to a relay server.
For example:
# cat test.conf
domain.com:    192.168.1.8
todd.com:    192.168.1.10
blue.com:    192.168.1.40
row.com:    192.168.1.10


"Now I want to accept relay from IP addresses where I route manually,
I do not find a way to build a list of <IP> from the file, any hins?
(note the only way I found was to build a second file by extracting IP
with some shell scripts

So he wants to generate a hostlist of all IP's that he manually routes
to. I figured a simple wildlsearch regex search on the file for .*
would do exactly what he wanted, so I tested with:

hostlist test_hosts = ${lookup{^.*}wildlsearch{/etc/exim/test.conf}

But it doesn't work, it shows this when being processed in an acl:
>>> processing "warn"
>>> check hosts = +test_hosts
>>> ^.* in "domain.com"? no (end of list)
>>> ^.* in "todd.com"? no (end of list)
>>> ^.* in "blue.com"? no (end of list)
>>> ^.* in "row.com"? no (end of list)
>>> host in ""? no (end of list)
>>> host in "+test_hosts"? no (end of list)


I also tried {^\N.*\N} and a few other combinations which had the same
negative result.

Is there a way to do it the way he wants? Does he have to use
something other than wildlsearch? Or just a different regex? Or is
the only solution (without external scripts) going to be to slurp the
file in with readfile and transform it with sg?

...Todd
--
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. -- Martin Golding