[Mimedefang] Filter_relay, global variable help

Dan Tulovsky dtulovsky at sbigroup.com
Mon Nov 3 13:59:45 EST 2003


I am hoping this is something very easy.  I would like to use the
filter_relay sub to check if the connection is coming from a local
network.  If it is, I would like to set a variable that will be visible
in filter_end, which is where I do the spamassassin check.  That way I
can skip the check from local networks.

I tried defining a variable $IsLocal at the top of mimedefang-filter
outside of all subs and then setting it inside filter_relay if the
network is local.  I then check this variable in filter_end.  I am not,
though getting the expected results.  

I have something like (among everything else)


$IsLocal = 0;

Sub filter_relay($$$) {

--- much skipped ----

if (($addr & $mask) eq $network) {
                # mail is local (going out - don't scan for SPAM)
                $IsLocal = 1;
                return ('CONTINUE', 'ok');


Sub filter_end($) {

    # don't spam check local stuff
    if ($IsLocal == 1) {
       action_add_header("X-Spam-Status", "Skipped, internal relay:
       return action_accept();
       $IsLocal = 0;


Any pointers much appreciated.

Thank you,

More information about the MIMEDefang mailing list