From: Vsevolod Stakhov Date: Thu, 12 Oct 2017 18:44:48 +0000 (+0100) Subject: [Minor] Use config field X-Git-Tag: 1.7.0~563 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5c9b5f6021df9c560a81df2cbafd6bb3239c0a4;p=thirdparty%2Frspamd.git [Minor] Use config field --- diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index e51ed32997..4389d72b5e 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -291,18 +291,18 @@ local backends = { } local function is_rule_applicable(task, rule) - if rule.outbound then + if rule.config.outbound then if not (task:get_user() or (ip and ip:is_local())) then return false end - elseif rule.inbound then + elseif rule.config.inbound then if task:get_user() or (ip and ip:is_local()) then return false end end - if rule.whitelisted_ip_map then - if rule.whitelisted_ip_map:get_key(task:get_from_ip()) then + if rule.config.whitelisted_ip_map then + if rule.config.whitelisted_ip_map:get_key(task:get_from_ip()) then return false end end @@ -390,7 +390,8 @@ local function parse_rule(name, tbl) -- Allow config override local rule = { selector = deepcopy(selector), - backend = deepcopy(backend) + backend = deepcopy(backend), + config = {} } -- Override default config params @@ -399,8 +400,8 @@ local function parse_rule(name, tbl) -- Generic options override_defaults(rule.config, tbl) - if rule.whitelisted_ip then - rule.whitelisted_ip_map = lua_maps.rspamd_map_add_from_ucl(rule.whitelisted_ip, + if rule.config.whitelisted_ip then + rule.config.whitelisted_ip_map = lua_maps.rspamd_map_add_from_ucl(rule.whitelisted_ip, 'radix', 'Reputation whiteliist for ' .. name) end