version 1.9, 2007/07/26 16:10:16 |
version 1.10, 2008/11/14 11:58:08 |
|
|
#ifdef HAVE_UNISTD_H |
#ifdef HAVE_UNISTD_H |
# include <unistd.h> |
# include <unistd.h> |
#endif /* HAVE_UNISTD_H */ |
#endif /* HAVE_UNISTD_H */ |
#ifdef HAVE_ERR_H |
|
# include <err.h> |
|
#else |
|
# include "emul/err.h" |
|
#endif /* HAVE_ERR_H */ |
|
|
|
#include "sudo.h" |
#include "sudo.h" |
|
|
#ifndef lint |
#ifndef lint |
__unused static const char rcsid[] = "$Sudo: find_path.c,v 1.108.2.4 2007/06/12 01:43:01 millert Exp $"; |
__unused static const char rcsid[] = "$Sudo: find_path.c,v 1.115 2005/03/29 14:29:46 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
int len; /* length parameter */ |
int len; /* length parameter */ |
|
|
if (strlen(infile) >= PATH_MAX) |
if (strlen(infile) >= PATH_MAX) |
errx(1, "%s: File name too long", infile); |
errorx(1, "%s: File name too long", infile); |
|
|
/* |
/* |
* If we were given a fully qualified or relative path |
* If we were given a fully qualified or relative path |
|
|
} |
} |
|
|
/* Use PATH passed in unless SECURE_PATH is in effect. */ |
/* Use PATH passed in unless SECURE_PATH is in effect. */ |
#ifdef SECURE_PATH |
if (def_secure_path && !user_is_exempt()) |
if (!user_is_exempt()) |
path = def_secure_path; |
path = SECURE_PATH; |
else if (path == NULL) |
#endif /* SECURE_PATH */ |
|
if (path == NULL) |
|
return(NOT_FOUND); |
return(NOT_FOUND); |
path = estrdup(path); |
path = estrdup(path); |
origpath = path; |
origpath = path; |
|
|
*/ |
*/ |
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)) |
errx(1, "%s: File name too long", infile); |
errorx(1, "%s: File name too long", infile); |
if ((result = sudo_goodpath(command, sbp))) |
if ((result = sudo_goodpath(command, sbp))) |
break; |
break; |
|
|