aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_admin_telnet.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-05-18 13:19:31 +0200
committerKim Alvefur <zash@zash.se>2013-05-18 13:19:31 +0200
commitaa4b5036e35c1e60d3eba1fc2eeeaf96ae76ab15 (patch)
tree8972473329851c2a4c58fef18262c01914833680 /plugins/mod_admin_telnet.lua
parent146ed08e62ea1fe04dadaf57a8541ad0dd58f2c9 (diff)
downloadprosody-aa4b5036e35c1e60d3eba1fc2eeeaf96ae76ab15.tar.gz
prosody-aa4b5036e35c1e60d3eba1fc2eeeaf96ae76ab15.zip
mod_admin_telnet: Verify that the host exists in user commands (Thanks SkyBlue)
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r--plugins/mod_admin_telnet.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 92c11d4b..3d149623 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -939,7 +939,9 @@ local um = require"core.usermanager";
def_env.user = {};
function def_env.user:create(jid, password)
local username, host = jid_split(jid);
- if um.user_exists(username, host) then
+ if not hosts[host] then
+ return nil, "No such host: "..host;
+ elseif um.user_exists(username, host) then
return nil, "User exists";
end
local ok, err = um.create_user(username, password, host);
@@ -952,7 +954,9 @@ end
function def_env.user:delete(jid)
local username, host = jid_split(jid);
- if not um.user_exists(username, host) then
+ if not hosts[host] then
+ return nil, "No such host: "..host;
+ elseif um.user_exists(username, host) then
return nil, "No such user";
end
local ok, err = um.delete_user(username, host);
@@ -965,7 +969,9 @@ end
function def_env.user:password(jid, password)
local username, host = jid_split(jid);
- if not um.user_exists(username, host) then
+ if not hosts[host] then
+ return nil, "No such host: "..host;
+ elseif um.user_exists(username, host) then
return nil, "No such user";
end
local ok, err = um.set_password(username, password, host);