From 701cab2c3b40216c01bf1cda23fe15c9ff0d7caa Mon Sep 17 00:00:00 2001
From: Stef Walter <stef@memberwebs.com>
Date: Sat, 06 Feb 2010 15:39:05 +0000
Subject: [secrets] Fix problems with collection reloading.
The module had a bug which would cause collections that were reloaded
to appear as new collections
---
diff --git a/pkcs11/secret-store/gck-secret-module.c b/pkcs11/secret-store/gck-secret-module.c
index 0cd7f50..5b08008 100644
--- a/pkcs11/secret-store/gck-secret-module.c
+++ b/pkcs11/secret-store/gck-secret-module.c
@@ -110,15 +110,15 @@ complete_add (GckTransaction *transaction, GObject *obj, gpointer user_data)
static void
add_collection (GckSecretModule *self, GckTransaction *transaction, GckSecretCollection *collection)
{
- const gchar *identifier;
+ const gchar *filename;
g_assert (GCK_IS_SECRET_MODULE(self));
g_assert (GCK_IS_SECRET_COLLECTION (collection));
- identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (collection));
- g_return_if_fail (identifier);
+ filename = gck_secret_collection_get_filename (collection);
+ g_return_if_fail (filename);
- g_hash_table_replace (self->collections, g_strdup (identifier), g_object_ref (collection));
+ g_hash_table_replace (self->collections, g_strdup (filename), g_object_ref (collection));
gck_object_expose_full (GCK_OBJECT (collection), transaction, TRUE);
if (transaction)
@@ -138,15 +138,15 @@ complete_remove (GckTransaction *transaction, GObject *obj, gpointer user_data)
static void
remove_collection (GckSecretModule *self, GckTransaction *transaction, GckSecretCollection *collection)
{
- const gchar *identifier;
+ const gchar *filename;
g_assert (GCK_IS_SECRET_MODULE (self));
g_assert (GCK_IS_SECRET_COLLECTION (collection));
- identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (collection));
- g_return_if_fail (identifier);
+ filename = gck_secret_collection_get_filename (collection);
+ g_return_if_fail (filename);
- g_hash_table_remove (self->collections, identifier);
+ g_hash_table_remove (self->collections, filename);
gck_object_expose_full (GCK_OBJECT (collection), transaction, FALSE);
if (transaction)
@@ -222,6 +222,9 @@ on_file_load (GckFileTracker *tracker, const gchar *path, GckSecretModule *self)
"filename", path,
"manager", manager,
NULL);
+ } else {
+ created = FALSE;
+ g_object_ref (collection);
}
res = gck_secret_collection_load (collection);
--
cgit v0.8.3.1