diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-08 11:42:56 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-08 11:42:56 +0100 |
commit | 0315b0d8d23002040b66a0158cc79c4af26813e4 (patch) | |
tree | f8e7158d2970b6491622e534ecd230476beb53bd /lualib/lua_scanners/sophos.lua | |
parent | 19598026fd121cc6b9aa2bd4eda14b5ebf616866 (diff) | |
download | rspamd-0315b0d8d23002040b66a0158cc79c4af26813e4.tar.gz rspamd-0315b0d8d23002040b66a0158cc79c4af26813e4.zip |
[Feature] Support caching for encrypted files and macros
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 |