]> source.dussan.org Git - rspamd.git/commitdiff
rbl.lua: Fix issues with application of whitelists 303/head
authorAndrew Lewis <nerf@judo.za.org>
Tue, 23 Jun 2015 15:32:19 +0000 (17:32 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 23 Jun 2015 15:33:05 +0000 (17:33 +0200)
src/plugins/lua/rbl.lua

index c524c5bf1d7c8cd6c3b5eaaea8ec8f607d6ab6ec..62d1a8bd9ca94b9bc826c4903e454f4304319060 100644 (file)
@@ -370,9 +370,13 @@ for key,rbl in pairs(opts['rbls']) do
             if not foundException then
               table.insert(white_symbols, s)
             end
+          else
+              table.insert(white_symbols, s)
           end
         else
-          table.insert(black_symbols, s)
+          if rbl['ignore_whitelists'] == false then
+            table.insert(black_symbols, s)
+          end
         end
       end
     end
@@ -383,7 +387,24 @@ for key,rbl in pairs(opts['rbls']) do
   if type(rspamd_config.get_api_version) ~= 'nil' and rbl['symbol'] then
     rspamd_config:register_virtual_symbol(rbl['symbol'], 1, id)
     if(rbl['is_whitelist']) then
-      table.insert(white_symbols, rbl['symbol'])
+          if type(rbl['whitelist_exception']) == 'string' then
+            if (rbl['whitelist_exception'] ~= rbl['symbol']) then
+              table.insert(white_symbols, rbl['symbol'])
+            end
+          elseif type(rbl['whitelist_exception']) == 'table' then
+            local foundException = false
+            for _, e in pairs(rbl['whitelist_exception']) do
+              if e == s then
+                foundException = true
+                break
+              end
+            end
+            if not foundException then
+              table.insert(white_symbols, rbl['symbol'])
+            end
+          else
+            table.insert(white_symbols, rbl['symbol'])
+          end
     else
       if rbl['ignore_whitelists'] == false then
         table.insert(black_symbols, rbl['symbol'])