Index: configure.in
===================================================================
--- configure.in	(revision 4516)
+++ configure.in	(working copy)
@@ -56,7 +56,7 @@
 LIBGNOMEUI_REQUIRED=2.2.0
 GTK_REQUIRED=2.11.1
 DBUS_GLIB_REQUIRED=0.35
-GNOME_KEYRING_REQUIRED=0.5.1
+GNOME_KEYRING_REQUIRED=2.21.92
 
 dnl pkg-config dependency checks
 
Index: gnome-session/gsm-keyring.c
===================================================================
--- gnome-session/gsm-keyring.c	(revision 4516)
+++ gnome-session/gsm-keyring.c	(working copy)
@@ -53,10 +53,10 @@
 {
   GError *err;
   char *standard_out;
-  char **lines;
+  char **lines, **l;
   int status;
   long pid;
-  char *pid_str, *end;
+  char *t, *end;
   const char *old_keyring;
   const char *display;
   char *argv[2];
@@ -66,10 +66,7 @@
   if (old_keyring != NULL &&
       access (old_keyring, R_OK | W_OK) == 0)
     {
-      display = g_getenv ("DISPLAY");
-      if (display != NULL)
-        gnome_keyring_daemon_set_display_sync (display); 
-
+      gnome_keyring_daemon_prepare_environment_sync ();
       return;
     }  
 
@@ -100,23 +97,29 @@
 	  WEXITSTATUS (status) == 0 &&
 	  standard_out != NULL)
         {
-	  lines = g_strsplit (standard_out, "\n", 3);
+	  lines = g_strsplit (standard_out, "\n", 0);
+	  for (l = lines; *l; ++l)
+	    {
+	      /* Split the line into name=value */
+	      t = strchr (*l, '=');
+	      if (!t)
+		continue;
+	      *(t++) = 0;
 
-	  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)
+	      /* Everything that comes out should be an env var */
+	      if (g_str_equal (*l, "GNOME_KEYRING_SOCKET"))
+		g_setenv (*l, t, TRUE);
+
+	      /* Track the daemon's PID */
+	      if (g_str_equal (*l, "GNOME_KEYRING_PID")) 
 		{
-		  gnome_keyring_daemon_pid = pid;
-		  g_setenv ("GNOME_KEYRING_SOCKET",
-			    lines[0] + strlen ("GNOME_KEYRING_SOCKET="), TRUE);
+		  pid = strtol (t, &end, 10);
+		  if (end != t)
+		      gnome_keyring_daemon_pid = pid;
 		}
 	    }
-
 	  g_strfreev (lines);
+	  gnome_keyring_daemon_prepare_environment_sync ();
         }
       else
 	{
