Bug 7740 - Cannot set OLEMacro regex options
Summary: Cannot set OLEMacro regex options
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Plugins (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: PC Linux
: P2 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-21 12:51 UTC by Marcel
Modified: 2019-08-09 13:58 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel 2019-07-21 12:51:19 UTC
In my SpamAssassin Config:


> ifplugin Mail::SpamAssassin::Plugin::OLEMacro
> olemacro_max_file 512000
> olemacro_num_mime 5
> olemacro_num_zip 5
> olemacro_zip_depth 2
> olemacro_extended_scan 0
> olemacro_exts (?:doc|docx|dot|pot|ppa|pps|ppt|rtf|sldm|xl|xla|xls|xlsx|xlt|xslb)$
> olemacro_macro_exts (?:docm|dotm|ppam|potm|ppst|ppsm|pptm|sldm|xlm|xlam|xlsb|xlsm|xltm|xps)$
> olemacro_zips (?:zip)$
> olemacro_skip_exts (?:dotx|potx|ppsx|pptx|sldx|xltx)$
> olemacro_skip_ctypes ^(?:(audio|image|text)\/|application\/(?:pdf))
> olemacro_prefer_contentdisposition 1
> endif

Running spamassassin ---lint I get these errors:
> Jul 21 05:55:07.773 [15957] warn: config: SpamAssassin failed to parse line, "(?:doc|docx|dot|pot|ppa|pps|ppt|rtf|sldm|xl|xla|xls|xlsx|xlt|xslb)$" is not valid for "olemacro_exts", skipping: olemacro_exts (?:doc|docx|dot|pot|ppa|pps|ppt|rtf|sldm|xl|xla|xls|xlsx|xlt|xslb)$
> Jul 21 05:55:07.773 [15957] warn: config: SpamAssassin failed to parse line, "(?:docm|dotm|ppam|potm|ppst|ppsm|pptm|sldm|xlm|xlam|xlsb|xlsm|xltm|xps)$" is not valid for "olemacro_macro_exts", skipping: olemacro_macro_exts (?:docm|dotm|ppam|potm|ppst|ppsm|pptm|sldm|xlm|xlam|xlsb|xlsm|xltm|xps)$
> Jul 21 05:55:07.774 [15957] warn: config: SpamAssassin failed to parse line, "(?:zip)$" is not valid for "olemacro_zips", skipping: olemacro_zips (?:zip)$
> Jul 21 05:55:07.774 [15957] warn: config: SpamAssassin failed to parse line, "(?:dotx|potx|ppsx|pptx|sldx|xltx)$" is not valid for "olemacro_skip_exts", skipping: olemacro_skip_exts (?:dotx|potx|ppsx|pptx|sldx|xltx)$
> Jul 21 05:55:07.774 [15957] warn: config: SpamAssassin failed to parse line, "^(?:(audio|image|text)\/|application\/(?:pdf))" is not valid for "olemacro_skip_ctypes", skipping: olemacro_skip_ctypes ^(?:(audio|image|text)\/|application\/(?:pdf))

This seems to be a duplicate of this bug that was fixed in the spamassassin-olemacro repo but wasn't carried over when it was included in SpamAssassin:

https://github.com/fmbla/spamassassin-olemacro/issues/1

I'm sure that wrapping the regex check in regex delimiters like '/'.$value.'/' would likely fix it too.


My setup:
# spamassassin -V
SpamAssassin version 3.4.3-rc3 running on Perl version 5.16.3
Comment 1 Henrik Krohns 2019-07-21 13:49:07 UTC
Fixed regex stuff. Documentation doesn't imply that /foo/ delimiters would be supported, so they are still unsupported.

Sending        spamassassin-3.4/lib/Mail/SpamAssassin/Plugin/OLEMacro.pm
Sending        trunk/lib/Mail/SpamAssassin/Plugin/OLEMacro.pm
Transmitting file data ..done
Committing transaction...
Committed revision 1863524.
Comment 2 Marcel 2019-07-21 14:01:43 UTC
Thanks Henrik that looks like it fixed it :)
Comment 3 Marcel 2019-08-09 13:27:56 UTC
Sorry Henrik it looks like this is still broken. You said that /foo/ delimiters would be not be supported but I still get errors when I try to use the old syntax:

My config:
>ifplugin Mail::SpamAssassin::Plugin::OLEMacro
>olemacro_num_mime 5
>olemacro_num_zip 5
>olemacro_zip_depth 2
>olemacro_extended_scan 0
>olemacro_prefer_contentdisposition 1
>olemacro_max_file 512000
>olemacro_exts (?:doc|docx|dot|pot|ppa|pps|ppt|rtf|sldm|xl|xla|xls|xlsx|xlt|xslb)$
>olemacro_macro_exts (?:docm|dotm|ppam|potm|ppst|ppsm|pptm|sldm|xlm|xlam|xlsb|xlsm|xltm|xps)$
>olemacro_zips (?:zip)$
>olemacro_skip_exts (?:dotx|potx|ppsx|pptx|sldx|xltx)$
>olemacro_skip_ctypes ^(?:(audio|image|text)\/|application\/(?:pdf))
>endif

When restarting my new spamassassin 3.4 build: spamassassin-3.4.3-0.20190809svn1864760.el7.x86_64

>Aug  9 07:08:55 www0 spamd[3909]: config: dup unknown type olemacro_macro_exts, Regexp
>Aug  9 07:08:55 www0 spamd[3909]: config: dup unknown type olemacro_exts, Regexp
>Aug  9 07:08:55 www0 spamd[3909]: config: dup unknown type olemacro_skip_exts, Regexp
>Aug  9 07:08:55 www0 spamd[3909]: config: dup unknown type olemacro_skip_ctypes, Regexp
>Aug  9 07:08:55 www0 spamd[3909]: config: dup unknown type olemacro_zips, Regexp
Comment 4 Henrik Krohns 2019-08-09 13:58:17 UTC
Was the case of SA internals not supporting set_config "default => qr//" thing, apparently tests or I didn't catch it as Conf::clone() is called only on spamd reload(?)... anyway should work now.

Sending        spamassassin-3.4/lib/Mail/SpamAssassin/Conf.pm
Sending        trunk/lib/Mail/SpamAssassin/Conf.pm
Transmitting file data ..done
Committing transaction...
Committed revision 1864805.