Hi, sorry for taking a little bit longer. Attached is a patch against spampd which takes sure that it will get a nice and friendly environment and also sets a correct SA home for itself and his helpers.
Alex -- Alexander Wirt, [EMAIL PROTECTED] CC99 2DDD D39E 75B0 B0AA B25C D35B BC99 BC7D 020A
--- spampd 2005-10-31 20:45:53.000000000 +0100 +++ /tmp/spampd-2.30/spampd 2007-04-25 17:44:15.000000000 +0200 @@ -752,6 +752,7 @@ my $satimeout = 285; # SpamAssassin timeout in seconds (15s less than Postfix # default for smtp_data_done_timeout) my $pidfile = '/var/run/spampd.pid'; # write pid to file +my $configfile = undef; # file to read spampd specific config from my $user = 'mail'; # user to run as my $group = 'mail'; # group to run as my $tagall = 0; # mark-up all msgs with SA, not just spam @@ -772,6 +773,7 @@ relayhost => \$relayhost, relayport => \$relayport, pid => \$pidfile, + config => \$configfile, user => \$user, group => \$group, maxrequests => \$maxrequests, @@ -783,6 +785,7 @@ logsock => \$logsock, envelopeheaders => \$envelopeheaders, setenvelopefrom => \$setenvelopefrom, + homedir => \$homedir, ); usage(1) unless GetOptions(\%options, @@ -807,6 +810,8 @@ 'debug|d', 'help|h|?', 'local-only|l', + 'config|C=s', + 'homedir=s', 'log-rules-hit|rh', 'dose', 'add-sc-header|ash', # deprecated @@ -838,6 +843,13 @@ # my $min_spare_servers = ($children == $maxchildren) ? 0 : 1; # my $max_spare_servers = ($min_spare_servers == 0) ? 0 : $maxchildren-1; +#cleanup environment + +$ENV{'PATH'} = '/bin:/usr/bin:/sbin:/usr/sbin'; +delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV', 'HOME'}; + +my $home_dir = $options{'homedir'} || '/var/cache/spampd'; + my @tmp = split (/:/, $relayhost); $relayhost = $tmp[0]; if ( $tmp[1] ) { $relayport = $tmp[1]; } @@ -846,10 +858,23 @@ $host = $tmp[0]; if ( $tmp[1] ) { $port = $tmp[1]; } -my $assassin = Mail::SpamAssassin->new({ +my $assassin; +if ( defined($options{'config'}) ) { + $assassin=Mail::SpamAssassin->new({ + 'dont_copy_prefs' => 1, + 'debug' => $debug, + 'home_dir_for_helpers' => $home_dir, + 'userstate_dir' => $home_dir, + 'userprefs_filename' => ${$options{'config'}}, + 'local_tests_only' => $options{'local-only'} || 0 }); +} else { + $assassin=Mail::SpamAssassin->new({ 'dont_copy_prefs' => 1, 'debug' => $debug, 'local_tests_only' => $options{'local-only'} || 0 }); + 'home_dir_for_helpers' => $home_dir, + 'userstate_dir' => $home_dir, +}; $options{'auto-whitelist'} and eval { require Mail::SpamAssassin::DBBasedAddrList; @@ -859,7 +884,11 @@ $assassin->set_persistent_address_list_factory ($addrlistfactory); }; -$assassin->compile_now(); +if ( defined($options{'config'}) ) { + $assassin->compile_now(); +} else { + $assassin->compile_now(0); +} # thanks to Kurt Andersen for the 'uname -s' fix if ( !$options{logsock} ) { @@ -1046,6 +1075,7 @@ [B<--set-envelope-from|sef>] [B<--auto-whitelist|aw>] [B<--local-only|L>] +[B<--config|C=filename>] [B<--debug|d>] B<spampd> B<--help> @@ -1375,6 +1405,17 @@ Turn off all SA network-based tests (DNS, Razor, etc). +=item B<--config=filename> or B<--C filename> + +Use the specified filename as the config read by spampd in addition to +SpamAssassin's normal configuration files, overriding the latter. Defaults +to not using a spampd specific configuration file. + +=item B<--homedir=directory> + +Use the specified directory as home directory for the spamassassin process. +Defaults to /var/cache/spampd. + =item B<--debug> or B<--d> Turns on SpamAssassin debug messages which print to the system mail log
signature.asc
Description: Digital signature