This patch adds some default values so that SpamAssassin-only users of amavisd-new do not have to add any new configuration options. Hopefully, amavisd-new with this patch will behave as amavisd-new 2.4.1. 1. @load_spamscanners defaults to SpamAssassin now. Everybody who uses only SpamAssassin does not have to add this command to the config file. 2. "@load_spamscanners = ()" has the same effect as "@bypass_spam_checks_maps = (1);" 3. If a recipient has no explicitely specified spam scanner (in "$spamscanner_tables"), the default scanner is used. The default scanner is the first scanner in @load_spamscanners. --- original/amavisd 2006-05-21 12:23:13.000000000 +0200 +++ modified/amavisd 2006-05-22 22:04:39.000000000 +0200 @@ -640,6 +640,8 @@ $sa_debug = undef; $sa_timeout = 30; # timeout in seconds for a call to SpamAssassin +@load_spamscanners = ( 'SpamAssassin' ); + $file = 'file'; # path to the file(1) utility for classifying contents # provide names for content categories - to be used only for logging, @@ -9298,9 +9300,12 @@ ${$ref} = 1; } +sub noSpamscannersLoaded() { + return scalar(@{ca('load_spamscanners')}) < 1; +} my($bpscm) = ca('bypass_spam_checks_maps'); -if (@$bpscm && !ref($bpscm->[0]) && $bpscm->[0]) { +if ((@$bpscm && !ref($bpscm->[0]) && $bpscm->[0]) or noSpamscannersLoaded()) { # do a simple-minded test to make it easy to turn off spam checks $extra_code_antispam = undef; $extra_code_antispam_dspam = undef; @@ -14475,7 +14480,7 @@ # called at startup, before chroot and before main fork sub init_pre_chroot() { - if (! $Amavis::extra_code_antispam) { + if (not $Amavis::extra_code_antispam) { do_log(0, "SpamControl: antispam code not loaded, no spam scanning"); %spamscanners = undef; } else { @@ -14529,7 +14534,10 @@ $spamscanner = setScannerIfNotSet($name, $spamscanner); } if (not defined $spamscanner) { # fall back to default scanner! - $spamscanner = "SpamAssassin"; # TODO: make default scanner configurable + # The first scanner in the list "load_spamscanners" is considered to be + # the default scanner. This scanner is used for all users which do not + # have an explicit entry in "spamscanner_tables". + $spamscanner = ${ca('load_spamscanners')}[0]; } return $spamscanner; }