dbus: Initialize secret service before claiming name

This commit is contained in:
Kalev Lember 2015-10-14 19:58:37 +02:00
parent 485edf9808
commit dc5eb1f3a1
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,56 @@
From 3cf744f67939dc23c2cc8715cda999a7ec13f1b6 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Tue, 6 Oct 2015 21:12:49 +0200
Subject: [PATCH] dbus: Initialize secret service before claiming name
Otherwise incoming calls can race with our initialization. Activating
calls are even guaranteed to arrive before we have set up the service.
https://bugzilla.gnome.org/show_bug.cgi?id=756006
---
daemon/dbus/gkd-dbus-secrets.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/daemon/dbus/gkd-dbus-secrets.c b/daemon/dbus/gkd-dbus-secrets.c
index 2712a33..207524b 100644
--- a/daemon/dbus/gkd-dbus-secrets.c
+++ b/daemon/dbus/gkd-dbus-secrets.c
@@ -74,6 +74,7 @@ gkd_dbus_secrets_startup (void)
guint res;
g_return_val_if_fail (dbus_conn, FALSE);
+ g_return_val_if_fail (!secrets_service, FALSE);
#ifdef WITH_DEBUG
service = g_getenv ("GNOME_KEYRING_TEST_SERVICE");
@@ -86,6 +87,9 @@ gkd_dbus_secrets_startup (void)
/* Figure out which slot to use */
slot = calculate_secrets_slot ();
g_return_val_if_fail (slot, FALSE);
+ secrets_service = g_object_new (GKD_SECRET_TYPE_SERVICE,
+ "connection", dbus_conn, "pkcs11-slot", slot, NULL);
+ g_object_unref (slot);
/* Try and grab our name */
request_variant = g_dbus_connection_call_sync (dbus_conn,
@@ -120,16 +124,12 @@ gkd_dbus_secrets_startup (void)
g_message ("another secret service is running");
break;
default:
+ g_clear_object (&secrets_service);
g_return_val_if_reached (FALSE);
break;
};
}
- g_return_val_if_fail (!secrets_service, FALSE);
- secrets_service = g_object_new (GKD_SECRET_TYPE_SERVICE,
- "connection", dbus_conn, "pkcs11-slot", slot, NULL);
-
- g_object_unref (slot);
return TRUE;
}
--
2.5.0

View File

@ -6,11 +6,12 @@
Summary: Framework for managing passwords and other secrets Summary: Framework for managing passwords and other secrets
Name: gnome-keyring Name: gnome-keyring
Version: 3.18.0 Version: 3.18.0
Release: 1%{?dist} Release: 2%{?dist}
License: GPLv2+ and LGPLv2+ License: GPLv2+ and LGPLv2+
Group: System Environment/Libraries Group: System Environment/Libraries
#VCS: git:git://git.gnome.org/gnome-keyring #VCS: git:git://git.gnome.org/gnome-keyring
Source: https://download.gnome.org/sources/%{name}/3.15/%{name}-%{version}.tar.xz Source: https://download.gnome.org/sources/%{name}/3.15/%{name}-%{version}.tar.xz
Patch0: 0001-dbus-Initialize-secret-service-before-claiming-name.patch
URL: https://wiki.gnome.org/Projects/GnomeKeyring URL: https://wiki.gnome.org/Projects/GnomeKeyring
BuildRequires: pkgconfig(dbus-1) >= %{dbus_version} BuildRequires: pkgconfig(dbus-1) >= %{dbus_version}
@ -51,6 +52,7 @@ automatically unlock the "login" keyring when the user logs in.
%prep %prep
%setup -q -n gnome-keyring-%{version} %setup -q -n gnome-keyring-%{version}
%patch0 -p1
%build %build
%configure \ %configure \
@ -107,6 +109,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas >&/dev/null || :
%changelog %changelog
* Wed Oct 14 2015 Kalev Lember <klember@redhat.com> - 3.18.0-2
- dbus: Initialize secret service before claiming name
* Mon Sep 28 2015 Kalev Lember <klember@redhat.com> - 3.18.0-1 * Mon Sep 28 2015 Kalev Lember <klember@redhat.com> - 3.18.0-1
- Update to 3.18.0 - Update to 3.18.0