gdm r6229 - in trunk: . daemon



Author: halfline
Date: Mon May 12 17:48:24 2008
New Revision: 6229
URL: http://svn.gnome.org/viewvc/gdm?rev=6229&view=rev

Log:
2008-05-12 Ray Strode  <rstrode redhat com>

	* daemon/gdm-session-worker.c:
	(attempt_to_load_user_settings):
	(attempt_to_load_user_settings_as_root):
	rename function and allow it to be run as non-root
	also, to work in situations where ~/.dmrc isn't
	available until after the user's uid/gid have
	been changed.


Modified:
   trunk/ChangeLog
   trunk/daemon/gdm-session-worker.c

Modified: trunk/daemon/gdm-session-worker.c
==============================================================================
--- trunk/daemon/gdm-session-worker.c	(original)
+++ trunk/daemon/gdm-session-worker.c	Mon May 12 17:48:24 2008
@@ -501,8 +501,8 @@
 }
 
 static void
-attempt_to_load_user_settings_as_root (GdmSessionWorker *worker,
-                                       const char       *username)
+attempt_to_load_user_settings (GdmSessionWorker *worker,
+                               const char       *username)
 {
         struct passwd *passwd_entry;
         uid_t          old_uid;
@@ -511,9 +511,6 @@
         old_uid = geteuid ();
         old_gid = getegid ();
 
-        g_assert (old_uid == 0);
-        g_assert (old_gid == 0);
-
         passwd_entry = getpwnam (username);
 
         /* User input isn't a valid username
@@ -522,19 +519,18 @@
                 return;
         }
 
+        /* We may get called late in the pam conversation after
+         * the user has already been authenticated.  This could
+         * happen if for instance, the user's home directory isn't
+         * available until late in the pam conversation so user
+         * settings couldn't get loaded until late in the conversation.
+         * If we get called late the seteuid/setgid calls here will fail,
+         * but that's okay, because we'll already be the uid/gid we want
+         * to be.
+         */
         setegid (passwd_entry->pw_gid);
         seteuid (passwd_entry->pw_uid);
 
-        /* FIXME: if this call fails, we should probably do some
-         * heuristics to try to figure out if .dmrc doesn't
-         * exist at all or just isn't readable yet.  If it doesn't
-         * exist at all (and won't exist by the end of the pam
-         * conversation) then we should send some sort of
-         * "NoSavedSettings" message to the slave so that it can
-         * tell the greeter to use specific default settings
-         * instead of the place holder "Last Session" "Last
-         * Language" items in the combo boxes in the panel
-         */
         gdm_session_settings_load (worker->priv->user_settings,
                                    passwd_entry->pw_dir,
                                    NULL);
@@ -566,7 +562,7 @@
                  */
                 if (username != NULL &&
                     !gdm_session_settings_is_loaded (worker->priv->user_settings)) {
-                        attempt_to_load_user_settings_as_root (worker, username);
+                        attempt_to_load_user_settings (worker, username);
                 }
 
                 if ((worker->priv->username == username) ||
@@ -1915,8 +1911,8 @@
          * We'll try now, and if it doesn't work out, try later.
          */
         if (worker->priv->username != NULL) {
-                attempt_to_load_user_settings_as_root (worker,
-                                                       worker->priv->username);
+                attempt_to_load_user_settings (worker,
+                                               worker->priv->username);
         }
 
         error = NULL;



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