If the command in sudoers does not exist on the file system, match by name.

We still want to match the command even if it doesn't exist so that the
NOPASSWD flag on sudoers entries with non-existant paths works as expected.
Bug #888.
This commit is contained in:
Todd C. Miller
2019-07-19 13:51:23 -06:00
parent 15db0c3f82
commit a7137a5225
2 changed files with 13 additions and 7 deletions

View File

@@ -52,6 +52,9 @@ digest_matches(int fd, const char *file, const struct command_digest *digest)
size_t digest_len;
debug_decl(digest_matches, SUDOERS_DEBUG_MATCH)
if (fd == -1)
goto done;
file_digest = sudo_filedigest(fd, file, digest->digest_type, &digest_len);
if (lseek(fd, (off_t)0, SEEK_SET) == -1) {
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|SUDO_DEBUG_LINENO,