aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/external_services.lua
diff options
context:
space:
mode:
authorCarsten Rosenberg <c.rosenberg@heinlein-support.de>2021-01-15 17:49:25 +0100
committerCarsten Rosenberg <c.rosenberg@heinlein-support.de>2021-03-18 09:36:42 +0100
commitcc7c38bd4361ae99e4b0a82cb07d56cb87cd764b (patch)
treed50c0b3696790abfc33bee261d29c7eb84341d10 /src/plugins/lua/external_services.lua
parente4f459ef31aed15751edd9ae77f6183b7da3b7b4 (diff)
downloadrspamd-cc7c38bd4361ae99e4b0a82cb07d56cb87cd764b.tar.gz
rspamd-cc7c38bd4361ae99e4b0a82cb07d56cb87cd764b.zip
[Minor] lua_scanners - fix symbol registration
Diffstat (limited to 'src/plugins/lua/external_services.lua')
-rw-r--r--src/plugins/lua/external_services.lua38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/plugins/lua/external_services.lua b/src/plugins/lua/external_services.lua
index 37665378c..2dd55e360 100644
--- a/src/plugins/lua/external_services.lua
+++ b/src/plugins/lua/external_services.lua
@@ -142,6 +142,12 @@ local function add_scanner_rule(sym, opts)
if not rule.symbol_fail then
rule.symbol_fail = rule.symbol .. '_FAIL'
end
+ if not rule.symbol_encrypted then
+ rule.symbol_encrypted = rule.symbol .. '_ENCRYPTED'
+ end
+ if not rule.symbol_macro then
+ rule.symbol_macro = rule.symbol .. '_MACRO'
+ end
rule.redis_params = redis_params
@@ -283,7 +289,37 @@ if opts and type(opts) == 'table' then
end
end
end
-
+ if type(m['patterns_fail']) == 'table' then
+ if m['patterns_fail'][1] then
+ for _, p in ipairs(m['patterns_fail']) do
+ if type(p) == 'table' then
+ for sym in pairs(p) do
+ rspamd_logger.debugm(N, rspamd_config, 'registering: %1', {
+ type = 'virtual',
+ name = sym,
+ parent = m['symbol'],
+ parent_id = id,
+ })
+ rspamd_config:register_symbol({
+ type = 'virtual',
+ name = sym,
+ parent = id,
+ group = N
+ })
+ end
+ end
+ end
+ else
+ for sym in pairs(m['patterns_fail']) do
+ rspamd_config:register_symbol({
+ type = 'virtual',
+ name = sym,
+ parent = id,
+ group = N
+ })
+ end
+ end
+ end
if m.symbols then
local function reg_symbols(tbl)
for _,sym in pairs(tbl) do