aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-08-26 12:00:51 +0200
committerKim Alvefur <zash@zash.se>2014-08-26 12:00:51 +0200
commitaea3b6d32d2ddc7bef8eaf6e07e6f490e86f46be (patch)
treea7c9626534da045d2ad473fa6f8e57f395f85c30
parentd73585bca84dd9df894abebd2ef4cb722242ba5a (diff)
downloadprosody-aea3b6d32d2ddc7bef8eaf6e07e6f490e86f46be.tar.gz
prosody-aea3b6d32d2ddc7bef8eaf6e07e6f490e86f46be.zip
prosodyctl: Verify that 'pidfile' is a string, show friendly error otherwise
-rwxr-xr-xprosodyctl1
-rw-r--r--util/prosodyctl.lua4
2 files changed, 5 insertions, 0 deletions
diff --git a/prosodyctl b/prosodyctl
index 38dac363..8580aaf6 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -220,6 +220,7 @@ local error_messages = setmetatable({
["no-such-host"] = "The given hostname does not exist in the config";
["unable-to-save-data"] = "Unable to store, perhaps you don't have permission?";
["no-pidfile"] = "There is no 'pidfile' option in the configuration file, see http://prosody.im/doc/prosodyctl#pidfile for help";
+ ["invalid-pidfile"] = "The 'pidfile' option in the configuration file is not a string, see http://prosody.im/doc/prosodyctl#pidfile for help";
["no-posix"] = "The mod_posix module is not enabled in the Prosody config file, see http://prosody.im/doc/prosodyctl for more info";
["no-such-method"] = "This module has no commands";
["not-running"] = "Prosody is not running";
diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua
index b80a69f2..c6fe1986 100644
--- a/util/prosodyctl.lua
+++ b/util/prosodyctl.lua
@@ -188,6 +188,10 @@ function getpid()
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("*", "modules_enabled"));
if not modules_enabled:contains("posix") then