[Xfce4-commits] <xfce4-session:master> Add support for new gnome-keyring (Luca Niccoli).

Jérôme Guelfucci noreply at xfce.org
Sun Oct 24 22:08:01 CEST 2010


Updating branch refs/heads/master
         to f32cd3e21c9d557cc8fab23b7c59baff36b16a9a (commit)
       from d3eeda13da06c110e5d40601a9e7b12e7cb0913c (commit)

commit f32cd3e21c9d557cc8fab23b7c59baff36b16a9a
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sun Oct 24 22:01:47 2010 +0200

    Add support for new gnome-keyring (Luca Niccoli).
    
    This fixes bugs #5912, #5137 and #6073. Support for old gnome-keyring
    versions is dropped with this commit.

 xfce4-session/xfsm-compat-gnome.c |   52 +++++++++++++++---------------------
 1 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/xfce4-session/xfsm-compat-gnome.c b/xfce4-session/xfsm-compat-gnome.c
index 62f1452..3ed79b3 100644
--- a/xfce4-session/xfsm-compat-gnome.c
+++ b/xfce4-session/xfsm-compat-gnome.c
@@ -104,27 +104,15 @@ child_setup (gpointer user_data)
 static void
 gnome_keyring_daemon_startup (void)
 {
-  const char *old_keyring;
-
   GError *error = NULL;
   gchar  *sout;
   gchar **lines;
+  gsize   lineno;
   gint    status;
   long    pid;
   gchar  *pid_str;
   gchar  *end;
-  char *argv[2];
-
-  /* If there is already a working keyring, don't start a new daemon */
-  old_keyring = g_getenv ("GNOME_KEYRING_SOCKET");
-  if (old_keyring != NULL && access (old_keyring, R_OK | W_OK) == 0)
-    {
-#ifdef HAVE_GNOME_KEYRING
-      gnome_keyring_daemon_prepare_environment_sync ();
-#endif
-      return;
-    }
-
+  char *argv[3];
 
   /* Pipe to slave keyring lifetime to */
   if (pipe (keyring_lifetime_pipe))
@@ -135,8 +123,10 @@ gnome_keyring_daemon_startup (void)
 
   error = NULL;
   argv[0] = GNOME_KEYRING_DAEMON;
-  argv[1] = NULL;
-  g_spawn_sync (NULL, argv, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+  argv[1] = "--start";
+  argv[2] = NULL;
+  g_spawn_sync (NULL, argv, NULL,
+                G_SPAWN_SEARCH_PATH | G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
                 child_setup, NULL,
                 &sout, NULL, &status, &error);
 
@@ -154,20 +144,22 @@ gnome_keyring_daemon_startup (void)
     {
       if (WIFEXITED (status) && WEXITSTATUS (status) == 0 && sout != NULL)
         {
-          lines = g_strsplit (sout, "\n", 3);
-
-          if (lines[0] != NULL && lines[1] != NULL
-              && g_str_has_prefix (lines[1], "GNOME_KEYRING_PID="))
-          {
-            pid_str = lines[1] + strlen ("GNOME_KEYRING_PID=");
-            pid = strtol (pid_str, &end, 10);
-
-            if (end != pid_str)
-              {
-                gnome_keyring_daemon_pid = pid;
-                xfce_putenv (lines[0]);
-              }
-          }
+          lines = g_strsplit (sout, "\n", 0);
+
+          for (lineno = 0; lines[lineno] != NULL; lineno++)
+            {
+              xfce_putenv (lines[lineno]);
+
+              if (g_str_has_prefix (lines[lineno], "GNOME_KEYRING_PID="))
+                {
+                  pid_str = lines[lineno] + strlen ("GNOME_KEYRING_PID=");
+                  pid = strtol (pid_str, &end, 10);
+                  if (end != pid_str)
+                    {
+                      gnome_keyring_daemon_pid = pid;
+                    }
+                }
+            }
 
           g_strfreev (lines);
 



More information about the Xfce4-commits mailing list