Comparison

core/certmanager.lua @ 11533:f97592336399

core.certmanager: Join paths with OS-aware util.paths function Right thing to do, rather than hardcoding '/'
author Kim Alvefur <zash@zash.se>
date Wed, 05 May 2021 15:54:05 +0200
parent 11532:c0c859425c22
child 11534:1cef62ca3e03
comparison
equal deleted inserted replaced
11532:c0c859425c22 11533:f97592336399
35 local select = select; 35 local select = select;
36 local now = os.time; 36 local now = os.time;
37 local next = next; 37 local next = next;
38 38
39 local prosody = prosody; 39 local prosody = prosody;
40 local resolve_path = require"util.paths".resolve_relative_path; 40 local pathutil = require"util.paths";
41 local resolve_path = pathutil.resolve_relative_path;
41 local config_path = prosody.paths.config or "."; 42 local config_path = prosody.paths.config or ".";
42 43
43 local luasec_major, luasec_minor = ssl._VERSION:match("^(%d+)%.(%d+)"); 44 local luasec_major, luasec_minor = ssl._VERSION:match("^(%d+)%.(%d+)");
44 local luasec_version = tonumber(luasec_major) * 100 + tonumber(luasec_minor); 45 local luasec_version = tonumber(luasec_major) * 100 + tonumber(luasec_minor);
45 -- TODO Use ssl.config instead of require here once we are sure that the fix 46 -- TODO Use ssl.config instead of require here once we are sure that the fix
101 files_by_name = files_by_name or {}; 102 files_by_name = files_by_name or {};
102 depth_limit = depth_limit or 3; 103 depth_limit = depth_limit or 3;
103 if depth_limit <= 0 then return files_by_name; end 104 if depth_limit <= 0 then return files_by_name; end
104 105
105 for file in lfs.dir(dir) do 106 for file in lfs.dir(dir) do
106 local full = dir.."/"..file 107 local full = pathutil.join(dir, file);
107 if lfs.attributes(full, "mode") == "directory" then 108 if lfs.attributes(full, "mode") == "directory" then
108 if file:sub(1,1) ~= "." then 109 if file:sub(1,1) ~= "." then
109 index_certs(full, files_by_name, depth_limit-1); 110 index_certs(full, files_by_name, depth_limit-1);
110 end 111 end
111 -- TODO support more filename patterns? 112 -- TODO support more filename patterns?