More verbose error message when a password is required and no terminal

is present.  Bug #828.
This commit is contained in:
Todd C. Miller
2019-07-19 11:51:20 -06:00
parent 3c825e298d
commit 15db0c3f82
4 changed files with 22 additions and 13 deletions

View File

@@ -144,7 +144,7 @@ restart:
/* If no tty present and we need to disable echo, try askpass. */
if (ttyfd == -1 && !ISSET(flags, TGP_ECHO|TGP_NOECHO_TRY)) {
if (askpass == NULL || getenv_unhooked("DISPLAY") == NULL) {
sudo_warnx(U_("no tty present and no askpass program specified"));
sudo_warnx(U_("a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper"));
debug_return_str(NULL);
}
SET(flags, TGP_ASKPASS);