2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-29 13:28:10 +00:00

if given a fully-qualified or relative path we now check it

with sudo_goodpath() and error out with the appropriate error
message if the file does not exist or is not executable
This commit is contained in:
Todd C. Miller 1995-09-01 04:04:43 +00:00
parent f55ea664c4
commit a7b14880ab

View File

@ -110,11 +110,20 @@ char * find_path(file)
}
/*
* If we were given a fully qualified or relative path just accept for now
* If we were given a fully qualified or relative path
* there is no need to look at PATH.
* We really want to fall back if !sudo_goodpath() but then
* the error is "not found" -- this way we get the correct error.
*/
if (strchr(file, '/')) {
(void) strcpy(command, file);
if (sudo_goodpath(command)) {
return(command);
} else {
(void) fprintf(stderr, "%s: %s: ", Argv[0], command);
perror("");
exit(1);
}
}
/*
@ -124,7 +133,7 @@ char * find_path(file)
return(NULL);
if ((path = strdup(path)) == NULL) {
(void) fprintf(stderr, "sudo: out of memory!\n");
(void) fprintf(stderr, "%s: out of memory!\n", Argv[0]);
exit(1);
}
origpath=path;