From 1ea7a0b88cb6905a101736ff9f1b4dfe0fadfb7d Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Thu, 25 Jan 2024 11:12:53 +0200 Subject: [PATCH] [Minor] rbl: fix warning --- lualib/plugins/rbl.lua | 12 ++++++------ src/plugins/lua/rbl.lua | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lualib/plugins/rbl.lua b/lualib/plugins/rbl.lua index b5232a8b4..af5d6bd91 100644 --- a/lualib/plugins/rbl.lua +++ b/lualib/plugins/rbl.lua @@ -149,7 +149,7 @@ local rule_schema_tbl = { exclude_checks = ts.array_of(ts.one_of(lua_util.keys(check_types))):is_optional(), } -local function convert_checks(rule) +local function convert_checks(rule, name) local rspamd_logger = require "rspamd_logger" if rule.checks then local all_connfilter = true @@ -160,7 +160,7 @@ local function convert_checks(rule) if check_type.require_argument then if not rule[check] then rspamd_logger.errx(rspamd_config, 'rbl rule %s has check %s which requires an argument', - rule.symbol, check) + name, check) return nil end end @@ -173,12 +173,12 @@ local function convert_checks(rule) if not check_type then rspamd_logger.errx(rspamd_config, 'rbl rule %s has invalid check type: %s', - rule.symbol, check) + name, check) return nil end else rspamd_logger.infox(rspamd_config, 'disable check %s in %s: excluded explicitly', - check, rule.symbol) + check, name) end end rule.connfilter = all_connfilter @@ -196,7 +196,7 @@ local function convert_checks(rule) if not check_found then -- Enable implicit `from` check to allow upgrade rspamd_logger.warnx(rspamd_config, 'rbl rule %s has no check enabled, enable default `from` check', - rule.symbol) + name) rule.from = true end @@ -204,7 +204,7 @@ local function convert_checks(rule) for _, v in pairs(rule.returncodes) do for _, e in ipairs(v) do if e:find('[%%%[]') then - rspamd_logger.warn(rspamd_config, 'implicitly enabling luapattern returncodes_matcher for rule %s', rule.symbol) + rspamd_logger.warn(rspamd_config, 'implicitly enabling luapattern returncodes_matcher for rule %s', name) rule.returncodes_matcher = 'luapattern' break end diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index a18f9a731..b2ccf8699 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -1342,7 +1342,7 @@ for key, rbl in pairs(opts.rbls) do rspamd_logger.errx(rspamd_config, 'invalid config for %s: %s, RBL is DISABLED', key, err) else - res = rbl_common.convert_checks(res) + res = rbl_common.convert_checks(res, rbl.symbol or key:upper()) -- Aliases if res.return_codes then res.returncodes = res.return_codes -- 2.39.5