Hello.
EMAIL_IP is not evaluated with SQLBasedAddrList.
In conclusion, the following patches are needed.
---
../Mail-SpamAssassin-4.0.1.orig/lib/Mail/SpamAssassin/SQLBasedAddrList.pm 2024-03-26
13:52:11.000000000 +0900
+++
../Mail-SpamAssassin-4.0.1/lib/Mail/SpamAssassin/SQLBasedAddrList.pm 2024-06-03
07:39:19.620985000 +0900
@@ -190,79 +190,79 @@
sub get_addr_entry {
my ($self, $addr, $signedby) = @_;
my $entry = { addr => $addr,
exists_p => 0,
msgcount => 0,
totscore => 0,
signedby => $signedby,
};
my ($email, $ip) = $self->_unpack_addr($addr);
return $entry unless $email ne '' && (defined $ip || defined
$signedby);
my $sql;
my $sth;
my $rc;
if($self->{main}->{conf}->{txrep_welcomelist_out} and ($email =~
/(?:[^\s\@]+)\@(?:[^\s\@]+)/)) {
$sql = "SELECT msgcount, totscore FROM $self->{tablename} " .
"WHERE username = ? AND email = ? AND ip =
'WELCOMELIST_OUT'";
$sth = $self->{dbh}->prepare($sql);
unless (defined($sth)) {
info("auto-welcomelist: sql-based get_addr_entry %s: SQL prepare
error: %s",
"$self->{_username}|$ip", $self->{dbh}->errstr);
}
$rc = $sth->execute($self->{_username}, $email);
my $cnt = 0;
my $aryref;
# 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->{msgcount} && defined $aryref->[1]) {
$entry->{msgcount} = $aryref->[0];
$entry->{totscore} = $aryref->[1];
}
$entry->{exists_p} = 1;
$cnt++;
}
$sth->finish();
- return $entry if $rc;
+ return $entry if $rc>=1;
}
undef $sth;
undef $rc;
$sql = "SELECT msgcount, totscore FROM $self->{tablename} " .
"WHERE username = ? AND email = ?";
Here $rc is dualvar.
https://metacpan.org/pod/DBI#execute
'if $rc' will be true even if the number of cases is zero.
I noticed this while doing $sa->check in the test environment.
* 3.2 TXREP TXREP: Score normalizing based on sender's reputation
* [EMAILIP: u...@host.com, rep: 24.34, count: 1] <--- This line
will not appear without patch above.
* [DOMAIN: host.com, rep: 4.87, count: 32]
* [IP: 123.123.123.123, rep: 6.35, count: 34]
if($self->{main}->{conf}->{txrep_welcomelist_out} and ($email =~
/(?:[^\s\@]+)\@(?:[^\s\@]+)/)) {
Entering the if branch above will always return $entry.
This seems to be a pretty big bug.
Thanks.