]> andersk Git - gssapi-openssh.git/blobdiff - openssh/readpass.c
Merge from OPENSSH_3_8_1P1_GSSAPI_20040713 to OPENSSH_3_9P1_GSSAPI_20040818.
[gssapi-openssh.git] / openssh / readpass.c
index 95ec5d8738987db9b7a7fdfdeb6c795f26104487..eb4f6fdb6d903aa29b533e42b315b150a2f9a3ca 100644 (file)
  */
 
 #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);
This page took 0.038572 seconds and 4 git commands to generate.