# HG changeset patch # User Kim Alvefur # Date 1367236844 -7200 # Node ID edc97af48d19fc41ea11e089c79ecf80ec6b360c # Parent d22416f8a836947ffd6315a7305b06e58bebfa1c prosodyctl: Ask about the distinguished name in a in a consistent order diff -r d22416f8a836 -r edc97af48d19 prosodyctl --- a/prosodyctl Mon Apr 29 13:59:39 2013 +0200 +++ b/prosodyctl Mon Apr 29 14:00:44 2013 +0200 @@ -662,19 +662,22 @@ 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]; + 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 - 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 local conf_file = io.open(conf_filename, "w"); conf_file:write(conf:serialize());