Commit 9b1eb6d9 authored by Steven Fackler's avatar Steven Fackler
Browse files

Add a version of Ssl::set_verify that doesn't set a callback

parent c7e68637
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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<F>(&mut self, mode: SslVerifyMode, verify: F)
    pub fn set_verify_callback<F>(&mut self, mode: SslVerifyMode, verify: F)
        where F: Fn(bool, &X509StoreContext) -> bool + Any + 'static + Sync + Send
    {
        unsafe {
+1 −1
Original line number Diff line number Diff line
@@ -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,