aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-02-08 23:03:25 -0800
committerSteven Fackler <[email protected]>2016-05-03 20:24:07 -0700
commita0549c160675c69935a71049143cabff4ec9aeee (patch)
tree68b911d60017957fabe8cdc724ba1c64d0cf4f3f /openssl/src
parentError reform (diff)
downloadrust-openssl-a0549c160675c69935a71049143cabff4ec9aeee.tar.xz
rust-openssl-a0549c160675c69935a71049143cabff4ec9aeee.zip
Adjust set_ssl_context API
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/ssl/mod.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index f9534bc2..55a97c94 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -1139,18 +1139,11 @@ impl Ssl {
/// change the context corresponding to the current connection
///
/// Returns a clone of the SslContext @ctx (ie: the new context). The old context is freed.
- pub fn set_ssl_context(&self, ctx: &SslContext) -> SslContext {
- // If duplication of @ctx's cert fails, this returns NULL. This _appears_ to only occur on
- // allocation failures (meaning panicing is probably appropriate), but it might be nice to
- // propogate the error.
- assert!(unsafe { ffi::SSL_set_SSL_CTX(self.ssl, ctx.ctx) } != ptr::null_mut());
-
- // FIXME: we return this reference here for compatibility, but it isn't actually required.
- // This should be removed when a api-incompatabile version is to be released.
- //
- // ffi:SSL_set_SSL_CTX() returns copy of the ctx pointer passed to it, so it's easier for
- // us to do the clone directly.
- ctx.clone()
+ pub fn set_ssl_context(&self, ctx: &SslContext) -> Result<(), ErrorStack> {
+ unsafe {
+ try_ssl_null!(ffi::SSL_set_SSL_CTX(self.ssl, ctx.ctx));
+ }
+ Ok(())
}
/// obtain the context corresponding to the current connection