From ff9214adfbb3a70d6d59f40b957c6143a09df365 Mon Sep 17 00:00:00 2001 From: Russell Hancox Date: Tue, 20 Oct 2020 21:07:03 -0400 Subject: [PATCH] Identity filtering: avoid infinite recursion properly (#18) --- MOLAuthenticatingURLSession.podspec | 2 +- .../MOLAuthenticatingURLSession.m | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MOLAuthenticatingURLSession.podspec b/MOLAuthenticatingURLSession.podspec index 5dc2157..ed732f6 100644 --- a/MOLAuthenticatingURLSession.podspec +++ b/MOLAuthenticatingURLSession.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MOLAuthenticatingURLSession' - s.version = '2.8' + s.version = '2.9' s.platform = :osx s.osx.deployment_target = '10.9' s.license = { :type => 'Apache 2.0', :file => 'LICENSE' } diff --git a/Source/MOLAuthenticatingURLSession/MOLAuthenticatingURLSession.m b/Source/MOLAuthenticatingURLSession/MOLAuthenticatingURLSession.m index 613530b..d1c54ad 100644 --- a/Source/MOLAuthenticatingURLSession/MOLAuthenticatingURLSession.m +++ b/Source/MOLAuthenticatingURLSession/MOLAuthenticatingURLSession.m @@ -371,10 +371,10 @@ - (SecIdentityRef)identityByFilteringArray:(NSArray *)array return identityRef; } else { // Avoid infinite recursion from self-signed certs - if ((cert.commonName && [cert.commonName isEqual:cert.issuerCommonName]) && - (cert.countryName && [cert.countryName isEqual:cert.issuerCountryName]) && - (cert.orgName && [cert.orgName isEqual:cert.issuerOrgName]) && - (cert.orgUnit && [cert.orgUnit isEqual:cert.issuerOrgUnit])) { + if ((!cert.commonName || [cert.commonName isEqual:cert.issuerCommonName]) && + (!cert.countryName || [cert.countryName isEqual:cert.issuerCountryName]) && + (!cert.orgName || [cert.orgName isEqual:cert.issuerOrgName]) && + (!cert.orgUnit || [cert.orgUnit isEqual:cert.issuerOrgUnit])) { continue; }