[gnome-keyring/gnome-3-4] gnome2-store: Ignore attributes that gcr-viewer sets



commit c53bb448d90e290d6b208090a285d1f4070b5ce9
Author: Stef Walter <stefw gnome org>
Date:   Tue Jun 19 12:35:29 2012 +0200

    gnome2-store: Ignore attributes that gcr-viewer sets
    
    We don't yet support all the attributes correctly, but try
    to not error out in gnome2-store for the ones that gcr-viewer
    sets.

 pkcs11/gkm/gkm-certificate.c                 |    6 ++++--
 pkcs11/gnome2-store/gkm-gnome2-private-key.c |    5 +++++
 pkcs11/gnome2-store/gkm-gnome2-storage.c     |    9 +++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/pkcs11/gkm/gkm-certificate.c b/pkcs11/gkm/gkm-certificate.c
index 1e3e2f2..0509c22 100644
--- a/pkcs11/gkm/gkm-certificate.c
+++ b/pkcs11/gkm/gkm-certificate.c
@@ -145,8 +145,10 @@ factory_create_certificate (GkmSession *session, GkmTransaction *transaction,
 		return NULL;
 	}
 
-	/* Note that we ignore the subject */
-	gkm_attributes_consume (attrs, n_attrs, CKA_VALUE, CKA_SUBJECT, G_MAXULONG);
+	/* We calculate these attributes automatically */
+	gkm_attributes_consume (attrs, n_attrs,
+	                        CKA_VALUE, CKA_SUBJECT, CKA_SERIAL_NUMBER, CKA_ID,
+	                        G_MAXULONG);
 
 	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (cert),
 	                                      TRUE, attrs, n_attrs);
diff --git a/pkcs11/gnome2-store/gkm-gnome2-private-key.c b/pkcs11/gnome2-store/gkm-gnome2-private-key.c
index a2bc738..0bacd8e 100644
--- a/pkcs11/gnome2-store/gkm-gnome2-private-key.c
+++ b/pkcs11/gnome2-store/gkm-gnome2-private-key.c
@@ -85,6 +85,11 @@ factory_create_private_key (GkmSession *session, GkmTransaction *transaction,
 
 	gkm_sexp_unref (sexp);
 
+	/* TODO: We don't support setting these yet, so ignore them */
+	gkm_attributes_consume (attrs, n_attrs,
+	                        CKA_SIGN_RECOVER, CKA_UNWRAP, CKA_ID,
+	                        G_MAXULONG);
+
 	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (key),
 	                                      TRUE, attrs, n_attrs);
 	return GKM_OBJECT (key);
diff --git a/pkcs11/gnome2-store/gkm-gnome2-storage.c b/pkcs11/gnome2-store/gkm-gnome2-storage.c
index ac52ccf..ec97836 100644
--- a/pkcs11/gnome2-store/gkm-gnome2-storage.c
+++ b/pkcs11/gnome2-store/gkm-gnome2-storage.c
@@ -857,6 +857,8 @@ static GObject*
 gkm_gnome2_storage_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
 	GkmGnome2Storage *self = GKM_GNOME2_STORAGE (G_OBJECT_CLASS (gkm_gnome2_storage_parent_class)->constructor(type, n_props, props));
+	CK_ATTRIBUTE attr;
+
 	g_return_val_if_fail (self, NULL);
 
 	g_return_val_if_fail (self->directory, NULL);
@@ -865,6 +867,13 @@ gkm_gnome2_storage_constructor (GType type, guint n_props, GObjectConstructParam
 	g_return_val_if_fail (self->manager, NULL);
 	g_return_val_if_fail (self->module, NULL);
 
+	/* Register store attributes */
+	attr.type = CKA_LABEL;
+	attr.pValue = "";
+	attr.ulValueLen = 0;
+
+	gkm_store_register_schema (GKM_STORE (self), &attr, NULL, 0);
+
 	return G_OBJECT (self);
 }
 



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