summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/readpass.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-10-28 16:03:53 +0000
committerdes <des@FreeBSD.org>2004-10-28 16:03:53 +0000
commitd5d493f03ae792146848e3cba16bb9e667c73125 (patch)
treeda81db150f0171c7861edf6e1f6b1fb45f81a6a7 /crypto/openssh/readpass.c
parentc69db9c5a2d88a51f8d2394cf37717ba93f07152 (diff)
downloadFreeBSD-src-d5d493f03ae792146848e3cba16bb9e667c73125.zip
FreeBSD-src-d5d493f03ae792146848e3cba16bb9e667c73125.tar.gz
Vendor import of OpenSSH 3.9p1.
Diffstat (limited to 'crypto/openssh/readpass.c')
-rw-r--r--crypto/openssh/readpass.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/openssh/readpass.c b/crypto/openssh/readpass.c
index 95ec5d8..eb4f6fd 100644
--- a/crypto/openssh/readpass.c
+++ b/crypto/openssh/readpass.c
@@ -23,10 +23,10 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: readpass.c,v 1.28 2003/01/23 13:50:27 markus Exp $");
+RCSID("$OpenBSD: readpass.c,v 1.30 2004/06/17 15:10:14 djm Exp $");
#include "xmalloc.h"
-#include "readpass.h"
+#include "misc.h"
#include "pathnames.h"
#include "log.h"
#include "ssh.h"
@@ -103,7 +103,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 {
@@ -115,6 +117,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);
OpenPOWER on IntegriCloud