[gnome-keyring] dbus: Initialize secret service before claiming name
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring] dbus: Initialize secret service before claiming name
- Date: Wed, 7 Oct 2015 17:10:39 +0000 (UTC)
commit 3cf744f67939dc23c2cc8715cda999a7ec13f1b6
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date: Tue Oct 6 21:12:49 2015 +0200
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 files 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]