diff options
Diffstat (limited to 'lualib/lua_scanners/sophos.lua')
-rw-r--r-- | lualib/lua_scanners/sophos.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lualib/lua_scanners/sophos.lua b/lualib/lua_scanners/sophos.lua index e646daaea..ee0407f9b 100644 --- a/lualib/lua_scanners/sophos.lua +++ b/lualib/lua_scanners/sophos.lua @@ -123,6 +123,7 @@ local function sophos_check(task, content, digest, rule) lua_util.debugm(rule.name, task, '%s [%s]: got reply: %s', rule['symbol'], rule['type'], data) local vname = string.match(data, 'VIRUS (%S+) ') + local cached if vname then common.yield_result(task, rule, vname) common.save_cache(task, digest, rule, vname) @@ -134,13 +135,14 @@ local function sophos_check(task, content, digest, rule) lua_util.debugm(rule.name, task, '%s: message or mime_part is clean', rule.log_prefix) end - common.save_cache(task, digest, rule, 'OK') + cached = 'OK' -- not finished - continue elseif string.find(data, 'ACC') or string.find(data, 'OK SSSP') then conn:add_read(sophos_callback) elseif string.find(data, 'FAIL 0212') then rspamd_logger.warnx(task, 'Message is encrypted (FAIL 0212): %s', data) common.yield_result(task, rule, 'SAVDI: Message is encrypted (FAIL 0212)', 0.0, 'fail') + cached = 'ENCRYPTED' elseif string.find(data, 'REJ 4') then rspamd_logger.warnx(task, 'Message is oversized (REJ 4): %s', data) common.yield_result(task, rule, 'SAVDI: Message oversized (REJ 4)', 0.0, 'fail') @@ -152,7 +154,9 @@ local function sophos_check(task, content, digest, rule) rspamd_logger.errx(task, 'unhandled response: %s', data) common.yield_result(task, rule, 'unhandled response: ' .. data, 0.0, 'fail') end - + if cached then + common.save_cache(task, digest, rule, cached) + end end end end |