Xorg 7.2 XDM ignores environment settings

Thomas-Martin Seck tmseck-lists at netcologne.de
Wed May 30 08:10:19 UTC 2007


* Szalai Andras <szalai.andras at t-online.hu> [gmane.os.freebsd.devel.x11]:

> I have encountered a problem when using XDM from Xorg 7.2:
> 
> When XDM is about to run /usr/local/lib/X11/xdm/Xsession, it doesn't
> set environment variables that are present in /etc/login.conf 
> (e.g. setenv=..., path=...).
> 
> I have discovered that XDM included with Xorg 7.2 doesn't contain a 
> patch (which is present in Xorg 6.9) which fixes the above problem:
> 
> http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/x11/xorg-clients/files/Attic/patch-xdm_session.c?rev=1.2;content-type=text%2Fplain

Thanks for finding this -- I was just wondering what I possibly screwed up
when upgrading from XFree86 to X.org 7.2. Could you open a PR -- if you
have not already done so -- so this issue does not get lost in the noise?

The updated patch I used is:

--- session.c.orig	Fri Feb  2 02:00:51 2007
+++ session.c	Wed May 30 09:15:32 2007
@@ -543,6 +543,7 @@ StartClient (
     pid_t	pid;
 #ifdef HAS_SETUSERCONTEXT
     struct passwd* pwd;
+    extern char **environ;
 #endif
 #ifdef USE_PAM
     pam_handle_t *pamh = thepamh ();
@@ -657,6 +658,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) {
@@ -664,6 +667,7 @@ StartClient (
 		    errno);
 		return (0);
 	    }
+            verify->userEnviron = environ;    
 	    endpwent();
 	} else {
 	    LogError ("getpwnam for \"%s\" failed, errno=%d\n", name, errno);


More information about the freebsd-x11 mailing list