File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Sources/PackageCollectionsSigning/Certificate Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -375,14 +375,21 @@ private struct BoringSSLOCSPClient {
375
375
376
376
group. notify ( queue: callbackQueue) {
377
377
// If there's no result then something must have gone wrong
378
- guard !results. isEmpty, results. compactMap ( { $0. failure } ) . isEmpty else {
378
+ guard !results. isEmpty else {
379
+ return wrappedCallback ( . failure( CertificatePolicyError . ocspFailure) )
380
+ }
381
+
382
+ let statuses = results. compactMap { $0. success }
383
+ // We got results but they are all failures
384
+ guard !statuses. isEmpty else {
379
385
diagnosticsEngine. emit ( error: " OCSP failed. All results: \( results) " )
380
386
return wrappedCallback ( . failure( CertificatePolicyError . ocspFailure) )
381
387
}
382
- // Is there response "bad status" response?
388
+ // If at least one response is "bad status" then the chain is invalid
383
389
guard results. compactMap ( { $0. success } ) . first ( where: { !$0 } ) == nil else {
384
390
return wrappedCallback ( . failure( CertificatePolicyError . invalidCertChain) )
385
391
}
392
+ // Good status
386
393
wrappedCallback ( . success( ( ) ) )
387
394
}
388
395
}
You can’t perform that action at this time.
0 commit comments