diff options
| author | Steven Fackler <[email protected]> | 2016-01-31 20:38:36 +0000 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-01-31 20:38:36 +0000 |
| commit | 627f394d595562346187b8210b1aeeb225223914 (patch) | |
| tree | 7a5318a5a95f466bc1e445340ead2804ef605337 /openssl/src/x509 | |
| parent | Fix PKey RSA constructors (diff) | |
| download | rust-openssl-627f394d595562346187b8210b1aeeb225223914.tar.xz rust-openssl-627f394d595562346187b8210b1aeeb225223914.zip | |
Revert "Revert "impl Clone for PKey and X509 by using their 'references' member""
Diffstat (limited to 'openssl/src/x509')
| -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 8cc34cad..a69f61d5 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -509,6 +509,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 { |