weston-launch: Clear environment and set it up from scratch
With recent systemd[1] XDG_VTNR will leak through to pam, which ends up setting a vtnr pam argument with the wrong value. The fix is to clear XDG_VTNR first, but what we should have been doing all along is resetting the environment. Thanks to Ray Strode for helping debug this. [1] http://cgit.freedesktop.org/systemd/systemd/commit/?id=a8573ccc35a4efe8900be5d48c6c803670540c2b
This commit is contained in:
parent
cdfc4c2d45
commit
b65a207388
|
@ -556,6 +556,12 @@ main(int argc, char *argv[])
|
||||||
if (wl.pw == NULL)
|
if (wl.pw == NULL)
|
||||||
error(1, errno, "failed to get username");
|
error(1, errno, "failed to get username");
|
||||||
|
|
||||||
|
clearenv();
|
||||||
|
setenv("USER", wl.pw->pw_name, 1);
|
||||||
|
setenv("LOGNAME", wl.pw->pw_name, 1);
|
||||||
|
setenv("HOME", wl.pw->pw_dir, 1);
|
||||||
|
setenv("SHELL", wl.pw->pw_shell, 1);
|
||||||
|
|
||||||
if (!weston_launch_allowed(&wl))
|
if (!weston_launch_allowed(&wl))
|
||||||
error(1, 0, "Permission denied. You should either:\n"
|
error(1, 0, "Permission denied. You should either:\n"
|
||||||
#ifdef HAVE_SYSTEMD_LOGIN
|
#ifdef HAVE_SYSTEMD_LOGIN
|
||||||
|
@ -605,12 +611,6 @@ main(int argc, char *argv[])
|
||||||
sleep(sleep_fork);
|
sleep(sleep_fork);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_user) {
|
|
||||||
setenv("USER", wl.pw->pw_name, 1);
|
|
||||||
setenv("LOGNAME", wl.pw->pw_name, 1);
|
|
||||||
setenv("HOME", wl.pw->pw_dir, 1);
|
|
||||||
setenv("SHELL", wl.pw->pw_shell, 1);
|
|
||||||
}
|
|
||||||
env = pam_getenvlist(wl.ph);
|
env = pam_getenvlist(wl.ph);
|
||||||
if (env) {
|
if (env) {
|
||||||
for (i = 0; env[i]; ++i) {
|
for (i = 0; env[i]; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue