From 801860b298d682467a5085936a1081498e1b68a6 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 27 Jan 2008 21:31:27 +0000 Subject: [PATCH] Only read /etc/environment on Linux and AIX --- env.c | 2 ++ sudo.c | 2 ++ sudo.pod | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/env.c b/env.c index 13272c73a..924a3acb4 100644 --- a/env.c +++ b/env.c @@ -737,6 +737,7 @@ validate_env_vars(env_vars) } } +#if defined(__linux__) || defined(_AIX) /* * Read in /etc/environment ala AIX and Linux. * Lines are in the form of NAME=VALUE @@ -770,6 +771,7 @@ read_env_file(path) } fclose(fp); } +#endif /* __linux__ || _AIX */ void init_envtables() diff --git a/sudo.c b/sudo.c index 61a397a73..39f71eb4f 100644 --- a/sudo.c +++ b/sudo.c @@ -462,8 +462,10 @@ main(argc, argv, envp) if (chdir(runas_pw->pw_dir) == -1) warning("unable to change directory to %s", runas_pw->pw_dir); +#if defined(__linux__) || defined(_AIX) /* Insert system-wide environment variables. */ read_env_file(_PATH_ENVIRONMENT); +#endif } if (ISSET(sudo_mode, MODE_EDIT)) diff --git a/sudo.pod b/sudo.pod index 1ed93d46b..d249d87c2 100644 --- a/sudo.pod +++ b/sudo.pod @@ -209,8 +209,8 @@ shell is executed. B attempts to change to that user's home directory before running the shell. It also initializes the environment, leaving I and I unchanged, setting I, I, I, I, and I, as well as -the contents of F. All other environment variables -are removed. +the contents of F on Linux and AIX systems. +All other environment variables are removed. =item -K @@ -506,7 +506,7 @@ Default editor to use in B<-e> (sudoedit) mode =item F<@timedir@>C< >Directory containing timestamps -=item FC< >Initial environment for B<-i> mode +=item FC< >Initial environment for B<-i> mode on Linux and AIX =back -- 2.40.0