- Backport some fixes related to password saving

This commit is contained in:
Tomas Bzatek 2010-02-08 13:57:22 +00:00
parent 0ce8a73039
commit 71012fc01b
4 changed files with 197 additions and 1 deletions

View File

@ -0,0 +1,63 @@
From 4d22df25dac5c051c04f8d957169ff5ba45b5020 Mon Sep 17 00:00:00 2001
From: Stef Walter <stef@memberwebs.com>
Date: Sat, 06 Feb 2010 15:06:16 +0000
Subject: [dbus] Refresh and store the default keyring correctly.
Although the default keyring was being loaded, it was not being
used correctly by the path resolution code.
---
diff --git a/daemon/dbus/gkd-secret-service.c b/daemon/dbus/gkd-secret-service.c
index 4e2b01c..3d5bd19 100644
--- a/daemon/dbus/gkd-secret-service.c
+++ b/daemon/dbus/gkd-secret-service.c
@@ -56,7 +56,6 @@ struct _GkdSecretService {
GHashTable *clients;
gchar *match_rule;
GkdSecretObjects *objects;
- gchar *default_collection;
};
typedef struct _ServiceClient {
@@ -88,9 +87,11 @@ static void
update_default (GkdSecretService *self, gboolean force)
{
gchar *contents = NULL;
+ const gchar *identifier;
gchar *path;
- if (!force && self->default_collection)
+ identifier = gkd_secret_objects_get_alias (self->objects, "default");
+ if (!force && identifier)
return;
path = default_path ();
@@ -103,21 +104,23 @@ update_default (GkdSecretService *self, gboolean force)
}
g_free (path);
- g_free (self->default_collection);
- self->default_collection = contents;
+ gkd_secret_objects_set_alias (self->objects, "default", contents);
+ g_free (contents);
}
static void
store_default (GkdSecretService *self)
{
GError *error = NULL;
+ const gchar *identifier;
gchar *path;
- if (!self->default_collection)
+ identifier = gkd_secret_objects_get_alias (self->objects, "default");
+ if (!identifier)
return;
path = default_path ();
- if (!g_file_set_contents (path, self->default_collection, -1, &error)) {
+ if (!g_file_set_contents (path, identifier, -1, &error)) {
g_message ("couldn't store default keyring: %s",
error->message ? error->message : "");
}
--
cgit v0.8.3.1

View File

@ -0,0 +1,57 @@
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

View File

@ -0,0 +1,64 @@
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

View File

@ -9,7 +9,7 @@
Summary: Framework for managing passwords and other secrets
Name: gnome-keyring
Version: 2.29.5
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+ and LGPLv2+
Group: System Environment/Libraries
Source: http://download.gnome.org/sources/gnome-keyring/2.29/gnome-keyring-%{version}.tar.bz2
@ -33,6 +33,11 @@ Patch5: gnome-keyring-2.29.6-stat-include.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=607869
Patch6: gnome-keyring-2.29.6-prompt-show-entry.patch
# from upstream
Patch7: gnome-keyring-2.29.6-dbus-refresh-store.patch
Patch8: gnome-keyring-2.29.6-secrets-reloading.patch
Patch9: gnome-keyring-2.29.6-pkcs11-attributes-storing.patch
URL: http://www.gnome.org
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -97,6 +102,10 @@ automatically unlock the "login" keyring when the user logs in.
%patch4 -p1 -b .lookup-endless-loop
%patch5 -p1 -b .ftbfs-stat
%patch6 -p1 -b .prompt-entry
%patch7 -p1 -b .dbus-refresh
%patch8 -p1 -b .secrets-reloading
%patch9 -p1 -b .attributes-storing
%build
%configure --disable-gtk-doc --with-pam-dir=/%{_lib}/security --disable-acl-prompts
@ -174,6 +183,9 @@ fi
%changelog
* Mon Feb 8 2010 Tomas Bzatek <tbzatek@redhat.com> - 2.29.5-4
- Backport some fixes related to password saving
* Mon Feb 1 2010 Tomas Bzatek <tbzatek@redhat.com> - 2.29.5-3
- Fix hidden entry boxes in the new password prompt (#560345)