]> source.dussan.org Git - rspamd.git/commitdiff
Fix multimap module if there is only one rule for it.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 15 Oct 2010 17:33:27 +0000 (21:33 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 15 Oct 2010 17:33:27 +0000 (21:33 +0400)
src/plugins/lua/multimap.lua

index 6e949b721af97e01eefbb0c1cf4347c778dbd0af..fa049d3b58a6e2eca1f901d57b8976f3641543f8 100644 (file)
@@ -133,10 +133,17 @@ local opts =  rspamd_config:get_all_opt('multimap')
 if opts then
        local strrules = opts['rule']
        if strrules then
-               for _,value in ipairs(strrules) do
-                       local params = split(value, ',')
+               if type(strrules) == 'array' then 
+                       for _,value in ipairs(strrules) do
+                               local params = split(value, ',')
+                               if not add_rule (params) then
+                                       rspamd_logger:err('cannot add rule: "'..value..'"')
+                               end
+                       end
+               elseif type(strrules) == 'string' then
+                       local params = split(strrules, ',')
                        if not add_rule (params) then
-                               rspamd_logger:err('cannot add rule: "'..value..'"')
+                               rspamd_logger:err('cannot add rule: "'..strrules..'"')
                        end
                end
        end