Add testsudoers_setshellfile() and use it in testsudoers.

This commit is contained in:
Todd C. Miller
2023-09-10 16:38:53 -06:00
parent 62b92c7fb8
commit 034b2f3bdd
5 changed files with 51 additions and 13 deletions

View File

@@ -462,12 +462,12 @@ PREFIX(valid_shell)(const char *shell)
sudo_debug_printf(SUDO_DEBUG_INFO,
"%s: checking /etc/shells for %s", __func__, shell);
setusershell();
while ((entry = getusershell()) != NULL) {
CALL(setusershell)();
while ((entry = CALL(getusershell)()) != NULL) {
if (strcmp(entry, shell) == 0)
debug_return_bool(true);
}
endusershell();
CALL(endusershell)();
debug_return_bool(false);
}