Revision: 4774
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4774&view=rev
Author:   hofman
Date:     2008-10-12 12:16:25 +0000 (Sun, 12 Oct 2008)

Log Message:
-----------
Check error before modifying keychain item comment

Modified Paths:
--------------
    trunk/SKPDFDocument.m

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2008-10-12 11:56:01 UTC (rev 4773)
+++ trunk/SKPDFDocument.m       2008-10-12 12:16:25 UTC (rev 4774)
@@ -1730,11 +1730,12 @@
                     // password not on keychain, so add it
                     passwordData = [password UTF8String];
                     err = SecKeychainAddGenericPassword(NULL, 
strlen(nameCString), nameCString, strlen(userNameCString), userNameCString, 
strlen(passwordData), passwordData, &itemRef);    
-                    
-                    SecKeychainAttribute attrs[] = { { kSecCommentItemAttr, 
strlen(commentCString), (char *)commentCString } };
-                    const SecKeychainAttributeList attributes = { 
sizeof(attrs) / sizeof(attrs[0]), attrs };
-                    
-                    err = SecKeychainItemModifyAttributesAndData(itemRef, 
&attributes, strlen(passwordData), passwordData);
+                    if (err == noErr && commentStr != NULL) {
+                        SecKeychainAttribute attrs[] = { { 
kSecCommentItemAttr, strlen(commentCString), (char *)commentCString } };
+                        const SecKeychainAttributeList attributes = { 
sizeof(attrs) / sizeof(attrs[0]), attrs };
+                        
+                        err = SecKeychainItemModifyAttributesAndData(itemRef, 
&attributes, strlen(passwordData), passwordData);
+                    }
                 } else 
                     NSLog(@"Error %d occurred setting password", err);
             }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to