In find_path(), return NOT_FOUND_ERROR instead of calling fatal()
if the path is too long. Remove an extraneous check against PATH_MAX in set_cmnd() since find_path() already contains such a check.
This commit is contained in:
@@ -623,13 +623,18 @@ set_cmnd(void)
|
||||
rval = find_path(NewArgv[0], &user_cmnd, user_stat, path,
|
||||
def_ignore_dot);
|
||||
restore_perms();
|
||||
if (rval != FOUND) {
|
||||
if (rval == NOT_FOUND) {
|
||||
/* Failed as root, try as invoking user. */
|
||||
set_perms(PERM_USER);
|
||||
rval = find_path(NewArgv[0], &user_cmnd, user_stat, path,
|
||||
def_ignore_dot);
|
||||
restore_perms();
|
||||
}
|
||||
if (rval == NOT_FOUND_ERROR) {
|
||||
if (errno == ENAMETOOLONG)
|
||||
audit_failure(NewArgv, N_("command too long"));
|
||||
log_fatal(NO_MAIL|USE_ERRNO, NewArgv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/* set user_args */
|
||||
@@ -668,11 +673,6 @@ set_cmnd(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen(user_cmnd) >= PATH_MAX) {
|
||||
audit_failure(NewArgv, N_("command too long"));
|
||||
errno = ENAMETOOLONG;
|
||||
fatal("%s", user_cmnd);
|
||||
}
|
||||
|
||||
if ((user_base = strrchr(user_cmnd, '/')) != NULL)
|
||||
user_base++;
|
||||
|
Reference in New Issue
Block a user