aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_scanners/icap.lua
diff options
context:
space:
mode:
authorCarsten Rosenberg <c.rosenberg@heinlein-support.de>2022-02-27 17:54:19 +0100
committerCarsten Rosenberg <c.rosenberg@heinlein-support.de>2022-02-27 17:54:19 +0100
commit9f67eef450c4341b2171c1b85b5cb973fca7e88c (patch)
tree8f7a53da6af6dbbb63423e6eb1a6ad44973f1493 /lualib/lua_scanners/icap.lua
parent287f81c148b30b9f9ea97c95255a88fa2725f7d1 (diff)
downloadrspamd-9f67eef450c4341b2171c1b85b5cb973fca7e88c.tar.gz
rspamd-9f67eef450c4341b2171c1b85b5cb973fca7e88c.zip
[Minor] lua_scanners - icap - lua linting
Diffstat (limited to 'lualib/lua_scanners/icap.lua')
-rw-r--r--lualib/lua_scanners/icap.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/lualib/lua_scanners/icap.lua b/lualib/lua_scanners/icap.lua
index 8a1b7b215..8fb4bff44 100644
--- a/lualib/lua_scanners/icap.lua
+++ b/lualib/lua_scanners/icap.lua
@@ -236,7 +236,7 @@ local function icap_check(task, content, digest, rule, maybe_part)
else
rspamd_logger.errx(task, '%s: failed to scan, maximum retransmits '..
'exceed - error: %s', rule.log_prefix, err_m or '')
- common.yield_result(task, rule, 'failed - error: ' .. err_m or '',
+ common.yield_result(task, rule, string.format('failed - error: %s', err_m),
0.0, 'fail', maybe_part)
end
end
@@ -480,9 +480,13 @@ local function icap_check(task, content, digest, rule, maybe_part)
threat_table_add(headers['x-block-reason'], false)
-- last try HTTP [4]xx return
elseif headers.http and string.find(headers.http, '^HTTP%/[12]%.. [4]%d%d') then
- threat_table_add(string.format("pseudo-virus (blocked): %s", string.gsub(headers.http, 'HTTP%/[12]%.. ', '')), false)
- elseif rule.use_http_3xx_as_threat and headers.http and string.find(headers.http, '^HTTP%/[12]%.. [3]%d%d') then
- threat_table_add(string.format("pseudo-virus (redirect): %s", string.gsub(headers.http, 'HTTP%/[12]%.. ', '')), false)
+ threat_table_add(
+ string.format("pseudo-virus (blocked): %s", string.gsub(headers.http, 'HTTP%/[12]%.. ', '')), false)
+ elseif rule.use_http_3xx_as_threat and headers.http and string.find(headers.http, '^HTTP%/[12]%.. [3]%d%d')
+ then
+
+ threat_table_add(
+ string.format("pseudo-virus (redirect): %s", string.gsub(headers.http, 'HTTP%/[12]%.. ', '')), false)
end
if #threat_table > 0 then
@@ -514,8 +518,7 @@ local function icap_check(task, content, digest, rule, maybe_part)
else
rspamd_logger.errx(task, '%s: unhandled response |%s|',
rule.log_prefix, string.gsub(result, "\r\n", ", "))
- common.yield_result(task, rule,
- 'unhandled icap response: ' .. icap_http_headers.icap or "-",
+ common.yield_result(task, rule, string.format('unhandled icap response: %s', icap_http_headers.icap),
0.0, 'fail', maybe_part)
end
end
@@ -569,8 +572,7 @@ local function icap_check(task, content, digest, rule, maybe_part)
else
rspamd_logger.errx(task, '%s: unhandled response |%s|',
rule.log_prefix, string.gsub(result, "\r\n", ", "))
- common.yield_result(task, rule,
- 'unhandled icap response: ' .. icap_headers.icap or "-",
+ common.yield_result(task, rule, string.format('unhandled icap response: %s', icap_headers.icap),
0.0, 'fail', maybe_part)
end
end