Menu

#17 sudosh adds current directory to PATH

v1.0_(example)
closed-fixed
nobody
None
5
2014-01-22
2012-01-10
No

When using "clearenvironment=yes", the current directory is being added to the path. Reason for this is the following code in src/sudosh.c:

if (!strcmp (user.to, "root"))
snprintf (user.path.str, BUFSIZ - 1,
"PATH=/sbin:/bin:/usr/sbin:/usr/bin:");
else
snprintf (user.path.str, BUFSIZ - 1,
"PATH=/usr/bin:/bin:/usr/local/bin:");

Changing this (removing ":" at the end of PATH=) to read
if (!strcmp (user.to, "root"))
snprintf (user.path.str, BUFSIZ - 1,
"PATH=/sbin:/bin:/usr/sbin:/usr/bin");
else
snprintf (user.path.str, BUFSIZ - 1,
"PATH=/usr/bin:/bin:/usr/local/bin");

seems to fix this for me

Discussion

  • Josh Grebe

    Josh Grebe - 2014-01-22

    Accepted into current build (1.0.5)

     
  • Josh Grebe

    Josh Grebe - 2014-01-22
    • status: open --> closed-fixed
    • Group: --> v1.0_(example)
     

Log in to post a comment.

MongoDB Logo MongoDB