fixes #17658; add cert dir for ssl ctx (#19920)

add cert dir for ssl ctx

Co-authored-by: Paul Roberts <pmr@stelo.org.uk>
Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com>
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
This commit is contained in:
ringabout 2022-08-29 10:16:19 +08:00 • committed by GitHub
commit 04642335c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -696,7 +696,11 @@ when defineSsl:
var found = false
let useEnvVars = (if verifyMode == CVerifyPeerUseEnvVars: true else: false)
for fn in scanSSLCertificates(useEnvVars = useEnvVars):
if newCTX.SSL_CTX_load_verify_locations(fn.cstring, nil) == VerifySuccess:
if fn.extractFilename == "":
if newCTX.SSL_CTX_load_verify_locations(nil, cstring(fn.normalizePathEnd(false))) == VerifySuccess:
found = true
break
elif newCTX.SSL_CTX_load_verify_locations(cstring(fn), nil) == VerifySuccess:
found = true
break
if not found: