Skip to content

Commit

Permalink
Merge pull request #735 from AtariDreams/Fixer
Browse files Browse the repository at this point in the history
Fix compilation on older macOS versions
  • Loading branch information
zdohnal authored Jun 21, 2023
2 parents ee82c5b + f528177 commit 3f12185
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cups/tls-darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ httpCopyCredentials(
{
OSStatus error; /* Error code */
SecTrustRef peerTrust; /* Peer trust reference */
CFIndex count; /* Number of credentials */
SecCertificateRef secCert; /* Certificate reference */
CFDataRef data; /* Certificate data */
CFIndex i; /* Looping var */


DEBUG_printf(("httpCopyCredentials(http=%p, credentials=%p)", (void *)http, (void *)credentials));
Expand All @@ -441,16 +444,15 @@ httpCopyCredentials(

if (!(error = SSLCopyPeerTrust(http->tls, &peerTrust)) && peerTrust)
{
DEBUG_printf(("2httpCopyCredentials: Peer provided %ld certificates.", (long)SecTrustGetCertificateCount(peerTrust)));

if ((*credentials = cupsArrayNew(NULL, NULL)) != NULL)
{
CFArrayRef secArray = SecTrustCopyCertificateChain(peerTrust);
CFIndex i, count = CFArrayGetCount(secArray);
count = SecTrustGetCertificateCount(peerTrust);

DEBUG_printf(("2httpCopyCredentials: Peer provided %ld certificates.", (long)count));

for (i = 0; i < count; i ++)
{
SecCertificateRef secCert = (SecCertificateRef)CFArrayGetValueAtIndex(secArray, i);
secCert = SecTrustGetCertificateAtIndex(peerTrust, i);

#ifdef DEBUG
CFStringRef cf_name = SecCertificateCopySubjectSummary(secCert);
Expand All @@ -471,7 +473,6 @@ httpCopyCredentials(
CFRelease(data);
}
}
CFRelease(secArray);
}

CFRelease(peerTrust);
Expand Down

0 comments on commit 3f12185

Please sign in to comment.