Skip to content

Commit

Permalink
also reset SYSTEM_CA_ROOTS from __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Feb 15, 2024
1 parent aab83e5 commit 5736d5e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/NetworkOptions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ include("ca_roots.jl")
include("ssh_options.jl")
include("verify_host.jl")

function __init__()
SYSTEM_CA_ROOTS[] = nothing
BUNDLED_KNOWN_HOSTS_FILE[] = nothing
end

end # module
4 changes: 2 additions & 2 deletions src/ca_roots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const BSD_CA_ROOTS = [
]

const SYSTEM_CA_ROOTS_LOCK = ReentrantLock()
const SYSTEM_CA_ROOTS = Ref{String}()
const SYSTEM_CA_ROOTS = Ref{Union{Nothing, String}}(nothing)

const BEGIN_CERT_REGULAR = "-----BEGIN CERTIFICATE-----"
const BEGIN_CERT_OPENSSL = "-----BEGIN TRUSTED CERTIFICATE-----"
Expand All @@ -84,7 +84,7 @@ NetworkOptions could only find OpenSSL-specific TLS certificates which cannot be

function system_ca_roots()
lock(SYSTEM_CA_ROOTS_LOCK) do
isassigned(SYSTEM_CA_ROOTS) && return # from lock()
SYSTEM_CA_ROOTS[] !== nothing && return # from lock()
search_path = Sys.islinux() ? LINUX_CA_ROOTS :
Sys.isbsd() && !Sys.isapple() ? BSD_CA_ROOTS : String[]
openssl_only = false
Expand Down
7 changes: 0 additions & 7 deletions src/ssh_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,6 @@ function bundled_known_hosts()
end
end

function __init__()
# Reset in case we serialized a value here.
lock(BUNDLED_KNOWN_HOSTS_LOCK) do
BUNDLED_KNOWN_HOSTS_FILE[] = nothing
end
end

const BUNDLED_KNOWN_HOSTS = """
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
Expand Down

0 comments on commit 5736d5e

Please sign in to comment.