revert(boring): Restore `src/x509/store.rs` to match upstream

This commit is contained in:
0x676e67 2025-06-17 20:22:42 +08:00
parent e04066ee46
commit f4419dc416
1 changed files with 11 additions and 17 deletions

View File

@ -134,23 +134,6 @@ foreign_type_and_impl_send_sync! {
pub struct X509Store;
}
impl Clone for X509Store {
fn clone(&self) -> Self {
(**self).to_owned()
}
}
impl ToOwned for X509StoreRef {
type Owned = X509Store;
fn to_owned(&self) -> Self::Owned {
unsafe {
ffi::X509_STORE_up_ref(self.as_ptr());
X509Store::from_ptr(self.as_ptr())
}
}
}
impl X509StoreRef {
/// **Warning: this method is unsound**
///
@ -175,3 +158,14 @@ impl X509StoreRef {
self.objects().len()
}
}
#[test]
#[allow(dead_code)]
// X509Store must not implement Clone because `SslContextBuilder::cert_store_mut` lets
// you get a mutable reference to a store that could have been cloned before being
// passed to `SslContextBuilder::set_cert_store`.
fn no_clone_for_x509store() {
trait MustNotImplementClone {}
impl<T: Clone> MustNotImplementClone for T {}
impl MustNotImplementClone for X509Store {}
}