]> granicus.if.org Git - sudo/commitdiff
Remove "secure_path" Defaults option since it cannot work with the
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 14 Dec 2001 06:40:03 +0000 (06:40 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 14 Dec 2001 06:40:03 +0000 (06:40 +0000)
existing parser.

def_data.c
def_data.h
def_data.in
defaults.c
env.c
find_path.c
sudo.c
sudoers.pod

index 0e6383a67d75de1b4618daf17be59c0583f43f9d..6c1a4a43f8c38bf4cfcc1295206d42b3833f84df 100644 (file)
@@ -146,9 +146,6 @@ struct sudo_defs_types sudo_defs_table[] = {
     }, {
        "runas_default", T_STR,
        "Default user to run commands as: %s"
-    }, {
-       "secure_path", T_STR|T_BOOL,
-       "Value to override user's $PATH with: %s"
     }, {
        "editor", T_STR|T_PATH,
        "Path to the editor for use by visudo: %s"
index 652989456e3c9afb12b2452f0bfed161fd8feb76..89c1a30e2e5cf6138da4a8078694fd0ba815f9d9 100644 (file)
 #define I_EXEMPT_GROUP          46
 #define I_PASSPROMPT            47
 #define I_RUNAS_DEFAULT         48
-#define I_SECURE_PATH           49
-#define I_EDITOR                50
-#define I_ENV_CHECK             51
-#define I_ENV_DELETE            52
-#define I_ENV_KEEP              53
-#define I_LISTPW_I              54
-#define I_VERIFYPW_I            55
-#define I_LISTPW                56
-#define I_VERIFYPW              57
+#define I_EDITOR                49
+#define I_ENV_CHECK             50
+#define I_ENV_DELETE            51
+#define I_ENV_KEEP              52
+#define I_LISTPW_I              53
+#define I_VERIFYPW_I            54
+#define I_LISTPW                55
+#define I_VERIFYPW              56
index 2627200391447aefdab5036873e95467d9820e1a..d1f3313a84504d4439a29eb1e620aa308f355c57 100644 (file)
@@ -153,9 +153,6 @@ passprompt
 runas_default
        T_STR
        "Default user to run commands as: %s"
-secure_path
-       T_STR|T_BOOL
-       "Value to override user's $PATH with: %s"
 editor
        T_STR|T_PATH
        "Path to the editor for use by visudo: %s"
index 95fabd992949ab368f8649c927305656dfc6f31c..fdbc9d3946d8197cca2787bb60b43e11b8e8d442 100644 (file)
@@ -490,9 +490,6 @@ init_defaults()
 #endif
 #ifdef EXEMPTGROUP
     def_str(I_EXEMPT_GROUP) = estrdup(EXEMPTGROUP);
-#endif
-#ifdef SECURE_PATH
-    def_str(I_SECURE_PATH) = estrdup(SECURE_PATH);
 #endif
     def_str(I_EDITOR) = estrdup(EDITOR);
 
diff --git a/env.c b/env.c
index 865f5985b26e80e85a9e8bcc7f0e02ff653fe39c..d04e01741c7f6ba35f4dfaecda3d92f94134ccf1 100644 (file)
--- a/env.c
+++ b/env.c
@@ -366,9 +366,10 @@ rebuild_env(sudo_mode, envp)
      * Access via 'nep' is not allowed (since we must check for dupes).
      */
 
+#ifdef SECURE_PATH
     /* Replace the PATH envariable with a secure one. */
-    if (def_str(I_SECURE_PATH))
-       insert_env(newenvp, format_env("PATH", def_str(I_SECURE_PATH)));
+    insert_env(newenvp, format_env("PATH", SECURE_PATH));
+#endif
 
     /* Set $HOME for `sudo -H'.  Only valid at PERM_RUNAS. */
     if ((sudo_mode & MODE_RESET_HOME) && runas_pw->pw_dir)
index 7f89a4fa76ad310b96a5392fdf036475389e875d..9a1a6e9a6e32e4b9b7781c8aaf90bc5b28ac8567 100644 (file)
@@ -104,9 +104,11 @@ find_path(infile, outfile, path)
     }
 
     /* Use PATH passed in unless SECURE_PATH is in effect.  */
-    if (def_str(I_SECURE_PATH))
-       path = def_str(I_SECURE_PATH);
-    else if (path == NULL)
+#ifdef SECURE_PATH
+    if (!user_is_exempt())
+       path = SECURE_PATH;
+#endif /* SECURE_PATH */
+    if (path == NULL)
        return(NOT_FOUND);
     path = estrdup(path);
     origpath = path;
diff --git a/sudo.c b/sudo.c
index 2dd08a060a2849f9babd0ccb0f0548bf8eaeeda5..e73013bec5c666202663134537dee4bc14381c11 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -245,12 +245,6 @@ main(argc, argv, envp)
     /* Validate the user but don't search for pseudo-commands. */
     validated = sudoers_lookup(pwflag);
 
-    /* Exempt users aren't affected by secure paths. */
-    if (user_is_exempt() && def_str(I_SECURE_PATH)) {
-       free(def_str(I_SECURE_PATH));
-       def_str(I_SECURE_PATH) = NULL;
-    }
-
     /*
      * Look up runas user passwd struct.  If we are given a uid then
      * there may be no corresponding passwd(5) entry (which is OK).
index ee8dce997be21c62991d0768c67938584fc47d02..623e987dd1f70af69511268151c25183a5a43d10 100644 (file)
@@ -422,10 +422,14 @@ dangerous functionality when a program is run setuid.
 =item env_reset
 
 If set, B<sudo> will reset the environment to only contain the
-following variables: C<HOME>, C<SHELL>, C<LOGNAME>, and C<USER>
-(in addition to the C<SUDO_*> variables).  The C<PATH> and C<TERM>
-environment variables are preserved unaltered.  Other specific variables
-may be preserved with the i<env_keep> option.
+following variables: C<HOME>, C<LOGNAME>, C<PATH>, C<SHELL>, C<TERM>,
+and C<USER> (in addition to the C<SUDO_*> variables).
+Of these, only C<TERM> is copied unaltered from the old environment.
+The other variables are set to default values (possibly modified
+by the value of the I<set_logname> option).  If B<sudo> was compiled
+with the C<SECURE_PATH> option, its value will be used for the C<PATH>
+environment variable.
+Other variables may be preserved with the i<env_keep> option.
 
 =item use_loginclass
 
@@ -564,13 +568,6 @@ interpreting the C<@> sign.  Defaults to C<@mailto@>.
 Users in this group are exempt from password and PATH requirements.
 This is not set by default.
 
-=item secure_path
-
-Path used for every command run from B<sudo>.  If you don't trust the
-people running B<sudo> to have a sane C<PATH> environment variable you may
-want to use this.  Another use is if you want to have the "root path"
-be separate from the "user path."  This is not set by default.
-
 =item verifypw
 
 This option controls when a password will be required when a user runs