util.prosodyctl: In the register command, check that the virtual exists before proceeding.
authorKim Alvefur <zash@zash.se>
Wed, 08 Feb 2012 15:33:36 +0100
changeset 4499 55ef5d83d00a
parent 4498 9454d237cf7c
child 4500 bfa387f268e2
child 4501 eacc93e23f21
util.prosodyctl: In the register command, check that the virtual exists before proceeding.
util/prosodyctl.lua
--- a/util/prosodyctl.lua	Fri Dec 16 16:01:59 2011 +0000
+++ b/util/prosodyctl.lua	Wed Feb 08 15:33:36 2012 +0100
@@ -121,7 +121,11 @@
 		return false, "invalid-hostname";
 	end
 
-	local provider = prosody.hosts[host].users;
+	local host = prosody.hosts[host];
+	if not host then
+		return false, "no-such-host";
+	end
+	local provider = host.users;
 	if not(provider) or provider.name == "null" then
 		usermanager.initialize_host(host);
 	end