prepare to upload
[debian/sudo] / find_path.c
index 22ff607df9562ce49c0d8d80c8b2c3638e5dd3c4..78c96eaa72ec532c7327bb85abab54bd85c806a4 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 1996, 1998-2005 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 1996, 1998-2005, 2010
+ *     Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
 #endif /* STDC_HEADERS */
 #ifdef HAVE_STRING_H
 # include <string.h>
-#else
-# ifdef HAVE_STRINGS_H
-#  include <strings.h>
-# endif
 #endif /* HAVE_STRING_H */
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif /* HAVE_STRINGS_H */
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif /* HAVE_UNISTD_H */
  * but it is in '.' and IGNORE_DOT is set.
  */
 int
-find_path(infile, outfile, sbp, path)
+find_path(infile, outfile, sbp, path, ignore_dot)
     char *infile;              /* file to find */
     char **outfile;            /* result parameter */
     struct stat *sbp;          /* stat result parameter */
     char *path;                        /* path to search */
+    int ignore_dot;            /* don't check cwd */
 {
     static char command[PATH_MAX]; /* qualified filename */
     char *n;                   /* for traversing path */
@@ -82,10 +83,7 @@ find_path(infile, outfile, sbp, 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;
@@ -126,7 +124,7 @@ find_path(infile, outfile, sbp, 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);
     }