diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-14 10:05:20 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-14 10:05:40 +0100 |
commit | c1f283a15d00ff9b77b899c7d7a00d16fbbb80a1 (patch) | |
tree | 0bfb59c1e28957af981911973d48e3fbc4e65b0c /src/plugins/lua/reputation.lua | |
parent | eca23e20df2f3aef513a06d32914d427b5efd7ca (diff) | |
download | rspamd-c1f283a15d00ff9b77b899c7d7a00d16fbbb80a1.tar.gz rspamd-c1f283a15d00ff9b77b899c7d7a00d16fbbb80a1.zip |
[Minor] Reputation: Fix set token methods
Diffstat (limited to 'src/plugins/lua/reputation.lua')
-rw-r--r-- | src/plugins/lua/reputation.lua | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index cec492008..2cb8f99e8 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -209,7 +209,7 @@ local function dkim_reputation_idempotent(task, rule) for dom,res in pairs(requests) do -- tld + "." + check_result, e.g. example.com.+ - reputation for valid sigs local query = string.format('%s.%s', dom, res) - rule.backend.set_token(task, rule, nil, query, sc, 'string') + rule.backend.set_token(task, rule, nil, query, sc) end end end @@ -335,7 +335,7 @@ local function url_reputation_idempotent(task, rule) if sc then for _,tld in ipairs(requests) do - rule.backend.set_token(task, rule, nil, tld[1], sc, 'string') + rule.backend.set_token(task, rule, nil, tld[1], sc) end end end @@ -508,13 +508,13 @@ local function ip_reputation_idempotent(task, rule) local sc = extract_task_score(task, rule) if sc then if asn then - rule.backend.set_token(task, rule, cfg.asn_prefix, asn, sc, 'string') + rule.backend.set_token(task, rule, cfg.asn_prefix, asn, sc, nil, 'string') end if country then - rule.backend.set_token(task, rule, cfg.country_prefix, country, sc, 'string') + rule.backend.set_token(task, rule, cfg.country_prefix, country, sc, nil, 'string') end - rule.backend.set_token(task, rule, cfg.ip_prefix, ip, sc, 'ip') + rule.backend.set_token(task, rule, cfg.ip_prefix, ip, sc, nil, 'ip') end end @@ -586,7 +586,7 @@ local function spf_reputation_idempotent(task, rule) lua_util.debugm(N, task, 'set spf record %s -> %s = %s', spf_record, hkey, sc) - rule.backend.set_token(task, rule, nil, hkey, sc, 'string') + rule.backend.set_token(task, rule, nil, hkey, sc) end @@ -680,12 +680,12 @@ local function generic_reputation_idempotent(task, rule) fun.each(function(e) lua_util.debugm(N, task, 'set generic selector (%s) %s = %s', rule['symbol'], e, sc) - rule.backend.set_token(task, rule, nil, e, sc, 'string') + rule.backend.set_token(task, rule, nil, e, sc) end, selector_res) else lua_util.debugm(N, task, 'set generic selector (%s) %s = %s', rule['symbol'], selector_res, sc) - rule.backend.set_token(task, rule, nil, selector_res, sc, 'string') + rule.backend.set_token(task, rule, nil, selector_res, sc) end end end @@ -743,7 +743,7 @@ local function gen_token_key(prefix, token, rule) if prefix then token = prefix .. token end - local res = prefix + local res = token if rule.backend.config.hashed then local hash_alg = rule.backend.config.hash_alg or "blake2" local encoding = "base32" @@ -948,7 +948,7 @@ local function reputation_redis_init(rule, cfg, ev_base, worker) end local function reputation_redis_get_token(task, rule, prefix, token, continuation_cb, token_type) - if token_type == 'ip' then + if token_type and token_type == 'ip' then token = tostring(token) end local key = gen_token_key(prefix, token, rule) @@ -986,7 +986,7 @@ local function reputation_redis_get_token(task, rule, prefix, token, continuatio end local function reputation_redis_set_token(task, rule, prefix, token, sc, continuation_cb, token_type) - if token_type == 'ip' then + if token_type and token_type == 'ip' then token = tostring(token) end local key = gen_token_key(prefix, token, rule) |