Comparison

prosodyctl @ 5554:e91db0aac408

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Wed, 01 May 2013 13:45:42 +0100
parent 5534:522e99b898a0
parent 5547:f306daf2bf6d
child 5584:1d841117117c
comparison
equal deleted inserted replaced
5543:d3f5165c4113 5554:e91db0aac408
658 if ask_overwrite(conf_filename) then 658 if ask_overwrite(conf_filename) then
659 return nil, conf_filename; 659 return nil, conf_filename;
660 end 660 end
661 local conf = openssl.config.new(); 661 local conf = openssl.config.new();
662 conf:from_prosody(hosts, config, arg); 662 conf:from_prosody(hosts, config, arg);
663 for k, v in pairs(conf.distinguished_name) do 663 show_message("Please provide details to include in the certificate config file.");
664 local nv; 664 show_message("Leave the field empty to use the default value or '.' to exclude the field.")
665 if k == "commonName" then 665 for i, k in ipairs(openssl._DN_order) do
666 v = arg[1] 666 local v = conf.distinguished_name[k];
667 elseif k == "emailAddress" then 667 if v then
668 v = "xmpp@" .. arg[1]; 668 local nv;
669 end 669 if k == "commonName" then
670 nv = show_prompt(("%s (%s):"):format(k, nv or v)); 670 v = arg[1]
671 nv = (not nv or nv == "") and v or nv; 671 elseif k == "emailAddress" then
672 if nv:find"[\192-\252][\128-\191]+" then 672 v = "xmpp@" .. arg[1];
673 conf.req.string_mask = "utf8only" 673 elseif k == "countryName" then
674 end 674 local tld = arg[1]:match"%.([a-z]+)$";
675 conf.distinguished_name[k] = nv ~= "." and nv or nil; 675 if tld and #tld == 2 and tld ~= "uk" then
676 v = tld:upper();
677 end
678 end
679 nv = show_prompt(("%s (%s):"):format(k, nv or v));
680 nv = (not nv or nv == "") and v or nv;
681 if nv:find"[\192-\252][\128-\191]+" then
682 conf.req.string_mask = "utf8only"
683 end
684 conf.distinguished_name[k] = nv ~= "." and nv or nil;
685 end
676 end 686 end
677 local conf_file = io.open(conf_filename, "w"); 687 local conf_file = io.open(conf_filename, "w");
678 conf_file:write(conf:serialize()); 688 conf_file:write(conf:serialize());
679 conf_file:close(); 689 conf_file:close();
680 print(""); 690 print("");