From: Vsevolod Stakhov Date: Wed, 25 Jul 2018 15:46:24 +0000 (+0100) Subject: [Fix] Allow to parse SA rules with no spaces around =~ (dirty hack) X-Git-Tag: 1.7.9~42 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=27517142cf5364fd8cc8532e76e18adb8cf11a4d;p=rspamd.git [Fix] Allow to parse SA rules with no spaces around =~ (dirty hack) Issue: #2372 --- diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 649abc51f..39ca8e327 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -152,10 +152,6 @@ local function replace_symbol(s) return rspamd_symbol, true end -local function trim(s) - return s:match "^%s*(.-)%s*$" -end - local ffi if type(jit) == 'table' then ffi = require("ffi") @@ -702,7 +698,9 @@ local function process_sa_conf(f) local if_nested = 0 for l in f:lines() do (function () - l = trim(l) + l = lua_util.rspamd_str_trim(l) + -- Replace bla=~/re/ with bla =~ /re/ (#2372) + l = l:gsub('([^%s])%s*=~%s*([^%s])', '%1 =~ %2') if string.len(l) == 0 or string.sub(l, 1, 1) == '#' then return