summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-07-28 21:12:35 +0100
committerGitHub <noreply@github.com>2021-07-28 21:12:35 +0100
commitcb7d74e84f4804a97f647e22901026f234dcfaae (patch)
tree006737d5a48e1841d2e3e752fb5f40a4d722986d
parent0b24fc6c10f2c4a9d5a684a67f06f3df2cd5a7f0 (diff)
parent3789d5c1d38223a98c4fda0c3b987b88aa5849b8 (diff)
downloadrspamd-cb7d74e84f4804a97f647e22901026f234dcfaae.tar.gz
rspamd-cb7d74e84f4804a97f647e22901026f234dcfaae.zip
Merge pull request #3832 from citrin/asn-plugin-fix
[Fix] ASN: fix _FAIL symbol for when main symbol is disabled
-rw-r--r--src/plugins/lua/asn.lua25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/plugins/lua/asn.lua b/src/plugins/lua/asn.lua
index 3e379f27b..952697463 100644
--- a/src/plugins/lua/asn.lua
+++ b/src/plugins/lua/asn.lua
@@ -71,7 +71,7 @@ local function asn_check(task)
if dns_err and (dns_err ~= 'requested record is not found' and dns_err ~= 'no records with this name') then
rspamd_logger.errx(task, 'error querying dns "%s" on %s: %s',
req_name, serv, dns_err)
- task:insert_result(options['symbol'] .. '_FAIL', 1, string.format('%s:%s', req_name, dns_err))
+ task:insert_result(options['symbol_fail'], 0, string.format('%s:%s', req_name, dns_err))
return
end
if not results or not results[1] then
@@ -128,6 +128,13 @@ local configure_asn_module = function()
rspamd_logger.errx("Unknown provider_type: %s", options['provider_type'])
return false
end
+
+ if options['symbol'] then
+ options['symbol_fail'] = options['symbol'] .. '_FAIL'
+ else
+ options['symbol_fail'] = 'ASN_FAIL'
+ end
+
return true
end
@@ -144,17 +151,17 @@ if configure_asn_module() then
name = options['symbol'],
parent = id,
type = 'virtual',
- flags = 'empty',
+ flags = 'empty,nostat',
score = 0,
})
- rspamd_config:register_symbol{
- name = options['symbol'] .. '_FAIL',
- parent = id,
- type = 'virtual',
- flags = 'nostat',
- score = 0,
- }
end
+ rspamd_config:register_symbol{
+ name = options['symbol_fail'],
+ parent = id,
+ type = 'virtual',
+ flags = 'empty,nostat',
+ score = 0,
+ }
else
lua_util.disable_module(N, 'config')
end