gnome-keyring/0001-dbus-Initialize-secret-service-before-claiming-name.patch

57 lines
1.8 KiB
Diff

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