util.xmppstream: Implement stanza size limiting, default limit 10MB
[prosody.git] / prosodyctl
index 88daf11b16296b645134090395ddfceb66e8ec78..d341a75bbabb7a5e131626e80f6628df85ff74b0 100755 (executable)
@@ -670,6 +670,11 @@ function cert_commands.config(arg)
                                        v = arg[1]
                                elseif k == "emailAddress" then
                                        v = "xmpp@" .. arg[1];
+                               elseif k == "countryName" then
+                                       local tld = arg[1]:match"%.([a-z]+)$";
+                                       if tld and #tld == 2 and tld ~= "uk" then
+                                               v = tld:upper();
+                                       end
                                end
                                nv = show_prompt(("%s (%s):"):format(k, nv or v));
                                nv = (not nv or nv == "") and v or nv;
@@ -679,7 +684,12 @@ function cert_commands.config(arg)
                                conf.distinguished_name[k] = nv ~= "." and nv or nil;
                        end
                end
-               local conf_file = io.open(conf_filename, "w");
+               local conf_file, err = io.open(conf_filename, "w");
+               if not conf_file then
+                       show_warning("Could not open OpenSSL config file for writing");
+                       show_warning(err);
+                       os.exit(1);
+               end
                conf_file:write(conf:serialize());
                conf_file:close();
                print("");