X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fprosodyctl.lua;h=c6fe1986718b87e964ff12ac9dac09d6fe5ad4c5;hb=533fc1fa57ce10fc0821f8edaeb247f2710a543c;hp=439de551687d6c87bc3aa826e6ac5201a3f8e8a7;hpb=3b635da220bdbe28712f7007be430eb6e1283912;p=prosody.git diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua index 439de551..c6fe1986 100644 --- a/util/prosodyctl.lua +++ b/util/prosodyctl.lua @@ -140,11 +140,12 @@ function adduser(params) 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 - storagemanager.initialize_host(host); local ok, errmsg = usermanager.create_user(user, password, host); if not ok then @@ -155,11 +156,12 @@ end 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 - storagemanager.initialize_host(host); return usermanager.user_exists(user, host); end @@ -176,18 +178,22 @@ function deluser(params) 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() - local pidfile = config.get("*", "core", "pidfile"); + local pidfile = config.get("*", "pidfile"); if not pidfile then return false, "no-pidfile"; end + + if type(pidfile) ~= "string" then + return false, "invalid-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 @@ -273,3 +279,5 @@ function reload() signal.kill(pid, signal.SIGHUP); return true; end + +return _M;