aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStuart Connolly <stuart02@gmail.com>2014-01-17 01:35:24 +0000
committerStuart Connolly <stuart02@gmail.com>2014-01-17 01:35:24 +0000
commit834724b5b23c774b1750b2ba53e6be9d02128edb (patch)
tree938183e18fef685aab89bcfa1292b40e0a44a00b
parentfda4c9c9a138b5b640275c16f01bd0557ccc402e (diff)
downloadsequelpro-834724b5b23c774b1750b2ba53e6be9d02128edb.tar.gz
sequelpro-834724b5b23c774b1750b2ba53e6be9d02128edb.tar.bz2
sequelpro-834724b5b23c774b1750b2ba53e6be9d02128edb.zip
Restore old keychain code when building against 10.7
-rw-r--r--Source/SPKeychain.m35
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj18
2 files changed, 40 insertions, 13 deletions
diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m
index f7580f65..cc98bf6c 100644
--- a/Source/SPKeychain.m
+++ b/Source/SPKeychain.m
@@ -213,6 +213,7 @@
*/
- (BOOL)passwordExistsForName:(NSString *)name account:(NSString *)account
{
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
NSMutableDictionary *query = [NSMutableDictionary dictionary];
[query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];
@@ -225,6 +226,40 @@
CFDictionaryRef result = NULL;
return SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef *)&result) == errSecSuccess;
+#else
+ SecKeychainItemRef item;
+ SecKeychainSearchRef search = NULL;
+ NSInteger numberOfItemsFound = 0;
+ SecKeychainAttributeList list;
+ SecKeychainAttribute attributes[2];
+
+ // Check supplied variables and replaces nils with empty strings
+ if (!name) name = @"";
+ if (!account) account = @"";
+
+ attributes[0].tag = kSecAccountItemAttr;
+ attributes[0].data = (void *)[account UTF8String]; // Account name
+ attributes[0].length = (UInt32)strlen([account UTF8String]); // Length of account name (bytes)
+
+ attributes[1].tag = kSecServiceItemAttr;
+ attributes[1].data = (void *)[name UTF8String]; // Service name
+ attributes[1].length = (UInt32)strlen([name UTF8String]); // Length of service name (bytes)
+
+ list.count = 2;
+ list.attr = attributes;
+
+ if (SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, &list, &search) == noErr) {
+ while (SecKeychainSearchCopyNext(search, &item) == noErr)
+ {
+ CFRelease(item);
+ numberOfItemsFound++;
+ }
+ }
+
+ if (search) CFRelease(search);
+
+ return (numberOfItemsFound > 0);
+#endif
}
/**
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index e9d21777..071bf2ef 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -99,6 +99,7 @@
17A20AC6124F9B110095CEFB /* SPServerSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 17A20AC5124F9B110095CEFB /* SPServerSupport.m */; };
17A7773411C52D8E001E27B4 /* SPIndexesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17A7773311C52D8E001E27B4 /* SPIndexesController.m */; };
17A7773811C52E61001E27B4 /* IndexesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 17A7773611C52E61001E27B4 /* IndexesView.xib */; };
+ 17AED4161888BD67008E380F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5EAC0FC0EC87FF900CC579C /* Security.framework */; };
17AF787B11FC41C00073D043 /* SPExportFilenameUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 17AF787A11FC41C00073D043 /* SPExportFilenameUtilities.m */; };
17BA2A3215275D8600389803 /* SPExportInterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17BA2A3115275D8600389803 /* SPExportInterfaceController.m */; };
17C058880FC9FC390077E9CF /* SPNarrowDownCompletion.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C058870FC9FC390077E9CF /* SPNarrowDownCompletion.m */; };
@@ -377,7 +378,6 @@
B5E2C5FA0F2353B5007446E0 /* table-property.png in Resources */ = {isa = PBXBuildFile; fileRef = B5E2C5F90F2353B5007446E0 /* table-property.png */; };
B5E92F190F75B2D100012500 /* ExportDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = B5E92F170F75B2D100012500 /* ExportDialog.xib */; };
B5E92F1C0F75B2E800012500 /* SPExportController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5E92F1B0F75B2E800012500 /* SPExportController.m */; };
- B5EAC0FD0EC87FF900CC579C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5EAC0FC0EC87FF900CC579C /* Security.framework */; };
BC01BCCF104024BE006BDEE7 /* SPEncodingPopupAccessory.m in Sources */ = {isa = PBXBuildFile; fileRef = BC01BCCE104024BE006BDEE7 /* SPEncodingPopupAccessory.m */; };
BC05F1C5101241DF008A97F8 /* YRKSpinningProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = BC05F1C4101241DF008A97F8 /* YRKSpinningProgressIndicator.m */; };
BC09D7DE12A786FB0030DB64 /* cancel-clicked-highlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = BC09D7D812A786FB0030DB64 /* cancel-clicked-highlighted.png */; };
@@ -1291,10 +1291,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 17AED4161888BD67008E380F /* Security.framework in Frameworks */,
296DC8BF0F9091DF002A3258 /* libicucore.dylib in Frameworks */,
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */,
4DECC3370EC2A170008D359E /* Growl.framework in Frameworks */,
- B5EAC0FD0EC87FF900CC579C /* Security.framework in Frameworks */,
4DECC3350EC2A170008D359E /* Sparkle.framework in Frameworks */,
584D877815140F7B00F24774 /* SPMySQL.framework in Frameworks */,
586AAB1514FAD3AF007F82BF /* QueryKit.framework in Frameworks */,
@@ -1313,6 +1313,9 @@
1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
+ 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */,
+ 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */,
+ B5EAC0FC0EC87FF900CC579C /* Security.framework */,
58475685120A065B0057631F /* CoreFoundation.framework */,
58B9077D11BD9B64000826E5 /* Carbon.framework */,
1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */,
@@ -1335,16 +1338,6 @@
name = "Linked Frameworks";
sourceTree = "<group>";
};
- 1058C7A8FEA54F5311CA2CBB /* Other Frameworks */ = {
- isa = PBXGroup;
- children = (
- 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */,
- 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */,
- B5EAC0FC0EC87FF900CC579C /* Security.framework */,
- );
- name = "Other Frameworks";
- sourceTree = "<group>";
- };
1198F5B01174EDA700670590 /* Database Actions */ = {
isa = PBXGroup;
children = (
@@ -2334,7 +2327,6 @@
isa = PBXGroup;
children = (
1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */,
- 1058C7A8FEA54F5311CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";