Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gdm2/ChangeLog,v
retrieving revision 1.1134
diff -u -u -r1.1134 ChangeLog
--- ChangeLog	15 Jun 2005 12:42:22 -0000	1.1134
+++ ChangeLog	17 Jun 2005 10:49:37 -0000
@@ -1,3 +1,10 @@
+2005-06-17  Julio M. Merino Vidal <jmmv84@gmail.com>
+
+	* daemon/slave.c: Make sure a setegid/seteuid couple of calls is only
+	  executed when needed (i.e., after we previously raised privileges).
+	  Otherwise, there are several subsequent calls to these functions
+	  which result in errors at least under NetBSD.
+
 2005-06-15  Brian Cameron  <brian.cameron@sun.com>
 
 	* gui/gdmXnestchooser.c, gui/gdmcomm.c, 
Index: daemon/slave.c
===================================================================
RCS file: /cvs/gnome/gdm2/daemon/slave.c,v
retrieving revision 1.286
diff -u -u -r1.286 slave.c
--- daemon/slave.c	6 May 2005 15:05:17 -0000	1.286
+++ daemon/slave.c	17 Jun 2005 10:49:39 -0000
@@ -4051,19 +4051,19 @@
 
 	    g_free (msg);
 
+	    if G_UNLIKELY (setegid (pwent->pw_gid) != 0 ||
+			   seteuid (pwent->pw_uid) != 0) {
+		    gdm_error ("Cannot set effective user/group id");
+		    gdm_verify_cleanup (d);
+		    session_started = FALSE;
+		    return;
+	    }
+
 	    home_dir_ok = FALSE;
 	    home_dir = "/";
     } else {
 	    home_dir_ok = TRUE;
 	    home_dir = pwent->pw_dir;
-    }
-
-    if G_UNLIKELY (setegid (pwent->pw_gid) != 0 ||
-		   seteuid (pwent->pw_uid) != 0) {
-	    gdm_error ("Cannot set effective user/group id");
-	    gdm_verify_cleanup (d);
-	    session_started = FALSE;
-	    return;
     }
 
     if G_LIKELY (home_dir_ok) {
