2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 22:35:10 +00:00

Only read /etc/environment on Linux and AIX

This commit is contained in:
Todd C. Miller
2008-01-27 21:31:27 +00:00
parent f0dc1caa45
commit 801860b298
3 changed files with 7 additions and 3 deletions

2
env.c
View File

@@ -737,6 +737,7 @@ validate_env_vars(env_vars)
} }
} }
#if defined(__linux__) || defined(_AIX)
/* /*
* Read in /etc/environment ala AIX and Linux. * Read in /etc/environment ala AIX and Linux.
* Lines are in the form of NAME=VALUE * Lines are in the form of NAME=VALUE
@@ -770,6 +771,7 @@ read_env_file(path)
} }
fclose(fp); fclose(fp);
} }
#endif /* __linux__ || _AIX */
void void
init_envtables() init_envtables()

2
sudo.c
View File

@@ -462,8 +462,10 @@ main(argc, argv, envp)
if (chdir(runas_pw->pw_dir) == -1) if (chdir(runas_pw->pw_dir) == -1)
warning("unable to change directory to %s", runas_pw->pw_dir); warning("unable to change directory to %s", runas_pw->pw_dir);
#if defined(__linux__) || defined(_AIX)
/* Insert system-wide environment variables. */ /* Insert system-wide environment variables. */
read_env_file(_PATH_ENVIRONMENT); read_env_file(_PATH_ENVIRONMENT);
#endif
} }
if (ISSET(sudo_mode, MODE_EDIT)) if (ISSET(sudo_mode, MODE_EDIT))

View File

@@ -209,8 +209,8 @@ shell is executed. B<sudo> attempts to change to that user's home
directory before running the shell. It also initializes the directory before running the shell. It also initializes the
environment, leaving I<DISPLAY> and I<TERM> unchanged, setting environment, leaving I<DISPLAY> and I<TERM> unchanged, setting
I<HOME>, I<SHELL>, I<USER>, I<LOGNAME>, and I<PATH>, as well as I<HOME>, I<SHELL>, I<USER>, I<LOGNAME>, and I<PATH>, as well as
the contents of F</etc/environment>. All other environment variables the contents of F</etc/environment> on Linux and AIX systems.
are removed. All other environment variables are removed.
=item -K =item -K
@@ -506,7 +506,7 @@ Default editor to use in B<-e> (sudoedit) mode
=item F<@timedir@>C< >Directory containing timestamps =item F<@timedir@>C< >Directory containing timestamps
=item F</etc/environment>C< >Initial environment for B<-i> mode =item F</etc/environment>C< >Initial environment for B<-i> mode on Linux and AIX
=back =back