Procházet zdrojové kódy

[Fix] Properly parse expressions atoms

Issue: #4181
tags/3.3
Vsevolod Stakhov před 2 roky
rodič
revize
101b8021a0
Žádný účet není propojen s e-mailovou adresou tvůrce revize

+ 1
- 1
lualib/lua_maps_expressions.lua Zobrazit soubor

@@ -174,7 +174,7 @@ local function create(cfg, obj, module_name)
-- Now process and parse expression
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

+ 1
- 1
src/plugins/lua/force_actions.lua Zobrazit soubor

@@ -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

+ 1
- 1
src/plugins/lua/multimap.lua Zobrazit soubor

@@ -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

+ 7
- 3
src/plugins/lua/settings.lua Zobrazit soubor

@@ -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

+ 1
- 1
src/plugins/lua/spamassassin.lua Zobrazit soubor

@@ -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

Načítá se…
Zrušit
Uložit