aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-07-31 07:11:54 +0100
committerMatthew Wild <mwild1@gmail.com>2014-07-31 07:11:54 +0100
commit3b8d61bf9828b5aa1e4f1776b306aeea5dfe8bb7 (patch)
tree3515ba9cb92ea9093dcb8f81c3bc71983fe46b29
parenta960fa32aced10e5c55a68286eef89d78a3748e9 (diff)
parent56339d76da26b41c723b5b44d660f9462622a3b4 (diff)
downloadprosody-3b8d61bf9828b5aa1e4f1776b306aeea5dfe8bb7.tar.gz
prosody-3b8d61bf9828b5aa1e4f1776b306aeea5dfe8bb7.zip
Merge 0.9->0.10
-rw-r--r--core/configmanager.lua5
-rwxr-xr-xprosodyctl6
2 files changed, 7 insertions, 4 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 1f7342b2..48f039ea 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -19,6 +19,9 @@ local resolve_relative_path = require"util.paths".resolve_relative_path;
local glob_to_pattern = require"util.paths".glob_to_pattern;
local path_sep = package.config:sub(1,1);
+local have_encodings, encodings = pcall(require, "util.encodings");
+local nameprep = have_encodings and encodings.stringprep.nameprep or function (host) return host:lower(); end
+
module "configmanager"
_M.resolve_relative_path = resolve_relative_path; -- COMPAT
@@ -139,6 +142,7 @@ do
rawset(env, "__currenthost", "*") -- Default is global
function env.VirtualHost(name)
+ name = nameprep(name);
if rawget(config, name) and rawget(config[name], "component_module") then
error(format("Host %q clashes with previously defined %s Component %q, for services use a sub-domain like conference.%s",
name, config[name].component_module:gsub("^%a+$", { component = "external", muc = "MUC"}), name, name), 0);
@@ -156,6 +160,7 @@ do
env.Host, env.host = env.VirtualHost, env.VirtualHost;
function env.Component(name)
+ name = nameprep(name);
if rawget(config, name) and rawget(config[name], "defined") and not rawget(config[name], "component_module") then
error(format("Component %q clashes with previously defined Host %q, for services use a sub-domain like conference.%s",
name, name, name), 0);
diff --git a/prosodyctl b/prosodyctl
index d9ae9b73..1060a7c9 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -268,13 +268,14 @@ local show_yesno = prosodyctl.show_yesno;
local show_prompt = prosodyctl.show_prompt;
local read_password = prosodyctl.read_password;
+local jid_split = require "util.jid".prepped_split;
+
local prosodyctl_timeout = (config.get("*", "prosodyctl_timeout") or 5) * 2;
-----------------------
local commands = {};
local command = arg[1];
function commands.adduser(arg)
- local jid_split = require "util.jid".split;
if not arg[1] or arg[1] == "--help" then
show_usage([[adduser JID]], [[Create the specified user account in Prosody]]);
return 1;
@@ -314,7 +315,6 @@ function commands.adduser(arg)
end
function commands.passwd(arg)
- local jid_split = require "util.jid".split;
if not arg[1] or arg[1] == "--help" then
show_usage([[passwd JID]], [[Set the password for the specified user account in Prosody]]);
return 1;
@@ -354,7 +354,6 @@ function commands.passwd(arg)
end
function commands.deluser(arg)
- local jid_split = require "util.jid".split;
if not arg[1] or arg[1] == "--help" then
show_usage([[deluser JID]], [[Permanently remove the specified user account from Prosody]]);
return 1;
@@ -373,7 +372,6 @@ function commands.deluser(arg)
if not hosts[host] then
show_warning("The host '%s' is not listed in the configuration file (or is not enabled).", host)
- show_warning("The user will not be able to log in until this is changed.");
hosts[host] = make_host(host);
end