mirror of
https://github.com/brunoos/luasec.git
synced 2024-12-27 04:58:20 +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
|
||||
succ, msg = context.setmode(ctx, cfg.mode)
|
||||
if not succ then return nil, msg end
|
||||
if not cfg.certificates then
|
||||
cfg.certificates = {}
|
||||
local certificates = cfg.certificates
|
||||
if not certificates then
|
||||
certificates = {
|
||||
{ certificate = cfg.certificate, key = cfg.key, password = cfg.password }
|
||||
}
|
||||
end
|
||||
local singularcertificate = {}
|
||||
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
|
||||
for _, certificate in ipairs(certificates) do
|
||||
-- Load the key
|
||||
if certificate.key then
|
||||
if certificate.password and
|
||||
|
Loading…
Reference in New Issue
Block a user