[pmg-devel] [PATCH pmg-api 1/7] ruledb: spam: adapt to spamassassin 4.0.0
Stoiko Ivanov
s.ivanov at proxmox.com
Mon Mar 13 22:23:44 CET 2023
find_all_addrs_in_line was changed to require an instantiated
Mail::SpamAssassin instance in:
https://github.com/apache/spamassassin/commit/139adfb5901b27fa13dccbf3a66c53ca7613f733
(read-only git mirror of the authoritative SVN)
Noticed while using `mutt` and bouncing mails, which adds Resent
headers.
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
src/PMG/RuleDB/Spam.pm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/PMG/RuleDB/Spam.pm b/src/PMG/RuleDB/Spam.pm
index 14d7bea..a0b8f26 100644
--- a/src/PMG/RuleDB/Spam.pm
+++ b/src/PMG/RuleDB/Spam.pm
@@ -300,13 +300,13 @@ sub __get_addr {
# because we do not call spamassassin in canes of commtouch match
# see Mail::Spamassassin:PerMsgStatus for details
sub __all_from_addrs {
- my ($head) = @_;
+ my ($head, $spamtest) = @_;
my @addrs;
my $resent = $head->get('Resent-From');
if (defined($resent) && $resent =~ /\S/) {
- @addrs = Mail::SpamAssassin->find_all_addrs_in_line($resent);
+ @addrs = $spamtest->find_all_addrs_in_line($resent);
} else {
@addrs = map { tr/././s; $_ } grep { $_ ne '' }
(__get_addr($head, 'From'), # std
@@ -330,6 +330,8 @@ sub analyze_spam {
$maxspamsize = 200*1024 if !$maxspamsize;
+ my $spamtest = $queue->{sa};
+
my ($sa_score, $sa_max, $sa_scores, $sa_sumary, $list, $autolearn, $bayes, $loglist);
$list = '';
$loglist = '';
@@ -345,7 +347,7 @@ sub analyze_spam {
}
my $fromhash = { $queue->{from} => 1 };
- foreach my $f (__all_from_addrs($entity->head())) {
+ foreach my $f (__all_from_addrs($entity->head(), $spamtest)) {
$fromhash->{$f} = 1;
}
$queue->{all_from_addrs} = [ keys %$fromhash ];
@@ -373,8 +375,6 @@ sub analyze_spam {
my ($csec, $usec) = gettimeofday ();
- my $spamtest = $queue->{sa};
-
# only run SA in testmode or when clamav_heuristic did not confirm spam (score < 5)
if ($msginfo->{testmode} || ($sa_score < 5)) {
--
2.30.2
More information about the pmg-devel
mailing list