]> granicus.if.org Git - sudo/commitdiff
Only read /etc/environment on Linux and AIX
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 27 Jan 2008 21:31:27 +0000 (21:31 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 27 Jan 2008 21:31:27 +0000 (21:31 +0000)
env.c
sudo.c
sudo.pod

diff --git a/env.c b/env.c
index 13272c73a85aad2e26490060407c446e800534bd..924a3acb4a17edd11a7308c867245fec041f6a51 100644 (file)
--- 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 61a397a73cc1b40f06df43abbefa3625283775af..39f71eb4f588b1fcec788528d1c47295361aec81 100644 (file)
--- 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))
index 1ed93d46be7a7dbac126a9f0950ea5caf9411548..d249d87c247957e3af2ef92e5097fef67e87fb79 100644 (file)
--- a/sudo.pod
+++ b/sudo.pod
@@ -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
 environment, leaving I<DISPLAY> and I<TERM> unchanged, setting
 I<HOME>, I<SHELL>, I<USER>, I<LOGNAME>, and I<PATH>, as well as
-the contents of F</etc/environment>.  All other environment variables
-are removed.
+the contents of F</etc/environment> 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 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