From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api 1/7] ruledb: spam: adapt to spamassassin 4.0.0
Date: Mon, 13 Mar 2023 22:23:44 +0100 [thread overview]
Message-ID: <20230313212351.111977-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20230313212351.111977-1-s.ivanov@proxmox.com>
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@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
next prev parent reply other threads:[~2023-03-13 21:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 21:23 [pmg-devel] [PATCH pmg-api 0/7] adapt to SpamAssassin 4.0.0 Stoiko Ivanov
2023-03-13 21:23 ` Stoiko Ivanov [this message]
2023-03-13 21:23 ` [pmg-devel] [PATCH pmg-api 2/7] templates: sync spamassassin templates with 4.0.0 upstream Stoiko Ivanov
2023-03-13 21:23 ` [pmg-devel] [PATCH pmg-api 3/7] templates: add template for spamassassin's v342.pre Stoiko Ivanov
2023-03-13 21:23 ` [pmg-devel] [PATCH pmg-api 4/7] templates: add template for spamassassin's v400.pre Stoiko Ivanov
2023-03-13 21:23 ` [pmg-devel] [PATCH pmg-api 5/7] config: add spam option for extract_text Stoiko Ivanov
2023-03-13 21:23 ` [pmg-devel] [PATCH pmg-api 6/7] templates: enable DecodeShortUrls for SpamAssassin 4.0.0 Stoiko Ivanov
2023-03-13 21:23 ` [pmg-devel] [PATCH pmg-api 7/7] templates: enable DMARC plugin in v400.pre.in Stoiko Ivanov
2023-03-13 21:23 ` [pmg-devel] [PATCH pmg-gui 1/1] spamdetector: add extract_text option Stoiko Ivanov
2023-03-27 18:06 ` [pmg-devel] applied: " Thomas Lamprecht
2023-03-15 15:55 ` [pmg-devel] applied: [PATCH pmg-api 0/7] adapt to SpamAssassin 4.0.0 Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230313212351.111977-2-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox