aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-06-24 21:46:02 +0000
committerBibiko <bibiko@eva.mpg.de>2010-06-24 21:46:02 +0000
commit2031d4b310b2742ea61ad6483d7e6dfeaadb44cc (patch)
treef626d45b5cfcca03507e5339b3281b77a456abc5
parentca64d295c058dcd3d5308cce56379401e6658434 (diff)
downloadsequelpro-2031d4b310b2742ea61ad6483d7e6dfeaadb44cc.tar.gz
sequelpro-2031d4b310b2742ea61ad6483d7e6dfeaadb44cc.tar.bz2
sequelpro-2031d4b310b2742ea61ad6483d7e6dfeaadb44cc.zip
• fixed issue for saving spf files of ssh connections
- retrieve the ssh password from keychain • allow to save empty passwords in spf files
-rw-r--r--Source/SPDatabaseDocument.m22
1 files changed, 19 insertions, 3 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 53a18913..c54a7a8b 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -3222,11 +3222,27 @@
[connection setObject:aString forKey:@"type"];
if([[spfDocData_temp objectForKey:@"save_password"] boolValue]) {
+
NSString *pw = [self keychainPasswordForConnection:nil];
if(![pw length]) pw = [connectionController password];
- if (pw) [connection setObject:pw forKey:@"password"];
- if([connectionController type] == SPSSHTunnelConnection && [connectionController sshPassword])
- [connection setObject:[connectionController sshPassword] forKey:@"ssh_password"];
+ if (pw)
+ [connection setObject:pw forKey:@"password"];
+ else
+ [connection setObject:@"" forKey:@"password"];
+
+ if([connectionController type] == SPSSHTunnelConnection) {
+ SPKeychain *keychain = [[SPKeychain alloc] init];
+ NSString *connectionSSHKeychainItemName = [[keychain nameForSSHForFavoriteName:[connectionController name] id:[self keyChainID]] retain];
+ NSString *connectionSSHKeychainItemAccount = [[keychain accountForSSHUser:[connectionController sshUser] sshHost:[connectionController sshHost]] retain];
+ NSString *sshpw = [keychain getPasswordForName:connectionSSHKeychainItemName account:connectionSSHKeychainItemAccount];
+ if (sshpw && [sshpw length])
+ [connection setObject:sshpw forKey:@"ssh_password"];
+ else
+ [connection setObject:@"" forKey:@"ssh_password"];
+ if(connectionSSHKeychainItemName) [connectionSSHKeychainItemName release];
+ if(connectionSSHKeychainItemAccount) [connectionSSHKeychainItemAccount release];
+ [keychain release];
+ }
}
if([connectionController port] && [[connectionController port] length])