You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2004/04/29 02:39:49 UTC
svn commit: rev 10392 - in incubator/spamassassin/trunk: lib/Mail lib/Mail/SpamAssassin spamd t
Author: jm
Date: Wed Apr 28 17:39:48 2004
New Revision: 10392
Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm
incubator/spamassassin/trunk/spamd/spamd.raw
incubator/spamassassin/trunk/t/spamd_allow_user_rules.t
Log:
bug 2641 'fix' reverted: I was wrong, virtual-config-dir was doing exactly what it's supposed to do.
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm Wed Apr 28 17:39:48 2004
@@ -550,7 +550,14 @@
A directory to use as a 'home directory' for the current user's data,
overriding the system default. This directory must be readable and writable by
-the process.
+the process. Note that the resulting C<userstate_dir> will be the
+C<.spamassassin> subdirectory of this dir.
+
+=item userstate_dir
+
+A directory to use as a directory for the current user's data, overriding the
+system default. This directory must be readable and writable by the process.
+The default is C<user_dir/.spamassassin>.
=back
@@ -569,6 +576,9 @@
if (defined $opts && $opts->{user_dir}) {
$self->{user_dir} = $opts->{user_dir};
}
+ if (defined $opts && $opts->{userstate_dir}) {
+ $self->{userstate_dir} = $opts->{userstate_dir};
+ }
# reopen bayes dbs for this user
$self->{bayes_scanner}->finish();
@@ -581,7 +591,8 @@
$self->call_plugins ("signal_user_changed", {
username => $self->{username},
- userdir => $self->{user_dir},
+ userstate_dir => $self->{userstate_dir},
+ user_dir => $self->{user_dir},
});
1;
@@ -1315,15 +1326,17 @@
sub get_and_create_userstate_dir {
my ($self) = @_;
- # user state directory
- my $fname = $self->{userstate_dir};
- $fname ||= $self->first_existing_path (@default_userstate_dir);
+ my $fname;
# If vpopmail is enabled then set fname to virtual homedir
#
if (defined $self->{user_dir}) {
$fname = File::Spec->catdir ($self->{user_dir}, ".spamassassin");
+ } elsif (defined $self->{userstate_dir}) {
+ $fname = $self->{userstate_dir};
}
+
+ $fname ||= $self->first_existing_path (@default_userstate_dir);
if (defined $fname && !$self->{dont_copy_prefs}) {
dbg ("using \"$fname\" for user state dir");
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm Wed Apr 28 17:39:48 2004
@@ -2318,9 +2318,13 @@
###########################################################################
# SECURITY: no eval'd code should be loaded before this line.
#
- if ($scoresonly && !$self->{allow_user_rules}) { goto failed_line; }
- if ($scoresonly) { dbg("Checking privileged commands in user config"); }
+ if ($scoresonly) {
+ if (!$self->{allow_user_rules}) {
+ goto failed_line;
+ }
+ dbg("Checking privileged commands in user config");
+ }
=back
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm Wed Apr 28 17:39:48 2004
@@ -206,7 +206,11 @@
=item user_dir
-The new user's storage directory.
+The new user's home directory. (equivalent to C<~>.)
+
+=item userstate_dir
+
+The new user's storage directory. (equivalent to C<~/.spamassassin>.)
=back
Modified: incubator/spamassassin/trunk/spamd/spamd.raw
==============================================================================
--- incubator/spamassassin/trunk/spamd/spamd.raw (original)
+++ incubator/spamassassin/trunk/spamd/spamd.raw Wed Apr 28 17:39:48 2004
@@ -1298,7 +1298,7 @@
$dir =~ s/\%\%/\%/g;
$userdir = $dir;
- $prefsfile = $dir . '/.spamassassin/user_prefs';
+ $prefsfile = $dir . '/user_prefs';
# Log that the default configuration is being used for a user.
logmsg("Using default config for $username: $prefsfile");
@@ -1315,6 +1315,7 @@
$spamtest->signal_user_changed(
{
username => $username,
+ userstate_dir => $userdir,
user_dir => $userdir
}
);
@@ -1847,9 +1848,10 @@
All others will be replaced by underscores (C<_>).
This path must be a writable directory. It will be created if it does not
-already exist. If a file called B<user_prefs> exists in this directory, it
-will be loaded as the user's preferences. The auto-whitelist and/or Bayes
-databases for that user will be stored in this directory.
+already exist. If a file called B<user_prefs> exists in this directory (note:
+B<not> in a C<.spamassassin> subdirectory!), it will be loaded as the user's
+preferences. The auto-whitelist and/or Bayes databases for that user will be
+stored in this directory.
Note that this B<requires> that B<-x> is used, and cannot be combined with
SQL- or LDAP-based configuration.
Modified: incubator/spamassassin/trunk/t/spamd_allow_user_rules.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_allow_user_rules.t (original)
+++ incubator/spamassassin/trunk/t/spamd_allow_user_rules.t Wed Apr 28 17:39:48 2004
@@ -24,7 +24,7 @@
rmtree ("log/virtualconfig/testuser", 0, 1);
mkpath ("log/virtualconfig/testuser", 0, 0755);
-open (OUT, ">log/virtualconfig/testuser/.spamassassin/user_prefs");
+open (OUT, ">log/virtualconfig/testuser/user_prefs");
print OUT "
header MYFOO Content-Transfer-Encoding =~ /quoted-printable/
";