diff --git a/Cargo.lock b/Cargo.lock index d8b09bf94..3b676e2a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2134,12 +2134,6 @@ dependencies = [ "syn", ] -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - [[package]] name = "openssl-probe" version = "0.2.0" @@ -2890,7 +2884,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" dependencies = [ - "openssl-probe 0.2.0", + "openssl-probe", "rustls-pki-types", "schannel", "security-framework", @@ -3184,7 +3178,7 @@ dependencies = [ "num_enum", "oid-registry", "openssl", - "openssl-probe 0.1.6", + "openssl-probe", "openssl-sys", "page_size", "parking_lot", diff --git a/crates/stdlib/Cargo.toml b/crates/stdlib/Cargo.toml index d39f0ab43..4af890b8e 100644 --- a/crates/stdlib/Cargo.toml +++ b/crates/stdlib/Cargo.toml @@ -115,7 +115,7 @@ dns-lookup = "3.0" # OpenSSL dependencies (optional, for ssl-openssl feature) openssl = { version = "0.10.72", optional = true } openssl-sys = { version = "0.9.110", optional = true } -openssl-probe = { version = "0.1.5", optional = true } +openssl-probe = { version = "0.2.0", optional = true } foreign-types-shared = { version = "0.1.1", optional = true } # Rustls dependencies (optional, for ssl-rustls feature) diff --git a/crates/stdlib/src/openssl.rs b/crates/stdlib/src/openssl.rs index 38103a9ab..df153459f 100644 --- a/crates/stdlib/src/openssl.rs +++ b/crates/stdlib/src/openssl.rs @@ -25,6 +25,7 @@ cfg_if::cfg_if! { use crate::vm::{PyRef, VirtualMachine, builtins::PyModule}; use openssl_probe::ProbeResult; +use std::sync::LazyLock; pub(crate) fn make_module(vm: &VirtualMachine) -> PyRef { // if openssl is vendored, it doesn't know the locations @@ -38,12 +39,12 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyRef { // easily, without having to have a bunch of cfgs cfg_if::cfg_if! { if #[cfg(openssl_vendored)] { - use std::sync::LazyLock; static PROBE: LazyLock = LazyLock::new(openssl_probe::probe); fn probe() -> &'static ProbeResult { &PROBE } } else { + static EMPTY_PROBE: LazyLock = LazyLock::new(|| ProbeResult { cert_file: None, cert_dir: vec![] }); fn probe() -> &'static ProbeResult { - &ProbeResult { cert_file: None, cert_dir: None } + &EMPTY_PROBE } } } @@ -446,7 +447,7 @@ mod _ssl { }); let cert_dir = probe .cert_dir - .as_ref() + .first() .map(PathBuf::from) .unwrap_or_else(|| { path_from_cstr(unsafe { CStr::from_ptr(sys::X509_get_default_cert_dir()) })