]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Rework] Adopt plugins
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 17 Oct 2016 15:23:45 +0000 (16:23 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 17 Oct 2016 15:23:45 +0000 (16:23 +0100)
src/plugins/lua/antivirus.lua
src/plugins/lua/asn.lua
src/plugins/lua/dmarc.lua
src/plugins/lua/fann_scores.lua
src/plugins/lua/greylist.lua
src/plugins/lua/ip_score.lua
src/plugins/lua/multimap.lua
src/plugins/lua/mx_check.lua
src/plugins/lua/ratelimit.lua
src/plugins/lua/replies.lua
src/plugins/lua/settings.lua

index 2ca43f8df8c17e70ab4c4413a031e5c5a47a8888..6dfadd0272ca1e30269081e45620063b72f1e667 100644 (file)
@@ -137,7 +137,7 @@ local function need_av_check(task, rule)
 end
 
 local function check_av_cache(task, rule, fn)
-  local function redis_av_cb(task, err, data)
+  local function redis_av_cb(err, data)
     if data and type(data) == 'string' then
       -- Cached
       if data ~= 'OK' then
@@ -172,7 +172,7 @@ end
 local function save_av_cache(task, rule, to_save)
   local key = task:get_digest()
 
-  local function redis_set_cb(task, err, data)
+  local function redis_set_cb(err, data)
     -- Do nothing
     if err then
       rspamd_logger.errx(task, 'failed to save virus cache for %s -> "%s": %s',
index 2bb380edc2accf3ed308c6e46bf903d53f82807b..75d495d79aa98d04092764657d2b0e08469eabc0 100644 (file)
@@ -65,7 +65,7 @@ local function asn_check(task)
       if redis_params then
         local redis_key = options.key_prefix .. ip:to_string()
         local ret,conn,upstream
-        local function redis_asn_set_cb(task, err, data)
+        local function redis_asn_set_cb(err, data)
           if not err then
             upstream:ok()
           else
@@ -101,13 +101,13 @@ local function asn_check(task)
   local function asn_check_cache(ip, continuation_func)
     local key = options.key_prefix .. ip:to_string()
 
-    local function redis_asn_get_cb(task, err, data)
+    local function redis_asn_get_cb(err, data)
       if err or not data or type(data[1]) ~= 'string' then
         continuation_func(ip)
       else
         asn_set(data[1], data[2], data[3])
         -- Refresh key
-        local function redis_asn_expire_cb(task, err, data)
+        local function redis_asn_expire_cb(err, data)
         end
 
         local ret,_,_ = rspamd_redis_make_request(task,
index 112865939a51ad4cfed6d0babb56d29ed0394a57..f160fd28cae3531cfbbb6e84b3e78b59b9aaae38 100644 (file)
@@ -92,7 +92,7 @@ local function dmarc_callback(task)
     return maybe_force_action('na')
   end
 
-  local function dmarc_report_cb(task, err, data)
+  local function dmarc_report_cb(err, data)
     if not err then
       rspamd_logger.infox(task, '<%1> dmarc report saved for %2',
         task:get_message_id(), from[1]['domain'])
index d1564cd2e5cc75f1d89e109d7024e6c29b865e8b..6a63e2e6eba904aada9067f4854006c7f564c7cc 100644 (file)
@@ -602,7 +602,7 @@ redis_params = rspamd_parse_redis_server('fann_scores')
 
 local function maybe_load_fann(task, continue_cb, call_if_fail)
   local function load_fann()
-    local function redis_fann_load_cb(task, err, data)
+    local function redis_fann_load_cb(err, data)
       if not err and type(data) == 'table' and type(data[2]) == 'string' then
         local version = tonumber(data[1])
         local err,ann_data = rspamd_util.zstd_decompress(data[2])
@@ -653,7 +653,7 @@ local function maybe_load_fann(task, continue_cb, call_if_fail)
   end
 
   local function check_fann()
-    local function redis_fann_check_cb(task, err, data)
+    local function redis_fann_check_cb(err, data)
       if not err and type(data) == 'string' then
         local version = tonumber(data)
 
@@ -737,7 +737,7 @@ local function create_fann()
 end
 
 local function save_fann(task, is_spam)
-  local function redis_fann_save_cb(task, err, data)
+  local function redis_fann_save_cb(err, data)
     if err then
       rspamd_logger.errx(task, "cannot save neural net to redis: %s", err)
     end
index e8f94101cf2b4f432875ece13068ae17ac30e46b..35d69ec1477b2789a02dbd31b079a5c7183a439e 100644 (file)
@@ -145,7 +145,7 @@ local function greylist_check(task)
   local hash_key = body_key .. meta_key
   local upstream
 
-  local function redis_set_cb(task, err, data)
+  local function redis_set_cb(err, data)
     if not err then
       upstream:ok()
     else
@@ -154,7 +154,7 @@ local function greylist_check(task)
     end
   end
 
-  local function redis_get_cb(task, err, data)
+  local function redis_get_cb(err, data)
     local ret_body = false
     local greylisted_body = false
     local ret_meta = false
@@ -240,7 +240,7 @@ local function greylist_set(task)
   local upstream, ret, conn
   local hash_key = body_key .. meta_key
 
-  local function redis_set_cb(task, err, data)
+  local function redis_set_cb(err, data)
     if not err then
       upstream:ok()
     else
index 6cb9d1a1f7551731dac635088e95eafce073b08b..28cffe452b4a1c8d7cdd3467a1697059c425d5b6 100644 (file)
@@ -105,7 +105,7 @@ local ip_score_set = function(task)
     return old_score + score, new_total
   end
 
-  local score_set_cb = function(task, err, data)
+  local score_set_cb = function(err, data)
     if err then
       rspamd_logger.infox(task, 'got error while IP score changing: %1', err)
     end
@@ -210,7 +210,7 @@ end
 local ip_score_check = function(task)
   local asn, country, ipnet = ip_score_get_task_vars(task)
 
-  local ip_score_redis_cb = function(task, err, data)
+  local ip_score_redis_cb = function(err, data)
     local function calculate_score(score)
       local parts = asn_re:split(score)
       local rep = tonumber(parts[1])
index 4e3286796df7cd25837eb85940a7e0fcfd6f8cb9..99295b1386e96f8e6f32d95613a703e22a2946aa 100644 (file)
@@ -317,7 +317,7 @@ local function multimap_callback(task, rule)
       return false
     end
 
-    local function redis_map_cb(task, err, data)
+    local function redis_map_cb(err, data)
       if not err and type(data) ~= 'userdata' then
         callback(data)
       end
index cdd0997542fbf1c2fd82dc25f36d99d74c07c59b..fe085cab02c12e01fcd89e8d18f045bb32234d70 100644 (file)
@@ -60,7 +60,7 @@ local function mx_check(task)
     if all(function(k, elt) return elt.checked end, mxes) then
       -- Save cache
       local key = settings.key_prefix .. mx_domain
-      local function redis_cache_cb(task, err, data)
+      local function redis_cache_cb(err, data)
         if err ~= nil then
           rspamd_logger.errx(task, 'redis_cache_cb received error: %1', err)
           return
@@ -189,7 +189,7 @@ local function mx_check(task)
       forced = true
     })
   else
-    local function redis_cache_get_cb(task, err, data)
+    local function redis_cache_get_cb(err, data)
       if err or type(data) ~= 'string' then
         local r = task:get_resolver()
         r:resolve('mx', {
index 7a4d606de098adaca2f5199d4cf2bfe6824c7e4b..7d6086c3b88fe401175724d6122f9c89e0ab3f02 100644 (file)
@@ -207,7 +207,7 @@ local function check_limits(task, args)
   local key = fun.foldl(function(acc, k) return acc .. k[2] end, '', args)
   local ret,upstream
   --- Called when value is got from server
-  local function rate_get_cb(task, err, data)
+  local function rate_get_cb(err, data)
     if err then
       rspamd_logger.infox(task, 'got error while getting limit: %1', err)
       upstream:fail()
@@ -309,7 +309,7 @@ local function set_limits(task, args)
   local key = fun.foldl(function(acc, k) return acc .. k[2] end, '', args)
   local ret, upstream
 
-  local function rate_set_cb(task, err, data)
+  local function rate_set_cb(err, data)
     if not err then
       upstream:ok()
     else
@@ -317,7 +317,7 @@ local function set_limits(task, args)
         err, upstream:get_addr())
     end
   end
-  local function rate_get_cb(task, err, data)
+  local function rate_get_cb(err, data)
     if err then
       rspamd_logger.infox(task, 'got error while setting limit: %1', err)
       upstream:fail()
index 236cb562631c180135a3ee98c3a1459a0a0e7f86..901595295a4488e7f369b01f3269c5fce1b131e9 100644 (file)
@@ -42,7 +42,7 @@ local function make_key(goop)
 end
 
 local function replies_check(task)
-  local function redis_get_cb(task, err, data)
+  local function redis_get_cb(err, data)
     if err ~= nil then
       rspamd_logger.errx('redis_get_cb received error: %1', err)
       return
@@ -83,7 +83,7 @@ local function replies_check(task)
 end
 
 local function replies_set(task)
-  local function redis_set_cb(task, err, data)
+  local function redis_set_cb(err, data)
     if err ~=nil then
       rspamd_logger.errx('redis_set_cb received error: %1', err)
     end
index 406385e783fec9917a7e39a540cef2de6d149f8f..2325f6781103c9dd0e71d450c3e10a46eb5552ee 100644 (file)
@@ -528,7 +528,7 @@ local function gen_redis_callback(handler, id)
   return function(task)
     local key = handler(task)
 
-    local function redis_settings_cb(task, err, data)
+    local function redis_settings_cb(err, data)
       if not err and type(data) == 'string' then
         local ucl = require "ucl"
         local parser = ucl.parser()