diff options
| author | Daniel Albert <[email protected]> | 2016-01-20 19:59:41 +0000 |
|---|---|---|
| committer | Daniel Albert <[email protected]> | 2016-01-20 19:59:41 +0000 |
| commit | 74db7db560ea1a9fc5fd9243e59cc5e5fced5dfd (patch) | |
| tree | 32c6a4923e3a4aca44e94f7083cb0ed5b30dc631 /openssl/src/x509/mod.rs | |
| parent | Fix incorrect unsafe declaration (diff) | |
| parent | Merge pull request #334 from jmesmon/ssl-context (diff) | |
| download | rust-openssl-74db7db560ea1a9fc5fd9243e59cc5e5fced5dfd.tar.xz rust-openssl-74db7db560ea1a9fc5fd9243e59cc5e5fced5dfd.zip | |
Merge branch 'master' of https://github.com/sfackler/rust-openssl
Diffstat (limited to 'openssl/src/x509/mod.rs')
| -rw-r--r-- | openssl/src/x509/mod.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index ffd478ef..f31de89b 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -507,6 +507,20 @@ impl<'ctx> X509<'ctx> { } } +extern "C" { + fn rust_X509_clone(x509: *mut ffi::X509); +} + +impl<'ctx> Clone for X509<'ctx> { + fn clone(&self) -> X509<'ctx> { + unsafe { rust_X509_clone(self.handle) } + /* FIXME: given that we now have refcounting control, 'owned' should be uneeded, the 'ctx + * is probably also uneeded. We can remove both to condense the x509 api quite a bit + */ + X509::new(self.handle, true) + } +} + impl<'ctx> Drop for X509<'ctx> { fn drop(&mut self) { if self.owned { |