projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mod_c2s, mod_s2s: Log a message that stream encryption has been enabled with some...
[prosody.git]
/
util
/
prosodyctl.lua
diff --git
a/util/prosodyctl.lua
b/util/prosodyctl.lua
index 8c58f2cdc309e2a6d3e95e1fe27a442cde890ed8..b80a69f26eaafab55be94e4a2b47b65130e9818a 100644
(file)
--- a/
util/prosodyctl.lua
+++ b/
util/prosodyctl.lua
@@
-136,11
+136,16
@@
function adduser(params)
return false, "invalid-hostname";
end
return false, "invalid-hostname";
end
- local provider = prosody.hosts[host].users;
+ local host_session = prosody.hosts[host];
+ if not host_session then
+ return false, "no-such-host";
+ end
+
+ storagemanager.initialize_host(host);
+ local provider = host_session.users;
if not(provider) or provider.name == "null" then
usermanager.initialize_host(host);
end
if not(provider) or provider.name == "null" then
usermanager.initialize_host(host);
end
- storagemanager.initialize_host(host);
local ok, errmsg = usermanager.create_user(user, password, host);
if not ok then
local ok, errmsg = usermanager.create_user(user, password, host);
if not ok then
@@
-151,11
+156,12
@@
end
function user_exists(params)
local user, host, password = nodeprep(params.user), nameprep(params.host), params.password;
function user_exists(params)
local user, host, password = nodeprep(params.user), nameprep(params.host), params.password;
+
+ storagemanager.initialize_host(host);
local provider = prosody.hosts[host].users;
if not(provider) or provider.name == "null" then
usermanager.initialize_host(host);
end
local provider = prosody.hosts[host].users;
if not(provider) or provider.name == "null" then
usermanager.initialize_host(host);
end
- storagemanager.initialize_host(host);
return usermanager.user_exists(user, host);
end
return usermanager.user_exists(user, host);
end
@@
-172,18
+178,18
@@
function deluser(params)
if not _M.user_exists(params) then
return false, "no-such-user";
end
if not _M.user_exists(params) then
return false, "no-such-user";
end
-
params.password = nil
;
+
local user, host = nodeprep(params.user), nameprep(params.host)
;
- return
_M.adduser(params
);
+ return
usermanager.delete_user(user, host
);
end
function getpid()
end
function getpid()
- local pidfile = config.get("*", "
core", "
pidfile");
+ local pidfile = config.get("*", "pidfile");
if not pidfile then
return false, "no-pidfile";
end
if not pidfile then
return false, "no-pidfile";
end
- local modules_enabled = set.new(config.get("*", "
core", "
modules_enabled"));
+ local modules_enabled = set.new(config.get("*", "modules_enabled"));
if not modules_enabled:contains("posix") then
return false, "no-posix";
end
if not modules_enabled:contains("posix") then
return false, "no-posix";
end
@@
-269,3
+275,5
@@
function reload()
signal.kill(pid, signal.SIGHUP);
return true;
end
signal.kill(pid, signal.SIGHUP);
return true;
end
+
+return _M;