[pmg-devel] [PATCH pmg-api 1/2] user-bl: use custom description of USER_IN_BLACKLIST consistently

Stoiko Ivanov s.ivanov at proxmox.com
Mon Nov 28 19:17:28 CET 2022


The USER_IN_BLACKLIST spamassassin hit is created by the Spam What
object, if the sending e-mail is in the receivers blacklist.
This 'hit' is kept on the PMG only - it is not written to the SPAMINFO
macro - and only visible in the quarantine interface afaict.

The description shown in the quarantine interface, however is read
from SpamAssassin sources.

They have recently changed to include a 'DEPRECATED' prefix, since the
rules containing 'blacklist' and 'whitelist' have been renamed to
'blocklist' and 'welcomelist' for the upcoming 4.0 series of
spamassassin.

In any case we should keep our description consistent, thus the move
to a sub of its own for reusing in both locations.

The mechanism for welcomlisted/whitelisted mails does not create an
'internal' sa-rule (but simply drops the SA hits for analysis) - so no
symmetric change is needed.

Reported-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PMG/RuleDB/Spam.pm | 2 +-
 src/PMG/Utils.pm       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/PMG/RuleDB/Spam.pm b/src/PMG/RuleDB/Spam.pm
index bc1d422..d7bfb63 100644
--- a/src/PMG/RuleDB/Spam.pm
+++ b/src/PMG/RuleDB/Spam.pm
@@ -221,7 +221,7 @@ sub what_match_targets {
 		sa_data => [{
 		    rule => 'USER_IN_BLACKLIST',
 		    score => 100,
-		    desc => 'From: address is in the user black-list',
+		    desc => PMG::Utils::user_bl_description(),
 		}],
 		sa_hits => 'USER_IN_BLACKLIST',
 	    };
diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index e20fc91..b9b1478 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -1166,6 +1166,10 @@ sub bencode_header {
     return $res;
 }
 
+sub user_bl_description {
+    return 'From: address is in the user black-list';
+}
+
 sub load_sa_descriptions {
     my ($additional_dirs) = @_;
 
@@ -1202,6 +1206,7 @@ sub load_sa_descriptions {
     }
 
     $res->{'ClamAVHeuristics'}->{desc} = "ClamAV heuristic tests";
+    $res->{'USER_IN_BLACKLIST'}->{desc} = user_bl_description();;
 
     return $res;
 }
-- 
2.30.2





More information about the pmg-devel mailing list