Loading openssl/src/x509/mod.rs +7 −5 Original line number Diff line number Diff line Loading @@ -826,7 +826,7 @@ impl X509NameRef { } /// Returns an iterator over all `X509NameEntry` values pub fn all_entries<'a>(&'a self) -> X509NameEntries<'a> { pub fn entries<'a>(&'a self) -> X509NameEntries<'a> { X509NameEntries { name: self, nid: None, Loading Loading @@ -854,15 +854,17 @@ impl<'a> Iterator for X509NameEntries<'a> { // There is a `Nid` specified to search for self.loc = ffi::X509_NAME_get_index_by_NID(self.name.as_ptr(), nid.as_raw(), self.loc); if self.loc == -1 { return None; } } None => { // Iterate over all `Nid`s self.loc += 1; if self.loc >= entry_count { return None; } } if self.loc == -1 || self.loc >= entry_count { return None; } let entry = ffi::X509_NAME_get_entry(self.name.as_ptr(), self.loc); Loading openssl/src/x509/tests.rs +1 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ fn test_nameref_iterator() { let cert = include_bytes!("../../test/nid_test_cert.pem"); let cert = X509::from_pem(cert).unwrap(); let subject = cert.subject_name(); let mut all_entries = subject.all_entries(); let mut all_entries = subject.entries(); let email = all_entries.next().unwrap(); assert_eq!(email.object().nid().as_raw(), Nid::PKCS9_EMAILADDRESS.as_raw()); Loading Loading
openssl/src/x509/mod.rs +7 −5 Original line number Diff line number Diff line Loading @@ -826,7 +826,7 @@ impl X509NameRef { } /// Returns an iterator over all `X509NameEntry` values pub fn all_entries<'a>(&'a self) -> X509NameEntries<'a> { pub fn entries<'a>(&'a self) -> X509NameEntries<'a> { X509NameEntries { name: self, nid: None, Loading Loading @@ -854,15 +854,17 @@ impl<'a> Iterator for X509NameEntries<'a> { // There is a `Nid` specified to search for self.loc = ffi::X509_NAME_get_index_by_NID(self.name.as_ptr(), nid.as_raw(), self.loc); if self.loc == -1 { return None; } } None => { // Iterate over all `Nid`s self.loc += 1; if self.loc >= entry_count { return None; } } if self.loc == -1 || self.loc >= entry_count { return None; } let entry = ffi::X509_NAME_get_entry(self.name.as_ptr(), self.loc); Loading
openssl/src/x509/tests.rs +1 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ fn test_nameref_iterator() { let cert = include_bytes!("../../test/nid_test_cert.pem"); let cert = X509::from_pem(cert).unwrap(); let subject = cert.subject_name(); let mut all_entries = subject.all_entries(); let mut all_entries = subject.entries(); let email = all_entries.next().unwrap(); assert_eq!(email.object().nid().as_raw(), Nid::PKCS9_EMAILADDRESS.as_raw()); Loading