mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-02-16 10:31:02 +00:00
Use default auth handling if the pinning fails
This commit is contained in:
@@ -279,28 +279,28 @@ static const NSString* HTTPS_PORT = @"47984";
|
||||
{
|
||||
if (SecTrustGetCertificateCount(challenge.protectionSpace.serverTrust) != 1) {
|
||||
Log(LOG_E, @"Server certificate count mismatch");
|
||||
completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, NULL);
|
||||
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
SecCertificateRef actualCert = SecTrustGetCertificateAtIndex(challenge.protectionSpace.serverTrust, 0);
|
||||
if (actualCert == nil) {
|
||||
Log(LOG_E, @"Server certificate parsing error");
|
||||
completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, NULL);
|
||||
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
CFDataRef actualCertData = SecCertificateCopyData(actualCert);
|
||||
if (actualCertData == nil) {
|
||||
Log(LOG_E, @"Server certificate data parsing error");
|
||||
completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, NULL);
|
||||
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CFEqual(actualCertData, (__bridge CFDataRef)_serverCert)) {
|
||||
Log(LOG_E, @"Server certificate mismatch");
|
||||
CFRelease(actualCertData);
|
||||
completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, NULL);
|
||||
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user