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

This commit is contained in:
Steven Fackler 2016-05-01 20:45:49 -07:00
parent c7e68637bb
commit 9b1eb6d94d
2 changed files with 9 additions and 2 deletions

View File

@ -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 {

View File

@ -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,