diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-25 16:46:24 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-25 16:46:56 +0100 |
commit | 27517142cf5364fd8cc8532e76e18adb8cf11a4d (patch) | |
tree | 02afe1ada5241b9cfaf4d86f5cf9a4ebae15f9eb /src | |
parent | ade28944a126040408f005971589d64f16332dbc (diff) | |
download | rspamd-27517142cf5364fd8cc8532e76e18adb8cf11a4d.tar.gz rspamd-27517142cf5364fd8cc8532e76e18adb8cf11a4d.zip |
[Fix] Allow to parse SA rules with no spaces around =~ (dirty hack)
Issue: #2372
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 8 |
1 files changed, 3 insertions, 5 deletions
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 |