]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Antivirus module: register virtual symbols for patterns 1464/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 1 Mar 2017 11:12:01 +0000 (13:12 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 1 Mar 2017 11:12:01 +0000 (13:12 +0200)
src/plugins/lua/antivirus.lua

index c7664f6d1880d8ffa2b2eb2c6472060b816d9ad1..97e9c0ecf83ea9ffe8778dc27197be5a6cd2db54 100644 (file)
@@ -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'