]> source.dussan.org Git - rspamd.git/commitdiff
Add whitelist_exception setting to RBL module
authorAndrew Lewis <nerf@judo.za.org>
Mon, 22 Jun 2015 19:40:21 +0000 (21:40 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 22 Jun 2015 19:55:31 +0000 (21:55 +0200)
doc/markdown/modules/rbl.md
src/plugins/lua/rbl.lua

index 33c3a4c18001ac2fa9ed25b8b9838f5c57abc348..b5f797fd300eed7964286a90ad6d35f647f68ced 100644 (file)
@@ -105,3 +105,8 @@ an_rbl {
 }
 ~~~
 
+The following extra settings are valid in the RBL subsection:
+
+- whitelist_exception
+
+(For whitelists) - Symbols named as parameters for this setting will not be used for neutralising blacklists (set this multiple times to add multiple exceptions).
index eddb4c77bcaab263f8375d0ecbf3c0230ba0e494..6a4d5024c1090aa2766203af7350a5822d1808f4 100644 (file)
@@ -353,7 +353,22 @@ for key,rbl in pairs(opts['rbls']) do
       if type(rspamd_config.get_api_version) ~= 'nil' then
         rspamd_config:register_virtual_symbol(s, 1)
         if(rbl['is_whitelist']) then
-          table.insert(white_symbols, s)
+          if type(rbl['whitelist_exception']) == 'string' then
+            if (rbl['whitelist_exception'] ~= s) then
+              table.insert(white_symbols, s)
+            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, s)
+            end
+          end
         else
           table.insert(black_symbols, s)
         end