From: Max Khon Date: Tue, 6 Dec 2022 17:55:35 +0000 (+0000) Subject: Fix lua_alloc_cmd (#4813) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5648e2e30e35c312d87315e224a98ee28b86f2d;p=thirdparty%2Ffreeradius-server.git Fix lua_alloc_cmd (#4813) (0) redis_ippool - ERROR: (0) error : ERR Error running script (call to f_555f9a10a670669b1725edfc4b558c4c5eb3f9ad): @user_script:14: user_script:14: attempt to compare number with string --- diff --git a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c index 3a8816532fc..5a393319bdf 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c @@ -215,9 +215,9 @@ static char lua_alloc_cmd[] = " if expires_in > 0 then" EOL /* 11 */ " ip = redis.call('HMGET', '{' .. KEYS[1] .. '}:"IPPOOL_ADDRESS_KEY":' .. exists, 'device', 'range', 'counter')" EOL /* 12 */ " if ip and (ip[1] == ARGV[3]) then" EOL /* 13 */ - " if expires_in < ARGV[2] then" EOL /* 14 */ - " redis.call('ZADD', pool_key, 'XX', ARGV[1] + ARGV[2], ip[1])" EOL /* 15 */ - " expires_in = ARGV[2]" EOL /* 16 */ + " if expires_in < tonumber(ARGV[2]) then" EOL /* 14 */ + " redis.call('ZADD', pool_key, 'XX', ARGV[1] + ARGV[2], exists)" EOL /* 15 */ + " expires_in = tonumber(ARGV[2])" EOL /* 16 */ " end" EOL /* 17 */ " return {" STRINGIFY(_IPPOOL_RCODE_SUCCESS) ", exists, ip[2], expires_in, ip[3] }" EOL /* 18 */ " end" EOL /* 19 */