diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-08-07 12:19:03 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-08-07 12:19:03 +0100 |
commit | 460a82484915f5fcbf34f65194c3437fa2a4e0c7 (patch) | |
tree | 6ef6f49a1061c73ac0520594eeadcbc3a3ed593d /src | |
parent | 662145d0554de5e769b92dab2d41173a98adcee5 (diff) | |
download | rspamd-460a82484915f5fcbf34f65194c3437fa2a4e0c7.tar.gz rspamd-460a82484915f5fcbf34f65194c3437fa2a4e0c7.zip |
[Minor] Allow to log configuration errors from plugins
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/antivirus.lua | 1 | ||||
-rw-r--r-- | src/plugins/lua/bimi.lua | 4 | ||||
-rw-r--r-- | src/plugins/lua/reputation.lua | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua index 26b8509b8..44fe10e98 100644 --- a/src/plugins/lua/antivirus.lua +++ b/src/plugins/lua/antivirus.lua @@ -204,6 +204,7 @@ if opts and type(opts) == 'table' then if not cb then rspamd_logger.errx(rspamd_config, 'cannot add rule: "' .. k .. '"') + lua_util.push_config_error(N, 'cannot add AV rule: "' .. k .. '"') else rspamd_logger.infox(rspamd_config, 'added antivirus engine %s -> %s', k, m.symbol) local t = { diff --git a/src/plugins/lua/bimi.lua b/src/plugins/lua/bimi.lua index e3f555e48..5959f59e7 100644 --- a/src/plugins/lua/bimi.lua +++ b/src/plugins/lua/bimi.lua @@ -353,7 +353,9 @@ local res, err = settings_schema:transform(settings) if not res then rspamd_logger.warnx(rspamd_config, 'plugin is misconfigured: %s', err) - lua_util.disable_module(N, "config") + local err_msg = string.format("schema error: %s", res) + lua_util.push_config_error(N, err_msg) + lua_util.disable_module(N, "failed", err_msg) return end diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index 2fc1c3ad5..d569e9070 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -1377,8 +1377,11 @@ if opts['rules'] then for k, v in pairs(opts['rules']) do if not ((v or E).selector) then rspamd_logger.errx(rspamd_config, "no selector defined for rule %s", k) + lua_util.push_config_error(N, "no selector defined for rule: " .. k) else - parse_rule(k, v) + if not parse_rule(k, v) then + lua_util.push_config_error(N, "reputation rule is misconfigured: " .. k) + end end end else |