Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 May 2007 09:37:43 +0200 (CEST)
From:      tmseck-lists@netcologne.de (Thomas-Martin Seck)
To:        Szalai Andras <szalai.andras@t-online.hu>
Cc:        freebsd-x11@freebsd.org
Subject:   Re: Xorg 7.2 XDM ignores environment settings
Message-ID:  <200705300737.l4U7bhnh035493@hardy.tmseck.homedns.org>
In-Reply-To: <20070522091713.GB81200@tristania.kispest.home>

next in thread | previous in thread | raw e-mail | index | archive | help
* Szalai Andras <szalai.andras@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705300737.l4U7bhnh035493>