Re: [exim] Capture matched value of match_ip

Pàgina inicial
Delete this message
Reply to this message
Autor: Tony Finch
Data:  
A: Craig Jackson
CC: exim-users
Assumpte: Re: [exim] Capture matched value of match_ip
On Sat, 16 Feb 2008, Craig Jackson wrote:
>
> I am trying to capture the value that matches the given IP address in
> match_ip operator, for instance,


Your example used the wrong syntax - it was missing an if.

  set acl_m1QQ = \
    ${if match_ip{$sender_host_address} \
                 {${sg {${lookup mysql{TAG_BADNETWRKS} }} \
                       {\n}{:} }} \
         {$0} {0} }


> I've read the documentation for match_ip and there's no mention of
> capturing the value.


That's correct.

I can think of a couple of ways of doing what you want. The first is to do
the matching in the SQL query so that the whole result of the query is the
network that matches - but this assumes that MySQL has the necessary
features, and I don't know if it does. The second is to use a non-SQL
lookup, in which case you can write something like:

  warn
    hosts = lsearch;/etc/exim/badnets
    set acl_m1QQ = $host_data


The table has to have doubled entries, because the host is matched against
the left-hand part and the right-hand part is set to $host_data.

127.0.0.0/8: 127.0.0.0/8

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}