[Exim] Router Preconditions

Top Page
Delete this message
Reply to this message
Author: Marc Perkel
Date:  
To: exim-users, ph10
Subject: [Exim] Router Preconditions
Here's what I need to do. I need to test if a file exists and is it does
exist I need to user it as part of a senders statement.

bounce_spam_personal:
driver = redirect
allow_defer
allow_fail
data = :fail: "unknown user \"$local_part\" in domain \"$domain\""
require_files =
${lookup{$local_part}lsearch{/etc/vmail/passwd.$domain}{${extract{5}{:}{$value}}/.bouncelist}}
retry_use_local_part
senders =
${lookup{$local_part}lsearch{/etc/vmail/passwd.$domain}{${extract{5}{:}{$value}}/.bouncelist}}

Originally something like this work in Exim 3. Now it doesn't and the
reason - as I understand it is that senders executes first and fails
because the file isn't there. require-files - or condition with exists -
would also fail because senders is run first. But - I need to test if
the file exists before senders runs.

Suggestion:

Right now senders runs - fails to open the file - and the router
immediately fails because of the missing file. This kicks in to a
"defer" and it logs the error as file missing. I suggest a different
behavior for missing files.

One solution is to merely set a flag that the file is missing and
evaluate the other conditions,. In this case the require_files would
make it jump to the next router. After the rest is evaluated then you
come back at the end and if that missing file issue is still pending
then you error out and deffer. Errors could be chained together in a
linked list in case of multiple missing files.

Second Solution:

A new command "skip_on_missing_file = on" so that if the router fails to
stat() a file then the router skips rather than defer. That eliminated
the need to test for files and makes it so that the existance of
nesessary files becomes the condition for running the router. This would
be a very very useful feature and would greatly simplify my work.