Skip to content

Commit 4d27e73

Browse files
committed
fix
1 parent b13fc03 commit 4d27e73

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

stdlib/build.rs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,28 @@ fn main() {
2323
println!("cargo::rustc-check-cfg=cfg({cfg})");
2424
}
2525

26-
#[allow(clippy::unusual_byte_groupings)]
27-
if let Ok(v) = std::env::var("DEP_OPENSSL_VERSION_NUMBER") {
28-
println!("cargo:rustc-env=OPENSSL_API_VERSION={v}");
29-
// cfg setup from openssl crate's build script
30-
let version = u64::from_str_radix(&v, 16).unwrap();
31-
for (ver, cfg) in ossl_vers {
32-
if version >= ver {
33-
println!("cargo:rustc-cfg={cfg}");
26+
#[cfg(feature = "ssl-openssl")]
27+
{
28+
#[allow(clippy::unusual_byte_groupings)]
29+
if let Ok(v) = std::env::var("DEP_OPENSSL_VERSION_NUMBER") {
30+
println!("cargo:rustc-env=OPENSSL_API_VERSION={v}");
31+
// cfg setup from openssl crate's build script
32+
let version = u64::from_str_radix(&v, 16).unwrap();
33+
for (ver, cfg) in ossl_vers {
34+
if version >= ver {
35+
println!("cargo:rustc-cfg={cfg}");
36+
}
3437
}
3538
}
36-
}
37-
if let Ok(v) = std::env::var("DEP_OPENSSL_CONF") {
38-
for conf in v.split(',') {
39-
println!("cargo:rustc-cfg=osslconf=\"{conf}\"");
39+
if let Ok(v) = std::env::var("DEP_OPENSSL_CONF") {
40+
for conf in v.split(',') {
41+
println!("cargo:rustc-cfg=osslconf=\"{conf}\"");
42+
}
43+
}
44+
// it's possible for openssl-sys to link against the system openssl under certain conditions,
45+
// so let the ssl module know to only perform a probe if we're actually vendored
46+
if std::env::var("DEP_OPENSSL_VENDORED").is_ok_and(|s| s == "1") {
47+
println!("cargo::rustc-cfg=openssl_vendored")
4048
}
41-
}
42-
// it's possible for openssl-sys to link against the system openssl under certain conditions,
43-
// so let the ssl module know to only perform a probe if we're actually vendored
44-
if std::env::var("DEP_OPENSSL_VENDORED").is_ok_and(|s| s == "1") {
45-
println!("cargo::rustc-cfg=openssl_vendored")
4649
}
4750
}

stdlib/src/ssl/cert.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,9 +1007,9 @@ impl ClientCertVerifier for DeferredClientCertVerifier {
10071007
}
10081008

10091009
fn client_auth_mandatory(&self) -> bool {
1010-
// Return false to make client auth optional during handshake
1011-
// This allows the handshake to complete even if client cert is invalid
1012-
false
1010+
// Delegate to inner verifier to respect CERT_REQUIRED mode
1011+
// This ensures client certificates are mandatory when verify_mode=CERT_REQUIRED
1012+
self.inner.client_auth_mandatory()
10131013
}
10141014

10151015
fn root_hint_subjects(&self) -> &[rustls::DistinguishedName] {

stdlib/src/ssl/compat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,13 @@ impl SslError {
473473
// Set library and reason attributes like CPython
474474
// Ignore errors as they're extremely rare (e.g., out of memory)
475475
let _ = exc.as_object().set_attr(
476-
"_library",
476+
"library",
477477
vm.ctx.new_str(library).as_object().to_owned(),
478478
vm,
479479
);
480480
let _ =
481481
exc.as_object()
482-
.set_attr("_reason", vm.ctx.new_str(reason).as_object().to_owned(), vm);
482+
.set_attr("reason", vm.ctx.new_str(reason).as_object().to_owned(), vm);
483483

484484
exc
485485
}

0 commit comments

Comments
 (0)