[gnome-keyring/dbus-api: 4/6] [pkcs11] Reorder creation to fix unit tests.



commit e0773b730bc5db35e8a6661fa2b6fec799f0d273
Author: Stef Walter <stef memberwebs com>
Date:   Tue Nov 10 01:51:08 2009 +0000

    [pkcs11] Reorder creation to fix unit tests.
    
    Reorder object creation so that we initialize create only
    attributes before we try to use them.

 pkcs11/gck/gck-session.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/pkcs11/gck/gck-session.c b/pkcs11/gck/gck-session.c
index cea06c4..98c15a6 100644
--- a/pkcs11/gck/gck-session.c
+++ b/pkcs11/gck/gck-session.c
@@ -825,9 +825,14 @@ gck_session_create_object_for_factory (GckSession *self, GckFactory *factory,
 	*object = NULL;
 	(factory->func) (self, transaction, attrs, n_attrs, object);
 
-	/* See if we can create due to read-only */
+	/* Give the object a chance to create additional attributes */
 	if (!gck_transaction_get_failed (transaction)) {
 		g_return_val_if_fail (*object, CKR_GENERAL_ERROR);
+		gck_object_create_attributes (*object, self, transaction, attrs, n_attrs);
+	}
+
+	/* See if we can create due to read-only */
+	if (!gck_transaction_get_failed (transaction)) {
 		if (gck_object_is_token (*object)) {
 			if (!gck_object_is_transient (*object) &&
 			    gck_module_get_write_protected (self->pv->module))
@@ -846,11 +851,6 @@ gck_session_create_object_for_factory (GckSession *self, GckFactory *factory,
 		}
 	}
 
-	/* Give the object a chance to create additional attributes */
-	if (!gck_transaction_get_failed (transaction)) {
-		gck_object_create_attributes (*object, self, transaction, attrs, n_attrs);
-	}
-
 	/* Find somewhere to store the object */
 	if (!gck_transaction_get_failed (transaction)) {
 		if (gck_object_is_token (*object))



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