[gnome-keyring] dbus: Expose the 'session' and 'login' keyrings as aliases



commit 398c356dbacb071bef5f91c5d1ed16d9083ecfb1
Author: Stef Walter <stefw gnome org>
Date:   Wed Jun 27 16:30:16 2012 +0200

    dbus: Expose the 'session' and 'login' keyrings as aliases
    
     * The Secret Service API supports the concept of aliases, so
       expose the 'session' and 'login' keyrings as aliases, so
       that callers can identify which keyrings have those special
       behaviors.

 daemon/dbus/gkd-secret-service.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/daemon/dbus/gkd-secret-service.c b/daemon/dbus/gkd-secret-service.c
index 4aa166e..6beb3cb 100644
--- a/daemon/dbus/gkd-secret-service.c
+++ b/daemon/dbus/gkd-secret-service.c
@@ -1439,17 +1439,31 @@ gkd_secret_service_get_alias (GkdSecretService *self, const gchar *alias)
 	g_return_val_if_fail (alias != NULL, NULL);
 
 	identifier =  g_hash_table_lookup (self->aliases, alias);
-	if (!identifier && g_str_equal (alias, "default")) {
-		update_default (self, TRUE);
-		identifier = g_hash_table_lookup (self->aliases, alias);
+	if (!identifier) {
+		if (g_str_equal (alias, "default")) {
+			update_default (self, TRUE);
+			identifier = g_hash_table_lookup (self->aliases, alias);
+
+			/* Default to to 'login' if no default keyring */
+			if (identifier == NULL) {
+				identifier = "login";
+				g_hash_table_replace (self->aliases, g_strdup (alias),
+				                      g_strdup (identifier));
+			}
+
+		} else if (g_str_equal (alias, "session")) {
+			identifier = "session";
+			g_hash_table_replace (self->aliases, g_strdup (alias),
+			                      g_strdup (identifier));
 
-		/* Default to to 'login' if no default keyring */
-		if (identifier == NULL) {
+		/* TODO: We should be using CKA_G_LOGIN_COLLECTION */
+		} else if (g_str_equal (alias, "login")) {
 			identifier = "login";
 			g_hash_table_replace (self->aliases, g_strdup (alias),
 			                      g_strdup (identifier));
 		}
 	}
+
 	return identifier;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]