aboutsummaryrefslogtreecommitdiff
path: root/x11/xdm/files/patch-xdm_session.c
blob: 9ac29aa7c1e33f9610b25e3fbec38df45003d05c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- xdm/session.c.orig	2011-09-25 07:35:47 UTC
+++ xdm/session.c
@@ -575,6 +575,7 @@ StartClient (
     pid_t	pid;
 #ifdef HAVE_SETUSERCONTEXT
     struct passwd* pwd;
+    extern char **environ;
 #endif
 #ifdef USE_PAM
     pam_handle_t *pamh = thepamh ();
@@ -695,6 +696,8 @@ StartClient (
 	 * Set the user's credentials: uid, gid, groups,
 	 * environment variables, resource limits, and umask.
 	 */
+	/* destroy user environment before calling setusercontext */
+	environ = verify->userEnviron;
 	pwd = getpwnam(name);
 	if (pwd) {
 	    if (setusercontext(NULL, pwd, pwd->pw_uid, LOGIN_SETALL) < 0) {
@@ -702,6 +705,7 @@ StartClient (
 			  name, _SysErrorMsg (errno));
 		return (0);
 	    }
+	    verify->userEnviron = environ;
 	    endpwent();
 	} else {
 	    LogError ("getpwnam for \"%s\" failed: %s\n",