Re: [exim] Problem with nested forany and spurious lookups

Top Page
Delete this message
Reply to this message
Author: Jeremy Harris
Date:  
To: exim users
Subject: Re: [exim] Problem with nested forany and spurious lookups
On 16/12/17 00:13, Robert Bannocks via Exim-users wrote:
> I an trying to write a route to override routing on the basis of a combination of [envelope] to address, [envelope] from address, and host that is forwarding the email to the exim server. I have found that when you nest forany loops spurious lookup are done. To simplify I have taken the standard exim config file and added at the top of the routers secition a line:
>
>
>
> .include /usr/local/etc/exim.conf.new-router
>
>
>
> in /usr/local/etc/exim.conf.new-router is the following router
>
>
>
> OVERRIDEDEFAULTDOMAIN=$qualify_domain
>
> OVERRIDELOOKUPORDEFAULTRESULT=${if eq{$value}{}{exim@OVERRIDEDEFAULTDOMAIN}{$value}}
>
> OVERRIDEROUTERFILE=/usr/local/etc/sender-recipient-override.txt-manual
>
> OVERRIDEHOSTNAMEFORM=test.host.net
>
> OVERRIDELOOKUP=${lookup{${item}}lsearch{OVERRIDEROUTERFILE}{LOOKUPORDEFAULTRESULT}}
>
> OVERRIDEBOOLLOOKUP=bool_lax{OVERRIDELOOKUP}
>
> OVERRIDETOFOR=${if forany{ C,${item} : D,${item} }{OVERRIDEBOOLLOOKUP}{$value}}
>
> OVERRIDETOBOOLFOR=bool_lax{OVERRIDETOFOR}
>
> OVERRIDEFROMFOR=${if forany{ A@${item} : B@${item} }{OVERRIDETOBOOLFOR}}
>
> OVERRIDEFROMBOOLFOR=bool_lax{OVERRIDEFROMFOR}
>
> OVERIDEHOSTFOR=${if forany{OVERRIDEHOSTNAMEFORM : SECONDHOSTNAMEPERHAPSWILDCARD }{OVERRIDEFROMBOOLFOR}}
>
> override_sender:
>
>         driver  = redirect

>
>         data = OVERIDEHOSTFOR

>
> repeat_use = false
>
>
>
> When I test the routing extra lookups seem to occour:
>
> /usr/local/bin/exim -d+all -bt robert@??? 2>2
>
>
>
> grepping for lookups gives:
>
>
>
> grep 'type=lsearch key=' 2
>
>
>
> 23:57:05 35137 type=lsearch key="C,"
>
> 23:57:05 35137 type=lsearch key="D,"
>

[...]
> I cannot see where the first, second, seventh, eigth, thirteenth and fourteenth lookups come from.


Let's just take the first.

23:57:05 35137 /considering: ${if forany{test.host.net :
SECONDHOSTNAMEPERHAPSWILDCARD }{bool_lax{${if forany{ A@${item} :
B@${item} }{bool_lax{${if forany{ C,${item} : D,${item}
}{bool_lax{${lookup{${item}}lsearch{/usr/local/etc/sender-recipient-override.txt-manual}{LOOKUPORDEFAULTRESULT}}}}{$value}}}}}}}}

After macro expansion, the router is dealing with that. Given the
CAPITAL LETTERS in it, I suspect you have macro problems which need
sorting out before you get to worrying over lookups.

Start with the rules on macros.
--
Cheers,
Jeremy