local r = nil
local h = nil -- radix tree and hash table
-function check_whitelist (task)
+local function check_whitelist (task)
if symbol_ip then
-- check client's ip
local ipn = task:get_from_ip_num()
local opts = rspamd_config:get_all_opt('whitelist')
if opts then
if opts['symbol_ip'] or opts['symbol_from'] then
- symbol_ip = opts['symbol_ip']
- symbol_from = opts['symbol_from']
+ local symbol_ip = opts['symbol_ip']
+ local symbol_from = opts['symbol_from']
if symbol_ip then
if opts['ip_whitelist'] then
-- Register symbol's callback
- if symbol_ip then
- rspamd_config:register_symbol(symbol_ip, 1.0, 'check_whitelist')
- elseif symbol_from then
- rspamd_config:register_symbol(symbol_from, 1.0, 'check_whitelist')
+ if symbol_ip or symbol_from then
+ rspamd_config:register_callback_symbol_priority('WHITELIST', 1.0, -1, check_whitelist)
+ if symbol_from then
+ rspamd_config:register_virtual_symbol(symbol_from, 1.0)
+ end
+ if symbol_ip then
+ rspamd_config:register_virtual_symbol(symbol_ip, 1.0)
+ end
end
end
end