[exim] Condition problem

Top Page
Delete this message
Reply to this message
Author: Christian Hertel
Date:  
To: exim-users
Subject: [exim] Condition problem

Hello all!

I'd like to configure exim to use an external mailfilter to scan incoming
mails, so I wrote the following router:


--- snip ---

##
## mailfilter incoming
##
mailfilter_incoming_director:
  driver = manualroute
  domains = +forward_domains
  condition = "${if and { \
                          { !eq {$received_protocol}{mailfilter} } \
                          { eq
{${lookup{$local_part@$domain}lsearch{/etc/exim4/whitelisted-recipients}}}{}
} \
                        } {yes}{no}}"
  transport = mailfilter_incoming
  route_list = "* localhost byname"
  verify = false


--- snap ---


The file /etc/exim4/whitelisted-recipients looks similar to the following:


--- snip ---

user1@???
user2@???
user3@???

--- snap ---


Now if I run exim in debug mode with batched SMTP (exim4 -d -bS) and send a
mail to test@???, debugging shows the following lines:

---
checking "condition"
search_open: lsearch "/etc/exim4/whitelisted-recipients"
search_find: file="/etc/exim4/whitelisted-recipients"
key="test@???" partial=-1 affix=NULL starflags=0
LRU list:
:/etc/exim4/whitelisted-recipients
:/etc/exim4/forward-domains
End
internal_search_find: file="/etc/exim4/whitelisted-recipients"
type=lsearch key="test@???"
file lookup required for test@???
in /etc/exim4/whitelisted-recipients
lookup failed
calling mailfilter_incoming_director router
---

Ok so long, but if I do it again with user1@???, debbugging always
looks like that:

---
checking "condition"
search_open: lsearch "/etc/exim4/whitelisted-recipients"
search_find: file="/etc/exim4/whitelisted-recipients"
key="mueller.u@???" partial=-1 affix=NULL starflags=0
LRU list:
:/etc/exim4/whitelisted-recipients
:/etc/exim4/forward-domains
End
internal_search_find: file="/etc/exim4/whitelisted-recipients"
type=lsearch key="user1@???"
file lookup required for user1@???
in /etc/exim4/whitelisted-recipients
lookup yielded:
calling mailfilter_incoming_director router
---


So it always calls the mailfilter director no matter if the recipient's
address is listed in my whitelist.
What is wrong with that condition? I think the line should read "lookup
yieled: user1@???", so the lookup result is expanded and can be
compared in my condition. Perhaps someone knows a better way how to
configure the router to do what it is intended to do.

Any help is greatly appreciated.


Cheers,

--
Christian Hertel
Netzwerk-Sicherheit/Netzwerk-Applikationen

infoServe GmbH
Nell-Breuning-Allee 6
D-66115 Saarbruecken

T: (0681) 8 80 08 - 59
F: (0681) 8 80 08 - 33
www.infos.de
mailto: c.hertel@???

Handelsregister: Amtsgericht Saarbrücken, HRB 11001
Erfüllungsort: Saarbrücken
Geschäftsführer: Dr. Werner Stein
Ust-IdNr.: DE168970599