From d7dfc173fd4b0aee5feb9d269aa76353c8254ae9 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Tue, 23 Jun 2015 17:32:19 +0200 Subject: [PATCH] rbl.lua: Fix issues with application of whitelists --- src/plugins/lua/rbl.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index 6a4d5024c..544619a0b 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -368,9 +368,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 @@ -381,7 +385,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) 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']) -- 2.39.5