]> source.dussan.org Git - rspamd.git/commitdiff
Check type of rule in multimap module.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Nov 2013 00:17:15 +0000 (00:17 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 20 Nov 2013 00:17:15 +0000 (00:17 +0000)
src/plugins/lua/multimap.lua

index a7008b82fb9100d08878e2b0e860f92e82a56581..33ad35a2c01e64f6a0165b4b7690a4bea8b4b4ed 100644 (file)
@@ -282,13 +282,17 @@ end
 local opts =  rspamd_config:get_all_opt('multimap')
 if opts and type(opts) == 'table' then
        for k,m in pairs(opts) do
-               local rule = add_multimap_rule(k, m)
-               if not rule then
-                       rspamd_logger.err('cannot add rule: "'..k..'"')
-               else
-                       if type(rspamd_config.get_api_version) ~= 'nil' then
-                               rspamd_config:register_virtual_symbol(m['symbol'], 1.0)
+               if type(m) == 'table' then
+                       local rule = add_multimap_rule(k, m)
+                       if not rule then
+                               rspamd_logger.err('cannot add rule: "'..k..'"')
+                       else
+                               if type(rspamd_config.get_api_version) ~= 'nil' then
+                                       rspamd_config:register_virtual_symbol(m['symbol'], 1.0)
+                               end
                        end
+               else
+                       rspamd_logger.err('parameter ' .. k .. ' is invalid, must be an object')
                end
        end
        -- add fake symbol to check all maps inside a single callback