summaryrefslogtreecommitdiff
path: root/readpass.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2004-06-18 01:19:03 +1000
committerDamien Miller <djm@mindrot.org>2004-06-18 01:19:03 +1000
commit23f0770a1bf8b0a1aa7c8d4bd78699fa0e9358d0 (patch)
treea4011718b766af34f837471c2311e6cd044e2c20 /readpass.c
parent3756dcee244f47c20a6590129d99e625169836c6 (diff)
- djm@cvs.openbsd.org 2004/06/17 15:10:14
[clientloop.c misc.h readconf.c readpass.c ssh.c ssh_config.5] Add option for confirmation (ControlMaster=ask) via ssh-askpass before opening shared connections; ok markus@
Diffstat (limited to 'readpass.c')
-rw-r--r--readpass.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/readpass.c b/readpass.c
index fc7629c37..eb4f6fdb6 100644
--- a/readpass.c
+++ b/readpass.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: readpass.c,v 1.29 2004/05/08 00:21:31 djm Exp $"); 26RCSID("$OpenBSD: readpass.c,v 1.30 2004/06/17 15:10:14 djm Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29#include "misc.h" 29#include "misc.h"
@@ -103,7 +103,9 @@ read_passphrase(const char *prompt, int flags)
103 int rppflags, use_askpass = 0, ttyfd; 103 int rppflags, use_askpass = 0, ttyfd;
104 104
105 rppflags = (flags & RP_ECHO) ? RPP_ECHO_ON : RPP_ECHO_OFF; 105 rppflags = (flags & RP_ECHO) ? RPP_ECHO_ON : RPP_ECHO_OFF;
106 if (flags & RP_ALLOW_STDIN) { 106 if (flags & RP_USE_ASKPASS)
107 use_askpass = 1;
108 else if (flags & RP_ALLOW_STDIN) {
107 if (!isatty(STDIN_FILENO)) 109 if (!isatty(STDIN_FILENO))
108 use_askpass = 1; 110 use_askpass = 1;
109 } else { 111 } else {
@@ -115,6 +117,9 @@ read_passphrase(const char *prompt, int flags)
115 use_askpass = 1; 117 use_askpass = 1;
116 } 118 }
117 119
120 if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL)
121 return (flags & RP_ALLOW_EOF) ? NULL : xstrdup("");
122
118 if (use_askpass && getenv("DISPLAY")) { 123 if (use_askpass && getenv("DISPLAY")) {
119 if (getenv(SSH_ASKPASS_ENV)) 124 if (getenv(SSH_ASKPASS_ENV))
120 askpass = getenv(SSH_ASKPASS_ENV); 125 askpass = getenv(SSH_ASKPASS_ENV);