aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPKeychain.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-05-27 22:33:26 +0000
committerrowanbeentje <rowan@beent.je>2012-05-27 22:33:26 +0000
commit1f0dde0452519496a3d361ad6ddb38731c350a7e (patch)
tree94a37bd6d035ebf0c3e6956ba954fdf2466d24c6 /Source/SPKeychain.m
parent03f6c875ed6c240e9af2916ce92584ac6624ef87 (diff)
downloadsequelpro-1f0dde0452519496a3d361ad6ddb38731c350a7e.tar.gz
sequelpro-1f0dde0452519496a3d361ad6ddb38731c350a7e.tar.bz2
sequelpro-1f0dde0452519496a3d361ad6ddb38731c350a7e.zip
Improve connection handling and editing:
- Fix long-standing intermittent crashes caused by connection errors after SSH tunnels were established - Fix edits causing keychain -25299 errors (Issue #1340) - Allow changes of favourite type to be saved rather than disassociating the edit from the selection - Fix the favourites view scrolling to the top when there's no selection and connection details are being edited - Fix some issues with automatic naming of connections on connection type change
Diffstat (limited to 'Source/SPKeychain.m')
-rw-r--r--Source/SPKeychain.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m
index aa38f7b5..3a66b327 100644
--- a/Source/SPKeychain.m
+++ b/Source/SPKeychain.m
@@ -283,6 +283,14 @@
status = SecKeychainItemModifyAttributesAndData(itemRef, &attList, (UInt32)strlen([password UTF8String]), [password UTF8String]);
if (status != noErr) {
+
+ // An error of -25299 indicates that the keychain item is a duplicate. As connection names include a unique ID,
+ // this indicates an issue when previously altering keychain items; delete the old item and try again.
+ if ((int)status == -25299) {
+ [self deletePasswordForName:newName account:newAccount];
+ return [self updateItemWithName:name account:account toName:newName account:newAccount password:password];
+ }
+
NSLog(@"Error (%i) while updating keychain item for name: %@ account: %@", (int)status, name, account);
SPBeginAlertSheet(NSLocalizedString(@"Error updating Keychain item", @"error updating keychain item message"),
NSLocalizedString(@"OK", @"OK button"),