aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-05-18 15:29:31 +0100
committerMatthew Wild <mwild1@gmail.com>2013-05-18 15:29:31 +0100
commitae3f10826d62c09f5ee5a7ac5be2a0746ae23c08 (patch)
treefda21a54555298a2369737f472bf288fcff6dce9 /plugins
parente3dd43d3a9975de0d8a5a211610af72926b2e5ca (diff)
parent7681e34f83898993205274a416718dc3db56333d (diff)
downloadprosody-ae3f10826d62c09f5ee5a7ac5be2a0746ae23c08.tar.gz
prosody-ae3f10826d62c09f5ee5a7ac5be2a0746ae23c08.zip
Merge
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_telnet.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 2056f1e2..1fd20543 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -700,9 +700,9 @@ function def_env.s2s:showcert(domain)
error("This version of LuaSec does not support certificate viewing");
end
else
- local certs = conn:getpeerchain();
- local cert = certs[1];
+ local cert = conn:getpeercertificate();
if cert then
+ local certs = conn:getpeerchain();
local digest = cert:digest("sha1");
if not cert_set[digest] then
local chain_valid, chain_errors = conn:getpeerverification();
@@ -957,7 +957,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);
@@ -970,7 +972,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);
@@ -983,7 +987,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);