diff options
author | Carsten Rosenberg <c.rosenberg@heinlein-support.de> | 2019-09-26 22:56:36 +0200 |
---|---|---|
committer | Carsten Rosenberg <c.rosenberg@heinlein-support.de> | 2019-09-26 22:56:36 +0200 |
commit | cb1fb98db95bb42ba43c98b8c390748f7ac9c300 (patch) | |
tree | d2400d79b2c04b9c1e35651c91b0db0fceb132a5 /lualib/lua_scanners/dcc.lua | |
parent | 8bd1b26f6fef45b8d60ae9edd0bf7f891cf48e55 (diff) | |
download | rspamd-cb1fb98db95bb42ba43c98b8c390748f7ac9c300.tar.gz rspamd-cb1fb98db95bb42ba43c98b8c390748f7ac9c300.zip |
[Minor] lua_scanners - simplify need_check and dynamic_scan
Diffstat (limited to 'lualib/lua_scanners/dcc.lua')
-rw-r--r-- | lualib/lua_scanners/dcc.lua | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/lualib/lua_scanners/dcc.lua b/lualib/lua_scanners/dcc.lua index e26e666f9..85d72dd8b 100644 --- a/lualib/lua_scanners/dcc.lua +++ b/lualib/lua_scanners/dcc.lua @@ -193,7 +193,7 @@ local function dcc_check(task, content, digest, rule) if (result == 'R') then -- Reject common.yield_result(task, rule, info, rule.default_score) - common.save_av_cache(task, digest, rule, info, rule.default_score) + common.save_cache(task, digest, rule, info, rule.default_score) elseif (result == 'T') then -- Temporary failure rspamd_logger.warnx(task, 'DCC returned a temporary failure result: %s', result) @@ -248,9 +248,9 @@ local function dcc_check(task, content, digest, rule) task:insert_result(rule.symbol_bulk, score, opts) - common.save_av_cache(task, digest, rule, opts, score) + common.save_cache(task, digest, rule, opts, score) else - common.save_av_cache(task, digest, rule, 'OK') + common.save_cache(task, digest, rule, 'OK') if rule.log_clean then rspamd_logger.infox(task, '%s: clean, returned result A - info: %s', rule.log_prefix, info) @@ -261,7 +261,7 @@ local function dcc_check(task, content, digest, rule) end elseif result == 'G' then -- do nothing - common.save_av_cache(task, digest, rule, 'OK') + common.save_cache(task, digest, rule, 'OK') if rule.log_clean then rspamd_logger.infox(task, '%s: clean, returned result G - info: %s', rule.log_prefix, info) else @@ -269,7 +269,7 @@ local function dcc_check(task, content, digest, rule) end elseif result == 'S' then -- do nothing - common.save_av_cache(task, digest, rule, 'OK') + common.save_cache(task, digest, rule, 'OK') if rule.log_clean then rspamd_logger.infox(task, '%s: clean, returned result S - info: %s', rule.log_prefix, info) else @@ -284,14 +284,6 @@ local function dcc_check(task, content, digest, rule) end end - if rule.dynamic_scan then - local pre_check, pre_check_msg = common.check_metric_results(task, rule) - if pre_check then - rspamd_logger.infox(task, '%s: aborting: %s', rule.log_prefix, pre_check_msg) - return true - end - end - tcp.request({ task = task, host = addr:to_string(), @@ -305,13 +297,11 @@ local function dcc_check(task, content, digest, rule) fuz2_max = 999999, }) end - if common.need_av_check(task, content, rule) then - if common.check_av_cache(task, digest, rule, dcc_check_uncached) then - return - else - dcc_check_uncached() - end + + if common.need_check(task, content, rule, digest) then + dcc_check_uncached() end + end return { |