summaryrefslogtreecommitdiffstats
path: root/lualib/lua_scanners/icap.lua
diff options
context:
space:
mode:
authorCarsten Rosenberg <c.rosenberg@heinlein-support.de>2019-01-16 20:44:01 +0100
committerCarsten Rosenberg <c.rosenberg@heinlein-support.de>2019-01-16 20:44:01 +0100
commit44de7f58793a846a36b9eaf4c459c035e7d9cfb2 (patch)
treebaa0be9a0dc38fc66fbae6793c9d34b6b5a1e143 /lualib/lua_scanners/icap.lua
parent42bde308e2975fc02f41ce348cd857eff46c70fb (diff)
downloadrspamd-44de7f58793a846a36b9eaf4c459c035e7d9cfb2.tar.gz
rspamd-44de7f58793a846a36b9eaf4c459c035e7d9cfb2.zip
[FIX] lua_scanners - using N is much smarter ;)
Diffstat (limited to 'lualib/lua_scanners/icap.lua')
-rw-r--r--lualib/lua_scanners/icap.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/lualib/lua_scanners/icap.lua b/lualib/lua_scanners/icap.lua
index 81c6190f6..8810681f9 100644
--- a/lualib/lua_scanners/icap.lua
+++ b/lualib/lua_scanners/icap.lua
@@ -27,7 +27,7 @@ local upstream_list = require "rspamd_upstream_list"
local rspamd_logger = require "rspamd_logger"
local common = require "lua_scanners/common"
-local module_name = 'icap'
+local N = 'icap'
local function icap_check(task, content, digest, rule)
local function icap_check_uncached ()
@@ -44,7 +44,7 @@ local function icap_check(task, content, digest, rule)
"Encapsulated: null-body=0\r\n\r\n",
}
local size = string.format("%x", tonumber(#content))
- lua_util.debugm(rule.module_name, task, '%s: size: %s', rule.log_prefix, size)
+ lua_util.debugm(rule.N, task, '%s: size: %s', rule.log_prefix, size)
local function get_respond_query()
table.insert(respond_headers, 1, 'RESPMOD icap://' .. addr:to_string() .. ':' .. addr:get_port() .. '/'
@@ -72,7 +72,7 @@ local function icap_check(task, content, digest, rule)
icap_headers[key] = value
end
end
- lua_util.debugm(rule.module_name, task, '%s: icap_headers: %s', rule.log_prefix, icap_headers)
+ lua_util.debugm(rule.N, task, '%s: icap_headers: %s', rule.log_prefix, icap_headers)
return icap_headers
end
@@ -99,10 +99,10 @@ local function icap_check(task, content, digest, rule)
if icap_headers['X-Infection-Found'] ~= nil then
pattern_symbols = "(Type%=%d; .* Threat%=)(.*)([;]+)"
match = string.gsub(icap_headers['X-Infection-Found'], pattern_symbols, "%2")
- lua_util.debugm(rule.module_name, task, '%s: icap X-Infection-Found: %s', rule.log_prefix, match)
+ lua_util.debugm(rule.N, task, '%s: icap X-Infection-Found: %s', rule.log_prefix, match)
table.insert(threat_string, match)
elseif icap_headers['X-Virus-ID'] ~= nil then
- lua_util.debugm(rule.module_name, task, '%s: icap X-Virus-ID: %s', rule.log_prefix, icap_headers['X-Virus-ID'])
+ lua_util.debugm(rule.N, task, '%s: icap X-Virus-ID: %s', rule.log_prefix, icap_headers['X-Virus-ID'])
table.insert(threat_string, icap_headers['X-Virus-ID'])
end
@@ -177,14 +177,14 @@ local function icap_check(task, content, digest, rule)
retransmits = retransmits - 1
- lua_util.debugm(rule.module_name, task, '%s: Request Error: %s - retries left: %s',
+ lua_util.debugm(rule.N, task, '%s: Request Error: %s - retries left: %s',
rule.log_prefix, error, retransmits)
-- Select a different upstream!
upstream = rule.upstreams:get_upstream_round_robin()
addr = upstream:get_addr()
- lua_util.debugm(rule.module_name, task, '%s: retry IP: %s:%s',
+ lua_util.debugm(rule.N, task, '%s: retry IP: %s:%s',
rule.log_prefix, addr, addr:get_port())
tcp.request({
@@ -237,7 +237,7 @@ end
local function icap_config(opts)
local icap_conf = {
- module_name = module_name,
+ N = N,
scan_mime_parts = true,
scan_all_mime_parts = true,
scan_text_mime = false,
@@ -283,7 +283,7 @@ local function icap_config(opts)
icap_conf.default_port)
if icap_conf.upstreams then
- lua_util.add_debug_alias('external_services', icap_conf.module_name)
+ lua_util.add_debug_alias('external_services', icap_conf.N)
return icap_conf
end
@@ -293,9 +293,9 @@ local function icap_config(opts)
end
return {
- type = {module_name,'virus', 'virus', 'scanner'},
+ type = {N,'virus', 'virus', 'scanner'},
description = 'generic icap antivirus',
configure = icap_config,
check = icap_check,
- name = module_name
+ name = N
}