1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-01 10:59:55 +00:00
freebsd-ports/x11/xdm/files/patch-xdm_session.c
Kurt Jaeger 9c9536deee x11/xdm: Use MIT-MAGIC-COOKIE-1 by default
- It is more useful that way
- pet portlint for the patches

PR:		211624
MFH:		2016Q3
Submitted by:	Tobias Kortkamp <t@tobik.me>
2016-08-26 13:57:13 +00:00

28 lines
818 B
C

--- 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",