Revision: 6961
http://skim-app.svn.sourceforge.net/skim-app/?rev=6961&view=rev
Author: hofman
Date: 2010-12-11 01:01:17 +0000 (Sat, 11 Dec 2010)
Log Message:
-----------
no need to get password data from stale keychain item we're gonna modify
Modified Paths:
--------------
trunk/SKMainDocument.m
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2010-12-11 00:55:30 UTC (rev 6960)
+++ trunk/SKMainDocument.m 2010-12-11 01:01:17 UTC (rev 6961)
@@ -1783,25 +1783,19 @@
OSStatus err;
SecKeychainItemRef itemRef = NULL;
- const void *passwordData = NULL;
- UInt32 passwordLength = 0;
+ const void *passwordData = [password UTF8String];
// first see if the password exists in the keychain
- err = SecKeychainFindGenericPassword(NULL, strlen(serviceName),
serviceName, strlen(userName), userName, &passwordLength, (void
**)&passwordData, &itemRef);
+ err = SecKeychainFindGenericPassword(NULL, strlen(serviceName),
serviceName, strlen(userName), userName, NULL, NULL, &itemRef);
if(err == noErr){
- // password was on keychain, so flush the buffer and then
modify the keychain
- SecKeychainItemFreeContent(NULL, (void *)passwordData);
- passwordData = NULL;
-
- passwordData = [password UTF8String];
+ // password was on keychain, so modify the keychain
SecKeychainAttribute attrs[] = { { kSecCommentItemAttr,
comment == NULL ? 0 : strlen(comment), (char *)comment } };
const SecKeychainAttributeList attributes = { comment == NULL
? 0 : 1, attrs };
err = SecKeychainItemModifyAttributesAndData(itemRef, (comment
== NULL ? NULL : &attributes), strlen(passwordData), passwordData);
} else if(err == errSecItemNotFound){
// password not on keychain, so add it
- passwordData = [password UTF8String];
err = SecKeychainAddGenericPassword(NULL, strlen(serviceName),
serviceName, strlen(userName), userName, strlen(passwordData), passwordData,
&itemRef);
if (err == noErr && comment != NULL) {
SecKeychainAttribute attrs[] = { { kSecCommentItemAttr,
strlen(comment), (char *)comment } };
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages,
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit