Rename to reset_with_context_data
This commit is contained in:
parent
56e9fef055
commit
05f798adc4
|
|
@ -131,8 +131,6 @@ impl X509StoreContextRef {
|
|||
///
|
||||
/// This can be used to provide data to callbacks registered with the context. Use the
|
||||
/// `Ssl::new_ex_index` method to create an `Index`.
|
||||
///
|
||||
/// The previous value, if any, will be returned.
|
||||
#[corresponds(X509_STORE_CTX_set_ex_data)]
|
||||
pub fn set_ex_data<T>(&mut self, index: Index<X509StoreContext, T>, data: T) {
|
||||
if let Some(old) = self.ex_data_mut(index) {
|
||||
|
|
@ -207,7 +205,14 @@ impl X509StoreContextRef {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn init_without_cleanup(
|
||||
/// Initializes this context with the given certificate, certificates chain and certificate
|
||||
/// store.
|
||||
///
|
||||
/// * `trust` - The certificate store with the trusted certificates.
|
||||
/// * `cert` - The certificate that should be verified.
|
||||
/// * `cert_chain` - The certificates chain.
|
||||
#[corresponds(X509_STORE_CTX_init)]
|
||||
pub fn reset_with_context_data(
|
||||
&mut self,
|
||||
trust: store::X509Store,
|
||||
cert: X509,
|
||||
|
|
|
|||
|
|
@ -451,14 +451,26 @@ fn test_verify_cert() {
|
|||
let mut store_bldr = X509StoreBuilder::new().unwrap();
|
||||
store_bldr.add_cert(ca).unwrap();
|
||||
let store = store_bldr.build();
|
||||
let empty_store = X509StoreBuilder::new().unwrap().build();
|
||||
|
||||
let mut context = X509StoreContext::new().unwrap();
|
||||
assert!(context
|
||||
.init(&store, &cert, &chain, |c| c.verify_cert())
|
||||
.unwrap());
|
||||
assert!(!context
|
||||
.init(&empty_store, &cert, &chain, |c| c.verify_cert())
|
||||
.unwrap());
|
||||
assert!(context
|
||||
.init(&store, &cert, &chain, |c| c.verify_cert())
|
||||
.unwrap());
|
||||
|
||||
context
|
||||
.reset_with_context_data(empty_store, cert.clone(), Stack::new().unwrap())
|
||||
.unwrap();
|
||||
assert!(!context.verify_cert().unwrap());
|
||||
|
||||
context.reset_with_context_data(store, cert, chain).unwrap();
|
||||
assert!(context.verify_cert().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in New Issue