mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 21:43:33 +00:00
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:
@@ -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:
|
||||
|
||||
@@ -126,7 +126,13 @@ iterator scanSSLCertificates*(useEnvVars = false): string =
|
||||
if fileExists(p):
|
||||
yield p
|
||||
elif dirExists(p):
|
||||
# check if it's a dir where each cert is one file
|
||||
# named by it's hasg
|
||||
for fn in joinPath(p, "*.0").walkFiles:
|
||||
yield p.normalizePathEnd(true)
|
||||
break
|
||||
for fn in joinPath(p, "*").walkFiles():
|
||||
|
||||
yield fn
|
||||
else:
|
||||
var
|
||||
|
||||
Reference in New Issue
Block a user