diff options
| author | mredlek <[email protected]> | 2017-02-07 21:49:07 +0100 |
|---|---|---|
| committer | mredlek <[email protected]> | 2017-02-07 21:49:07 +0100 |
| commit | 8ae424235e1a09b5fdcd2879a960742d529c04da (patch) | |
| tree | 1c60195c9a7a2ee57c4c3bf3639df40f17b7b913 /openssl/src | |
| parent | Merge branch 'master' into x509_req_version_subject (diff) | |
| download | rust-openssl-8ae424235e1a09b5fdcd2879a960742d529c04da.tar.xz rust-openssl-8ae424235e1a09b5fdcd2879a960742d529c04da.zip | |
Make it compile again.
Make self mut in set_subject_name.
Add assert to prevent a null pointer in subject_name.
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/asn1.rs | 8 | ||||
| -rw-r--r-- | openssl/src/x509/mod.rs | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/openssl/src/asn1.rs b/openssl/src/asn1.rs index 8016df13..46c09740 100644 --- a/openssl/src/asn1.rs +++ b/openssl/src/asn1.rs @@ -93,7 +93,13 @@ impl Asn1StringRef { } } -type_!(Asn1Integer, Asn1IntegerRef, ffi::ASN1_INTEGER, ffi::ASN1_INTEGER_free); +foreign_type! { + type CType = ffi::ASN1_INTEGER; + fn drop = ffi::ASN1_INTEGER_free; + + pub struct Asn1Integer; + pub struct Asn1IntegerRef; +} impl Asn1IntegerRef { pub fn get(&self) -> i64 { diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 174635ca..d9fd36ef 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -647,11 +647,12 @@ impl X509ReqRef { pub fn subject_name(&self) -> &X509NameRef { unsafe { let name = compat::X509_REQ_get_subject_name(self.as_ptr()); + assert!(!name.is_null()); X509NameRef::from_ptr(name) } } - pub fn set_subject_name(&self, value: &X509NameRef) -> Result<(), ErrorStack> { + pub fn set_subject_name(&mut self, value: &X509NameRef) -> Result<(), ErrorStack> { unsafe { cvt(ffi::X509_REQ_set_subject_name(self.as_ptr(), value.as_ptr())).map(|_| ()) } |