aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-05-09 01:11:27 +0200
committerKim Alvefur <zash@zash.se>2012-05-09 01:11:27 +0200
commitacb9adf50a417be9d42236d9a5748713340e2917 (patch)
tree8a1f9533d57be27c6265e82a0d6863de6513a0c3
parent742dc2254e3a58c69a1d67def04852f53753199c (diff)
downloadprosody-acb9adf50a417be9d42236d9a5748713340e2917.tar.gz
prosody-acb9adf50a417be9d42236d9a5748713340e2917.zip
prosodyctl: Show an error if the user doesn't supply a hostname to the certificate commands
-rwxr-xr-xprosodyctl7
1 files changed, 6 insertions, 1 deletions
diff --git a/prosodyctl b/prosodyctl
index 4511ec2c..40a15010 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -205,6 +205,7 @@ local error_messages = setmetatable({
["invalid-hostname"] = "The given hostname is invalid";
["no-password"] = "No password was supplied";
["no-such-user"] = "The given user does not exist on the server";
+ ["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";
["no-posix"] = "The mod_posix module is not enabled in the Prosody config file, see http://prosody.im/doc/prosodyctl for more info";
@@ -648,7 +649,7 @@ function cert_commands.config(arg)
show_message("Config written to " .. conf_filename);
return nil, conf_filename;
else
- show_usage("cert config HOSTNAME", "generates config for OpenSSL")
+ show_usage("cert config HOSTNAME", "builds a config for OpenSSL")
end
end
@@ -714,6 +715,10 @@ function commands.cert(arg)
if #arg >= 1 and arg[1] ~= "--help" then
local subcmd = table.remove(arg, 1);
if type(cert_commands[subcmd]) == "function" then
+ if not hosts[arg[1]] then
+ show_message(error_messages["no-such-host"]);
+ return
+ end
return cert_commands[subcmd](arg);
end
end