Below is a patch (against CVS) which allows the config to use the user
argument.  This allows spamd to setuid to that user and use the user_prefs
and other various configuration details of that user.  I've been running
this against SA 3.0.1.

The astute observer will note how I tagged the X-Envelope-From: with the 1.0
call and not the 1.2.  I can't see that it's needed as it was with the newer
spamd.  

peter



--- spamassassin.orig   2004-11-22 20:54:10.000000000 -0600
+++ spamassassin        2004-11-22 21:04:16.000000000 -0600
@@ -58,6 +58,12 @@ not trust such headers and should either
 parameter 'rename') or have them removed (parameter 'drop'). If you know
 what you are doing, you can also leave them intact (parameter 'keep').
 
+=item user [login]
+
+If spamd is running as root you can use the ~/.spamassassin/user_prefs and
+bayesian info.  This will change the spamc protocol to use 1.2 rather than
+the default 1.0.  Tested with SA 3.0.
+
 =back
 
 With both of the first options the configuration line will look like the
following
@@ -129,13 +135,20 @@ sub check_spam {
   SPAMD->autoflush(1);
   
   $transaction->body_resetpos;
-  
-  print SPAMD "SYMBOLS SPAMC/1.0" . CRLF;
-  # or CHECK or REPORT or SYMBOLS
-
-  print SPAMD "X-Envelope-From: ", $transaction->sender->format, CRLF
-    or warn "Could not print to spamd: $!";
 
+  if (defined $self->{_args}->{user}) {
+    print SPAMD "SYMBOLS SPAMC/1.0" . CRLF;
+    # or CHECK or REPORT or SYMBOLS
+      
+    print SPAMD "X-Envelope-From: ", $transaction->sender->format, CRLF
+      or warn "Could not print to spamd: $!";
+  } else {
+    print SPAMD "SYMBOLS SPAMC/1.2" . CRLF;
+    # or CHECK or REPORT or SYMBOLS
+      
+    print SPAMD "User: ", $self->{_args}->{user}, CRLF, CRLF
+      or warn "Could not print to spamd: $!";
+  }
   print SPAMD join CRLF, split /\n/, $transaction->header->as_string
     or warn "Could not print to spamd: $!";
 

Reply via email to