Revision: 7031
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7031&view=rev
Author:   hofman
Date:     2011-01-02 13:07:41 +0000 (Sun, 02 Jan 2011)

Log Message:
-----------
log description of keychain access error

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

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2011-01-02 12:01:38 UTC (rev 7030)
+++ trunk/SKMainDocument.m      2011-01-02 13:07:41 UTC (rev 7031)
@@ -1588,9 +1588,8 @@
         err = SecKeychainFindGenericPassword(NULL, strlen(service), service, 
strlen(account), account, password ? &passwordLength : 0, password ? 
&passwordData : NULL, itemRef);
         
         status = (err == noErr ? SKPDFPasswordStatusFoundOldFormat : err == 
errSecItemNotFound ? SKPDFPasswordStatusNotFound : SKPDFPasswordStatusError);
-        
     } else {
-        status = err == noErr ? SKPDFPasswordStatusFound : 
SKPDFPasswordStatusError;
+        status = (err == noErr ? SKPDFPasswordStatusFound : 
SKPDFPasswordStatusError);
     }
     
     if (err == noErr && password) {
@@ -1599,7 +1598,7 @@
     }
     
     if (err != noErr && err != errSecItemNotFound)
-        NSLog(@"Error %d occurred finding password", err);
+        NSLog(@"Error %d occurred finding password: %@", err, 
[(id)SecCopyErrorMessageString(err, NULL) autorelease]);
     
     return status;
 }
@@ -1631,15 +1630,17 @@
     attributes.count = attrCount;
     attributes.attr = attrs;
     
-    if (itemRef)
+    if (itemRef) {
         // password was on keychain, so modify the keychain
         err = SecKeychainItemModifyAttributesAndData(itemRef, &attributes, 
passwordLength, passwordData);
-    else
+        if (err != noErr)
+            NSLog(@"Error %d occurred modifying password: %@", err, 
[(id)SecCopyErrorMessageString(err, NULL) autorelease]);
+    } else {
         // password not on keychain, so add it
         err = SecKeychainItemCreateFromContent(kSecGenericPasswordItemClass, 
&attributes, passwordLength, passwordData, NULL, NULL, NULL);
-    
-    if (err != noErr)
-        NSLog(@"Error %d occurred %@ password", err, itemRef ? @"modifying" : 
@"adding");
+        if (err != noErr)
+            NSLog(@"Error %d occurred adding password: %@", err, 
[(id)SecCopyErrorMessageString(err, NULL) autorelease]);
+    }
 }
 
 - (void)passwordAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode 
contextInfo:(void *)contextInfo {


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

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to