From: Andrew Lewis Date: Wed, 1 Mar 2017 11:12:01 +0000 (+0200) Subject: [Fix] Antivirus module: register virtual symbols for patterns X-Git-Tag: 1.5.0~2^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1464%2Fhead;p=rspamd.git [Fix] Antivirus module: register virtual symbols for patterns --- 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'