public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] utils: ignore leading whitespace in sa description
Date: Thu, 19 Nov 2020 16:48:39 +0100	[thread overview]
Message-ID: <20201119154839.4740-1-s.ivanov@proxmox.com> (raw)

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@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





             reply	other threads:[~2020-11-19 15:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 15:48 Stoiko Ivanov [this message]
2020-11-25  9:20 ` [pmg-devel] applied: " 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=20201119154839.4740-1-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal