diff --git a/ChangeLog b/ChangeLog index 32ddf0b4..615ea537 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-06-06 Nicolas François + + * src/su.c, man/su.1.xml: The default behavior (without -p or + --login) is to copy most of the environment variables. Revert a + previous change and update the documentation. + 2009-06-06 Nicolas François * man/passwd.5.xml, man/shadow.5.xml: Document the passwd- and diff --git a/man/su.1.xml b/man/su.1.xml index 41bfe2df..d965705f 100644 --- a/man/su.1.xml +++ b/man/su.1.xml @@ -247,13 +247,20 @@ + + + If is not used, the + environment is copied, except for the variables above. + + + If is used, the $TERM, $COLORTERM, $DISPLAY, and $XAUTHORITY environment variables are - kept if they were set. + copied if they were set. @@ -270,13 +277,17 @@ - + - Other environment variables are deleted, but might be - set by the - file (see - below)PAM - modules. + If is used, other environment + variables might be set by the + file (see below). + + + + + + Other environment might be set by PAM modules. diff --git a/src/su.c b/src/su.c index 9f81dbed..876b4605 100644 --- a/src/su.c +++ b/src/su.c @@ -559,8 +559,7 @@ 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 (change_environment) { - if (fakelogin) { + if (change_environment && fakelogin) { /* * The terminal type will be left alone if it is present in * the environment already. @@ -610,7 +609,6 @@ int main (int argc, char **argv) if (NULL != cp) { addenv ("XAUTHORITY", cp); } - } } else { while (NULL != *envp) { addenv (*envp, NULL);