Preserve DISPLAY environment variable by default.

This commit is contained in:
Todd C. Miller
2005-06-25 21:46:16 +00:00
parent 485fa9b662
commit 8f90cfbd89
3 changed files with 11 additions and 9 deletions

1
env.c
View File

@@ -160,6 +160,7 @@ static const char *initial_checkenv_table[] = {
*/ */
static const char *initial_keepenv_table[] = { static const char *initial_keepenv_table[] = {
"KRB5CCNAME", "KRB5CCNAME",
"DISPLAY",
"PATH", "PATH",
"TERM", "TERM",
"TZ", "TZ",

View File

@@ -185,8 +185,8 @@ in the L<passwd(@mansectform@)> entry of the user that the command is
being run as. The command name argument given to the shell begins being run as. The command name argument given to the shell begins
with a `C<->' to tell the shell to run as a login shell. B<sudo> with a `C<->' to tell the shell to run as a login shell. B<sudo>
attempts to change to that user's home directory before running the attempts to change to that user's home directory before running the
shell. It also initializes the environment, leaving I<TERM> shell. It also initializes the environment, leaving I<DISPLAY>
unchanged, setting I<HOME>, I<SHELL>, I<USER>, I<LOGNAME>, and and I<TERM> unchanged, setting I<HOME>, I<SHELL>, I<USER>, I<LOGNAME>, and
I<PATH>, and unsetting all other environment variables. I<PATH>, and unsetting all other environment variables.
=item -K =item -K

View File

@@ -437,13 +437,14 @@ function.
=item env_reset =item env_reset
If set, B<sudo> will reset the environment to only contain the If set, B<sudo> will reset the environment to only contain the
following variables: C<HOME>, C<LOGNAME>, C<PATH>, C<SHELL>, C<TERM>, following variables: C<DISPLAY>, C<HOME>, C<LOGNAME>, C<PATH>,
C<TZ> and C<USER> (in addition to the C<SUDO_*> variables). C<SHELL>, C<TERM>, C<TZ> and C<USER> (in addition to the C<SUDO_*>
Of these, only C<PATH>, C<TZ> and C<TERM> are copied unaltered from the old variables). Of these, only C<DISPLAY>, C<PATH>, C<TZ> and C<TERM>
environment. The other variables are set to default values (possibly are copied unaltered from the old environment. The other variables
modified by the value of the I<set_logname> option). If the I<secure_path> are set to default values (possibly modified by the value of the
option is set, its value will be used for the C<PATH> environment variable. I<set_logname> option). If the I<secure_path> option is set, its
Other variables may be preserved via the I<env_keep> option. value will be used for the C<PATH> environment variable. Other
variables may be preserved via the I<env_keep> option.
This flag is I<on> by default. This flag is I<on> by default.
=item use_loginclass =item use_loginclass