[gdm] slave: Pass session id to unlocking code if we know it



commit 74e4b08cbc5a1404dc26190b3947082ea36b3115
Author: Ray Strode <rstrode redhat com>
Date:   Fri Nov 1 15:27:14 2013 -0400

    slave: Pass session id to unlocking code if we know it
    
    We currently figure out which session to unlock on-the-fly based on
    the username that was just reauthenticated.  This doesn't work, for
    XDMCP sessions, under logind, since they don't have a seat. There's
    no reason to try to deduce the session, though.  We already know it,
    so we might as well pass it down.
    
    This fixes unlocking for XDMCP.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690926

 daemon/gdm-simple-slave.c |    5 ++++-
 daemon/gdm-slave.c        |   13 +++++++++----
 daemon/gdm-slave.h        |    1 +
 3 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index 35951c7..1fe58bc 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -437,15 +437,18 @@ switch_to_and_unlock_session (GdmSimpleSlave  *slave,
                               gboolean         fail_if_already_switched)
 {
         char    *username;
+        char    *session_id;
         gboolean res;
 
         username = gdm_session_get_username (slave->priv->session);
+        session_id = gdm_session_get_session_id (slave->priv->session);
 
         g_debug ("GdmSimpleSlave: trying to switch to session for user %s", username);
 
         /* try to switch to an existing session */
-        res = gdm_slave_switch_to_user_session (GDM_SLAVE (slave), username, fail_if_already_switched);
+        res = gdm_slave_switch_to_user_session (GDM_SLAVE (slave), username, session_id, 
fail_if_already_switched);
         g_free (username);
+        g_free (session_id);
 
         return res;
 }
diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c
index 128a800..851f1ef 100644
--- a/daemon/gdm-slave.c
+++ b/daemon/gdm-slave.c
@@ -1639,6 +1639,7 @@ session_unlock (GdmSlave   *slave,
 gboolean
 gdm_slave_switch_to_user_session (GdmSlave   *slave,
                                   const char *username,
+                                  const char *session_id,
                                   gboolean    fail_if_already_switched)
 {
         gboolean    res;
@@ -1648,10 +1649,14 @@ gdm_slave_switch_to_user_session (GdmSlave   *slave,
 
         ret = FALSE;
 
-        ssid_to_activate = gdm_slave_get_primary_session_id_for_user (slave, username);
-        if (ssid_to_activate == NULL) {
-                g_debug ("GdmSlave: unable to determine session to activate");
-                goto out;
+        if (session_id != NULL) {
+                ssid_to_activate = g_strdup (session_id);
+        } else {
+                ssid_to_activate = gdm_slave_get_primary_session_id_for_user (slave, username);
+                if (ssid_to_activate == NULL) {
+                        g_debug ("GdmSlave: unable to determine session to activate");
+                        goto out;
+                }
         }
 
         session_already_switched = session_is_active (slave, slave->priv->display_seat_id, ssid_to_activate);
diff --git a/daemon/gdm-slave.h b/daemon/gdm-slave.h
index 902de21..9808433 100644
--- a/daemon/gdm-slave.h
+++ b/daemon/gdm-slave.h
@@ -100,6 +100,7 @@ gboolean            gdm_slave_add_user_authorization (GdmSlave   *slave,
 
 gboolean            gdm_slave_switch_to_user_session (GdmSlave   *slave,
                                                       const char *username,
+                                                      const char *session_id,
                                                       gboolean    fail_if_already_switched);
 
 gboolean            gdm_slave_connect_to_x11_display (GdmSlave   *slave);


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