[Mimedefang] MIMEDefang 2.43 does not use my SpamAssassin prefs file

Jeff Rife mimedefang at nabs.net
Wed Jun 23 11:49:28 EDT 2004


In mimedefang-filter, I have:

#####################################################################
# The next lines force SpamAssassin modules to be loaded and rules
# to be compiled immediately.  This may improve performance on busy
# mail servers.  Comment the lines out if you don't like them.
if ($Features{"SpamAssassin"})
  {
  spam_assassin_init("/etc/mail/spamassassin/site-prefs")->compile_now(1) if defined(spam_assassin_init());

  # If you want to use auto-whitelisting:
  if (defined($SASpamTester))
    {
    use Mail::SpamAssassin::DBBasedAddrList;
    my $awl = Mail::SpamAssassin::DBBasedAddrList->new();
    $SASpamTester->set_persistent_address_list_factory($awl) if defined($awl);
    }
  }
#####################################################################

The only change from the shipping version is the parameter to 
spam_assassin_init, which tells it to use my own user-prefs file.  When I 
got a message today with an incorrect score for a rule that was in the 
prefs file, I investigated by changing mimedefang.pl by adding a logging 
line to spam_assassin_init:

#####################################################################
sub spam_assassin_init (;$) {

    unless ($Features{"SpamAssassin"}) {
        md_syslog('err', "$MsgID: Attempt to call SpamAssassin function, but SpamAssassin is not installed.");
        return undef;
    }

    if (!defined($SASpamTester)) {
        my $config = shift;
        unless ($config)
        {
            if (-r "/etc/mail/spamassassin/sa-mimedefang.cf") {
                $config = "/etc/mail/spamassassin/sa-mimedefang.cf";
            } elsif (-r "/etc/mail/spamassassin/local.cf") {
                $config = "/etc/mail/spamassassin/local.cf";
            } else {
                $config = "/etc/mail/spamassassin.cf";
            }
        }

### Added logging line
        md_syslog('notice',"User-prefs files set to $config");

        $SASpamTester = Mail::SpamAssassin->new({
            local_tests_only   => $SALocalTestsOnly,
            dont_copy_prefs    => 1,
            userprefs_filename => $config});
    }

    return $SASpamTester;
}
#####################################################################

Here are the lines this generates in the log file:

#####################################################################
Jun 23 11:33:51 HOSTNAME mimedefang-multiplexor[29252]: started; minSlaves=2, maxSlaves=10, maxRequests=500, maxIdleTime=300, busyTimeout=120, clientTimeout=10
Jun 23 11:33:53 HOSTNAME mimedefang.pl[29252]: User-prefs files set to /etc/mail/spamassassin.cf
Jun 23 11:33:57 HOSTNAME mimedefang.pl[29252]: Initialized embedded Perl interpreter
Jun 23 11:33:57 HOSTNAME mimedefang.pl[29252]: Starting slave 0 (pid 29271) (1 running): Bringing slaves up to minSlaves (2)
Jun 23 11:33:57 HOSTNAME mimedefang[29265]: Multiplexor alive - entering main loop
Jun 23 11:34:00 HOSTNAME mimedefang.pl[29252]: Starting slave 1 (pid 29273) (2 running): Bringing slaves up to minSlaves (2)
#####################################################################

As far as I can tell, the "unless ($config)" is always returning false, 
which means that $config is uninitialized for some reason.  I'm not a 
Perl guru, so I couldn't figure out why.  The limit of my guesses was 
changing the "" around the filename to '', and that didn't help.


--
Jeff Rife        |  
SPAM bait:       | 
http://www.nabs.net/Cartoons/Dilbert/MoneyToConsultants.gif 
AskDOJ at usdoj.gov |  
uce at ftc.gov      |  




More information about the MIMEDefang mailing list