aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_scanners
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-17 15:48:38 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-17 15:48:38 +0000
commit2cb70c9fd69f0427e6c9e732da1ac42ba0ed6c93 (patch)
treec399700bbc8a4d938ca3b41eec78567306944f69 /lualib/lua_scanners
parent05d331d07ad6fdc791b750e182d5ca266e4c5aaa (diff)
downloadrspamd-2cb70c9fd69f0427e6c9e732da1ac42ba0ed6c93.tar.gz
rspamd-2cb70c9fd69f0427e6c9e732da1ac42ba0ed6c93.zip
[Minor] Lua_scanners: More N->name changes
Diffstat (limited to 'lualib/lua_scanners')
-rw-r--r--lualib/lua_scanners/dcc.lua24
-rw-r--r--lualib/lua_scanners/fprot.lua4
2 files changed, 12 insertions, 16 deletions
diff --git a/lualib/lua_scanners/dcc.lua b/lualib/lua_scanners/dcc.lua
index fcee609d7..4ed149779 100644
--- a/lualib/lua_scanners/dcc.lua
+++ b/lualib/lua_scanners/dcc.lua
@@ -90,14 +90,14 @@ local function dcc_check(task, content, digest, rule)
retransmits = retransmits - 1
- lua_util.debugm(rule.N, task, '%s: Request Error: %s - retries left: %s',
+ lua_util.debugm(rule.name, task, '%s: Request Error: %s - retries left: %s',
rule.log_prefix, err, retransmits)
-- Select a different upstream!
upstream = rule.upstreams:get_upstream_round_robin()
addr = upstream:get_addr()
- lua_util.debugm(rule.N, task, '%s: retry IP: %s:%s',
+ lua_util.debugm(rule.name, task, '%s: retry IP: %s:%s',
rule.log_prefix, addr, addr:get_port())
tcp.request({
@@ -128,7 +128,7 @@ local function dcc_check(task, content, digest, rule)
-- Parse the response
if upstream then upstream:ok() end
local _,_,result,disposition,header = tostring(data):find("(.-)\n(.-)\n(.-)\n")
- lua_util.debugm(rule.N, task, 'DCC result=%1 disposition=%2 header="%3"',
+ lua_util.debugm(rule.name, task, 'DCC result=%1 disposition=%2 header="%3"',
result, disposition, header)
if header then
@@ -198,7 +198,7 @@ local function dcc_check(task, content, digest, rule)
rspamd_logger.infox(task, '%s: clean, returned result A - info: %s',
rule.log_prefix, info)
else
- lua_util.debugm(rule.N, task, '%s: returned result A - info: %s',
+ lua_util.debugm(rule.name, task, '%s: returned result A - info: %s',
rule.log_prefix, info)
end
end
@@ -208,7 +208,7 @@ local function dcc_check(task, content, digest, rule)
if rule.log_clean then
rspamd_logger.infox(task, '%s: clean, returned result G - info: %s', rule.log_prefix, info)
else
- lua_util.debugm(rule.N, task, '%s: returned result G - info: %s', rule.log_prefix, info)
+ lua_util.debugm(rule.name, task, '%s: returned result G - info: %s', rule.log_prefix, info)
end
elseif result == 'S' then
-- do nothing
@@ -216,7 +216,7 @@ local function dcc_check(task, content, digest, rule)
if rule.log_clean then
rspamd_logger.infox(task, '%s: clean, returned result S - info: %s', rule.log_prefix, info)
else
- lua_util.debugm(rule.N, task, '%s: returned result S - info: %s', rule.log_prefix, info)
+ lua_util.debugm(rule.name, task, '%s: returned result S - info: %s', rule.log_prefix, info)
end
else
-- Unknown result
@@ -254,7 +254,7 @@ end
local function dcc_config(opts)
local dcc_conf = {
- N = N,
+ name = N,
default_port = 10045,
timeout = 5.0,
log_clean = false,
@@ -276,15 +276,11 @@ local function dcc_config(opts)
dcc_conf = lua_util.override_defaults(dcc_conf, opts)
if not dcc_conf.prefix then
- dcc_conf.prefix = 'rs_' .. dcc_conf.N .. '_'
+ dcc_conf.prefix = 'rs_' .. dcc_conf.name .. '_'
end
if not dcc_conf.log_prefix then
- if dcc_conf.name:lower() == dcc_conf.type:lower() then
- dcc_conf.log_prefix = dcc_conf.name
- else
- dcc_conf.log_prefix = dcc_conf.name .. ' (' .. dcc_conf.type .. ')'
- end
+ dcc_conf.log_prefix = dcc_conf.name
end
if not dcc_conf.servers and dcc_conf.socket then
@@ -302,7 +298,7 @@ local function dcc_config(opts)
dcc_conf.default_port)
if dcc_conf.upstreams then
- lua_util.add_debug_alias('external_services', dcc_conf.N)
+ lua_util.add_debug_alias('external_services', dcc_conf.name)
return dcc_conf
end
diff --git a/lualib/lua_scanners/fprot.lua b/lualib/lua_scanners/fprot.lua
index 8be894126..f002f72c7 100644
--- a/lualib/lua_scanners/fprot.lua
+++ b/lualib/lua_scanners/fprot.lua
@@ -69,7 +69,7 @@ local function fprot_config(opts)
fprot_conf.default_port)
if fprot_conf['upstreams'] then
- lua_util.add_debug_alias('antivirus', fprot_conf.N)
+ lua_util.add_debug_alias('antivirus', fprot_conf.name)
return fprot_conf
end
@@ -103,7 +103,7 @@ local function fprot_check(task, content, digest, rule)
upstream = rule.upstreams:get_upstream_round_robin()
addr = upstream:get_addr()
- lua_util.debugm(rule.N, task, '%s [%s]: retry IP: %s', rule['symbol'], rule['type'], addr)
+ lua_util.debugm(rule.name, task, '%s [%s]: retry IP: %s', rule['symbol'], rule['type'], addr)
tcp.request({
task = task,