Merge pull request #1867 from RustPython/coolreader18/fix-openssl-vendor-certs

Fix openssl certificates not being found when openssl is vendored
This commit is contained in:
Jeong YunWon
2020-04-14 01:00:03 +09:00
committed by GitHub
3 changed files with 13 additions and 0 deletions

7
Cargo.lock generated
View File

@@ -1032,6 +1032,12 @@ dependencies = [
"openssl-sys",
]
[[package]]
name = "openssl-probe"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]]
name = "openssl-src"
version = "111.8.1+1.1.1f"
@@ -1584,6 +1590,7 @@ dependencies = [
"num_enum",
"once_cell",
"openssl",
"openssl-probe",
"openssl-sys",
"paste",
"pwd",

View File

@@ -95,6 +95,7 @@ socket2 = { version = "0.3", features = ["unix"] }
rustyline = "6.0"
openssl = { version = "0.10", features = ["vendored"] }
openssl-sys = "0.9"
openssl-probe = "0.1"
[target.'cfg(not(any(target_arch = "wasm32", target_os = "redox")))'.dependencies]
dns-lookup = "1.0"

View File

@@ -740,6 +740,11 @@ fn parse_version_info(mut n: i64) -> (u8, u8, u8, u8, u8) {
}
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
// if openssl is vendored, it doesn't know the locations of system certificates
match option_env!("OPENSSL_NO_VENDOR") {
None | Some("0") => {}
_ => openssl_probe::init_ssl_cert_env_vars(),
}
openssl::init();
let ctx = &vm.ctx;
let ssl_error = create_type(