]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Lua_scanners: Add debug aliases
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 31 Dec 2018 11:35:59 +0000 (11:35 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 31 Dec 2018 11:35:59 +0000 (11:35 +0000)
lualib/lua_scanners/clamav.lua
lualib/lua_scanners/common.lua
lualib/lua_scanners/dcc.lua
lualib/lua_scanners/fprot.lua
lualib/lua_scanners/kaspersky_av.lua
lualib/lua_scanners/savapi.lua
lualib/lua_scanners/sophos.lua

index c7dd08bfcabefe6b74048804523e0953e1a8b3f7..b7de739cdd5719c11bd60c4489b7a653c0e0cef4 100644 (file)
@@ -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
 
index 605e3bb15f842c5b9cb4ff9cabfb91862ed98641..da1a4dd49f32f1726cae1925f6a7126e9b1f179f 100644 (file)
@@ -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
 
index d34bd842514030f32779a544f96bab0a5ae10549..f7bef47b21972999ead9e313b50c4095637d9af2 100644 (file)
@@ -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
 
index 27a29a4bc319c827f051652b5eb96014cb03e031..bfa0b4d332604923b7ad6ca8d62be228162c03b7 100644 (file)
@@ -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
 
index e903467c2b85feceee5780db3dd2ab2bddef0d9a..40cb6eb76abb9bd932bd0531c3b9416857a17d6f 100644 (file)
@@ -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
 
index 84452e017ef67a87a405ebb0162066041146f44e..fab9de31b2e224680b1da4706633d5f9b3947f94 100644 (file)
@@ -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
 
index c805cc56fa60a048c4bd979a2e173cb976aac2d5..b3eafc8374eaa216b05ca6fe23b019d1c08ac0b9 100644 (file)
@@ -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