You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2009/08/06 20:56:45 UTC
svn commit: r801771 - in /spamassassin/trunk/lib/Mail/SpamAssassin:
BayesStore/MySQL.pm BayesStore/SQL.pm Client.pm SQLBasedAddrList.pm
Author: mmartinec
Date: Thu Aug 6 18:56:44 2009
New Revision: 801771
URL: http://svn.apache.org/viewvc?rev=801771&view=rev
Log:
Bug 5893 (and Bug 5965): bayes_sql_override_username is ignored
if value evalutes to 'false'
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/MySQL.pm
spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm
spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm
spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/MySQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/MySQL.pm?rev=801771&r1=801770&r2=801771&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/MySQL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/MySQL.pm Thu Aug 6 18:56:44 2009
@@ -676,9 +676,8 @@
sub _initialize_db {
my ($self, $create_entry_p) = @_;
- return 0 unless (defined($self->{_dbh}));
-
- return 0 if (!$self->{_username});
+ return 0 if !defined $self->{_dbh};
+ return 0 if !defined $self->{_username} || $self->{_username} eq '';
# Check to see if we should call the services_authorized_for_username plugin
# hook to see if this user is allowed/able to use bayes. If not, do nothing
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm?rev=801771&r1=801770&r2=801771&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/SQL.pm Thu Aug 6 18:56:44 2009
@@ -93,7 +93,7 @@
# Need to make sure that a username is set, so just in case there is
# no username set in main, set one here.
- unless ($self->{_username}) {
+ if (!defined $self->{_username} || $self->{_username} eq '') {
$self->{_username} = "GLOBALBAYES";
}
}
@@ -1734,9 +1734,8 @@
sub _initialize_db {
my ($self, $create_entry_p) = @_;
- return 0 unless (defined($self->{_dbh}));
-
- return 0 if (!$self->{_username});
+ return 0 if !defined $self->{_dbh};
+ return 0 if !defined $self->{_username} || $self->{_username} eq '';
# Check to see if we should call the services_authorized_for_username plugin
# hook to see if this user is allowed/able to use bayes. If not, do nothing
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm?rev=801771&r1=801770&r2=801771&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm Thu Aug 6 18:56:44 2009
@@ -91,7 +91,7 @@
$self->{host} = $args->{host};
}
- if ($args->{username}) {
+ if (defined $args->{username}) {
$self->{username} = $args->{username};
}
@@ -201,7 +201,7 @@
print $remote "TELL $PROTOVERSION$EOL";
print $remote "Content-length: $msgsize$EOL";
- print $remote "User: $self->{username}$EOL" if ($self->{username});
+ print $remote "User: $self->{username}$EOL" if defined $self->{username};
if ($learntype == 0) {
print $remote "Message-class: spam$EOL";
@@ -288,7 +288,7 @@
print $remote "TELL $PROTOVERSION$EOL";
print $remote "Content-length: $msgsize$EOL";
- print $remote "User: $self->{username}$EOL" if ($self->{username});
+ print $remote "User: $self->{username}$EOL" if defined $self->{username};
print $remote "Message-class: spam$EOL";
print $remote "Set: local,remote$EOL";
print $remote "$EOL";
@@ -349,7 +349,7 @@
print $remote "TELL $PROTOVERSION$EOL";
print $remote "Content-length: $msgsize$EOL";
- print $remote "User: $self->{username}$EOL" if ($self->{username});
+ print $remote "User: $self->{username}$EOL" if defined $self->{username};
print $remote "Message-class: ham$EOL";
print $remote "Set: local$EOL";
print $remote "Remove: remote$EOL";
@@ -539,7 +539,7 @@
print $remote "$command $PROTOVERSION$EOL";
print $remote "Content-length: $msgsize$EOL";
- print $remote "User: $self->{username}$EOL" if ($self->{username});
+ print $remote "User: $self->{username}$EOL" if defined $self->{username};
print $remote "$EOL";
print $remote $msg;
print $remote "$EOL";
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm?rev=801771&r1=801770&r2=801771&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm Thu Aug 6 18:56:44 2009
@@ -161,15 +161,16 @@
'tablename' => $main->{conf}->{user_awl_sql_table},
};
- if ($main->{conf}->{user_awl_sql_override_username}) {
- $self->{_username} = $main->{conf}->{user_awl_sql_override_username};
+ my $override_username = $main->{conf}->{user_awl_sql_override_username};
+ if (defined $override_username && $override_username ne '') {
+ $self->{_username} = $override_username;
}
else {
$self->{_username} = $main->{username};
# Need to make sure that a username is set, so just in case there is
# no username set in main, set one here.
- unless ($self->{_username}) {
+ if (!defined $self->{_username} || $self->{_username} eq '') {
$self->{_username} = "GLOBAL";
}
}