commit 2266103: [Fix] Spamassassin: Fix pcre_only flags
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Nov 23 11:07:07 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-11-23 11:00:30 +0000
URL: https://github.com/rspamd/rspamd/commit/22661039ec1530c3f6c18bb96431aecfc7e03b5a (HEAD -> master)
[Fix] Spamassassin: Fix pcre_only flags
---
src/plugins/lua/spamassassin.lua | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 07ffd193a..691930bb1 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -189,6 +189,7 @@ end
local function is_pcre_only(name)
if pcre_only_regexps[name] then
+ rspamd_logger.infox(rspamd_config, 'mark re %s as PCRE only', name)
return true
end
return false
@@ -1664,16 +1665,18 @@ end
local has_rules = false
if type(section) == "table" then
+ if type(section.pcre_only) == 'table' then
+ pcre_only_regexps = lua_util.list_to_hash(section.pcre_only)
+ end
+ if type(section.alpha) == 'number' then
+ meta_score_alpha = section.alpha
+ end
+ if type(section.match_limit) == 'number' then
+ match_limit = section.match_limit
+ end
+
for k, fn in pairs(section) do
- if k == 'alpha' and type(fn) == 'number' then
- meta_score_alpha = fn
- elseif k == 'match_limit' and type(fn) == 'number' then
- match_limit = fn
- elseif k == 'pcre_only' and type(fn) == 'table' then
- for _,s in ipairs(fn) do
- pcre_only_regexps[s] = 1
- end
- else
+ if k ~= 'pcre_only' and k ~= 'alpha' and k ~= 'match_limit' then
if type(fn) == 'table' then
for _, elt in ipairs(fn) do
local files = util.glob(elt)
More information about the Commits
mailing list