From 9b1eb6d94d88da1a466954f3709b8399583ec5da Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 1 May 2016 20:45:49 -0700 Subject: [PATCH] Add a version of Ssl::set_verify that doesn't set a callback --- openssl/src/ssl/mod.rs | 9 ++++++++- openssl/src/ssl/tests/mod.rs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index b3c558c4e..aa7851421 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -968,6 +968,13 @@ impl Ssl { } } + /// Sets the verification mode to be used during the handshake process. + /// + /// Use `set_verify_callback` to additionally add a callback. + pub fn set_verify(&mut self, mode: SslVerifyMode) { + unsafe { ffi::SSL_set_verify(self.ssl, mode.bits as c_int, None) } + } + /// Sets the certificate verification callback to be used during the /// handshake process. /// @@ -975,7 +982,7 @@ impl Ssl { /// preveification process was successful, and an object providing access /// to the certificate chain. It should return `true` if the certificate /// chain is valid and `false` otherwise. - pub fn set_verify(&mut self, mode: SslVerifyMode, verify: F) + pub fn set_verify_callback(&mut self, mode: SslVerifyMode, verify: F) where F: Fn(bool, &X509StoreContext) -> bool + Any + 'static + Sync + Send { unsafe { diff --git a/openssl/src/ssl/tests/mod.rs b/openssl/src/ssl/tests/mod.rs index 608d6fd78..c3e7a363b 100644 --- a/openssl/src/ssl/tests/mod.rs +++ b/openssl/src/ssl/tests/mod.rs @@ -392,7 +392,7 @@ run_test!(ssl_verify_callback, |method, stream| { let node_hash_str = "db400bb62f1b1f29c3b8f323b8f7d9dea724fdcd67104ef549c772ae3749655b"; let node_id = node_hash_str.from_hex().unwrap(); - ssl.set_verify(SSL_VERIFY_PEER, move |_, x509| { + ssl.set_verify_callback(SSL_VERIFY_PEER, move |_, x509| { CHECKED.store(1, Ordering::SeqCst); match x509.get_current_cert() { None => false, -- GitLab