From 6bdb25f84bbce0cd671df19913f67a68fedc92e8 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Mon, 7 Nov 2016 15:54:45 +0200 Subject: [PATCH] [Minor] Remove couple more globals in Lua plugins --- src/plugins/lua/once_received.lua | 2 +- src/plugins/lua/ratelimit.lua | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua index 82d044c19..9b502defa 100644 --- a/src/plugins/lua/once_received.lua +++ b/src/plugins/lua/once_received.lua @@ -63,7 +63,7 @@ local function check_quantity_received (task) local task_ip = task:get_ip() - if ((not check_user and task:get_user()) or + if ((not check_authed and task:get_user()) or (not check_local and task_ip and task_ip:is_local())) then rspamd_logger.infox(task, 'Skipping once_received for authenticated user or local network') return diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index 571cfda97..001f3caa1 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -187,8 +187,8 @@ local function dynamic_rate_key(task, rtype) if not have_to then return table.concat(key_t, ":") else - rate_keys = {} - rcpts = task:get_recipients(0) + local rate_keys = {} + local rcpts = task:get_recipients(0) if not rcpts or not rcpts[1] or not rcpts[1]['addr'] then return nil end @@ -196,7 +196,7 @@ local function dynamic_rate_key(task, rtype) local total_rcpt = 0 for _, r in ipairs(rcpts) do if r['addr'] and total_rcpt < max_rcpt then - key_f = string.format(key_s, r['addr']) + local key_f = string.format(key_s, r['addr']) table.insert(rate_keys, key_f) total_rcpt = total_rcpt + 1 end @@ -298,6 +298,7 @@ local function check_limits(task, args) fun.map(function(a) return rspamd_str_split(a[2], ":")[2] end, args))) end + local _ ret,_,upstream = rspamd_redis_make_request(task, redis_params, -- connect params key, -- hash key @@ -381,6 +382,7 @@ local function set_limits(task, args) end end + local _ ret,_,upstream = rspamd_redis_make_request(task, redis_params, -- connect params key, -- hash key -- 2.39.5