Revision: 21829
http://sourceforge.net/p/bibdesk/svn/21829
Author: hofman
Date: 2018-02-05 16:58:35 +0000 (Mon, 05 Feb 2018)
Log Message:
-----------
Log every keychain error, unless not found or user canceled, also log error
message
Modified Paths:
--------------
trunk/bibdesk/BDSKPasswordController.m
Modified: trunk/bibdesk/BDSKPasswordController.m
===================================================================
--- trunk/bibdesk/BDSKPasswordController.m 2018-02-05 07:30:46 UTC (rev
21828)
+++ trunk/bibdesk/BDSKPasswordController.m 2018-02-05 16:58:35 UTC (rev
21829)
@@ -57,6 +57,8 @@
if(err == noErr){
pwData = [NSData dataWithBytes:password length:passwordLength];
SecKeychainItemFreeContent(NULL, password);
+ } else if (err != errSecItemNotFound && err != errSecUserCanceled){
+ NSLog(@"Error %d occurred getting password: %@", (int)err,
[(id)SecCopyErrorMessageString(err, NULL) autorelease]);
}
return pwData;
}
@@ -82,6 +84,8 @@
// password was on keychain, so flush the buffer and then modify the
keychain if necessary
if (passwordLength != strlen(passwordData) || strncmp(passwordData,
oldPasswordData, passwordLength) != 0) {
err = SecKeychainItemModifyAttributesAndData(itemRef, NULL,
strlen(passwordData), passwordData);
+ if (err != noErr && err != errSecUserCanceled)
+ NSLog(@"Error %d occurred modifying password: %@", (int)err,
[(id)SecCopyErrorMessageString(err, NULL) autorelease]);
result = (err == noErr);
}
SecKeychainItemFreeContent(NULL, (void *)oldPasswordData);
@@ -88,10 +92,12 @@
CFRelease(itemRef);
} else if (err == errSecItemNotFound) {
// password not on keychain, so add it
- err = SecKeychainAddGenericPassword(NULL, strlen(nameCString),
nameCString, strlen(userNameCString), userNameCString, strlen(passwordData),
passwordData, NULL);
+ err = SecKeychainAddGenericPassword(NULL, strlen(nameCString),
nameCString, strlen(userNameCString), userNameCString, strlen(passwordData),
passwordData, NULL);
+ if (err != noErr && err != errSecUserCanceled)
+ NSLog(@"Error %d occurred adding password: %@", (int)err,
[(id)SecCopyErrorMessageString(err, NULL) autorelease]);
result = (err == noErr);
- } else {
- NSLog(@"Error %d occurred setting password", (int)err);
+ } else if (err != errSecUserCanceled) {
+ NSLog(@"Error %d occurred getting password: %@", (int)err,
[(id)SecCopyErrorMessageString(err, NULL) autorelease]);
}
return result;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit