From 1ef7f18752399e71f6cfd58fa95769fb6600d45b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 6 Dec 2015 23:47:47 +0100 Subject: core.usermanager: Return as soon as possible once admin status is known --- core/usermanager.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'core') diff --git a/core/usermanager.lua b/core/usermanager.lua index d874447d..0d8d7f91 100644 --- a/core/usermanager.lua +++ b/core/usermanager.lua @@ -111,7 +111,6 @@ local function is_admin(jid, host) if host and not hosts[host] then return false; end if type(jid) ~= "string" then return false; end - local is_admin; jid = jid_bare(jid); host = host or "*"; @@ -122,8 +121,7 @@ local function is_admin(jid, host) if type(host_admins) == "table" then for _,admin in ipairs(host_admins) do if jid_prep(admin) == jid then - is_admin = true; - break; + return true; end end elseif host_admins then @@ -131,12 +129,11 @@ local function is_admin(jid, host) end end - if not is_admin and global_admins then + if global_admins then if type(global_admins) == "table" then for _,admin in ipairs(global_admins) do if jid_prep(admin) == jid then - is_admin = true; - break; + return true; end end elseif global_admins then @@ -145,10 +142,10 @@ local function is_admin(jid, host) end -- Still not an admin, check with auth provider - if not is_admin and host ~= "*" and hosts[host].users and hosts[host].users.is_admin then - is_admin = hosts[host].users.is_admin(jid); + if host ~= "*" and hosts[host].users and hosts[host].users.is_admin then + return hosts[host].users.is_admin(jid); end - return is_admin or false; + return false; end return { -- cgit v1.2.3 From 2458f50dcae3f60055a9f79e8a9c91dd1b28fc46 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 8 Dec 2015 20:12:38 +0100 Subject: portmanager: Lower the priority of module-supplied TLS options --- core/portmanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/portmanager.lua b/core/portmanager.lua index 9f95077a..ad1a0be3 100644 --- a/core/portmanager.lua +++ b/core/portmanager.lua @@ -111,10 +111,10 @@ local function activate(service_name) local global_ssl_config = config.get("*", "ssl") or {}; local prefix_ssl_config = config.get("*", config_prefix.."ssl") or global_ssl_config; ssl, err = certmanager.create_context(service_info.name.." port "..port, "server", - service_info.ssl_config or {}, prefix_ssl_config[interface], prefix_ssl_config[port], prefix_ssl_config, + service_info.ssl_config or {}, global_ssl_config[interface], global_ssl_config[port]); if not ssl then -- cgit v1.2.3