58 lines
2.2 KiB
Diff
58 lines
2.2 KiB
Diff
From aa548019df045b4085c088c84aec585ab0e62a98 Mon Sep 17 00:00:00 2001
|
|
From: Stef Walter <stef@memberwebs.com>
|
|
Date: Sun, 07 Feb 2010 17:32:57 +0000
|
|
Subject: [pkcs11] Set attributes on object before storing.
|
|
|
|
Set attributes on new objects before storing them.
|
|
---
|
|
diff --git a/pkcs11/gck/gck-session.c b/pkcs11/gck/gck-session.c
|
|
index 8b280ec..ead7b1c 100644
|
|
--- a/pkcs11/gck/gck-session.c
|
|
+++ b/pkcs11/gck/gck-session.c
|
|
@@ -770,7 +770,6 @@ gck_session_create_object_for_factory (GckSession *self, GckFactory *factory,
|
|
{
|
|
GckTransaction *owned = NULL;
|
|
GckObject *object;
|
|
- gulong i;
|
|
|
|
g_return_val_if_fail (GCK_IS_SESSION (self), NULL);
|
|
g_return_val_if_fail (factory && factory->func, NULL);
|
|
@@ -797,13 +796,6 @@ gck_session_create_object_for_factory (GckSession *self, GckFactory *factory,
|
|
gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
|
|
}
|
|
|
|
- /* Next go through and set all attributes that weren't used initially */
|
|
- gck_attributes_consume (template, count, CKA_TOKEN, G_MAXULONG);
|
|
- for (i = 0; i < count && !gck_transaction_get_failed (transaction); ++i) {
|
|
- if (!gck_attribute_consumed (&template[i]))
|
|
- gck_object_set_attribute (object, self, transaction, &template[i]);
|
|
- }
|
|
-
|
|
g_free (template);
|
|
|
|
if (owned)
|
|
@@ -846,6 +838,7 @@ gck_session_complete_object_creation (GckSession *self, GckTransaction *transact
|
|
GckObject *object, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
|
|
{
|
|
gboolean is_private;
|
|
+ gulong i;
|
|
|
|
g_return_if_fail (GCK_IS_SESSION (self));
|
|
g_return_if_fail (GCK_IS_OBJECT (object));
|
|
@@ -872,6 +865,13 @@ gck_session_complete_object_creation (GckSession *self, GckTransaction *transact
|
|
return gck_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
|
|
}
|
|
|
|
+ /* Next go through and set all attributes that weren't used initially */
|
|
+ gck_attributes_consume (attrs, n_attrs, CKA_TOKEN, G_MAXULONG);
|
|
+ for (i = 0; i < n_attrs && !gck_transaction_get_failed (transaction); ++i) {
|
|
+ if (!gck_attribute_consumed (&attrs[i]))
|
|
+ gck_object_set_attribute (object, self, transaction, &attrs[i]);
|
|
+ }
|
|
+
|
|
/* Find somewhere to store the object */
|
|
if (gck_object_is_token (object))
|
|
gck_module_store_token_object (self->pv->module, transaction, object);
|
|
--
|
|
cgit v0.8.3.1
|