commit ad132fa: Escape redis+selector

GitHub noreply at github.com
Sat Aug 7 19:14:04 UTC 2021


Author: foron
Date: 2021-08-06 16:44:06 +0200
URL: https://github.com/rspamd/rspamd/commit/ad132fa10e76d9313dbd9bc7d08a1abef7fd787a (refs/pull/3840/head)

Escape redis+selector
I believe it would be better to have the "redis+selector" pattern escaped as "redis%+selector". This would make it easier for string.find to match the documented map string.
---
 src/plugins/lua/multimap.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 172553cb3..8ae903078 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -1099,14 +1099,14 @@ local function add_multimap_rule(key, newrule)
       ret = true
     end
   elseif type(newrule['map']) == 'string' and
-      string.find(newrule['map'], '^redis+selector://.*$') then
+      string.find(newrule['map'], '^redis%+selector://.*$') then
     if not redis_params then
       rspamd_logger.infox(rspamd_config, 'no redis servers are specified, ' ..
           'cannot add redis map %s: %s', newrule['symbol'], newrule['map'])
       return nil
     end
 
-    local selector_str = string.match(newrule['map'], '^redis+selector://(.*)$')
+    local selector_str = string.match(newrule['map'], '^redis%+selector://(.*)$')
     local selector = lua_selectors.create_selector_closure(
         rspamd_config, selector_str, newrule['delimiter'] or "")
 


More information about the Commits mailing list