# HG changeset patch # User Kim Alvefur # Date 1572699373 -3600 # Node ID 3d0adbc74c39fb5723d1d4d0f831c40887d78c29 # Parent a832335592531696b7aa8a425121ac6c45a25b58 core.configmanager: Handle nameprep validation errors diff -r a83233559253 -r 3d0adbc74c39 core/configmanager.lua --- a/core/configmanager.lua Sat Nov 02 13:55:38 2019 +0100 +++ b/core/configmanager.lua Sat Nov 02 13:56:13 2019 +0100 @@ -141,7 +141,11 @@ 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 @@ 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",