From a3b5ad3d3be5f44996d247e7b1486fcc9f8ba7e3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 6 Aug 2021 12:42:06 +0100 Subject: [Feature] Allow to save and show attachment name when inserting AV scan results --- lualib/lua_scanners/avast.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lualib/lua_scanners/avast.lua') diff --git a/lualib/lua_scanners/avast.lua b/lualib/lua_scanners/avast.lua index 16c838dbc..da8e6d710 100644 --- a/lualib/lua_scanners/avast.lua +++ b/lualib/lua_scanners/avast.lua @@ -81,7 +81,7 @@ local function avast_config(opts) return nil end -local function avast_check(task, content, digest, rule) +local function avast_check(task, content, digest, rule, maybe_part) local function avast_check_uncached () local upstream = rule.upstreams:get_upstream_round_robin() local addr = upstream:get_addr() @@ -148,7 +148,7 @@ local function avast_check(task, content, digest, rule) '%s [%s]: failed to scan, maximum retransmits exceed', rule['symbol'], rule['type']) common.yield_result(task, rule, 'failed to scan and retransmits exceed', - 0.0, 'fail') + 0.0, 'fail', maybe_part) return end @@ -251,7 +251,7 @@ local function avast_check(task, content, digest, rule) if vname then vname = vname:gsub('\\ ', ' '):gsub('\\\\', '\\') - common.yield_result(task, rule, vname) + common.yield_result(task, rule, vname, 1.0, nil, maybe_part) cached = vname end end @@ -263,12 +263,12 @@ local function avast_check(task, content, digest, rule) if ret then rspamd_logger.errx(task, '%s: error: %s', rule.log_prefix, ret[1][2]) common.yield_result(task, rule, 'error:' .. ret[1][2], - 0.0, 'fail') + 0.0, 'fail', maybe_part) end end if cached then - common.save_cache(task, digest, rule, cached) + common.save_cache(task, digest, rule, cached, 1.0, maybe_part) else -- Unexpected reply rspamd_logger.errx(task, '%s: unexpected reply: %s', rule.log_prefix, mdata) @@ -286,7 +286,8 @@ local function avast_check(task, content, digest, rule) maybe_retransmit() end - if common.condition_check_and_continue(task, content, rule, digest, avast_check_uncached) then + if common.condition_check_and_continue(task, content, rule, digest, + avast_check_uncached, maybe_part) then return else avast_check_uncached() -- cgit v1.2.3