]> git.proxmox.com Git - pmg-api.git/commitdiff
utils: ignore leading whitespace in sa description
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 19 Nov 2020 15:48:39 +0000 (16:48 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 25 Nov 2020 09:19:55 +0000 (10:19 +0100)
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>
src/PMG/Utils.pm

index 8a7021dc9fe40f7f25c85fd879ffec837427a669..d3fae9e90b1478366a6dfc3941515185421cbc70 100644 (file)
@@ -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;