# HG changeset patch # User Waqas Hussain # Date 1323829198 -18000 # Node ID 2ccc386b9913049073a6945a43705fbcb90119f6 # Parent 9f6c68cb3fbded8388b6b37e6dc65e6dc19793ee usermanager: Prep admin JIDs (fixes issue#276). diff -r 9f6c68cb3fbd -r 2ccc386b9913 core/usermanager.lua --- a/core/usermanager.lua Wed Dec 14 06:46:24 2011 +0500 +++ b/core/usermanager.lua Wed Dec 14 07:19:58 2011 +0500 @@ -11,6 +11,7 @@ local type = type; local ipairs = ipairs; local jid_bare = require "util.jid".bare; +local jid_prep = require "util.jid".prep; local config = require "core.configmanager"; local hosts = hosts; local sasl_new = require "util.sasl".new; @@ -97,6 +98,7 @@ 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); @@ -108,7 +110,7 @@ if host_admins and host_admins ~= global_admins then if type(host_admins) == "table" then for _,admin in ipairs(host_admins) do - if admin == jid then + if jid_prep(admin) == jid then is_admin = true; break; end @@ -121,7 +123,7 @@ if not is_admin and global_admins then if type(global_admins) == "table" then for _,admin in ipairs(global_admins) do - if admin == jid then + if jid_prep(admin) == jid then is_admin = true; break; end