diff options
| author | Steven Fackler <[email protected]> | 2016-08-18 12:59:44 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-08-18 12:59:44 -0700 |
| commit | 87a3bc261553ca71e364a2d7a8d890247c747246 (patch) | |
| tree | 13fb6b56c9db24b1375d3b633fb4e5d584585688 /openssl/src/ssl/mod.rs | |
| parent | Merge branch 'release-sys-v0.7.16-v0.8.1' into release (diff) | |
| parent | Release openssl-sys v0.7.17, openssl v0.8.2 (diff) | |
| download | rust-openssl-openssl-v0.8.2.tar.xz rust-openssl-openssl-v0.8.2.zip | |
Merge branch 'release-sys-v0.7.17-v0.8.2' into releaseopenssl-v0.8.2openssl-sys-v0.7.17
Diffstat (limited to 'openssl/src/ssl/mod.rs')
| -rw-r--r-- | openssl/src/ssl/mod.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 64a2ccaf..6e365af6 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -535,9 +535,14 @@ impl<'a> SslContextRef<'a> { /// Adds a certificate to the certificate chain presented together with the /// certificate specified using set_certificate() pub fn add_extra_chain_cert(&mut self, cert: &X509Ref) -> Result<(), ErrorStack> { - wrap_ssl_result(unsafe { - ffi::SSL_CTX_add_extra_chain_cert(self.as_ptr(), cert.as_ptr()) as c_int - }) + // FIXME this should really just take an X509 by value + let der = try!(cert.to_der()); + let cert = try!(X509::from_der(&der)); + unsafe { + try_ssl!(ffi::SSL_CTX_add_extra_chain_cert(self.as_ptr(), cert.as_ptr())); + } + mem::forget(cert); + Ok(()) } /// Specifies the file that contains private key |