Diff for /embedaddon/sudo/plugins/sudoers/find_path.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 16:23:02 version 1.1.1.2, 2012/05/29 12:26:49
Line 60  find_path(char *infile, char **outfile, struct stat *s Line 60  find_path(char *infile, char **outfile, struct stat *s
     static char command[PATH_MAX]; /* qualified filename */      static char command[PATH_MAX]; /* qualified filename */
     char *n;                    /* for traversing path */      char *n;                    /* for traversing path */
     char *origpath;             /* so we can free path later */      char *origpath;             /* so we can free path later */
    char *result = NULL;        /* result of path/file lookup */    bool found = false;         /* did we find the command? */
    int checkdot = 0;              /* check current dir? */    bool checkdot = false;       /* check current dir? */
     int len;                    /* length parameter */      int len;                    /* length parameter */
       debug_decl(find_path, SUDO_DEBUG_UTIL)
   
     if (strlen(infile) >= PATH_MAX)      if (strlen(infile) >= PATH_MAX)
         errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));          errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));
Line 75  find_path(char *infile, char **outfile, struct stat *s Line 76  find_path(char *infile, char **outfile, struct stat *s
         strlcpy(command, infile, sizeof(command));      /* paranoia */          strlcpy(command, infile, sizeof(command));      /* paranoia */
         if (sudo_goodpath(command, sbp)) {          if (sudo_goodpath(command, sbp)) {
             *outfile = command;              *outfile = command;
            return FOUND;            debug_return_int(FOUND);
         } else          } else
            return NOT_FOUND;            debug_return_int(NOT_FOUND);
     }      }
   
     if (path == NULL)      if (path == NULL)
        return NOT_FOUND;        debug_return_int(NOT_FOUND);
     path = estrdup(path);      path = estrdup(path);
     origpath = path;      origpath = path;
   
Line 105  find_path(char *infile, char **outfile, struct stat *s Line 106  find_path(char *infile, char **outfile, struct stat *s
         len = snprintf(command, sizeof(command), "%s/%s", path, infile);          len = snprintf(command, sizeof(command), "%s/%s", path, infile);
         if (len <= 0 || len >= sizeof(command))          if (len <= 0 || len >= sizeof(command))
             errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));              errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));
        if ((result = sudo_goodpath(command, sbp)))        if ((found = sudo_goodpath(command, sbp)))
             break;              break;
   
         path = n + 1;          path = n + 1;
Line 116  find_path(char *infile, char **outfile, struct stat *s Line 117  find_path(char *infile, char **outfile, struct stat *s
     /*      /*
      * Check current dir if dot was in the PATH       * Check current dir if dot was in the PATH
      */       */
    if (!result && checkdot) {    if (!found && checkdot) {
         len = snprintf(command, sizeof(command), "./%s", infile);          len = snprintf(command, sizeof(command), "./%s", infile);
         if (len <= 0 || len >= sizeof(command))          if (len <= 0 || len >= sizeof(command))
             errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));              errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG));
        result = sudo_goodpath(command, sbp);        found = sudo_goodpath(command, sbp);
        if (result && ignore_dot)        if (found && ignore_dot)
            return NOT_FOUND_DOT;            debug_return_int(NOT_FOUND_DOT);
     }      }
   
    if (result) {    if (found) {
        *outfile = result;        *outfile = command;
        return FOUND;        debug_return_int(FOUND);
     } else      } else
        return NOT_FOUND;        debug_return_int(NOT_FOUND);
 }  }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>