[pmg-devel] [PATCH pmg-api] utils: ignore leading whitespace in sa description

Stoiko Ivanov s.ivanov at proxmox.com
Thu Nov 19 16:48:39 CET 2020


load_sa_descriptions is used to parse the 'describe' lines for SpamAssassin
rules for the SpamInfo in the quarantine view.

The regex for parsing is too strict, since config lines can contain
leading whitespace (e.g. due to indentation in an 'ifplugin' block)

checked Mail::SpamAssassin::Conf::Parser and they strip leading/trailing
whitespace as well.

tested on my local setup with a quarantined mail which hit KAM_DMARC_STATUS.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
reported in our community forum:
https://forum.proxmox.com/threads/consultation-about-the-meaning-of-some-pmg-smtp-filter-intercept-parameters.78962/

 src/PMG/Utils.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index 8a7021d..d3fae9e 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -1164,7 +1164,7 @@ sub load_sa_descriptions {
 	return if !defined($fh);
 
 	while (defined(my $line = <$fh>)) {
-	    if ($line =~ m/^describe\s+(\S+)\s+(.*)\s*$/) {
+	    if ($line =~ m/^(?:\s*)describe\s+(\S+)\s+(.*)\s*$/) {
 		my ($name, $desc) = ($1, $2);
 		next if $res->{$name};
 		$res->{$name}->{desc} = $desc;
-- 
2.20.1





More information about the pmg-devel mailing list