[Mimedefang] Bug at SA website: SA 3.3.1 - Is "local.cf" read in TWICE when loading configuration files?
Kevin A. McGrail
KMcGrail at PCCC.com
Tue Aug 10 15:25:17 EDT 2010
> As noted, spam_assassin_check() is the ONLY call I make to SA, and only in filter_end().
>
> I've taken a look at the subroutines in mimedefang.pl, and I note that in spam_assassin_init() a reference to "config" which selects a configuration file. Although I don't select one explicitly, the routine may suggest that it picks one to load -- one that may already be loaded by SA itself, so the "user_prefs" parameter may not be needed.
>
> I experimented with setting an empty configuration, spam_assassin_check(""), and that worked. Apparently, leaving the default allowed mimedefang.pl to pick a file that SA was already loading. ARGH!
>
> The lines 6749-6759 in spam_assassin_init(), where it picks a configuration file if none was passed, are the problem. The choices in the "/etc/mail/spamassassin/" directory are ALREADY LOADED by SA. Perhaps they should be deleted?
>
> I conclude that MD is at fault in causing a file to be loaded twice.
> I also have my fix: Explicitly pass "" as the configuration parameter to spam_assassin_check(), such that "user_prefs" => "" to the ..._init() call.
>
Copying the same information I put on Bugzilla for SA:
Hmm. I think you are on the right track that it's not SA but I also don't
think it is MD, per se.
I think the key point you have to realize is that SA isn't loading anything
prior. MD is instead calling SA through an API at least by default since I
actually use MD to interact with SA through spamd/spamc.
Anyway, it sounds like to me you've got multiple cf files that are being read
such as sa-mimedefang.cf in /etc/mail, local.cf in /etc/mail/spamassassin and
perhaps a user_prefs file somewhere perhaps under a local defang user.
I'd grep the following:
cd /etc/mail
grep report *.cf
cd /etc/mail/spamassassin
grep report *.cf
and check the home dir for whatever user is calling spamassassin.
Though to be more specific, I think you've got more than one cf file with
report variables specified in one of these directories.
Especially since SA will load EVERY config (.cf) file on purpose in
/etc/mail/spamassassin.
So if you have a report line in these cf files like
"/etc/mail/sa-mimedefang.cf"& "/etc/mail/spamassassin.cf" as well as in
local.cf, you could end up with duplicates.
Since you can fix your issue by passing "" to MD's spam_assassin_init is a
"defined" config variable, you then activate this code which is why I state the
examples outside of /etc/mail/spamassassin above:
if (!defined($config)) {
if (-r "/etc/mail/sa-mimedefang.cf") {
$config = "/etc/mail/sa-mimedefang.cf";
} elsif (-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";
}
}
Regards,
KAM
More information about the MIMEDefang
mailing list