Re: [Exim] RE: [exiscanusers] Condition for Exiscan?

Pàgina inicial
Delete this message
Reply to this message
Autor: Tore Anderson
Data:  
A: Jan Johansson
CC: exiscanusers, exim-users
Assumpte: Re: [Exim] RE: [exiscanusers] Condition for Exiscan?
* Tore Anderson

> >No. One mail may very well have several recipients.


* Jan Johansson

> Granted. Didn't think that far. Any possible way to handle this for
> exiscan?


Sort-of. The way we handle it here is to check all recipients'
preference wrt. handling of spam individually, and construct a
string with a list of actions to take. If the action `pass' exists
in the list, we pass the message (even though the other recipients
wanted to reject the message). I think that is the closest you'll
get to having true user-configurable actions.

The expansion involved goes something like this:

    exiscan_spamd_action = ${if match {${sg{$recipients}{([^, ]+)} \
    {\N${lookup {${local_part:$1}} lsearch {/etc/spamaction} \
    {$value}{pass} }\N}}} {pass} {pass}{reject}}


I'm using LDAP, so I've not tested that exact expression, but I
guess you'll see what is being done anyway.

You'll have to apply this patch to the Exim source tree (after
applying the exiscan patch) to make $recipients available:

--- exim-4.12/src/exiscan.c~    Sun Nov 10 16:35:41 2002
+++ exim-4.12/src/exiscan.c     Sun Nov 10 16:36:30 2002
@@ -44,6 +44,8 @@
 #define REGEX_HEADER "X-Regex-Match"
 #define EXISCAN_BANNER "exiscan for exim4 (http://duncanthrax.net/exiscan/)"


+extern BOOL    enable_dollar_recipients;
+
 // extra global variables
 uschar return_message[1024];  // the return message to exim
 uschar msg_subject[512];  // the message's subject (if we find one)
@@ -246,8 +248,13 @@
 // returns: 0 - go on with checks
 //          1 - abort checks, return retvalue to exim


-int exiscan_do_action(uschar *facility, uschar *action, int *retvalue) {
+int exiscan_do_action(uschar *facility, uschar *action_string, int *retvalue) {
uschar *actionptr;
+ uschar *action;
+
+ enable_dollar_recipients = TRUE;
+ action = expand_string(action_string);
+ enable_dollar_recipients = FALSE;

// if action is NULL, we must do the default action for the facility
// av -> reject


HTH! Oh and happy new year to all readers. :-)

--
Tore Anderson