certmanager: Try filename.key if certificate is set to a full filename ending with .crt
authorKim Alvefur <zash@zash.se>
Fri, 05 Feb 2016 16:12:01 +0100
changeset 7148 b1a109858502
parent 7147 f855ba7da30e
child 7149 c793f9d13a36
child 7152 bb0fd02ae70f
certmanager: Try filename.key if certificate is set to a full filename ending with .crt
core/certmanager.lua
--- a/core/certmanager.lua	Fri Feb 05 15:03:39 2016 +0100
+++ b/core/certmanager.lua	Fri Feb 05 16:12:01 2016 +0100
@@ -63,14 +63,13 @@
 		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