gnome-keyring r1623 - in trunk: . gp11



Author: nnielsen
Date: Fri Feb 27 01:00:07 2009
New Revision: 1623
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1623&view=rev

Log:
When enumerating objects in a module, skip tokens that fail from not being initialized.

Modified:
   trunk/ChangeLog
   trunk/gp11/gp11-module.c

Modified: trunk/gp11/gp11-module.c
==============================================================================
--- trunk/gp11/gp11-module.c	(original)
+++ trunk/gp11/gp11-module.c	Fri Feb 27 01:00:07 2009
@@ -999,6 +999,9 @@
  * You can access the session in which the object was found, by using the 
  * gp11_object_get_session() function on the resulting objects.
  * 
+ * This function skips tokens that are not initialize, and makes a best effort to 
+ * find objects on valid tokens. 
+ * 
  * The function can return FALSE to stop the enumeration.
  * 
  * Return value: If FALSE then an error prevented all matching objects from being enumerated.
@@ -1070,9 +1073,19 @@
 	slots = gp11_module_get_slots (self, TRUE);
 	
 	for (l = slots; ret && !stop && l; l = g_list_next (l)) {
-		session = gp11_slot_open_session (l->data, CKF_SERIAL_SESSION, err);
+		session = gp11_slot_open_session (l->data, CKF_SERIAL_SESSION, &error);
 		if (!session) {
-			ret = FALSE;
+			g_return_val_if_fail (error != NULL, FALSE);
+			
+			/* Ignore these errors when enumerating */
+			if (error->code == CKR_USER_PIN_NOT_INITIALIZED) {
+				g_clear_error (&error);
+				
+			} else {
+				ret = FALSE;
+				g_propagate_error (err, error);
+				error = NULL;
+			}
 			continue;
 		}
 		



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]