aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/certmanager.lua2
-rw-r--r--core/portmanager.lua4
2 files changed, 4 insertions, 2 deletions
diff --git a/core/certmanager.lua b/core/certmanager.lua
index 2585716f..c193e824 100644
--- a/core/certmanager.lua
+++ b/core/certmanager.lua
@@ -120,7 +120,7 @@ local function index_certs(dir, files_by_name, depth_limit)
if f then
-- TODO look for chained certificates
local firstline = f:read();
- if firstline == "-----BEGIN CERTIFICATE-----" then
+ if firstline == "-----BEGIN CERTIFICATE-----" and lfs.attributes(find_matching_key(full), "mode") == "file" then
f:seek("set")
local cert = ssl.loadcertificate(f:read("*a"))
-- TODO if more than one cert is found for a name, the most recently
diff --git a/core/portmanager.lua b/core/portmanager.lua
index 95d42b77..38c74b66 100644
--- a/core/portmanager.lua
+++ b/core/portmanager.lua
@@ -216,7 +216,9 @@ function close(interface, port)
end
function get_service_at(interface, port)
- local data = active_services:search(nil, interface, port)[1][1];
+ local data = active_services:search(nil, interface, port);
+ if not data or not data[1] or not data[1][1] then return nil, "not-found"; end
+ data = data[1][1];
return data.service, data.server;
end