Blame SOURCES/fix-empty-username-crash.patch

01018b
From d8a1083e983478818e2d7b139cf0ab809c10b1b4 Mon Sep 17 00:00:00 2001
01018b
From: Ray Strode <rstrode@redhat.com>
01018b
Date: Wed, 8 Jan 2014 11:46:24 -0500
01018b
Subject: [PATCH] worker: ignore '' username
01018b
01018b
Some PAM modules set a "" username to mean "user not set yet",
01018b
apparently, instead of NULL.
01018b
01018b
This commit guards against that to prevent a crash.
01018b
01018b
Red-Hat-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=965370
01018b
01018b
https://bugzilla.gnome.org/show_bug.cgi?id=721803
01018b
---
01018b
 daemon/gdm-session-worker.c | 1 +
01018b
 1 file changed, 1 insertion(+)
01018b
01018b
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
01018b
index dd58af7..ad1b077 100644
01018b
--- a/daemon/gdm-session-worker.c
01018b
+++ b/daemon/gdm-session-worker.c
01018b
@@ -628,60 +628,61 @@ gdm_session_worker_update_username (GdmSessionWorker *worker)
01018b
         username = NULL;
01018b
         res = gdm_session_worker_get_username (worker, &username);
01018b
         if (res) {
01018b
                 g_debug ("GdmSessionWorker: old-username='%s' new-username='%s'",
01018b
                          worker->priv->username != NULL ? worker->priv->username : "<unset>",
01018b
                          username != NULL ? username : "<unset>");
01018b
 
01018b
 
01018b
                 gdm_session_auditor_set_username (worker->priv->auditor, worker->priv->username);
01018b
 
01018b
                 if ((worker->priv->username == username) ||
01018b
                     ((worker->priv->username != NULL) && (username != NULL) &&
01018b
                      (strcmp (worker->priv->username, username) == 0)))
01018b
                         goto out;
01018b
 
01018b
                 g_debug ("GdmSessionWorker: setting username to '%s'", username);
01018b
 
01018b
                 g_free (worker->priv->username);
01018b
                 worker->priv->username = username;
01018b
                 username = NULL;
01018b
 
01018b
                 gdm_dbus_worker_emit_username_changed (GDM_DBUS_WORKER (worker),
01018b
                                                        worker->priv->username);
01018b
 
01018b
                 /* We have a new username to try. If we haven't been able to
01018b
                  * read user settings up until now, then give it a go now
01018b
                  * (see the comment in do_setup for rationale on why it's useful
01018b
                  * to keep trying to read settings)
01018b
                  */
01018b
                 if (worker->priv->username != NULL &&
01018b
+                    worker->priv->username[0] != '\0' &&
01018b
                     !gdm_session_settings_is_loaded (worker->priv->user_settings)) {
01018b
                         attempt_to_load_user_settings (worker, worker->priv->username);
01018b
                 }
01018b
         }
01018b
 
01018b
  out:
01018b
         g_free (username);
01018b
 }
01018b
 
01018b
 static gboolean
01018b
 gdm_session_worker_ask_question (GdmSessionWorker *worker,
01018b
                                  const char       *question,
01018b
                                  char            **answerp)
01018b
 {
01018b
         return gdm_dbus_worker_manager_call_info_query_sync (worker->priv->manager,
01018b
                                                              worker->priv->service,
01018b
                                                              question,
01018b
                                                              answerp,
01018b
                                                              NULL,
01018b
                                                              NULL);
01018b
 }
01018b
 
01018b
 static gboolean
01018b
 gdm_session_worker_ask_for_secret (GdmSessionWorker *worker,
01018b
                                    const char       *question,
01018b
                                    char            **answerp)
01018b
 {
01018b
         return gdm_dbus_worker_manager_call_secret_info_query_sync (worker->priv->manager,
01018b
                                                                     worker->priv->service,
01018b
                                                                     question,
01018b
-- 
01018b
1.8.4.2
01018b