certmanager: Try filename.key if certificate is set to a full filename ending with...
authorKim Alvefur <zash@zash.se>
Fri, 5 Feb 2016 15:12:01 +0000 (16:12 +0100)
committerKim Alvefur <zash@zash.se>
Fri, 5 Feb 2016 15:12:01 +0000 (16:12 +0100)
core/certmanager.lua

index f671599823720afd65d38374726be3a2aa3eb0ec..978a9efcfd4ba0209b8217cc97dcc5095fc336a9 100644 (file)
@@ -63,14 +63,13 @@ local function find_cert(user_certs, name)
                local key_path = certs .. key_try[i]:format(name);
 
                if stat(crt_path, "mode") == "file" then
-                       if stat(key_path, "mode") == "file" then
-                               return { certificate = crt_path, key = key_path };
-                       end
                        if key_path:sub(-4) == ".crt" then
                                key_path = key_path:sub(1, -4) .. "key";
                                if stat(key_path, "mode") == "file" then
                                        return { certificate = crt_path, key = key_path };
                                end
+                       elseif stat(key_path, "mode") == "file" then
+                               return { certificate = crt_path, key = key_path };
                        end
                end
        end