public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api] utils: ignore leading whitespace in sa description
@ 2020-11-19 15:48 Stoiko Ivanov
  2020-11-25  9:20 ` [pmg-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2020-11-19 15:48 UTC (permalink / raw)
  To: pmg-devel

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pmg-devel] applied: [PATCH pmg-api] utils: ignore leading whitespace in sa description
  2020-11-19 15:48 [pmg-devel] [PATCH pmg-api] utils: ignore leading whitespace in sa description Stoiko Ivanov
@ 2020-11-25  9:20 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2020-11-25  9:20 UTC (permalink / raw)
  To: Stoiko Ivanov, pmg-devel

On 19.11.20 16:48, Stoiko Ivanov wrote:
> 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(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-25  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 15:48 [pmg-devel] [PATCH pmg-api] utils: ignore leading whitespace in sa description Stoiko Ivanov
2020-11-25  9:20 ` [pmg-devel] applied: " Thomas Lamprecht

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