From 7356f170744be074658d2b7dab8b9c2cb470ff9a 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 41b4932ef2529031ea136adc368cfc7c6da0bd40 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 7a878f8b688be25d37ea7040ab2d7f491bd8d25f 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 8afacb5d92d6098f6eb85bbc32aff5632983bd5d 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