[gdm/wip/slave-connection: 31/38] worker: propagate 'is local' to session worker



commit 5d42ddbd77d72d5e95cf5898185ed328a944c922
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jul 9 21:33:10 2012 -0400

    worker: propagate 'is local' to session worker
    
    It's needed by ConsoleKit and it will be needed for
    starting reauthentication sessions.

 daemon/gdm-session-worker.c |   21 ++++++++++-----------
 daemon/gdm-session.c        |    7 +++++--
 daemon/gdm-session.xml      |    3 +++
 3 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 2bf79c9..45c24c9 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -133,6 +133,7 @@ struct GdmSessionWorkerPrivate
         guint32           cancelled : 1;
         guint32           timed_out : 1;
         guint32           is_program_session : 1;
+        guint32           display_is_local : 1;
         guint             state_change_idle_id;
 
         char                 *server_address;
@@ -193,7 +194,6 @@ open_ck_session (GdmSessionWorker  *worker)
         const char       *display_hostname;
         const char       *session_type;
         gint32            uid;
-        gboolean          is_local;
 
         g_assert (worker->priv->session_cookie == NULL);
 
@@ -221,15 +221,6 @@ open_ck_session (GdmSessionWorker  *worker)
 
         g_assert (worker->priv->username != NULL);
 
-        /* FIXME: this isn't very good */
-        if (display_hostname == NULL
-            || display_hostname[0] == '\0'
-            || strcmp (display_hostname, "localhost") == 0) {
-                is_local = TRUE;
-        } else {
-                is_local = FALSE;
-        }
-
         gdm_get_pwent_for_name (worker->priv->username, &pwent);
         if (pwent == NULL) {
                 goto out;
@@ -253,7 +244,7 @@ open_ck_session (GdmSessionWorker  *worker)
         g_variant_builder_add_parsed (&builder, "('display-device', <%s>)", display_device);
         g_variant_builder_add_parsed (&builder, "('x11-display', <%s>)", display_name);
         g_variant_builder_add_parsed (&builder, "('remote-host-name', <%s>)", display_hostname);
-        g_variant_builder_add_parsed (&builder, "('is-local', <%b>)", is_local);
+        g_variant_builder_add_parsed (&builder, "('is-local', <%b>)", worker->priv->display_is_local);
         g_variant_builder_add_parsed (&builder, "('session-type', <%s>)", session_type);
 
         parameters = g_variant_builder_end (&builder);
@@ -986,6 +977,7 @@ gdm_session_worker_initialize_pam (GdmSessionWorker *worker,
                                    const char       *service,
                                    const char       *username,
                                    const char       *hostname,
+                                   gboolean          display_is_local,
                                    const char       *x11_display_name,
                                    const char       *x11_authority_file,
                                    const char       *display_device,
@@ -2045,6 +2037,7 @@ do_setup (GdmSessionWorker *worker)
                                                  worker->priv->service,
                                                  worker->priv->username,
                                                  worker->priv->hostname,
+                                                 worker->priv->display_is_local,
                                                  worker->priv->x11_display_name,
                                                  worker->priv->x11_authority_file,
                                                  worker->priv->display_device,
@@ -2422,6 +2415,7 @@ on_setup (GdmDBusWorkerManager *proxy,
           const char           *console,
           const char           *seat_id,
           const char           *hostname,
+          gboolean              display_is_local,
           GdmSessionWorker     *worker)
 {
         if (worker->priv->state != GDM_SESSION_WORKER_STATE_NONE) {
@@ -2435,6 +2429,7 @@ on_setup (GdmDBusWorkerManager *proxy,
         worker->priv->display_device = g_strdup (console);
         worker->priv->display_seat_id = g_strdup (seat_id);
         worker->priv->hostname = g_strdup (hostname);
+        worker->priv->display_is_local = display_is_local;
         worker->priv->username = NULL;
 
         g_debug ("GdmSessionWorker: queuing setup: %s %s", service, console);
@@ -2450,6 +2445,7 @@ on_setup_for_user (GdmDBusWorkerManager *proxy,
                    const char           *console,
                    const char           *seat_id,
                    const char           *hostname,
+                   gboolean              display_is_local,
                    GdmSessionWorker     *worker)
 {
         if (worker->priv->state != GDM_SESSION_WORKER_STATE_NONE) {
@@ -2463,6 +2459,7 @@ on_setup_for_user (GdmDBusWorkerManager *proxy,
         worker->priv->display_device = g_strdup (console);
         worker->priv->display_seat_id = g_strdup (seat_id);
         worker->priv->hostname = g_strdup (hostname);
+        worker->priv->display_is_local = display_is_local;
         worker->priv->username = g_strdup (username);
 
         g_signal_connect_swapped (worker->priv->user_settings,
@@ -2496,6 +2493,7 @@ on_setup_for_program (GdmDBusWorkerManager *proxy,
                       const char           *console,
                       const char           *seat_id,
                       const char           *hostname,
+                      gboolean              display_is_local,
                       const char           *log_file,
                       GdmSessionWorker     *worker)
 {
@@ -2510,6 +2508,7 @@ on_setup_for_program (GdmDBusWorkerManager *proxy,
         worker->priv->display_device = g_strdup (console);
         worker->priv->display_seat_id = g_strdup (seat_id);
         worker->priv->hostname = g_strdup (hostname);
+        worker->priv->display_is_local = display_is_local;
         worker->priv->username = g_strdup (GDM_USERNAME);
         worker->priv->log_file = g_strdup (log_file);
         worker->priv->is_program_session = TRUE;
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 2fb507a..6b69530 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -1988,7 +1988,8 @@ send_setup (GdmSession *self,
                                                     display_x11_authority_file,
                                                     display_device,
                                                     display_seat_id,
-                                                    display_hostname);
+                                                    display_hostname,
+                                                    self->priv->display_is_local);
         }
 }
 
@@ -2049,7 +2050,8 @@ send_setup_for_user (GdmSession *self,
                                                              display_x11_authority_file,
                                                              display_device,
                                                              display_seat_id,
-                                                             display_hostname);
+                                                             display_hostname,
+                                                             self->priv->display_is_local);
         }
 }
 
@@ -2104,6 +2106,7 @@ send_setup_for_program (GdmSession *self,
                                                                 display_device,
                                                                 display_seat_id,
                                                                 display_hostname,
+                                                                self->priv->display_is_local,
                                                                 log_file);
         }
 }
diff --git a/daemon/gdm-session.xml b/daemon/gdm-session.xml
index bfa8297..2ef1ff8 100644
--- a/daemon/gdm-session.xml
+++ b/daemon/gdm-session.xml
@@ -106,6 +106,7 @@
       <arg name="display_device" type="s"/>
       <arg name="display_seat" type="s"/>
       <arg name="hostname" type="s"/>
+      <arg name="display_is_local" type="b"/>
     </signal>
     <signal name="SetupForUser">
       <arg name="service_name" type="s"/>
@@ -115,6 +116,7 @@
       <arg name="display_device" type="s"/>
       <arg name="display_seat" type="s"/>
       <arg name="hostname" type="s"/>
+      <arg name="display_is_local" type="b"/>
     </signal>
     <signal name="SetupForProgram">
       <arg name="service_name" type="s"/>
@@ -123,6 +125,7 @@
       <arg name="display_device" type="s"/>
       <arg name="display_seat" type="s"/>
       <arg name="hostname" type="s"/>
+      <arg name="display_is_local" type="b"/>
       <arg name="log_file" type="s"/>
     </signal>
     <signal name="Authenticate">



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