util.xml: Remove unused parameter (thanks, luacheck)
[prosody.git] / util / prosodyctl.lua
index e38f85d47a26ea5a6d0e24e5dbea7ebb0cfde0a9..cc48d5907155a9eee8b5afe1183f55daaa8b0e28 100644 (file)
@@ -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
@@ -182,13 +184,17 @@ function deluser(params)
 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"));
-       if not modules_enabled:contains("posix") then
+       local modules_enabled = set.new(config.get("*", "modules_disabled"));
+       if prosody.platform ~= "posix" or modules_enabled:contains("posix") then
                return false, "no-posix";
        end