Commit 8ae42423 authored by mredlek's avatar mredlek
Browse files

Make it compile again.

Make self mut in set_subject_name.
Add assert to prevent a null pointer in subject_name.
parent 30a634c8
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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 {
+2 −1
Original line number Diff line number Diff line
@@ -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(|_| ())
        }