Ignore:
Timestamp:
Aug 15, 2013, 9:38:43 PM (6 years ago)
Author:
landonf@…
Message:

Add work-arounds for Mac OS X 10.5, based on patch from dluke.

Issue: 40082

Location:
trunk/dports/security/certsync
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/security/certsync/Portfile

    r109371 r109458  
    44
    55name                    certsync
    6 version                 1.0.4
     6version                 1.0.5
    77categories              security
    88conflicts               curl-ca-bundle
  • trunk/dports/security/certsync/files/certsync.m

    r109343 r109458  
    3333
    3434#import <objc/message.h>
     35
     36/* Allow building with SDKs < 10.6 */
     37#ifndef MAC_OS_X_VERSION_10_6
     38#define MAC_OS_X_VERSION_10_6 1060
     39#endif /* !MAC_OS_X_VERSION_10_6 */
     40
     41/* Allow building with SDKs < 10.5 */
     42#ifndef MAC_OS_X_VERSION_10_5
     43#define MAC_OS_X_VERSION_10_5 1050
     44#endif /* !MAC_OS_X_VERSION_10_5 */
     45
     46#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
     47/* errSecSuccess was not defined until 10.6 */
     48#define errSecSuccess noErr
     49
     50/* NSDataWritingAtomic was not defined until 10.6 */
     51#define NSDataWritingAtomic NSAtomicWrite
     52#endif
    3553
    3654/* A wrapper class that may be used to pass configuration through the
     
    180198    NSArray *result;
    181199    NSError *error;
    182    
     200    OSStatus err;
     201
    183202    /* Current user */
    184203    if (userAnchors) {
     
    223242            subject = PLCFAutorelease(SecCertificateCopySubjectSummary((SecCertificateRef) certObj));
    224243        }
    225 #else
     244#elif MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_6
    226245        subject = PLCFAutorelease(SecCertificateCopySubjectSummary((SecCertificateRef) certObj));
     246#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
     247        if ((err = SecCertificateCopyCommonName((SecCertificateRef) certObj, &subject)) == errSecSuccess && subject != NULL) {
     248            PLCFAutorelease(subject);
     249        } else {
     250            /* In the case that the CN is simply unavailable, provide a more useful error code */
     251            if (err == errSecSuccess)
     252                err = errSecNoSuchAttr;
     253   
     254            NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: @"SecCertificateCopyCommonName() failed", NSLocalizedDescriptionKey, nil];
     255            cferror = (CFErrorRef) [NSError errorWithDomain: NSOSStatusErrorDomain code: err userInfo: userInfo];
     256            subject = NULL;
     257        }
    227258#endif
    228259
    229260        if (subject == NULL) {
    230261            nsfprintf(stderr, @"Failed to extract certificate description: %@\n", cferror);
    231             [pool release];
    232             return EXIT_FAILURE;
    233262        } else {
    234263            nsfprintf(stderr, @"Extracting %@\n", subject);
     
    240269     */
    241270    CFDataRef pemData;
    242     OSStatus err;
    243271   
    244272    /* Prefer the non-deprecated SecItemExport on Mac OS X >= 10.7. We use an ifdef to keep the code buildable with earlier SDKs, too. */
Note: See TracChangeset for help on using the changeset viewer.