From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id B691992302 for ; Mon, 13 Mar 2023 22:24:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9585118C39 for ; Mon, 13 Mar 2023 22:24:12 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 13 Mar 2023 22:24:08 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3810045788 for ; Mon, 13 Mar 2023 22:24:08 +0100 (CET) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Mon, 13 Mar 2023 22:23:44 +0100 Message-Id: <20230313212351.111977-2-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230313212351.111977-1-s.ivanov@proxmox.com> References: <20230313212351.111977-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.108 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_NUMSUBJECT 0.5 Subject ends in numbers excluding current years SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH pmg-api 1/7] ruledb: spam: adapt to spamassassin 4.0.0 X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Mar 2023 21:24:42 -0000 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 --- 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