Make find_path() a little more generic by not checking def_foo

variables inside it.  Instead, pass in ignore_dot as a function
argument.
This commit is contained in:
Todd C. Miller
2010-05-13 10:27:03 -04:00
parent 832ce341e4
commit d5bfd148d6
4 changed files with 13 additions and 10 deletions

View File

@@ -53,7 +53,8 @@
* but it is in '.' and IGNORE_DOT is set.
*/
int
find_path(char *infile, char **outfile, struct stat *sbp, char *path)
find_path(char *infile, char **outfile, struct stat *sbp, char *path,
int ignore_dot)
{
static char command[PATH_MAX]; /* qualified filename */
char *n; /* for traversing path */
@@ -78,10 +79,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path)
return(NOT_FOUND);
}
/* Use PATH passed in unless SECURE_PATH is in effect. */
if (def_secure_path && !user_is_exempt())
path = def_secure_path;
else if (path == NULL)
if (path == NULL)
return(NOT_FOUND);
path = estrdup(path);
origpath = path;
@@ -122,7 +120,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path)
if (len <= 0 || len >= sizeof(command))
errorx(1, "%s: File name too long", infile);
result = sudo_goodpath(command, sbp);
if (result && def_ignore_dot)
if (result && ignore_dot)
return(NOT_FOUND_DOT);
}