Mercurial > prosody-hg
comparison core/certmanager.lua @ 7145:b1a109858502
certmanager: Try filename.key if certificate is set to a full filename ending with .crt
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 05 Feb 2016 16:12:01 +0100 |
| parents | f855ba7da30e |
| children | 5c1ee8c06235 |
comparison
equal
deleted
inserted
replaced
| 7144:f855ba7da30e | 7145:b1a109858502 |
|---|---|
| 61 for i = 1, #crt_try do | 61 for i = 1, #crt_try do |
| 62 local crt_path = certs .. crt_try[i]:format(name); | 62 local crt_path = certs .. crt_try[i]:format(name); |
| 63 local key_path = certs .. key_try[i]:format(name); | 63 local key_path = certs .. key_try[i]:format(name); |
| 64 | 64 |
| 65 if stat(crt_path, "mode") == "file" then | 65 if stat(crt_path, "mode") == "file" then |
| 66 if stat(key_path, "mode") == "file" then | |
| 67 return { certificate = crt_path, key = key_path }; | |
| 68 end | |
| 69 if key_path:sub(-4) == ".crt" then | 66 if key_path:sub(-4) == ".crt" then |
| 70 key_path = key_path:sub(1, -4) .. "key"; | 67 key_path = key_path:sub(1, -4) .. "key"; |
| 71 if stat(key_path, "mode") == "file" then | 68 if stat(key_path, "mode") == "file" then |
| 72 return { certificate = crt_path, key = key_path }; | 69 return { certificate = crt_path, key = key_path }; |
| 73 end | 70 end |
| 71 elseif stat(key_path, "mode") == "file" then | |
| 72 return { certificate = crt_path, key = key_path }; | |
| 74 end | 73 end |
| 75 end | 74 end |
| 76 end | 75 end |
| 77 end | 76 end |
| 78 | 77 |
