aboutsummaryrefslogtreecommitdiffstats
path: root/core/configmanager.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-02 13:56:13 +0100
committerKim Alvefur <zash@zash.se>2019-11-02 13:56:13 +0100
commitf563584fca3f6dff5ee1c98c5679018645f10ac0 (patch)
tree62334fe8adfb9332bfd988404ae7c169185d7018 /core/configmanager.lua
parent4b69a96d83465e0b04b4b07043f28516da0afc92 (diff)
downloadprosody-f563584fca3f6dff5ee1c98c5679018645f10ac0.tar.gz
prosody-f563584fca3f6dff5ee1c98c5679018645f10ac0.zip
core.configmanager: Handle nameprep validation errors
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r--core/configmanager.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 8ed74e3c..ae0a274a 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -141,7 +141,11 @@ do
if not name then
error("Host must have a name", 2);
end
- name = nameprep(name);
+ local prepped_name = nameprep(name);
+ if not prepped_name then
+ error(format("Name of Host %q contains forbidden characters", name), 0);
+ end
+ name = prepped_name;
if rawget(config_table, name) and rawget(config_table[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_table[name].component_module:gsub("^%a+$", { component = "external", muc = "MUC"}), name, name), 0);
@@ -162,7 +166,11 @@ do
if not name then
error("Component must have a name", 2);
end
- name = nameprep(name);
+ local prepped_name = nameprep(name);
+ if not prepped_name then
+ error(format("Name of Component %q contains forbidden characters", name), 0);
+ end
+ name = prepped_name;
if rawget(config_table, name) and rawget(config_table[name], "defined")
and not rawget(config_table[name], "component_module") then
error(format("Component %q clashes with previously defined Host %q, for services use a sub-domain like conference.%s",