spamassassin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j.@apache.org
Subject svn commit: r492202 - in /spamassassin/trunk: lib/Mail/SpamAssassin.pm spamd/spamd.raw
Date Wed, 03 Jan 2007 16:38:51 GMT
Author: jm
Date: Wed Jan  3 08:38:50 2007
New Revision: 492202

URL: http://svn.apache.org/viewvc?view=rev&rev=492202
Log:
bug 4820: fix get_and_create_userstate_dir() to create the .spamassassin directory in the
correct location, if virtual users are being used (thanks to <support at math.uni-bonn.de>)

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin.pm
    spamassassin/trunk/spamd/spamd.raw

Modified: spamassassin/trunk/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin.pm?view=diff&rev=492202&r1=492201&r2=492202
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin.pm Wed Jan  3 08:38:50 2007
@@ -674,12 +674,18 @@
 
   if (defined $opts && $opts->{username}) {
     $self->{username} = $opts->{username};
+  } else {
+    undef $self->{username};
   }
   if (defined $opts && $opts->{user_dir}) {
     $self->{user_dir} = $opts->{user_dir};
+  } else {
+    undef $self->{user_dir};
   }
   if (defined $opts && $opts->{userstate_dir}) {
     $self->{userstate_dir} = $opts->{userstate_dir};
+  } else {
+    undef $self->{userstate_dir};
   }
 
   # reopen bayes dbs for this user
@@ -1532,13 +1538,16 @@
 }
 
 sub get_and_create_userstate_dir {
-  my ($self) = @_;
+  my ($self, $dir) = @_;
 
   my $fname;
 
   # If vpopmail is enabled then set fname to virtual homedir
-  # precedence: userstate_dir, derive from user_dir, system default
-  if (defined $self->{userstate_dir}) {
+  # precedence: dir, userstate_dir, derive from user_dir, system default
+  if (defined $dir) {
+    $fname = File::Spec->catdir ($dir, ".spamassassin");
+  }
+  elsif (defined $self->{userstate_dir}) {
     $fname = $self->{userstate_dir};
   }
   elsif (defined $self->{user_dir}) {
@@ -1602,15 +1611,15 @@
     return(0);
   }
 
-  if ($userdir && $userdir ne $self->{user_dir}) {
-    warn "config: oops! user_dirs don't match! '$userdir' vs '$self->{user_dir}'\n";
-  }
+#  if ($userdir && $userdir ne $self->{user_dir}) {
+#    warn "config: hooray! user_dirs don't match! '$userdir' vs '$self->{user_dir}'\n";
+#  }
 
   if (!-f $fname)
   {
     # Pass on the value of $userdir for virtual users in vpopmail
     # otherwise it is empty and the user's normal homedir is used
-    $self->get_and_create_userstate_dir();
+    $self->get_and_create_userstate_dir($userdir);
 
     # copy in the default one for later editing
     my $defprefs = $self->first_existing_path (@Mail::SpamAssassin::default_prefs_path);

Modified: spamassassin/trunk/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamd/spamd.raw?view=diff&rev=492202&r1=492201&r2=492202
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Wed Jan  3 08:38:50 2007
@@ -1966,7 +1966,7 @@
 
   }
   else {
-    create_default_cf_if_needed( $cf_file, $username );
+    create_default_cf_if_needed( $cf_file, $username, $dir );
     $spamtest->read_scoreonly_config($cf_file);
     $spamtest->signal_user_changed(
       {



Mime
View raw message