diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-06-02 21:23:12 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-06-02 21:23:12 +0100 |
commit | 101b8021a09eed4bdd5047c3dd1d4bc447ffddad (patch) | |
tree | 78066af25c03da037b036a6d3df172ccaff5cc3c /src/plugins/lua | |
parent | 068dd8ec2b7bc4b714ff3e41f4f194c8779329e8 (diff) | |
download | rspamd-101b8021a09eed4bdd5047c3dd1d4bc447ffddad.tar.gz rspamd-101b8021a09eed4bdd5047c3dd1d4bc447ffddad.zip |
[Fix] Properly parse expressions atoms
Issue: #4181
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/force_actions.lua | 2 | ||||
-rw-r--r-- | src/plugins/lua/multimap.lua | 2 | ||||
-rw-r--r-- | src/plugins/lua/settings.lua | 10 | ||||
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/lua/force_actions.lua b/src/plugins/lua/force_actions.lua index 4704b849b..c0c023fae 100644 --- a/src/plugins/lua/force_actions.lua +++ b/src/plugins/lua/force_actions.lua @@ -38,7 +38,7 @@ local function gen_cb(params) local function parse_atom(str) local atom = table.concat(fun.totable(fun.take_while(function(c) - if string.find(', \t()><+!|&\n', c) then + if string.find(', \t()><+!|&\n', c, 1, true) then return false end return true diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index edc54443d..31891fc6a 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -1195,7 +1195,7 @@ local function add_multimap_rule(key, newrule) local function parse_atom(str) local atom = table.concat(fun.totable(fun.take_while(function(c) - if string.find(', \t()><+!|&\n', c) then + if string.find(', \t()><+!|&\n', c, 1, true) then return false end return true diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index ead8ced8e..94e1b2327 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -848,7 +848,7 @@ local function process_settings_table(tbl, allow_ids, mempool, is_static) if not checks[safe_key] then checks[safe_key] = cond - aliases[safe_key] = true + aliases[full_key] = true end return safe_key @@ -943,7 +943,11 @@ local function process_settings_table(tbl, allow_ids, mempool, is_static) -- Count checks and create Rspamd expression from a set of rules local nchecks = 0 - for _,_ in pairs(checks) do nchecks = nchecks + 1 end + for k,_ in pairs(checks) do + if not aliases[k] then + nchecks = nchecks + 1 + end + end if nchecks > 0 then -- Now we can deal with the expression! @@ -970,7 +974,7 @@ local function process_settings_table(tbl, allow_ids, mempool, is_static) -- Parse expression's sanity local function parse_atom(str) local atom = table.concat(fun.totable(fun.take_while(function(c) - if string.find(', \t()><+!|&\n', c) then + if string.find(', \t()><+!|&\n', c, 1, true) then return false end return true diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 2e332d198..c98203fb6 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -1170,7 +1170,7 @@ end local function parse_atom(str) local atom = table.concat(fun.totable(fun.take_while(function(c) - if string.find(', \t()><+!|&\n', c) then + if string.find(', \t()><+!|&\n', c, 1, true) then return false end return true |