Browse Source

[Minor] Remove handful more globals

tags/1.4.0
Andrew Lewis 7 years ago
parent
commit
d7e15fe443
3 changed files with 8 additions and 6 deletions
  1. 3
    2
      src/plugins/lua/hfilter.lua
  2. 4
    3
      src/plugins/lua/ratelimit.lua
  3. 1
    1
      src/plugins/lua/trie.lua

+ 3
- 2
src/plugins/lua/hfilter.lua View File

@@ -299,7 +299,7 @@ local function hfilter(task)

--No more checks for auth user or local network
local rip = task:get_from_ip()
if ((not check_user and task:get_user()) or
if ((not check_authed and task:get_user()) or
(not check_local and rip and rip:is_local())) then
return false
end
@@ -312,8 +312,9 @@ local function hfilter(task)

-- Check's HELO
local weight_helo = 0
local helo
if config['helo_enabled'] then
local helo = task:get_helo()
helo = task:get_helo()
if helo then
if helo ~= rspamc_local_helo then
helo = string.gsub(helo, '[%[%]]', '')

+ 4
- 3
src/plugins/lua/ratelimit.lua View File

@@ -376,7 +376,7 @@ local function set_limits(task, args)
conn:add_cmd('setex', v)
end, fun.drop_n(1, values))
else
rspamd_logger.infox(task, 'got error while connecting to redis: %1', addr)
rspamd_logger.infox(task, 'got error while connecting to redis: %1', upstream:get_addr())
upstream:fail()
end
end
@@ -482,8 +482,8 @@ local function parse_limit(str)

local key_keywords = rspamd_str_split(params[1], '_')
for _, k in ipairs(key_keywords) do
if (custom_keywords[v] and type(custom_keywords[v]['get_value']) == 'function') or
(keywords[v] and type(keywords[v]['get_value']) == 'function') then
if (custom_keywords[k] and type(custom_keywords[k]['get_value']) == 'function') or
(keywords[k] and type(keywords[k]['get_value']) == 'function') then
set_limit(settings[params[1]], params[2], params[3])
else
rspamd_logger.errx(rspamd_config, 'invalid limit type: ' .. params[1])
@@ -588,6 +588,7 @@ if opts then
priority = 10,
})
else
local symbol
if not ratelimit_symbol then
symbol = 'RATELIMIT_CHECK'
else

+ 1
- 1
src/plugins/lua/trie.lua View File

@@ -95,7 +95,7 @@ local function process_single_pattern(pat, symbol, cf)
end

local function process_trie_file(symbol, cf)
file = io.open(cf['file'])
local file = io.open(cf['file'])

if not file then
rspamd_logger.errx(rspamd_config, 'Cannot open trie file %1', cf['file'])

Loading…
Cancel
Save