You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by gb...@apache.org on 2018/10/19 06:36:48 UTC

svn commit: r1844306 - in /spamassassin: branches/3.4/ branches/3.4/lib/Mail/SpamAssassin/ branches/3.4/lib/Mail/SpamAssassin/Plugin/ branches/3.4/sql/ trunk/ trunk/lib/Mail/SpamAssassin/ trunk/lib/Mail/SpamAssassin/Plugin/ trunk/sql/

Author: gbechis
Date: Fri Oct 19 06:36:47 2018
New Revision: 1844306

URL: http://svn.apache.org/viewvc?rev=1844306&view=rev
Log:
Starting from SQL-92 "count" is a reserved word
Renamed field count to msgcount, follow UPGRADE notes to update your database
fixes bz #7578

Modified:
    spamassassin/branches/3.4/UPGRADE
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/AutoWhitelist.pm
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/DBBasedAddrList.pm
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/TxRep.pm
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
    spamassassin/branches/3.4/sql/README.awl
    spamassassin/branches/3.4/sql/awl_mysql.sql
    spamassassin/branches/3.4/sql/awl_pg.sql
    spamassassin/branches/3.4/sql/txrep_mysql.sql
    spamassassin/branches/3.4/sql/txrep_pg.sql
    spamassassin/trunk/UPGRADE
    spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/TxRep.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
    spamassassin/trunk/sql/README.awl
    spamassassin/trunk/sql/awl_mysql.sql
    spamassassin/trunk/sql/awl_pg.sql
    spamassassin/trunk/sql/txrep_mysql.sql
    spamassassin/trunk/sql/txrep_pg.sql

