commit 15e3f27: [Minor] Reiterate on the previous changes

Andrew Lewis nerf at judo.za.org
Thu Oct 26 10:07:08 UTC 2023


Author: Andrew Lewis
Date: 2023-10-26 08:40:00 +0200
URL: https://github.com/rspamd/rspamd/commit/15e3f277fad7c692b641423b38d6b508b764a3f8 (refs/pull/4657/head)

[Minor] Reiterate on the previous changes
 - Demote message to info level
 - Name it returncodes_matcher for better specificity

---
 conf/modules.d/rbl.conf                      |  6 +++---
 lualib/plugins/rbl.lua                       | 10 +++++-----
 src/plugins/lua/rbl.lua                      |  8 ++++----
 test/functional/configs/merged-override.conf |  8 ++++----
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/conf/modules.d/rbl.conf b/conf/modules.d/rbl.conf
index cb90d5d31..dcb5661c0 100644
--- a/conf/modules.d/rbl.conf
+++ b/conf/modules.d/rbl.conf
@@ -105,7 +105,7 @@ rbl {
       ipv6 = true;
       checks = ['from', 'received'];
       is_whitelist = true;
-      matcher = "luapattern";
+      returncodes_matcher = "luapattern";
       whitelist_exception = "RCVD_IN_DNSWL";
       whitelist_exception = "RCVD_IN_DNSWL_NONE";
       whitelist_exception = "RCVD_IN_DNSWL_LOW";
@@ -153,7 +153,7 @@ rbl {
       rbl = "dwl.dnswl.org";
       checks = ['dkim'];
       ignore_whitelist = true;
-      matcher = "luapattern";
+      returncodes_matcher = "luapattern";
       unknown = false;
 
       returncodes {
@@ -224,7 +224,7 @@ rbl {
       selector = "specific_urls_filter_map('surbl_hashbl_map', {limit = 10}).apply_methods('get_host', 'get_path').join_tables('/')",
       hash = 'md5';
       hash_len = 32;
-      matcher = "luapattern";
+      returncodes_matcher = "luapattern";
       returncodes = {
         SURBL_HASHBL_PHISH = "127.0.0.8";
         SURBL_HASHBL_MALWARE = "127.0.0.16";
diff --git a/lualib/plugins/rbl.lua b/lualib/plugins/rbl.lua
index 89304baa0..320fd7725 100644
--- a/lualib/plugins/rbl.lua
+++ b/lualib/plugins/rbl.lua
@@ -107,7 +107,6 @@ local rule_schema_tbl = {
   ipv6 = ts.boolean:is_optional(),
   is_whitelist = ts.boolean:is_optional(),
   local_exclude_ip_map = ts.string:is_optional(),
-  matcher = ts.one_of { "equality", "glob", "luapattern", "radix", "regexp" }:is_optional(),
   monitored_address = ts.string:is_optional(),
   no_ip = ts.boolean:is_optional(),
   process_script = ts.string:is_optional(),
@@ -131,6 +130,7 @@ local rule_schema_tbl = {
   return_codes = return_codes_schema:is_optional(),
   returnbits = return_bits_schema:is_optional(),
   returncodes = return_codes_schema:is_optional(),
+  returncodes_matcher = ts.one_of { "equality", "glob", "luapattern", "radix", "regexp" }:is_optional(),
   selector = ts.one_of { ts.string, ts.table }:is_optional(),
   selector_flatten = ts.boolean:is_optional(),
   symbol = ts.string:is_optional(),
@@ -200,16 +200,16 @@ local function convert_checks(rule)
     rule.from = true
   end
 
-  if rule.returncodes and not rule.matcher then
+  if rule.returncodes and not rule.returncodes_matcher then
     for _, v in pairs(rule.returncodes) do
       for _, e in ipairs(v) do
         if e:find('%', 1, true) then
-          rspamd_logger.warnx(rspamd_config, 'implicitly enabling luapattern matcher for rule %s', rule.symbol)
-          rule.matcher = 'luapattern'
+          rspamd_logger.info(rspamd_config, 'implicitly enabling luapattern returncodes_matcher for rule %s', rule.symbol)
+          rule.returncodes_matcher = 'luapattern'
           break
         end
       end
-      if rule.matcher then
+      if rule.returncodes_matcher then
         break
       end
     end
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index d1f2df69c..f2233a3e5 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -894,10 +894,10 @@ local function gen_rbl_callback(rule)
     description[#description + 1] = 'selector'
   end
 
-  if not rule.matcher then
-    rule.matcher = 'equality'
+  if not rule.returncodes_matcher then
+    rule.returncodes_matcher = 'equality'
   end
-  local match = matchers[rule.matcher]
+  local match = matchers[rule.returncodes_matcher]
 
   local callback_f = function(task)
     -- DNS requests to issue (might be hashed afterwards)
@@ -1096,7 +1096,7 @@ local function add_rbl(key, rbl, global_opts)
         def_type, rbl.symbol)
   end
 
-  local match_type = rbl.matcher
+  local match_type = rbl.returncodes_matcher
   if match_type and rbl.returncodes and map_match_types[match_type] then
     if not rbl.returncodes_maps then
       rbl.returncodes_maps = {}
diff --git a/test/functional/configs/merged-override.conf b/test/functional/configs/merged-override.conf
index 752711369..c94d8df00 100644
--- a/test/functional/configs/merged-override.conf
+++ b/test/functional/configs/merged-override.conf
@@ -269,7 +269,7 @@ rbl {
         from = 'FAKE_RBL',
       }
       unknown = true;
-      matcher = "regexp";
+      returncodes_matcher = "regexp";
       returncodes = {
         "CODE_2" = '^127\.0\.0\.2$';
         "CODE_3" = '^127\.0\.0\.3$';
@@ -284,7 +284,7 @@ rbl {
       rbl = "fake.wl";
       symbol = "FAKE_WL_RBL_UNKNOWN";
       unknown = true;
-      #matcher = "luapattern";
+      #returncodes_matcher = "luapattern";
       returncodes = {
         "FAKE_WL_RBL_CODE_2" = "127%.0%.0%.2";
         "FAKE_WL_RBL_CODE_3" = "127%.0%.0%.3";
@@ -296,7 +296,7 @@ rbl {
       ignore_defaults = true;
       emails = true;
       emails_domainonly = true
-      matcher = "radix";
+      returncodes_matcher = "radix";
       returncodes = {
         RSPAMD_EMAILBL = "127.0.0.2/32";
       }
@@ -314,7 +314,7 @@ rbl {
       checks = ["numeric_urls"];
       content_urls = true;
       rbl = "test9.uribl";
-      matcher = "glob";
+      returncodes_matcher = "glob";
       returncodes = {
         URIBL_NUMERIC_CONTENT = "*.*.*.*";
       }


More information about the Commits mailing list