[gnome-keyring/dbus-api] [secret-store] Add proper CKA_CLASS attributes to item/collection



commit 17a897bada44cd82d8a467ae13bc57e0fca2c3fa
Author: Stef Walter <stef memberwebs com>
Date:   Sun Aug 23 01:56:28 2009 +0000

    [secret-store] Add proper CKA_CLASS attributes to item/collection

 pkcs11/secret-store/gck-secret-collection.c |   15 +++++++++++++++
 pkcs11/secret-store/gck-secret-item.c       |    3 +++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/pkcs11/secret-store/gck-secret-collection.c b/pkcs11/secret-store/gck-secret-collection.c
index 49e80bd..cb78d97 100644
--- a/pkcs11/secret-store/gck-secret-collection.c
+++ b/pkcs11/secret-store/gck-secret-collection.c
@@ -27,12 +27,15 @@
 #include "gck-secret-item.h"
 #include "gck-secret-textual.h"
 
+#include "gck/gck-attributes.h"
 #include "gck/gck-authenticator.h"
 #include "gck/gck-secret.h"
 #include "gck/gck-session.h"
 
 #include <glib/gi18n.h>
 
+#include "pkcs11/pkcs11i.h"
+
 enum {
 	PROP_0,
 	PROP_FILENAME
@@ -130,6 +133,17 @@ expose_each_item (gpointer key, gpointer value, gpointer user_data)
  */
 
 static CK_RV
+gck_secret_collection_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE_PTR attr)
+{
+	switch (attr->type) {
+	case CKA_CLASS:
+		return gck_attribute_set_ulong (attr, CKO_G_COLLECTION);
+	}
+
+	return GCK_OBJECT_CLASS (gck_secret_collection_parent_class)->get_attribute (base, session, attr);
+}
+
+static CK_RV
 gck_secret_collection_real_unlock (GckObject *obj, GckAuthenticator *auth)
 {
 	GckSecretCollection *self = GCK_SECRET_COLLECTION (obj);
@@ -281,6 +295,7 @@ gck_secret_collection_class_init (GckSecretCollectionClass *klass)
 	gobject_class->dispose = gck_secret_collection_dispose;
 	gobject_class->finalize = gck_secret_collection_finalize;
 
+	gck_class->get_attribute = gck_secret_collection_get_attribute;
 	gck_class->unlock = gck_secret_collection_real_unlock;
 	gck_class->expose_object = gck_secret_collection_expose;
 
diff --git a/pkcs11/secret-store/gck-secret-item.c b/pkcs11/secret-store/gck-secret-item.c
index 9fcb12d..a40e8c4 100644
--- a/pkcs11/secret-store/gck-secret-item.c
+++ b/pkcs11/secret-store/gck-secret-item.c
@@ -120,6 +120,9 @@ gck_secret_item_real_get_attribute (GckObject *base, GckSession *session, CK_ATT
 	g_return_val_if_fail (self->collection, CKR_GENERAL_ERROR);
 
 	switch (attr->type) {
+	case CKA_CLASS:
+		return gck_attribute_set_ulong (attr, CKO_SECRET_KEY);
+
 	case CKA_VALUE:
 		sdata = gck_secret_collection_unlocked_data (self->collection, session);
 		if (sdata == NULL)



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