aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-01-10 00:51:27 +0000
committerrowanbeentje <rowan@beent.je>2011-01-10 00:51:27 +0000
commit870da55b26764076d657ef9625e8798f538304cd (patch)
tree0dca1ba7605618d9fcacc3bf58fefcf60513b522 /Source
parenta445243c4c9140556b66c8d529c1531011774911 (diff)
downloadsequelpro-870da55b26764076d657ef9625e8798f538304cd.tar.gz
sequelpro-870da55b26764076d657ef9625e8798f538304cd.tar.bz2
sequelpro-870da55b26764076d657ef9625e8798f538304cd.zip
- Track the keychain ID of the favourite in the connection controller, fixing errors when amending favourites in the connection view and thereafter saving as .spf or duplicating connections
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionController.h1
-rw-r--r--Source/SPConnectionController.m9
2 files changed, 7 insertions, 3 deletions
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h
index 672e983f..5d9a21a1 100644
--- a/Source/SPConnectionController.h
+++ b/Source/SPConnectionController.h
@@ -82,6 +82,7 @@
NSString *sshPort;
@private NSString *favoritesPBoardType;
+ NSString *connectionKeychainID;
NSString *connectionKeychainItemName;
NSString *connectionKeychainItemAccount;
NSString *connectionSSHKeychainItemName;
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 3558d484..c521213c 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -89,6 +89,7 @@
tableDocument = theTableDocument;
databaseConnectionSuperview = [tableDocument databaseView];
databaseConnectionView = [tableDocument valueForKey:@"contentViewSplitter"];
+ connectionKeychainID = nil;
connectionKeychainItemName = nil;
connectionKeychainItemAccount = nil;
connectionSSHKeychainItemName = nil;
@@ -173,6 +174,7 @@
if (favorites) [favorites release];
if (mySQLConnection) [mySQLConnection release];
if (sshTunnel) [sshTunnel setConnectionStateChangeSelector:nil delegate:nil], [sshTunnel disconnect], [sshTunnel release];
+ if (connectionKeychainID) [connectionKeychainID release];
if (connectionKeychainItemName) [connectionKeychainItemName release];
if (connectionKeychainItemAccount) [connectionKeychainItemAccount release];
if (connectionSSHKeychainItemName) [connectionSSHKeychainItemName release];
@@ -512,9 +514,7 @@
for (NSInteger i = 0; i < [toolbarItems count]; i++) [[toolbarItems objectAtIndex:i] setEnabled:YES];
// Set keychain id for saving SPF files
- if ([self valueForKeyPath:@"selectedFavorite.id"]) {
- [tableDocument setKeychainID:[[self valueForKeyPath:@"selectedFavorite.id"] stringValue]];
- }
+ if (connectionKeychainID) [tableDocument setKeychainID:connectionKeychainID];
// Pass the connection to the table document, allowing it to set
// up the other classes and the rest of the interface.
@@ -884,6 +884,7 @@
automaticFavoriteSelection = YES;
// Clear the keychain referral items as appropriate
+ if (connectionKeychainID) [connectionKeychainID release], connectionKeychainID = nil;
if (connectionKeychainItemName) [connectionKeychainItemName release], connectionKeychainItemName = nil;
if (connectionKeychainItemAccount) [connectionKeychainItemAccount release], connectionKeychainItemAccount = nil;
if (connectionSSHKeychainItemName) [connectionSSHKeychainItemName release], connectionSSHKeychainItemName = nil;
@@ -933,6 +934,8 @@
[connectionKeychainItemAccount release], connectionKeychainItemAccount = nil;
}
+ if ([self valueForKeyPath:@"selectedFavorite.id"]) connectionKeychainID = [[[self valueForKeyPath:@"selectedFavorite.id"] stringValue] retain];
+
// And the same for the SSH password
connectionSSHKeychainItemName = [[keychain nameForSSHForFavoriteName:[self valueForKeyPath:@"selectedFavorite.name"] id:[self valueForKeyPath:@"selectedFavorite.id"]] retain];
connectionSSHKeychainItemAccount = [[keychain accountForSSHUser:[self valueForKeyPath:@"selectedFavorite.sshUser"] sshHost:[self valueForKeyPath:@"selectedFavorite.sshHost"]] retain];