]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Propagate redis_timeout into nested greylist.redis{} block 5977/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Fri, 10 Apr 2026 11:31:48 +0000 (14:31 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Fri, 10 Apr 2026 11:31:48 +0000 (14:31 +0300)
When Redis is configured via greylist { redis { ... } }, parse_redis_server
reads opts.redis and ignores opts.timeout, so redis_timeout had no effect.
Shallow-copy the nested redis subtable and set its timeout when not
explicitly configured by the operator.

src/plugins/lua/greylist.lua

index d9badcd502827cfda4c3b7fd1c50493d85681530..cdfacd6891b926ee0b5e2246825f967d8056c1ab 100644 (file)
@@ -574,6 +574,14 @@ if opts then
   -- enrich_defaults since settings.redis_timeout equals lua_redis's default_timeout (1.0).
   local redis_opts = lua_util.shallowcopy(opts)
   redis_opts.timeout = settings.redis_timeout
+  if redis_opts.redis then
+    -- When Redis is configured in a nested greylist.redis{} block, parse_redis_server
+    -- uses opts.redis and never reads opts.timeout, so propagate redis_timeout there too.
+    redis_opts.redis = lua_util.shallowcopy(redis_opts.redis)
+    if not redis_opts.redis.timeout then
+      redis_opts.redis.timeout = settings.redis_timeout
+    end
+  end
   redis_params = lua_redis.parse_redis_server(N, redis_opts)
   if not redis_params then
     rspamd_logger.infox(rspamd_config, 'no servers are specified, disabling module')