diff options
author | Carsten Rosenberg <c.rosenberg@heinlein-support.de> | 2019-09-27 14:06:41 +0200 |
---|---|---|
committer | Carsten Rosenberg <c.rosenberg@heinlein-support.de> | 2019-09-27 14:06:41 +0200 |
commit | 259a51ccefbac3e48bfcc0501be963d5baf10bc4 (patch) | |
tree | 8a5e6688b9adb78fc20613e341c2d338e4b36a8f /lualib/lua_scanners | |
parent | cb1fb98db95bb42ba43c98b8c390748f7ac9c300 (diff) | |
download | rspamd-259a51ccefbac3e48bfcc0501be963d5baf10bc4.tar.gz rspamd-259a51ccefbac3e48bfcc0501be963d5baf10bc4.zip |
[Minor] lua_scanners - fix small errors
Diffstat (limited to 'lualib/lua_scanners')
-rw-r--r-- | lualib/lua_scanners/common.lua | 2 | ||||
-rw-r--r-- | lualib/lua_scanners/icap.lua | 21 |
2 files changed, 16 insertions, 7 deletions
diff --git a/lualib/lua_scanners/common.lua b/lualib/lua_scanners/common.lua index dcd31db30..64f67dcc8 100644 --- a/lualib/lua_scanners/common.lua +++ b/lualib/lua_scanners/common.lua @@ -207,7 +207,7 @@ local function check_cache(task, digest, rule, fn) if err then rspamd_logger.errx(task, 'got error checking cache: %s', err) end - fn() + return true end end diff --git a/lualib/lua_scanners/icap.lua b/lualib/lua_scanners/icap.lua index c7b495c29..d43ba4f78 100644 --- a/lualib/lua_scanners/icap.lua +++ b/lualib/lua_scanners/icap.lua @@ -243,20 +243,29 @@ local function icap_check(task, content, digest, rule) table.insert(threat_string, icap_headers['X-Virus-ID']) end elseif icap_headers['X-FSecure-Scan-Result'] ~= nil and icap_headers['X-FSecure-Scan-Result'] ~= "clean" then + + local infected_filename = "" + local infection_name = "-unknown-" + + if icap_headers['X-FSecure-Infected-Filename'] ~= nil then + infected_filename = string.gsub(icap_headers['X-FSecure-Infected-Filename'], '[%s"]', '') + end + if icap_headers['X-FSecure-Infection-Name'] ~= nil then + infection_name = string.gsub(icap_headers['X-FSecure-Infection-Name'], '[%s"]', '') + end + lua_util.debugm(rule.name, task, '%s: icap X-FSecure-Infection-Name (X-FSecure-Infected-Filename): %s (%s)', - rule.log_prefix, string.gsub(icap_headers['X-FSecure-Infection-Name'], '[%s"]', ''), - string.gsub(icap_headers['X-FSecure-Infected-Filename:'], '[%s"]', '')) + rule.log_prefix, infection_name, infected_filename) - if string.find(icap_headers['X-FSecure-Infection-Name'], ', ') then - local vnames = rspamd_str_split(string.gsub(icap_headers['X-FSecure-Infection-Name'], '[%s"]', '') - , ',') or {} + if string.find(infection_name, ', ') then + local vnames = rspamd_str_split(infection_name, ',') or {} for _,v in ipairs(vnames) do table.insert(threat_string, v) end else - table.insert(threat_string, string.gsub(icap_headers['X-FSecure-Infection-Name'], '[%s"]', '')) + table.insert(threat_string, infection_name) end end if #threat_string > 0 then |