diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-11-10 23:21:14 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-11-10 23:21:14 +0000 |
commit | 28973735682581bcb5c0825df562edcaa6641923 (patch) | |
tree | 74306b8c1ff8b9fb1eeaa401d3b22df63011c48f /src/plugins | |
parent | 53dcfa59ddd802b60ccf76e940d49467b3796e70 (diff) | |
download | rspamd-28973735682581bcb5c0825df562edcaa6641923.tar.gz rspamd-28973735682581bcb5c0825df562edcaa6641923.zip |
Fix IP validity checks.
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/ratelimit.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index e79f68420..afb88b4e7 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -131,11 +131,11 @@ end --- Make rate key local function make_rate_key(from, to, ip) - if from and ip then + if from and ip and ip:is_valid() then return string.format('%s:%s:%s', from, to, ip:to_string()) elseif from then return string.format('%s:%s', from, to) - elseif ip then + elseif ip and ip:is_valid() then return string.format('%s:%s', to, ip:to_string()) elseif to then return to @@ -158,7 +158,7 @@ end local function rate_test_set(task, func) -- Get initial task data local ip = task:get_from_ip() - if ip and whitelisted_ip then + if ip and ip:is_valid() and whitelisted_ip then if whitelisted_ip:get_key(ip) then -- Do not check whitelisted ip return |