aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-04-29 14:00:44 +0200
committerKim Alvefur <zash@zash.se>2013-04-29 14:00:44 +0200
commit11ff95b32fc14b91685628afc3104edc65033d61 (patch)
tree79b638ccb194aee32c465cc18cd29622bbf8a132
parent762b20d67d6784ed0f363314b8e29b1116a5c5c4 (diff)
downloadprosody-11ff95b32fc14b91685628afc3104edc65033d61.tar.gz
prosody-11ff95b32fc14b91685628afc3104edc65033d61.zip
prosodyctl: Ask about the distinguished name in a in a consistent order
-rwxr-xr-xprosodyctl27
1 files changed, 15 insertions, 12 deletions
diff --git a/prosodyctl b/prosodyctl
index 06590d1c..88daf11b 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -662,19 +662,22 @@ function cert_commands.config(arg)
conf:from_prosody(hosts, config, arg);
show_message("Please provide details to include in the certificate config file.");
show_message("Leave the field empty to use the default value or '.' to exclude the field.")
- for k, v in pairs(conf.distinguished_name) do
- local nv;
- if k == "commonName" then
- v = arg[1]
- elseif k == "emailAddress" then
- v = "xmpp@" .. arg[1];
- end
- nv = show_prompt(("%s (%s):"):format(k, nv or v));
- nv = (not nv or nv == "") and v or nv;
- if nv:find"[\192-\252][\128-\191]+" then
- conf.req.string_mask = "utf8only"
+ for i, k in ipairs(openssl._DN_order) do
+ local v = conf.distinguished_name[k];
+ if v then
+ local nv;
+ if k == "commonName" then
+ v = arg[1]
+ elseif k == "emailAddress" then
+ v = "xmpp@" .. arg[1];
+ end
+ nv = show_prompt(("%s (%s):"):format(k, nv or v));
+ nv = (not nv or nv == "") and v or nv;
+ if nv:find"[\192-\252][\128-\191]+" then
+ conf.req.string_mask = "utf8only"
+ end
+ conf.distinguished_name[k] = nv ~= "." and nv or nil;
end
- conf.distinguished_name[k] = nv ~= "." and nv or nil;
end
local conf_file = io.open(conf_filename, "w");
conf_file:write(conf:serialize());