[gdm/for-gnome-40: 13/14] worker: don't load user settings for program sessions




commit 015d76411a94b44f42111d32591ef5a4e7fcdf01
Author: Ray Strode <rstrode redhat com>
Date:   Wed Aug 15 10:48:16 2018 -0400

    worker: don't load user settings for program sessions
    
    We don't need or want the login greeter to access accountsservice
    for its session name

 daemon/gdm-session-worker.c | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index facd05f40..6e307ac60 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -427,6 +427,12 @@ static void
 attempt_to_load_user_settings (GdmSessionWorker *worker,
                                const char       *username)
 {
+        if (worker->priv->user_settings == NULL)
+                return;
+
+        if (gdm_session_settings_is_loaded (worker->priv->user_settings))
+                return;
+
         g_debug ("GdmSessionWorker: attempting to load user settings");
         gdm_session_settings_load (worker->priv->user_settings,
                                    username);
@@ -468,8 +474,7 @@ gdm_session_worker_update_username (GdmSessionWorker *worker)
                  * to keep trying to read settings)
                  */
                 if (worker->priv->username != NULL &&
-                    worker->priv->username[0] != '\0' &&
-                    !gdm_session_settings_is_loaded (worker->priv->user_settings)) {
+                    worker->priv->username[0] != '\0') {
                         attempt_to_load_user_settings (worker, worker->priv->username);
                 }
         }
@@ -2519,8 +2524,9 @@ gdm_session_worker_handle_set_session_name (GdmDBusWorker         *object,
 {
         GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
         g_debug ("GdmSessionWorker: session name set to %s", session_name);
-        gdm_session_settings_set_session_name (worker->priv->user_settings,
-                                               session_name);
+        if (worker->priv->user_settings != NULL)
+                gdm_session_settings_set_session_name (worker->priv->user_settings,
+                                                       session_name);
         gdm_dbus_worker_complete_set_session_name (object, invocation);
         return TRUE;
 }
@@ -2544,8 +2550,9 @@ gdm_session_worker_handle_set_language_name (GdmDBusWorker         *object,
 {
         GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
         g_debug ("GdmSessionWorker: language name set to %s", language_name);
-        gdm_session_settings_set_language_name (worker->priv->user_settings,
-                                                language_name);
+        if (worker->priv->user_settings != NULL)
+                gdm_session_settings_set_language_name (worker->priv->user_settings,
+                                                        language_name);
         gdm_dbus_worker_complete_set_language_name (object, invocation);
         return TRUE;
 }
@@ -2677,10 +2684,13 @@ save_account_details_now (GdmSessionWorker *worker)
         g_assert (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCREDITED);
 
         g_debug ("GdmSessionWorker: saving account details for user %s", worker->priv->username);
+
         gdm_session_worker_set_state (worker, GDM_SESSION_WORKER_STATE_ACCOUNT_DETAILS_SAVED);
-        if (!gdm_session_settings_save (worker->priv->user_settings,
-                                        worker->priv->username)) {
-                g_warning ("could not save session and language settings");
+        if (worker->priv->user_settings != NULL) {
+                if (!gdm_session_settings_save (worker->priv->user_settings,
+                                                worker->priv->username)) {
+                        g_warning ("could not save session and language settings");
+                }
         }
         queue_state_change (worker);
 }
@@ -2726,7 +2736,7 @@ do_save_account_details_when_ready (GdmSessionWorker *worker)
 {
         g_assert (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCREDITED);
 
-        if (!gdm_session_settings_is_loaded (worker->priv->user_settings)) {
+        if (worker->priv->user_settings != NULL && !gdm_session_settings_is_loaded 
(worker->priv->user_settings)) {
                 g_signal_connect (G_OBJECT (worker->priv->user_settings),
                                   "notify::is-loaded",
                                   G_CALLBACK (on_settings_is_loaded_changed),
@@ -3024,6 +3034,8 @@ gdm_session_worker_handle_initialize (GdmDBusWorker         *object,
         worker->priv->pending_invocation = invocation;
 
         if (!worker->priv->is_program_session) {
+                worker->priv->user_settings = gdm_session_settings_new ();
+
                 g_signal_connect_swapped (worker->priv->user_settings,
                                           "notify::language-name",
                                           G_CALLBACK (on_saved_language_name_read),
@@ -3079,6 +3091,8 @@ gdm_session_worker_handle_setup (GdmDBusWorker         *object,
         worker->priv->display_is_initial = display_is_initial;
         worker->priv->username = NULL;
 
+        worker->priv->user_settings = gdm_session_settings_new ();
+
         g_signal_connect_swapped (worker->priv->user_settings,
                                   "notify::language-name",
                                   G_CALLBACK (on_saved_language_name_read),
@@ -3119,6 +3133,8 @@ gdm_session_worker_handle_setup_for_user (GdmDBusWorker         *object,
         worker->priv->display_is_initial = display_is_initial;
         worker->priv->username = g_strdup (username);
 
+        worker->priv->user_settings = gdm_session_settings_new ();
+
         g_signal_connect_swapped (worker->priv->user_settings,
                                   "notify::language-name",
                                   G_CALLBACK (on_saved_language_name_read),
@@ -3510,7 +3526,6 @@ gdm_session_worker_init (GdmSessionWorker *worker)
 {
         worker->priv = GDM_SESSION_WORKER_GET_PRIVATE (worker);
 
-        worker->priv->user_settings = gdm_session_settings_new ();
         worker->priv->reauthentication_requests = g_hash_table_new_full (NULL,
                                                                          NULL,
                                                                          NULL,


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