aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-31 11:35:59 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-31 11:35:59 +0000
commit5c2c665915f62ffbf89bcc91217b2c995748d299 (patch)
tree0f8608cac4cc6a9b235e771fd12a0cde4c882312 /lualib
parenta72937fcfbd01b7d47bde8a46f73d01812f13ce0 (diff)
downloadrspamd-5c2c665915f62ffbf89bcc91217b2c995748d299.tar.gz
rspamd-5c2c665915f62ffbf89bcc91217b2c995748d299.zip
[Minor] Lua_scanners: Add debug aliases
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_scanners/clamav.lua1
-rw-r--r--lualib/lua_scanners/common.lua11
-rw-r--r--lualib/lua_scanners/dcc.lua1
-rw-r--r--lualib/lua_scanners/fprot.lua1
-rw-r--r--lualib/lua_scanners/kaspersky_av.lua1
-rw-r--r--lualib/lua_scanners/savapi.lua1
-rw-r--r--lualib/lua_scanners/sophos.lua1
7 files changed, 8 insertions, 9 deletions
diff --git a/lualib/lua_scanners/clamav.lua b/lualib/lua_scanners/clamav.lua
index c7dd08bfc..b7de739cd 100644
--- a/lualib/lua_scanners/clamav.lua
+++ b/lualib/lua_scanners/clamav.lua
@@ -63,6 +63,7 @@ local function clamav_config(opts)
clamav_conf.default_port)
if clamav_conf['upstreams'] then
+ lua_util.add_debug_alias('antivirus', N)
return clamav_conf
end
diff --git a/lualib/lua_scanners/common.lua b/lualib/lua_scanners/common.lua
index 605e3bb15..da1a4dd49 100644
--- a/lualib/lua_scanners/common.lua
+++ b/lualib/lua_scanners/common.lua
@@ -84,7 +84,7 @@ local function yield_result(task, rule, vname, N, dyn_weight)
end
end
-local function message_not_too_large(task, content, rule)
+local function message_not_too_large(task, content, rule, N)
local max_size = tonumber(rule.max_size)
if not max_size then return true end
if #content > max_size then
@@ -176,18 +176,11 @@ local function save_av_cache(task, digest, rule, to_save, N)
end
local function text_parts_min_words(task, min_words)
- local text_parts_empty = true
- local text_parts = task:get_text_parts()
-
local filter_func = function(p)
return p:get_words_count() >= min_words
end
- fun.each(function(p)
- text_parts_empty = false
- end, fun.filter(filter_func, text_parts))
-
- return text_parts_empty
+ return fun.any(filter_func, task:get_text_parts())
end
diff --git a/lualib/lua_scanners/dcc.lua b/lualib/lua_scanners/dcc.lua
index d34bd8425..f7bef47b2 100644
--- a/lualib/lua_scanners/dcc.lua
+++ b/lualib/lua_scanners/dcc.lua
@@ -271,6 +271,7 @@ local function dcc_config(opts)
dcc_conf.default_port)
if dcc_conf.upstreams then
+ lua_util.add_debug_alias('ext_scanners', N)
return dcc_conf
end
diff --git a/lualib/lua_scanners/fprot.lua b/lualib/lua_scanners/fprot.lua
index 27a29a4bc..bfa0b4d33 100644
--- a/lualib/lua_scanners/fprot.lua
+++ b/lualib/lua_scanners/fprot.lua
@@ -62,6 +62,7 @@ local function fprot_config(opts)
fprot_conf.default_port)
if fprot_conf['upstreams'] then
+ lua_util.add_debug_alias('antivirus', N)
return fprot_conf
end
diff --git a/lualib/lua_scanners/kaspersky_av.lua b/lualib/lua_scanners/kaspersky_av.lua
index e903467c2..40cb6eb76 100644
--- a/lualib/lua_scanners/kaspersky_av.lua
+++ b/lualib/lua_scanners/kaspersky_av.lua
@@ -58,6 +58,7 @@ local function kaspersky_config(opts)
kaspersky_conf['servers'], 0)
if kaspersky_conf['upstreams'] then
+ lua_util.add_debug_alias('antivirus', N)
return kaspersky_conf
end
diff --git a/lualib/lua_scanners/savapi.lua b/lualib/lua_scanners/savapi.lua
index 84452e017..fab9de31b 100644
--- a/lualib/lua_scanners/savapi.lua
+++ b/lualib/lua_scanners/savapi.lua
@@ -65,6 +65,7 @@ local function savapi_config(opts)
savapi_conf.default_port)
if savapi_conf['upstreams'] then
+ lua_util.add_debug_alias('antivirus', N)
return savapi_conf
end
diff --git a/lualib/lua_scanners/sophos.lua b/lualib/lua_scanners/sophos.lua
index c805cc56f..b3eafc837 100644
--- a/lualib/lua_scanners/sophos.lua
+++ b/lualib/lua_scanners/sophos.lua
@@ -64,6 +64,7 @@ local function sophos_config(opts)
sophos_conf.default_port)
if sophos_conf['upstreams'] then
+ lua_util.add_debug_alias('antivirus', N)
return sophos_conf
end