* NEWS, src/su.c: Preserve the DISPLAY and XAUTHORITY environment

variables, even with --login. This was not the case before in the
	PAM version.
This commit is contained in:
nekral-guest
2009-06-05 22:19:38 +00:00
parent d6f18c207e
commit f4f6300499
3 changed files with 13 additions and 2 deletions

View File

@ -559,7 +559,8 @@ int main (int argc, char **argv)
* (note: in the case of a subsystem, the shell will be restricted,
* and this won't be executed on the first pass)
*/
if (fakelogin && change_environment) {
if (change_environment) {
if (fakelogin) {
/*
* The terminal type will be left alone if it is present in
* the environment already.
@ -595,6 +596,7 @@ int main (int argc, char **argv)
if (NULL != cp) {
addenv (cp, NULL); /* set the default $HZ, if one */
}
#endif /* !USE_PAM */
/*
* Also leave DISPLAY and XAUTHORITY if present, else
@ -608,7 +610,7 @@ int main (int argc, char **argv)
if (NULL != cp) {
addenv ("XAUTHORITY", cp);
}
#endif /* !USE_PAM */
}
} else {
while (NULL != *envp) {
addenv (*envp, NULL);