[gnome-keyring/dbus-api] [secret-store] Implement C_SetAttributeValue.
- From: Stefan Walter <stefw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-keyring/dbus-api] [secret-store] Implement C_SetAttributeValue.
- Date: Sun, 30 Aug 2009 18:54:29 +0000 (UTC)
commit 522d8d99bc5b99231ebc619882502a0f7aade7ea
Author: Stef Walter <stef memberwebs com>
Date: Sun Aug 30 18:40:28 2009 +0000
[secret-store] Implement C_SetAttributeValue.
Complete the implementation of C_SetAttributeValue, which has been
missing up until this point.
pkcs11/gck/gck-module-ep.h | 2 +-
pkcs11/gck/gck-session.c | 26 ++++++++++++++++++++++++--
2 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/pkcs11/gck/gck-module-ep.h b/pkcs11/gck/gck-module-ep.h
index 7ef2216..d3df265 100644
--- a/pkcs11/gck/gck-module-ep.h
+++ b/pkcs11/gck/gck-module-ep.h
@@ -582,7 +582,7 @@ gck_C_SetAttributeValue (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
if (pkcs11_module != NULL) {
session = gck_module_lookup_session (pkcs11_module, handle);
if (session != NULL)
- rv = gck_session_C_SetAttributeValue (session, handle, template, count);
+ rv = gck_session_C_SetAttributeValue (session, object, template, count);
else
rv = CKR_SESSION_HANDLE_INVALID;
}
diff --git a/pkcs11/gck/gck-session.c b/pkcs11/gck/gck-session.c
index 8d76789..41fa189 100644
--- a/pkcs11/gck/gck-session.c
+++ b/pkcs11/gck/gck-session.c
@@ -1013,8 +1013,30 @@ CK_RV
gck_session_C_SetAttributeValue (GckSession* self, CK_OBJECT_HANDLE handle,
CK_ATTRIBUTE_PTR template, CK_ULONG count)
{
- /* TODO: Need to implement this */
- return CKR_FUNCTION_NOT_SUPPORTED;
+ GckObject *object = NULL;
+ GckTransaction *transaction;
+ CK_ULONG i;
+ CK_RV rv;
+
+ g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+ if (!(!count || template))
+ return CKR_ARGUMENTS_BAD;
+
+ rv = gck_session_lookup_writable_object (self, handle, &object);
+ if (rv != CKR_OK)
+ return rv;
+
+ /* The transaction for this whole dealio */
+ transaction = gck_transaction_new ();
+
+ for (i = 0; i < count && !gck_transaction_get_failed (transaction); ++i)
+ gck_object_set_attribute (object, self, transaction, &template[i]);
+
+ gck_transaction_complete (transaction);
+ rv = gck_transaction_get_result (transaction);
+ g_object_unref (transaction);
+
+ return rv;
}
CK_RV
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]