mirror of
https://github.com/brunoos/luasec.git
synced 2024-12-28 05:18:21 +01:00
Do not create 'certificates' on 'cfg' if it does not exist
This commit is contained in:
parent
1c3bf23551
commit
c0cb85d77f
20
src/ssl.lua
20
src/ssl.lua
@ -74,21 +74,13 @@ local function newcontext(cfg)
|
|||||||
-- Mode
|
-- Mode
|
||||||
succ, msg = context.setmode(ctx, cfg.mode)
|
succ, msg = context.setmode(ctx, cfg.mode)
|
||||||
if not succ then return nil, msg end
|
if not succ then return nil, msg end
|
||||||
if not cfg.certificates then
|
local certificates = cfg.certificates
|
||||||
cfg.certificates = {}
|
if not certificates then
|
||||||
|
certificates = {
|
||||||
|
{ certificate = cfg.certificate, key = cfg.key, password = cfg.password }
|
||||||
|
}
|
||||||
end
|
end
|
||||||
local singularcertificate = {}
|
for _, certificate in ipairs(certificates) do
|
||||||
local singularexists = false
|
|
||||||
for _, prop in pairs({ "key", "certificate", "password" }) do
|
|
||||||
if cfg[prop] then
|
|
||||||
singularexists = true
|
|
||||||
singularcertificate[prop] = cfg[prop]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if singularexists then
|
|
||||||
table.insert(crt.certificates, singularcertificate)
|
|
||||||
end
|
|
||||||
for _, certificate in pairs(cfg.certificates) do
|
|
||||||
-- Load the key
|
-- Load the key
|
||||||
if certificate.key then
|
if certificate.key then
|
||||||
if certificate.password and
|
if certificate.password and
|
||||||
|
Loading…
Reference in New Issue
Block a user