summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/readpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ssh/readpass.c')
-rw-r--r--usr.bin/ssh/readpass.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/ssh/readpass.c b/usr.bin/ssh/readpass.c
index 3cc94be0399..1a8397c4a8c 100644
--- a/usr.bin/ssh/readpass.c
+++ b/usr.bin/ssh/readpass.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: readpass.c,v 1.29 2004/05/08 00:21:31 djm Exp $");
+RCSID("$OpenBSD: readpass.c,v 1.30 2004/06/17 15:10:14 djm Exp $");
#include <readpassphrase.h>
@@ -105,7 +105,9 @@ read_passphrase(const char *prompt, int flags)
int rppflags, use_askpass = 0, ttyfd;
rppflags = (flags & RP_ECHO) ? RPP_ECHO_ON : RPP_ECHO_OFF;
- if (flags & RP_ALLOW_STDIN) {
+ if (flags & RP_USE_ASKPASS)
+ use_askpass = 1;
+ else if (flags & RP_ALLOW_STDIN) {
if (!isatty(STDIN_FILENO))
use_askpass = 1;
} else {
@@ -117,6 +119,9 @@ read_passphrase(const char *prompt, int flags)
use_askpass = 1;
}
+ if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL)
+ return (flags & RP_ALLOW_EOF) ? NULL : xstrdup("");
+
if (use_askpass && getenv("DISPLAY")) {
if (getenv(SSH_ASKPASS_ENV))
askpass = getenv(SSH_ASKPASS_ENV);