diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-04-23 10:59:34 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-04-23 10:59:34 +0100 |
commit | 8780f6f9d7b86235d05dd8b020b35809c81cda4e (patch) | |
tree | b87e1b0f83a94d31da762d249a2a93611a4f305f /src | |
parent | a1dc1fd0591d0880c1537c4032d404cc748537f6 (diff) | |
download | rspamd-8780f6f9d7b86235d05dd8b020b35809c81cda4e.tar.gz rspamd-8780f6f9d7b86235d05dd8b020b35809c81cda4e.zip |
[Minor] Add Lua 5.3 workaround
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/greylist.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua index dfcb29386..aeb5ca75f 100644 --- a/src/plugins/lua/greylist.lua +++ b/src/plugins/lua/greylist.lua @@ -44,6 +44,7 @@ end local redis_params local whitelisted_ip local whitelist_domains_map = nil +local toint =math.ifloor or math.floor local settings = { expire = 86400, -- 1 day by default timeout = 300, -- 5 minutes by default @@ -328,18 +329,18 @@ local function greylist_set(task) true, -- is write redis_set_cb, --callback 'EXPIRE', -- command - {body_key, tostring(settings['expire'])} -- arguments + {body_key, tostring(toint(settings['expire']))} -- arguments ) -- Update greylisting record expire if ret then conn:add_cmd('EXPIRE', { - meta_key, tostring(settings['expire']) + meta_key, tostring(toint(settings['expire'])) }) else rspamd_logger.errx(task, 'got error while connecting to redis') end elseif do_greylisting or do_greylisting_required then - local t = tostring(math.floor(rspamd_util.get_time())) + local t = tostring(toint(rspamd_util.get_time())) local end_time = rspamd_util.time_to_string(t + settings['timeout']) rspamd_logger.infox(task, 'greylisted until "%s", new record', end_time) task:insert_result(settings['symbol'], 0.0, 'greylisted', end_time, @@ -354,12 +355,12 @@ local function greylist_set(task) true, -- is write redis_set_cb, --callback 'SETEX', -- command - {body_key, tostring(settings['expire']), t} -- arguments + {body_key, tostring(toint(settings['expire'])), t} -- arguments ) if ret then conn:add_cmd('SETEX', { - meta_key, tostring(settings['expire']), t + meta_key, tostring(toint(settings['expire'])), t }) else rspamd_logger.errx(task, 'got error while connecting to redis') |