Yup, sure enough the compile_now was happening way too soon.  I've moved things around to make this better.  It's in CVS, or use the attached patch.

C

On Wed, 2002-01-16 at 11:36, Craig Hughes wrote:
chmod 0666 /var/spool/spamassassin/auto*

Somehow the permissions on those files got set so that only root can write to them.  But of course, you're running as nobody, so when it tries to write, it's failing.  I'll need to check if this is the code's fault.  My initial guess is that compile_now() is running before the uid is changed...

C
--- spamd.raw.~1.68.~   Wed Jan 16 12:13:57 2002
+++ spamd.raw   Wed Jan 16 12:18:14 2002
@@ -133,8 +133,6 @@
     $spamtest->set_persistent_address_list_factory ($addrlistfactory);
 };
 
-$spamtest->compile_now();      # ensure all modules etc. are loaded
-$/ = "\n";                     # argh, Razor resets this!  Bad Razor!
 
 sub spawn;  # forward declaration
 sub logmsg; # forward declaration
@@ -157,8 +155,11 @@
 setsockopt(Server,SOL_SOCKET,SO_REUSEADDR,pack("l",1))  || die "setsockopt: $!";
 bind(Server, sockaddr_in($port, $addr))                 || die "bind: $!";
 listen(Server,SOMAXCONN)                                || die "listen: $!";
-
-$opt_d and daemonize();
+if ($opt_D) {
+    warn "server started on port $port\n";
+    warn "server pid: $$\n";
+}
+logmsg "server started on port $port";
 
 # support non-root use (after we bind to the port)
 my $setuid_to_user = 0;
@@ -177,11 +178,10 @@
     $setuid_to_user = 1;
 }
 
-if ($opt_D) {
-    warn "server started on port $port\n";
-    warn "server pid: $$\n";
-}
-logmsg "server started on port $port";
+$spamtest->compile_now();      # ensure all modules etc. are loaded
+$/ = "\n";                     # argh, Razor resets this!  Bad Razor!
+
+$opt_d and daemonize();
 
 my $waitedpid = 0;
 my $current_user;


Reply via email to