[109458] trunk/dports/security/certsync
landonf at macports.org
landonf at macports.org
Thu Aug 15 14:38:43 PDT 2013
Revision: 109458
https://trac.macports.org/changeset/109458
Author: landonf at macports.org
Date: 2013-08-15 14:38:43 -0700 (Thu, 15 Aug 2013)
Log Message:
-----------
Add work-arounds for Mac OS X 10.5, based on patch from dluke.
Issue: 40082
Modified Paths:
--------------
trunk/dports/security/certsync/Portfile
trunk/dports/security/certsync/files/certsync.m
Modified: trunk/dports/security/certsync/Portfile
===================================================================
--- trunk/dports/security/certsync/Portfile 2013-08-15 20:24:53 UTC (rev 109457)
+++ trunk/dports/security/certsync/Portfile 2013-08-15 21:38:43 UTC (rev 109458)
@@ -3,7 +3,7 @@
PortSystem 1.0
name certsync
-version 1.0.4
+version 1.0.5
categories security
conflicts curl-ca-bundle
maintainers landonf openmaintainer
Modified: trunk/dports/security/certsync/files/certsync.m
===================================================================
--- trunk/dports/security/certsync/files/certsync.m 2013-08-15 20:24:53 UTC (rev 109457)
+++ trunk/dports/security/certsync/files/certsync.m 2013-08-15 21:38:43 UTC (rev 109458)
@@ -33,6 +33,24 @@
#import <objc/message.h>
+/* Allow building with SDKs < 10.6 */
+#ifndef MAC_OS_X_VERSION_10_6
+#define MAC_OS_X_VERSION_10_6 1060
+#endif /* !MAC_OS_X_VERSION_10_6 */
+
+/* Allow building with SDKs < 10.5 */
+#ifndef MAC_OS_X_VERSION_10_5
+#define MAC_OS_X_VERSION_10_5 1050
+#endif /* !MAC_OS_X_VERSION_10_5 */
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+/* errSecSuccess was not defined until 10.6 */
+#define errSecSuccess noErr
+
+/* NSDataWritingAtomic was not defined until 10.6 */
+#define NSDataWritingAtomic NSAtomicWrite
+#endif
+
/* A wrapper class that may be used to pass configuration through the
* FSEvent callback API */
@interface MPCertSyncConfig : NSObject {
@@ -179,7 +197,8 @@
NSMutableArray *anchors = [NSMutableArray array];
NSArray *result;
NSError *error;
-
+ OSStatus err;
+
/* Current user */
if (userAnchors) {
result = certificatesForTrustDomain(kSecTrustSettingsDomainUser, &error);
@@ -222,14 +241,24 @@
} else {
subject = PLCFAutorelease(SecCertificateCopySubjectSummary((SecCertificateRef) certObj));
}
-#else
+#elif MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_6
subject = PLCFAutorelease(SecCertificateCopySubjectSummary((SecCertificateRef) certObj));
+#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+ if ((err = SecCertificateCopyCommonName((SecCertificateRef) certObj, &subject)) == errSecSuccess && subject != NULL) {
+ PLCFAutorelease(subject);
+ } else {
+ /* In the case that the CN is simply unavailable, provide a more useful error code */
+ if (err == errSecSuccess)
+ err = errSecNoSuchAttr;
+
+ NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: @"SecCertificateCopyCommonName() failed", NSLocalizedDescriptionKey, nil];
+ cferror = (CFErrorRef) [NSError errorWithDomain: NSOSStatusErrorDomain code: err userInfo: userInfo];
+ subject = NULL;
+ }
#endif
if (subject == NULL) {
nsfprintf(stderr, @"Failed to extract certificate description: %@\n", cferror);
- [pool release];
- return EXIT_FAILURE;
} else {
nsfprintf(stderr, @"Extracting %@\n", subject);
}
@@ -239,7 +268,6 @@
* Perform export
*/
CFDataRef pemData;
- OSStatus err;
/* Prefer the non-deprecated SecItemExport on Mac OS X >= 10.7. We use an ifdef to keep the code buildable with earlier SDKs, too. */
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130815/59ff31da/attachment.html>
More information about the macports-changes
mailing list