aboutsummaryrefslogtreecommitdiffstats
path: root/x11/xdm/files/patch-xdm_session.c
blob: de1c579b4f8bec5a1eeac3b3a3d3aae45592e923 (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  Sun Jun  3 22:49:51 2007
+++ xdm/session.c   Sun Jun  3 22:56:06 2007
@@ -543,6 +543,7 @@
     pid_t  pid;
 #ifdef HAS_SETUSERCONTEXT
     struct passwd* pwd;
+    extern char **environ;
 #endif
 #ifdef USE_PAM
     pam_handle_t *pamh = thepamh ();
@@ -657,6 +660,8 @@
     * 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) {
@@ -664,6 +669,7 @@
            errno);
        return (0);
        }
+       verify->userEnviron = environ;
        endpwent();
    } else {
        LogError ("getpwnam for \"%s\" failed, errno=%d\n", name, errno);