util.openssl: Allow order of distinguished name fields to be included in config
authorKim Alvefur <zash@zash.se>
Thu, 25 Feb 2016 14:34:38 +0000 (15:34 +0100)
committerKim Alvefur <zash@zash.se>
Thu, 25 Feb 2016 14:34:38 +0000 (15:34 +0100)
util/openssl.lua

index 12e49eac2ef5efa8f96c266a758f72ad327ef3f0..757259f66469d6a5fdfb879338fea06741d8cd50 100644 (file)
@@ -70,8 +70,7 @@ function ssl_config:serialize()
                                end
                        end
                elseif k == "distinguished_name" then
-                       for i=1, #DN_order do
-                               local k = DN_order[i]
+                       for i, k in ipairs(t[1] and t or DN_order) do
                                local v = t[k];
                                if v then
                                        s = s .. ("%s = %s\n"):format(k, v);