diff options
| author | Valerii Hiora <[email protected]> | 2014-10-04 06:37:48 +0300 |
|---|---|---|
| committer | Valerii Hiora <[email protected]> | 2014-10-04 06:47:27 +0300 |
| commit | 4d3f9e0520ed25bb55a95f30fd07a2cb4cf74fa5 (patch) | |
| tree | e1204894c5915ca4fdfd9cc82bf0c663448aa76f /src/ssl/mod.rs | |
| parent | User-provided data in verify (diff) | |
| download | rust-openssl-4d3f9e0520ed25bb55a95f30fd07a2cb4cf74fa5.tar.xz rust-openssl-4d3f9e0520ed25bb55a95f30fd07a2cb4cf74fa5.zip | |
Simpler setter for verify with data
There is no need in wrapping function in option as there is no
sense in providing data without function.
Diffstat (limited to 'src/ssl/mod.rs')
| -rw-r--r-- | src/ssl/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs index e1f35724..ab467f7e 100644 --- a/src/ssl/mod.rs +++ b/src/ssl/mod.rs @@ -222,13 +222,15 @@ impl SslContext { /// Configures the certificate verification method for new connections also /// carrying supplied data. + // Note: no option because there is no point to set data without providing + // a function handling it pub fn set_verify_with_data<T>(&mut self, mode: SslVerifyMode, - verify: Option<VerifyCallbackData<T>>, + verify: VerifyCallbackData<T>, data: T) { let data = box data; unsafe { ffi::SSL_CTX_set_ex_data(self.ctx, VERIFY_IDX, - mem::transmute(verify)); + mem::transmute(Some(verify))); ffi::SSL_CTX_set_ex_data(self.ctx, get_verify_data_idx::<T>(), mem::transmute(data)); ffi::SSL_CTX_set_verify(self.ctx, mode as c_int, Some(raw_verify_with_data::<T>)); |