aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionDelegate.m2
-rw-r--r--Source/SPDatabaseDocument.m7
-rw-r--r--Source/SPFavoritesPreferencePane.m10
-rw-r--r--Source/SPKeychain.m2
4 files changed, 9 insertions, 12 deletions
diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m
index f02d5648..58482d1c 100644
--- a/Source/SPConnectionDelegate.m
+++ b/Source/SPConnectionDelegate.m
@@ -75,7 +75,7 @@
{
// If no keychain item is available, return an empty password
- if (![connectionController connectionKeychainItemName]) return @"";
+ if (![connectionController connectionKeychainItemName]) return nil;
// Otherwise, pull the password from the keychain using the details from this connection
SPKeychain *keychain = [[SPKeychain alloc] init];
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 4d6e4bda..20379ede 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -4143,11 +4143,8 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
if (includePasswords) {
NSString *pw = [self keychainPasswordForConnection:nil];
- if (![pw length]) pw = [connectionController password];
- if (pw)
- [connection setObject:pw forKey:@"password"];
- else
- [connection setObject:@"" forKey:@"password"];
+ if (!pw) pw = [connectionController password];
+ if (pw) [connection setObject:pw forKey:@"password"];
if ([connectionController type] == SPSSHTunnelConnection) {
NSString *sshpw = [self keychainPasswordForSSHConnection:nil];
diff --git a/Source/SPFavoritesPreferencePane.m b/Source/SPFavoritesPreferencePane.m
index 5cc01682..7641e5c8 100644
--- a/Source/SPFavoritesPreferencePane.m
+++ b/Source/SPFavoritesPreferencePane.m
@@ -499,15 +499,15 @@
NSString *keychainAccount = [keychain accountForUser:[currentFavorite objectForKey:@"user"] host:(([[currentFavorite objectForKey:@"type"] integerValue] == SPSocketConnection)?@"localhost":[currentFavorite objectForKey:@"host"]) database:[currentFavorite objectForKey:@"database"]];
NSString *passwordValue = [keychain getPasswordForName:keychainName account:keychainAccount];
- [standardPasswordField setStringValue:passwordValue];
- [socketPasswordField setStringValue:passwordValue];
- [sshSQLPasswordField setStringValue:passwordValue];
+ [standardPasswordField setStringValue:passwordValue?passwordValue:@""];
+ [socketPasswordField setStringValue:passwordValue?passwordValue:@""];
+ [sshSQLPasswordField setStringValue:passwordValue?passwordValue:@""];
// Retrieve the SSH keychain password if appropriate.
NSString *keychainSSHName = [keychain nameForSSHForFavoriteName:[currentFavorite objectForKey:@"name"] id:[currentFavorite objectForKey:@"id"]];
NSString *keychainSSHAccount = [keychain accountForSSHUser:[currentFavorite objectForKey:@"sshUser"] sshHost:[currentFavorite objectForKey:@"sshHost"]];
-
- [sshPasswordField setStringValue:[keychain getPasswordForName:keychainSSHName account:keychainSSHAccount]];
+ NSString *sshPasswordValue = [keychain getPasswordForName:keychainSSHName account:keychainSSHAccount];
+ [sshPasswordField setStringValue:sshPasswordValue?sshPasswordValue:@""];
favoriteNameFieldWasTouched = YES;
}
diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m
index bb010d3b..931f14d7 100644
--- a/Source/SPKeychain.m
+++ b/Source/SPKeychain.m
@@ -120,7 +120,7 @@
void *passwordData;
UInt32 passwordLength;
SecKeychainItemRef itemRef;
- NSString *password = @"";
+ NSString *password = nil;
// Check supplied variables and replaces nils with empty strings
if (!name) name = @"";