Add sudoers option to perform authentication even in non-interative mode.

If noninteractive_auth is set, authentication methods that do not
require input from the user's terminal may proceed.  It is off by
default, which restores the pre-1.9.9 behavior of "sudo -n".
This commit is contained in:
Todd C. Miller
2022-02-01 20:08:26 -07:00
parent 6564f1ae4c
commit 85fef8b50f
7 changed files with 53 additions and 4 deletions

View File

@@ -125,6 +125,12 @@ check_user_interactive(int validated, int mode, struct getpass_closure *closure)
FALLTHROUGH;
default:
if (ISSET(mode, MODE_NONINTERACTIVE) && !def_noninteractive_auth) {
validated |= FLAG_NO_USER_INPUT;
log_auth_failure(validated, 0);
goto done;
}
/* XXX - should not lecture if askpass helper is being used. */
lectured = display_lecture(closure->tstat);