From 1d2fdfab569e363c420506d0e5192bc5c0443ed5 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Wed, 1 Mar 2017 13:12:01 +0200 Subject: [PATCH] [Fix] Antivirus module: register virtual symbols for patterns --- src/plugins/lua/antivirus.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua index c7664f6d1..97e9c0ecf 100644 --- a/src/plugins/lua/antivirus.lua +++ b/src/plugins/lua/antivirus.lua @@ -677,11 +677,20 @@ if opts and type(opts) == 'table' then if not cb then rspamd_logger.errx(rspamd_config, 'cannot add rule: "' .. k .. '"') else - rspamd_config:register_symbol({ + local id = rspamd_config:register_symbol({ type = 'normal', name = m['symbol'], callback = cb, }) + if m['patterns'] then + for sym in pairs(m['patterns']) do + rspamd_config:register_symbol({ + type = 'virtual', + name = sym, + parent = id + }) + end + end if m['score'] then -- Register metric symbol local description = 'antivirus symbol' -- 2.39.5