Modified: spamassassin/branches/3.4/UPGRADE
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/UPGRADE?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/UPGRADE (original)
+++ spamassassin/branches/3.4/UPGRADE Fri Oct 19 06:36:47 2018
@@ -1,3 +1,17 @@
+Note for Users Upgrading to SpamAssassin 3.4.3
+----------------------------------------------
+
+- TxRep and Awl plugins has been modified to be compatible 
+  with latest Postgresql versions.
+  You should upgrade your sql database running the following command:
+  MySQL:
+  "ALTER TABLE `txrep` CHANGE `count` `msgcount` INT(11) NOT NULL DEFAULT '0';"
+  "ALTER TABLE `awl` CHANGE `count` `msgcount` INT(11) NOT NULL DEFAULT '0';"
+  PostgreSQL:
+  "ALTER TABLE txrep RENAME COLUMN count TO msgcount;"
+  "ALTER TABLE awl RENAME COLUMN count TO msgcount;"
+
+
 Note for Users Upgrading to SpamAssassin 3.4.2
 ----------------------------------------------
 

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/AutoWhitelist.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/AutoWhitelist.pm?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/AutoWhitelist.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/AutoWhitelist.pm Fri Oct 19 06:36:47 2018
@@ -128,35 +128,35 @@ sub check_address {
   my $entry = $self->{checker}->get_addr_entry ($fulladdr, $signedby);
   $self->{entry} = $entry;
 
-  if (!$entry->{count}) {
+  if (!$entry->{msgcount}) {
     # no entry found
     if (defined $origip) {
       # try upgrading a default entry (probably from "add-addr-to-foo")
       my $noipaddr = $self->pack_addr ($addr, undef);
       my $noipent = $self->{checker}->get_addr_entry ($noipaddr, undef);
 
-      if (defined $noipent->{count} && $noipent->{count} > 0) {
+      if (defined $noipent->{msgcount} && $noipent->{msgcount} > 0) {
 	dbg("auto-whitelist: found entry w/o IP address for $addr: replacing with $origip");
 	$self->{checker}->remove_entry($noipent);
         # Now assign proper entry the count and totscore values of the
         # no-IP entry instead of assigning the whole value to avoid
         # wiping out any information added to the previous entry.
-	$entry->{count} = $noipent->{count};
+	$entry->{msgcount} = $noipent->{msgcount};
 	$entry->{totscore} = $noipent->{totscore};
       }
     }
   }
 
-  if ($entry->{count} < 0 ||
-      $entry->{count} != $entry->{count} ||  # test for NaN
+  if ($entry->{msgcount} < 0 ||
+      $entry->{msgcount} != $entry->{msgcount} ||  # test for NaN
       $entry->{totscore} != $entry->{totscore})
   {
     warn "auto-whitelist: resetting bad data for ($addr, $origip), ".
-         "count: $entry->{count}, totscore: $entry->{totscore}\n";
-    $entry->{count} = $entry->{totscore} = 0;
+         "count: $entry->{msgcount}, totscore: $entry->{totscore}\n";
+    $entry->{msgcount} = $entry->{totscore} = 0;
   }
 
-  return !$entry->{count} ? undef : $entry->{totscore} / $entry->{count};
+  return !$entry->{msgcount} ? undef : $entry->{totscore} / $entry->{msgcount};
 }
 
 ###########################################################################
@@ -170,7 +170,7 @@ whitelist correction.
 
 sub count {
   my $self = shift;
-  return $self->{entry}->{count};
+  return $self->{entry}->{msgcount};
 }
 
 
@@ -195,7 +195,7 @@ sub add_score {
     return;		# don't try to add a NaN
   }
 
-  $self->{entry}->{count} ||= 0;
+  $self->{entry}->{msgcount} ||= 0;
   $self->{checker}->add_score($self->{entry}, $score);
 }
 

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/DBBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/DBBasedAddrList.pm?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/DBBasedAddrList.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/DBBasedAddrList.pm Fri Oct 19 06:36:47 2018
@@ -125,10 +125,10 @@ sub get_addr_entry {
 	addr			=> $addr,
   };
 
-  $entry->{count} = $self->{accum}->{$addr} || 0;
+  $entry->{msgcount} = $self->{accum}->{$addr} || 0;
   $entry->{totscore} = $self->{accum}->{$addr.'|totscore'} || 0;
 
-  dbg("auto-whitelist: db-based $addr scores ".$entry->{count}.'/'.$entry->{totscore});
+  dbg("auto-whitelist: db-based $addr scores ".$entry->{msgcount}.'/'.$entry->{totscore});
   return $entry;
 }
 
@@ -137,15 +137,15 @@ sub get_addr_entry {
 sub add_score {
     my($self, $entry, $score) = @_;
 
-    $entry->{count} ||= 0;
+    $entry->{msgcount} ||= 0;
     $entry->{addr}  ||= '';
 
-    $entry->{count}++;
+    $entry->{msgcount}++;
     $entry->{totscore} += $score;
 
-    dbg("auto-whitelist: add_score: new count: ".$entry->{count}.", new totscore: ".$entry->{totscore});
+    dbg("auto-whitelist: add_score: new count: ".$entry->{msgcount}.", new totscore: ".$entry->{totscore});
 
-    $self->{accum}->{$entry->{addr}} = $entry->{count};
+    $self->{accum}->{$entry->{addr}} = $entry->{msgcount};
     $self->{accum}->{$entry->{addr}.'|totscore'} = $entry->{totscore};
     return $entry;
 }

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/TxRep.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/TxRep.pm?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/TxRep.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/TxRep.pm Fri Oct 19 06:36:47 2018
@@ -1522,7 +1522,7 @@ sub check_reputation {
 #--------------------------------------------------------------------------
 
 ###########################################################################
-sub count {my $self=shift;  return (defined $self->{checker})? $self->{entry}->{count}    : undef;}
+sub count {my $self=shift;  return (defined $self->{checker})? $self->{entry}->{msgcount}    : undef;}
 sub total {my $self=shift;  return (defined $self->{checker})? $self->{entry}->{totscore} : undef;}
 ###########################################################################
 
@@ -1539,11 +1539,11 @@ sub get_sender {
   $self->{entry} = $entry;
   $origip        = $origip || 'none';
 
-  if ($entry->{count}<0 || $entry->{count}=~/^(nan|)$/ || $entry->{totscore}=~/^(nan|)$/) {
-    warn "TxRep: resetting bad data for ($addr, $origip), count: $entry->{count}, totscore: $entry->{totscore}\n";
-    $self->{entry}->{count} = $self->{entry}->{totscore} = 0;
+  if ($entry->{msgcount}<0 || $entry->{msgcount}=~/^(nan|)$/ || $entry->{totscore}=~/^(nan|)$/) {
+    warn "TxRep: resetting bad data for ($addr, $origip), count: $entry->{msgcount}, totscore: $entry->{totscore}\n";
+    $self->{entry}->{msgcount} = $self->{entry}->{totscore} = 0;
   }
-  return $self->{entry}->{count};
+  return $self->{entry}->{msgcount};
 }
 
 
@@ -1558,7 +1558,7 @@ sub add_score {
     warn "TxRep: attempt to add a $score to TxRep entry ignored\n";
     return;                                       # don't try to add a NaN
   }
-  $self->{entry}->{count} ||= 0;
+  $self->{entry}->{msgcount} ||= 0;
 
   # performing the dilution aging correction
   if (defined $self->total() && defined $self->count() && defined $self->{txrep_dilution_factor}) {
@@ -1588,9 +1588,9 @@ sub remove_score {
   }
   # no reversal dilution aging correction (not easily possible),
   # just removing the original message score
-  if ($self->{entry}->{count} > 2)
-        {$self->{entry}->{count} -= 2;}
-  else  {$self->{entry}->{count}  = 0;}
+  if ($self->{entry}->{msgcount} > 2)
+        {$self->{entry}->{msgcount} -= 2;}
+  else  {$self->{entry}->{msgcount}  = 0;}
   # substract 2, and add a score; hence decrementing by 1
   $self->{checker}->add_score($self->{entry}, -1*$score);
 }

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/SQLBasedAddrList.pm?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/SQLBasedAddrList.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/SQLBasedAddrList.pm Fri Oct 19 06:36:47 2018
@@ -45,7 +45,7 @@ CREATE TABLE awl (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   PRIMARY KEY (username,email,signedby,ip)
@@ -191,7 +191,7 @@ sub get_addr_entry {
 
   my $entry = { addr     => $addr,
                 exists_p => 0,
-                count    => 0,
+                msgcount    => 0,
                 totscore => 0,
                 signedby => $signedby,
               };
@@ -200,7 +200,7 @@ sub get_addr_entry {
 
   return $entry  unless $email ne '' && (defined $ip || defined $signedby);
 
-  my $sql = "SELECT count, totscore FROM $self->{tablename} " .
+  my $sql = "SELECT msgcount, totscore FROM $self->{tablename} " .
             "WHERE username = ? AND email = ?";
   my @args = ( $email );
   if (!$self->{_with_awl_signer}) {
@@ -225,7 +225,7 @@ sub get_addr_entry {
   if (!$rc) { # there was an error, but try to go on
     info("auto-whitelist: sql-based get_addr_entry %s: SQL error: %s",
          join('|',@args), $sth->errstr);
-    $entry->{count} = 0;
+    $entry->{msgcount} = 0;
     $entry->{totscore} = 0;
   }
   else {
@@ -234,8 +234,8 @@ sub get_addr_entry {
     # how to combine data if there are several entries (like signed by
     # an author domain and by a remailer)?  for now just take an average
     while ( defined($aryref = $sth->fetchrow_arrayref()) ) {
-      if (defined $entry->{count} && defined $aryref->[1]) {
-        $entry->{count} = $aryref->[0];
+      if (defined $entry->{msgcount} && defined $aryref->[1]) {
+        $entry->{msgcount} = $aryref->[0];
         $entry->{totscore} = $aryref->[1];
       }
       $entry->{exists_p} = 1;
@@ -247,8 +247,8 @@ sub get_addr_entry {
   }
   $sth->finish();
 
-  dbg("auto-whitelist: sql-based %s scores %s, count %s",
-      join('|',@args), $entry->{totscore}, $entry->{count});
+  dbg("auto-whitelist: sql-based %s scores %s, msgcount %s",
+      join('|',@args), $entry->{totscore}, $entry->{msgcount});
 
   return $entry;
 }
@@ -275,7 +275,7 @@ sub add_score {
   
   my ($email, $ip) = $self->_unpack_addr($entry->{addr});
 
-  $entry->{count} += 1;
+  $entry->{msgcount} += 1;
   $entry->{totscore} += $score;
   my $signedby = $entry->{signedby};
   
@@ -286,7 +286,7 @@ sub add_score {
 
   my $inserted = 0;
 
-  { my @fields = qw(username email ip count totscore);
+  { my @fields = qw(username email ip msgcount totscore);
     my @signedby;
     if ($self->{_with_awl_signer}) {
       push(@fields, 'signedby');
@@ -327,9 +327,9 @@ sub add_score {
     # insert failed, assume primary key constraint, so try the update
 
     my $sql = "UPDATE $self->{tablename} ".
-              "SET count = ?, totscore = totscore + ? ".
+              "SET msgcount = ?, totscore = totscore + ? ".
               "WHERE username = ? AND email = ?";
-    my(@args) = ($entry->{count}, $score, $self->{_username}, $email);
+    my(@args) = ($entry->{msgcount}, $score, $self->{_username}, $email);
     if ($self->{_with_awl_signer}) {
       my @signedby = !defined $signedby ? () : split(' ', lc $signedby);
       if (!@signedby) {
@@ -352,8 +352,8 @@ sub add_score {
            join('|',@args), $sth->errstr);
     } else {
       dbg("auto-whitelist: sql-based add_score/update ".
-          "new count: %s, new totscore: %s for %s",
-          $entry->{count}, $entry->{totscore}, join('|',@args));
+          "new msgcount: %s, new totscore: %s for %s",
+          $entry->{msgcount}, $entry->{totscore}, join('|',@args));
       $entry->{exists_p} = 1;
     }
   }

Modified: spamassassin/branches/3.4/sql/README.awl
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/sql/README.awl?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/sql/README.awl (original)
+++ spamassassin/branches/3.4/sql/README.awl Fri Oct 19 06:36:47 2018
@@ -75,7 +75,7 @@ setting: "awl") with at least these fiel
   username varchar(100)	  # this is the username whose e-mail is being filtered
   email varchar(200)      # this is the address key
   ip    varchar(40)       # this is the ip key (fits IPv4 or IPv6)
-  count int(11)           # this is the message counter
+  msgcount int(11)        # this is the message counter
   totscore float          # this is the total calculated score
   signedby varchar(255)   # a DKIM or DomainKeys signing domain(s)
 
@@ -109,7 +109,7 @@ CREATE TABLE awl (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   PRIMARY KEY (username,email,signedby,ip)

Modified: spamassassin/branches/3.4/sql/awl_mysql.sql
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/sql/awl_mysql.sql?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/sql/awl_mysql.sql (original)
+++ spamassassin/branches/3.4/sql/awl_mysql.sql Fri Oct 19 06:36:47 2018
@@ -2,7 +2,7 @@ CREATE TABLE awl (
   username varchar(100) NOT NULL default '',
   email varbinary(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   PRIMARY KEY (username,email,signedby,ip)

Modified: spamassassin/branches/3.4/sql/awl_pg.sql
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/sql/awl_pg.sql?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/sql/awl_pg.sql (original)
+++ spamassassin/branches/3.4/sql/awl_pg.sql Fri Oct 19 06:36:47 2018
@@ -2,7 +2,7 @@ CREATE TABLE awl (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count bigint NOT NULL default '0',
+  msgcount bigint NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   PRIMARY KEY (username,email,signedby,ip)

Modified: spamassassin/branches/3.4/sql/txrep_mysql.sql
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/sql/txrep_mysql.sql?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/sql/txrep_mysql.sql (original)
+++ spamassassin/branches/3.4/sql/txrep_mysql.sql Fri Oct 19 06:36:47 2018
@@ -2,7 +2,7 @@ CREATE TABLE txrep (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   last_hit timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

Modified: spamassassin/branches/3.4/sql/txrep_pg.sql
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/sql/txrep_pg.sql?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/branches/3.4/sql/txrep_pg.sql (original)
+++ spamassassin/branches/3.4/sql/txrep_pg.sql Fri Oct 19 06:36:47 2018
@@ -2,7 +2,7 @@ CREATE TABLE txrep (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   last_hit timestamp NOT NULL default CURRENT_TIMESTAMP,

Modified: spamassassin/trunk/UPGRADE
URL: http://svn.apache.org/viewvc/spamassassin/trunk/UPGRADE?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/UPGRADE (original)
+++ spamassassin/trunk/UPGRADE Fri Oct 19 06:36:47 2018
@@ -2,6 +2,16 @@
 Note for Users Upgrading to SpamAssassin 4.0.0
 ----------------------------------------------
 
+- TxRep and Awl plugins has been modified to be compatible 
+  with latest Postgresql versions.
+  You should upgrade your sql database running the following command:
+  MySQL:
+  "ALTER TABLE `txrep` CHANGE `count` `msgcount` INT(11) NOT NULL DEFAULT '0';"
+  "ALTER TABLE `awl` CHANGE `count` `msgcount` INT(11) NOT NULL DEFAULT '0';"
+  PostgreSQL:
+  "ALTER TABLE txrep RENAME COLUMN count TO msgcount;"
+  "ALTER TABLE awl RENAME COLUMN count TO msgcount;"
+
 - URILocalBL: uri_block_cc/uri_block_cont support negation (Bug 7528)
 
 - URILocalBL: uri_block_cidr "10.1.1.0-10.1.1.225" range format not

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm Fri Oct 19 06:36:47 2018
@@ -128,35 +128,35 @@ sub check_address {
   my $entry = $self->{checker}->get_addr_entry ($fulladdr, $signedby);
   $self->{entry} = $entry;
 
-  if (!$entry->{count}) {
+  if (!$entry->{msgcount}) {
     # no entry found
     if (defined $origip) {
       # try upgrading a default entry (probably from "add-addr-to-foo")
       my $noipaddr = $self->pack_addr ($addr, undef);
       my $noipent = $self->{checker}->get_addr_entry ($noipaddr, undef);
 
-      if (defined $noipent->{count} && $noipent->{count} > 0) {
+      if (defined $noipent->{msgcount} && $noipent->{msgcount} > 0) {
 	dbg("auto-whitelist: found entry w/o IP address for $addr: replacing with $origip");
 	$self->{checker}->remove_entry($noipent);
         # Now assign proper entry the count and totscore values of the
         # no-IP entry instead of assigning the whole value to avoid
         # wiping out any information added to the previous entry.
-	$entry->{count} = $noipent->{count};
+	$entry->{msgcount} = $noipent->{msgcount};
 	$entry->{totscore} = $noipent->{totscore};
       }
     }
   }
 
-  if ($entry->{count} < 0 ||
-      $entry->{count} != $entry->{count} ||  # test for NaN
+  if ($entry->{msgcount} < 0 ||
+      $entry->{msgcount} != $entry->{msgcount} ||  # test for NaN
       $entry->{totscore} != $entry->{totscore})
   {
     warn "auto-whitelist: resetting bad data for ($addr, $origip), ".
-         "count: $entry->{count}, totscore: $entry->{totscore}\n";
-    $entry->{count} = $entry->{totscore} = 0;
+         "count: $entry->{msgcount}, totscore: $entry->{totscore}\n";
+    $entry->{msgcount} = $entry->{totscore} = 0;
   }
 
-  return !$entry->{count} ? undef : $entry->{totscore} / $entry->{count};
+  return !$entry->{msgcount} ? undef : $entry->{totscore} / $entry->{msgcount};
 }
 
 ###########################################################################
@@ -170,7 +170,7 @@ whitelist correction.
 
 sub count {
   my $self = shift;
-  return $self->{entry}->{count};
+  return $self->{entry}->{msgcount};
 }
 
 
@@ -195,7 +195,7 @@ sub add_score {
     return;		# don't try to add a NaN
   }
 
-  $self->{entry}->{count} ||= 0;
+  $self->{entry}->{msgcount} ||= 0;
   $self->{checker}->add_score($self->{entry}, $score);
 }
 

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm Fri Oct 19 06:36:47 2018
@@ -125,10 +125,10 @@ sub get_addr_entry {
 	addr			=> $addr,
   };
 
-  $entry->{count} = $self->{accum}->{$addr} || 0;
+  $entry->{msgcount} = $self->{accum}->{$addr} || 0;
   $entry->{totscore} = $self->{accum}->{$addr.'|totscore'} || 0;
 
-  dbg("auto-whitelist: db-based $addr scores ".$entry->{count}.'/'.$entry->{totscore});
+  dbg("auto-whitelist: db-based $addr scores ".$entry->{msgcount}.'/'.$entry->{totscore});
   return $entry;
 }
 
@@ -137,15 +137,15 @@ sub get_addr_entry {
 sub add_score {
     my($self, $entry, $score) = @_;
 
-    $entry->{count} ||= 0;
+    $entry->{msgcount} ||= 0;
     $entry->{addr}  ||= '';
 
-    $entry->{count}++;
+    $entry->{msgcount}++;
     $entry->{totscore} += $score;
 
-    dbg("auto-whitelist: add_score: new count: ".$entry->{count}.", new totscore: ".$entry->{totscore});
+    dbg("auto-whitelist: add_score: new count: ".$entry->{msgcount}.", new totscore: ".$entry->{totscore});
 
-    $self->{accum}->{$entry->{addr}} = $entry->{count};
+    $self->{accum}->{$entry->{addr}} = $entry->{msgcount};
     $self->{accum}->{$entry->{addr}.'|totscore'} = $entry->{totscore};
     return $entry;
 }

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/TxRep.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/TxRep.pm?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/TxRep.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/TxRep.pm Fri Oct 19 06:36:47 2018
@@ -1522,7 +1522,7 @@ sub check_reputation {
 #--------------------------------------------------------------------------
 
 ###########################################################################
-sub count {my $self=shift;  return (defined $self->{checker})? $self->{entry}->{count}    : undef;}
+sub count {my $self=shift;  return (defined $self->{checker})? $self->{entry}->{msgcount}    : undef;}
 sub total {my $self=shift;  return (defined $self->{checker})? $self->{entry}->{totscore} : undef;}
 ###########################################################################
 
@@ -1539,11 +1539,11 @@ sub get_sender {
   $self->{entry} = $entry;
   $origip        = $origip || 'none';
 
-  if ($entry->{count}<0 || $entry->{count}=~/^(nan|)$/ || $entry->{totscore}=~/^(nan|)$/) {
-    warn "TxRep: resetting bad data for ($addr, $origip), count: $entry->{count}, totscore: $entry->{totscore}\n";
-    $self->{entry}->{count} = $self->{entry}->{totscore} = 0;
+  if ($entry->{msgcount}<0 || $entry->{msgcount}=~/^(nan|)$/ || $entry->{totscore}=~/^(nan|)$/) {
+    warn "TxRep: resetting bad data for ($addr, $origip), count: $entry->{msgcount}, totscore: $entry->{totscore}\n";
+    $self->{entry}->{msgcount} = $self->{entry}->{totscore} = 0;
   }
-  return $self->{entry}->{count};
+  return $self->{entry}->{msgcount};
 }
 
 
@@ -1558,7 +1558,7 @@ sub add_score {
     warn "TxRep: attempt to add a $score to TxRep entry ignored\n";
     return;                                       # don't try to add a NaN
   }
-  $self->{entry}->{count} ||= 0;
+  $self->{entry}->{msgcount} ||= 0;
 
   # performing the dilution aging correction
   if (defined $self->total() && defined $self->count() && defined $self->{txrep_dilution_factor}) {
@@ -1588,9 +1588,9 @@ sub remove_score {
   }
   # no reversal dilution aging correction (not easily possible),
   # just removing the original message score
-  if ($self->{entry}->{count} > 2)
-        {$self->{entry}->{count} -= 2;}
-  else  {$self->{entry}->{count}  = 0;}
+  if ($self->{entry}->{msgcount} > 2)
+        {$self->{entry}->{msgcount} -= 2;}
+  else  {$self->{entry}->{msgcount}  = 0;}
   # substract 2, and add a score; hence decrementing by 1
   $self->{checker}->add_score($self->{entry}, -1*$score);
 }

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/SQLBasedAddrList.pm Fri Oct 19 06:36:47 2018
@@ -45,7 +45,7 @@ CREATE TABLE awl (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   PRIMARY KEY (username,email,signedby,ip)
@@ -191,7 +191,7 @@ sub get_addr_entry {
 
   my $entry = { addr     => $addr,
                 exists_p => 0,
-                count    => 0,
+                msgcount    => 0,
                 totscore => 0,
                 signedby => $signedby,
               };
@@ -200,7 +200,7 @@ sub get_addr_entry {
 
   return $entry  unless $email ne '' && (defined $ip || defined $signedby);
 
-  my $sql = "SELECT count, totscore FROM $self->{tablename} " .
+  my $sql = "SELECT msgcount, totscore FROM $self->{tablename} " .
             "WHERE username = ? AND email = ?";
   my @args = ( $email );
   if (!$self->{_with_awl_signer}) {
@@ -225,7 +225,7 @@ sub get_addr_entry {
   if (!$rc) { # there was an error, but try to go on
     info("auto-whitelist: sql-based get_addr_entry %s: SQL error: %s",
          join('|',@args), $sth->errstr);
-    $entry->{count} = 0;
+    $entry->{msgcount} = 0;
     $entry->{totscore} = 0;
   }
   else {
@@ -234,8 +234,8 @@ sub get_addr_entry {
     # how to combine data if there are several entries (like signed by
     # an author domain and by a remailer)?  for now just take an average
     while ( defined($aryref = $sth->fetchrow_arrayref()) ) {
-      if (defined $entry->{count} && defined $aryref->[1]) {
-        $entry->{count} = $aryref->[0];
+      if (defined $entry->{msgcount} && defined $aryref->[1]) {
+        $entry->{msgcount} = $aryref->[0];
         $entry->{totscore} = $aryref->[1];
       }
       $entry->{exists_p} = 1;
@@ -247,8 +247,8 @@ sub get_addr_entry {
   }
   $sth->finish();
 
-  dbg("auto-whitelist: sql-based %s scores %s, count %s",
-      join('|',@args), $entry->{totscore}, $entry->{count});
+  dbg("auto-whitelist: sql-based %s scores %s, msgcount %s",
+      join('|',@args), $entry->{totscore}, $entry->{msgcount});
 
   return $entry;
 }
@@ -275,7 +275,7 @@ sub add_score {
   
   my ($email, $ip) = $self->_unpack_addr($entry->{addr});
 
-  $entry->{count} += 1;
+  $entry->{msgcount} += 1;
   $entry->{totscore} += $score;
   my $signedby = $entry->{signedby};
   
@@ -286,7 +286,7 @@ sub add_score {
 
   my $inserted = 0;
 
-  { my @fields = qw(username email ip count totscore);
+  { my @fields = qw(username email ip msgcount totscore);
     my @signedby;
     if ($self->{_with_awl_signer}) {
       push(@fields, 'signedby');
@@ -327,9 +327,9 @@ sub add_score {
     # insert failed, assume primary key constraint, so try the update
 
     my $sql = "UPDATE $self->{tablename} ".
-              "SET count = ?, totscore = totscore + ? ".
+              "SET msgcount = ?, totscore = totscore + ? ".
               "WHERE username = ? AND email = ?";
-    my(@args) = ($entry->{count}, $score, $self->{_username}, $email);
+    my(@args) = ($entry->{msgcount}, $score, $self->{_username}, $email);
     if ($self->{_with_awl_signer}) {
       my @signedby = !defined $signedby ? () : split(' ', lc $signedby);
       if (!@signedby) {
@@ -352,8 +352,8 @@ sub add_score {
            join('|',@args), $sth->errstr);
     } else {
       dbg("auto-whitelist: sql-based add_score/update ".
-          "new count: %s, new totscore: %s for %s",
-          $entry->{count}, $entry->{totscore}, join('|',@args));
+          "new msgcount: %s, new totscore: %s for %s",
+          $entry->{msgcount}, $entry->{totscore}, join('|',@args));
       $entry->{exists_p} = 1;
     }
   }

Modified: spamassassin/trunk/sql/README.awl
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sql/README.awl?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/sql/README.awl (original)
+++ spamassassin/trunk/sql/README.awl Fri Oct 19 06:36:47 2018
@@ -75,7 +75,7 @@ setting: "awl") with at least these fiel
   username varchar(100)	  # this is the username whose e-mail is being filtered
   email varchar(200)      # this is the address key
   ip    varchar(40)       # this is the ip key (fits IPv4 or IPv6)
-  count int(11)           # this is the message counter
+  msgcount int(11)        # this is the message counter
   totscore float          # this is the total calculated score
   signedby varchar(255)   # a DKIM or DomainKeys signing domain(s)
 
@@ -109,7 +109,7 @@ CREATE TABLE awl (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   PRIMARY KEY (username,email,signedby,ip)

Modified: spamassassin/trunk/sql/awl_mysql.sql
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sql/awl_mysql.sql?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/sql/awl_mysql.sql (original)
+++ spamassassin/trunk/sql/awl_mysql.sql Fri Oct 19 06:36:47 2018
@@ -2,7 +2,7 @@ CREATE TABLE awl (
   username varchar(100) NOT NULL default '',
   email varbinary(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   PRIMARY KEY (username,email,signedby,ip)

Modified: spamassassin/trunk/sql/awl_pg.sql
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sql/awl_pg.sql?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/sql/awl_pg.sql (original)
+++ spamassassin/trunk/sql/awl_pg.sql Fri Oct 19 06:36:47 2018
@@ -2,7 +2,7 @@ CREATE TABLE awl (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count bigint NOT NULL default '0',
+  msgcount bigint NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   PRIMARY KEY (username,email,signedby,ip)

Modified: spamassassin/trunk/sql/txrep_mysql.sql
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sql/txrep_mysql.sql?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/sql/txrep_mysql.sql (original)
+++ spamassassin/trunk/sql/txrep_mysql.sql Fri Oct 19 06:36:47 2018
@@ -2,7 +2,7 @@ CREATE TABLE txrep (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   last_hit timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

Modified: spamassassin/trunk/sql/txrep_pg.sql
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sql/txrep_pg.sql?rev=1844306&r1=1844305&r2=1844306&view=diff
==============================================================================
--- spamassassin/trunk/sql/txrep_pg.sql (original)
+++ spamassassin/trunk/sql/txrep_pg.sql Fri Oct 19 06:36:47 2018
@@ -2,7 +2,7 @@ CREATE TABLE txrep (
   username varchar(100) NOT NULL default '',
   email varchar(255) NOT NULL default '',
   ip varchar(40) NOT NULL default '',
-  count int(11) NOT NULL default '0',
+  msgcount int(11) NOT NULL default '0',
   totscore float NOT NULL default '0',
   signedby varchar(255) NOT NULL default '',
   last_hit timestamp NOT NULL default CURRENT_TIMESTAMP,