commit 77e5945: [Minor] Implement generic whitelist in reputation plugin

Vsevolod Stakhov vsevolod at highsecure.ru
Sat May 18 13:42:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-05-18 14:36:10 +0100
URL: https://github.com/rspamd/rspamd/commit/77e594517c2966657efc7f9cf47e07062f0d47eb

[Minor] Implement generic whitelist in reputation plugin

---
 src/plugins/lua/reputation.lua | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua
index 06fda45a6..5487020c1 100644
--- a/src/plugins/lua/reputation.lua
+++ b/src/plugins/lua/reputation.lua
@@ -27,6 +27,7 @@ local rspamd_logger = require "rspamd_logger"
 local rspamd_util = require "rspamd_util"
 local lua_util = require "lua_util"
 local lua_maps = require "lua_maps"
+local lua_maps_exprs = require "lua_maps_expressions"
 local hash = require 'rspamd_cryptobox_hash'
 local lua_redis = require "lua_redis"
 local fun = require "fun"
@@ -1022,8 +1023,8 @@ local function is_rule_applicable(task, rule)
     end
   end
 
-  if rule.selector.config.whitelisted_ip_map then
-    if rule.config.whitelisted_ip_map:get_key(ip) then
+  if rule.config.whitelist_map then
+    if rule.config.whitelist_map:process(task) then
       return false
     end
   end
@@ -1114,10 +1115,9 @@ local function parse_rule(name, tbl)
   tbl.backend = nil
   rule.config = lua_util.override_defaults(rule.config, tbl)
 
-  if rule.config.whitelisted_ip then
-    rule.config.whitelisted_ip_map = lua_maps.rspamd_map_add_from_ucl(rule.whitelisted_ip,
-      'radix',
-      'Reputation whitelist for ' .. name)
+  if rule.config.whitelist then
+    rule.config.whitelist_map = lua_maps_exprs.create(rspamd_config,
+        rule.config.whitelist, N)
   end
 
   local symbol = name


More information about the Commits mailing list