Software /
code /
prosody
Changeset
10374:a83233559253
core.configmanager: Ensure Hosts are given names
Prevents traceback from nameprep(nil)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Nov 2019 13:55:38 +0100 |
parents | 10373:51ea82f55322 |
children | 10375:3d0adbc74c39 |
files | core/configmanager.lua |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/core/configmanager.lua Sat Nov 02 14:22:06 2019 +0100 +++ b/core/configmanager.lua Sat Nov 02 13:55:38 2019 +0100 @@ -138,6 +138,9 @@ rawset(env, "__currenthost", "*") -- Default is global function env.VirtualHost(name) + if not name then + error("Host must have a name", 2); + end name = nameprep(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", @@ -156,6 +159,9 @@ env.Host, env.host = env.VirtualHost, env.VirtualHost; function env.Component(name) + if not name then + error("Component must have a name", 2); + end name = nameprep(name); if rawget(config_table, name) and rawget(config_table[name], "defined") and not rawget(config_table[name], "component_module") then