Bug 2866 - patch: allow user config file in places other than ~/.spamassassin
Summary: patch: allow user config file in places other than ~/.spamassassin
Status: NEW
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamassassin (show other bugs)
Version: 2.61
Hardware: All other
: P5 enhancement
Target Milestone: Future
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on: 5138
Blocks:
  Show dependency tree
 
Reported: 2003-12-22 15:25 UTC by Andrew Arensburger
Modified: 2006-10-19 06:39 UTC (History)
0 users



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Arensburger 2003-12-22 15:25:11 UTC
Due to the peculiarities of our setup (we use AFS), we store user_prefs and the
Bayes database in /mail/<username>/spamassassin/ , rather than ~/.spamassassin/ ,
which is not writable by the MTA.

The first patch below adds a new replaceable keyword "__username__" to
Mail/SpamAssassassin.pm which allows us to specify /mail/__username__ in local.cf
The second patch fixes spamd/spamd.raw to use the default_userstate_dir and
default_userprefs_path settings from local.cf, rather than assume that they're
in ~/.spamassassin/


--- Mail-SpamAssassin-2.61/lib/Mail/SpamAssassin.pm	2003/12/16 23:17:20	1.1
+++ Mail-SpamAssassin-2.61/lib/Mail/SpamAssassin.pm	2003/12/16 23:18:41
@@ -1369,6 +1371,7 @@
   $path =~ s/__def_rules_dir__/$self->{DEF_RULES_DIR} || ''/ges;
   $path =~ s{__prefix__}{$self->{PREFIX} || $Config{prefix} || '/usr'}ges;
   $path =~ s{__userstate__}{$self->get_and_create_userstate_dir()}ges;
+  $path =~ s{__username__}{$self->{username}}gs;
   $path =~ s/^\~([^\/]*)/$self->expand_name($1)/es;
 
   return Mail::SpamAssassin::Util::untaint_file_path ($path);




--- Mail-SpamAssassin-2.61/spamd/spamd.raw	2003/12/16 23:16:26	1.1
+++ Mail-SpamAssassin-2.61/spamd/spamd.raw	2003/12/16 23:56:49
@@ -943,15 +943,21 @@
 	   logmsg "info: setuid to $username succeeded";
 	}
     }
-
+    $spamtest->{username} = $name;
+ 
+    my $cf_file;
     #
     # If vpopmail config enabled then set $dir to virtual homedir
     #
     if ($opt{'vpopmail'}) {
 	$dir = `$dir/bin/vuserinfo -d $username`;
 	chomp ($dir);
+	$dir .= "/.spamassassin";
+	$cf_file = $dir . "/user_prefs";
+    } else {
+	$dir = $spamtest->first_existing_path(@Mail::SpamAssassin::default_userstate_dir);
+	$cf_file =
$spamtest->first_existing_path(@Mail::SpamAssassin::default_userprefs_path);
     }
-    my $cf_file = $dir."/.spamassassin/user_prefs";
 
     #
     # If vpopmail config enabled then pass virtual homedir onto
create_default_cf_needed
@@ -972,8 +978,7 @@
     } else {
 	create_default_cf_if_needed ($cf_file, $username);
 	$spamtest->read_scoreonly_config ($cf_file);
-	$spamtest->signal_user_changed ({ username => $username,
-					    user_dir => $dir });
+	$spamtest->signal_user_changed ({ username => $username });
     }
 
     return 1;
Comment 1 Michael Parker 2005-01-23 08:12:54 UTC
Is this something that --virtual-config-dir could rememdy?
Comment 2 Justin Mason 2005-01-24 10:27:38 UTC
we also now support "include" from user prefs files...
Comment 3 Daniel Quinlan 2005-03-30 01:09:02 UTC
move bug to Future milestone (previously set to Future -- I hope)
Comment 4 Justin Mason 2006-10-19 06:39:34 UTC
implementing bug 5138 would be the perfect way to do this