From 843d6bb62959582991aa6d0e095b383465bb7ec4 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 22 Jun 2016 22:22:29 +0200 Subject: mod_privacy: Fix selecting the top resource (fixes #694) --- plugins/mod_privacy.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_privacy.lua b/plugins/mod_privacy.lua index 49c9427f..f95dfa50 100644 --- a/plugins/mod_privacy.lua +++ b/plugins/mod_privacy.lua @@ -397,7 +397,7 @@ function preCheckIncoming(e) local prio = 0; if bare_sessions[node.."@"..host] ~= nil then for resource, session_ in pairs(bare_sessions[node.."@"..host].sessions) do - if session_.priority ~= nil and session_.priority > prio then + if session_.priority ~= nil and session_.priority >= prio then session = session_; prio = session_.priority; end -- cgit v1.2.3 From f7c083c86a1c8c7e1f31e7b4e2a02f945125c3cf Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 23 Jun 2016 21:07:48 +0200 Subject: util.prosodyctl: Handle os.execute in Lua 5.2 returning true when command terminates successfully --- util/prosodyctl.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua index cde1cdd4..7c9a3c19 100644 --- a/util/prosodyctl.lua +++ b/util/prosodyctl.lua @@ -44,7 +44,7 @@ end local function getchar(n) local stty_ret = os.execute("stty raw -echo 2>/dev/null"); local ok, char; - if stty_ret == 0 then + if stty_ret == true or stty_ret == 0 then ok, char = pcall(io.read, n or 1); os.execute("stty sane"); else -- cgit v1.2.3 From 621ba250ff7f8e5502e1ebebcdbe38d26e5f62f2 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 23 Jun 2016 21:08:51 +0200 Subject: util.openssl: Handle return value from os.execute being true in Lua 5.2 --- util/openssl.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/openssl.lua b/util/openssl.lua index 757259f6..33234a7d 100644 --- a/util/openssl.lua +++ b/util/openssl.lua @@ -166,7 +166,8 @@ do -- Lua to shell calls. setmetatable(_M, { __index = function(_, command) return function(opts) - return 0 == os_execute(serialize(command, type(opts) == "table" and opts or {})); + local ret = os_execute(serialize(command, type(opts) == "table" and opts or {})); + return ret == true or ret == 0; end; end; }); -- cgit v1.2.3 From 6fc4ad3aefeab816af4b13df7d877386958a510f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 28 Jun 2016 14:49:44 +0100 Subject: util.time: New tiny library to abstract LuaSocket's gettime() function, so we can use other sources in the future --- util/time.lua | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 util/time.lua diff --git a/util/time.lua b/util/time.lua new file mode 100644 index 00000000..84cff877 --- /dev/null +++ b/util/time.lua @@ -0,0 +1,8 @@ +-- Import gettime() from LuaSocket, as a way to access high-resolution time +-- in a platform-independent way + +local socket_gettime = require "socket".gettime; + +return { + now = socket_gettime; +} -- cgit v1.2.3