|
12 | 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
13 | 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14 | 14 |
|
15 |
| -use super::dns_name::{self, DnsNameRef, GeneralDnsNameRef, WildcardDnsNameRef}; |
| 15 | +use super::dns_name::{self, DnsNameRef, WildcardDnsNameRef}; |
16 | 16 | use super::ip_address::{self, IpAddrRef};
|
17 | 17 | use super::name::SubjectNameRef;
|
18 | 18 | use crate::der::{self, FromDer};
|
@@ -317,25 +317,19 @@ pub(crate) fn list_cert_dns_names<'names>(
|
317 | 317 | ) -> impl Iterator<Item = &'names str> {
|
318 | 318 | let cert = &cert.inner();
|
319 | 319 | NameIterator::new(Some(cert.subject), cert.subject_alt_name).filter_map(|result| {
|
320 |
| - let name = result.ok()?; |
321 |
| - |
322 |
| - let presented_id = match name { |
| 320 | + let presented_id = match result.ok()? { |
323 | 321 | GeneralName::DnsName(presented) => presented,
|
324 | 322 | _ => return None,
|
325 | 323 | };
|
326 | 324 |
|
327 |
| - let dns_name = DnsNameRef::try_from_ascii(presented_id.as_slice_less_safe()) |
328 |
| - .map(GeneralDnsNameRef::DnsName) |
329 |
| - .or_else(|_| { |
330 |
| - WildcardDnsNameRef::try_from_ascii(presented_id.as_slice_less_safe()) |
331 |
| - .map(GeneralDnsNameRef::Wildcard) |
332 |
| - }); |
333 |
| - |
334 |
| - // if the name could be converted to a DNS name, add it; otherwise, |
| 325 | + // if the name could be converted to a DNS name, return it; otherwise, |
335 | 326 | // keep going.
|
336 |
| - match dns_name { |
337 |
| - Ok(name) => Some(name.into()), |
338 |
| - _ => None, |
| 327 | + match DnsNameRef::try_from_ascii(presented_id.as_slice_less_safe()) { |
| 328 | + Ok(dns_name) => Some(dns_name.into()), |
| 329 | + Err(_) => match WildcardDnsNameRef::try_from_ascii(presented_id.as_slice_less_safe()) { |
| 330 | + Ok(wildcard_dns_name) => Some(wildcard_dns_name.into()), |
| 331 | + Err(_) => None, |
| 332 | + }, |
339 | 333 | }
|
340 | 334 | })
|
341 | 335 | }
|
|
0 commit comments