aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_scanners
diff options
context:
space:
mode:
authorCarsten Rosenberg <c.rosenberg@heinlein-support.de>2019-10-07 17:08:39 +0200
committerCarsten Rosenberg <c.rosenberg@heinlein-support.de>2019-10-07 17:08:39 +0200
commit7faba7453c13aec25b356c9e171e11746b685009 (patch)
treee83f7e3f415ffe62d2ca035cfc5fa149ce344a89 /lualib/lua_scanners
parent4feb562db9d6ea7e1828f3d7b9903a5d499b9a35 (diff)
downloadrspamd-7faba7453c13aec25b356c9e171e11746b685009.tar.gz
rspamd-7faba7453c13aec25b356c9e171e11746b685009.zip
[Minor] lua_Scanners - KAS SE fix response, av caching
Diffstat (limited to 'lualib/lua_scanners')
-rw-r--r--lualib/lua_scanners/kaspersky_se.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/lualib/lua_scanners/kaspersky_se.lua b/lualib/lua_scanners/kaspersky_se.lua
index 098e33cdf..a1c8992c1 100644
--- a/lualib/lua_scanners/kaspersky_se.lua
+++ b/lualib/lua_scanners/kaspersky_se.lua
@@ -130,7 +130,7 @@ local function kaspersky_se_check(task, content, digest, rule)
local message_fd = rspamd_util.create_file(fname)
if not message_fd then
- rspamd_logger.errx('cannot store file for savapi scan: %s', fname)
+ rspamd_logger.errx('cannot store file for kaspersky_se scan: %s', fname)
return
end
@@ -203,13 +203,12 @@ local function kaspersky_se_check(task, content, digest, rule)
task:insert_result(rule.symbol_fail, 1.0, 'Bad HTTP code: ' .. code)
return
end
- lua_util.debugm(rule.name, task, 'got reply: %s', body)
- local data = tostring(body)
+ local data = string.gsub(tostring(body), '[\r\n%s]$', '')
local cached
- lua_util.debugm(rule.name, task, '%s: got reply: %s',
+ lua_util.debugm(rule.name, task, '%s: got reply data: "%s"',
rule.log_prefix, data)
if data == 'CLEAN' then
- cached = 'CLEAN'
+ cached = 'OK'
if rule['log_clean'] then
rspamd_logger.infox(task, '%s: message or mime_part is clean',
rule.log_prefix)
@@ -239,9 +238,10 @@ local function kaspersky_se_check(task, content, digest, rule)
rspamd_logger.errx(task, '%s: unhandled response: %s', rule.log_prefix, data)
common.yield_result(task, rule, 'unhandled response:' .. data, 0.0, 'fail')
end
- if cached then
+
+ if cached then
common.save_cache(task, digest, rule, cached)
- end
+ end
end
end