Re: [EXIM] lsearch ${lookup in filter file?

Top Page
Delete this message
Reply to this message
Author: Dan Birchall
Date:  
To: exim-users
Subject: Re: [EXIM] lsearch ${lookup in filter file?
Philip Hazel wrote:

> > if ${lookup{$local_part@$domain:foo}lsearch{/etc/bar}{$value}} is "baz"
> > then freeze endif
> >
> > Over in /etc/bar, I have:
> >
> > djb@???: foo=baz
>
> Can't see anything wrong at first sight. Try inserting a testprint
> command and running the filter testing stuff.


Okie... hmm. Tried it. If I comment out the if-then-freeze
bit, I can get it to do the testprint:

Testing Exim filter file /usr/exim/lists/filters
Condition is false: error_message
Condition is false: $header_from: is "root"
At the end of filtering "delivered" is false
Testprint: to djb@???
Testprint: baz

But the if-then-freeze is really the crux of the matter.
When I use the -bf bit, I get "Filter error: unavailable
filtering command "freeze" near line 11 of filter file" whether
I'm on as me, or as root. I'm guessing that just means I can't
use "freeze" in testing, since it doesn't interfere with the
delivery of mail.

Unfortunately, its non-interference with mail delivery includes
letting through stuff that I don't logically want it to -
namely, messages to the addresses I've told it (for testing
purposes) to freeze everything to...

Any more thoughts?

--- filter file ---

# Exim filter <- Do not edit or remove this line!

if error_message then finish endif
if $header_from: is "root" then finish endif

testprint "to $local_part@$domain"
testprint ${lookup{$local_part@$domain:foo}lsearch{/etc/bar}{$value}}

if ${lookup{$local_part@$domain:foo}lsearch{/etc/bar}{$value}} is "baz"
then freeze endif

--- /etc/bar/ ---

djb: foo=baz
djb@???: foo=baz
djb@???: foo=baz
root@???: foo=baz

---

-Dan

--
Dan Birchall - Internet Sysadmin - 16 Straight Communications
Your source for great graphic design, web design and hosting.
http://www.16straight.com - 609.231.7887 - djb@???
AntiSpam. Populus Iamdudam Defutatus Est - Spam Delenda Est!

--
*** Exim information can be found at http://www.exim.org/ ***