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

Log Message:
-----------
Save file name as comment in keychain item

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

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2008-10-12 10:49:54 UTC (rev 4772)
+++ trunk/SKPDFDocument.m       2008-10-12 11:56:01 UTC (rev 4773)
@@ -1703,6 +1703,7 @@
             if (saveOption == NSAlertDefaultReturn) {
                 const char *userNameCString = [NSUserName() UTF8String];
                 const char *nameCString = [[NSString stringWithFormat:@"Skim - 
%@", fileIDString] UTF8String];
+                const char *commentCString = [[self fileName] UTF8String];
                 
                 OSStatus err;
                 SecKeychainItemRef itemRef = NULL;    
@@ -1720,7 +1721,8 @@
                     passwordData = [aPassword UTF8String];
                     SecKeychainAttribute attrs[] = {
                         { kSecAccountItemAttr, strlen(userNameCString), (char 
*)userNameCString },
-                        { kSecServiceItemAttr, strlen(nameCString), (char 
*)nameCString } };
+                        { kSecServiceItemAttr, strlen(nameCString), (char 
*)nameCString },
+                        { kSecCommentItemAttr, strlen(commentCString), (char 
*)commentCString } };
                     const SecKeychainAttributeList attributes = { 
sizeof(attrs) / sizeof(attrs[0]), attrs };
                     
                     err = SecKeychainItemModifyAttributesAndData(itemRef, 
&attributes, strlen(passwordData), passwordData);
@@ -1728,6 +1730,11 @@
                     // 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);
                 } 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