diff options
author | Matt Johnston <matt@ucc.asn.au> | 2007-11-29 11:38:06 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2007-11-29 11:38:06 +0000 |
commit | bb84e33d99f5cbdb362940fc5eb7e4548df4cf23 (patch) | |
tree | 84f270382532c10a4d213b51ca2d33ebf31b817b /cli-authpasswd.c | |
parent | e41452afebbe0a8520ddcb2220d62f5a15845815 (diff) | |
parent | 25554bc331cc684c3521b3c3ed4c0659c454d5df (diff) |
propagate from branch 'au.asn.ucc.matt.dropbear' (head fb7080ca6e254faaf7cfaee93b0ab6ab6de4ed59)
to branch 'au.asn.ucc.matt.dropbear.cli-agent' (head 78d02301ae8310efa2639f15da0ea62dea110e4b)
--HG--
branch : agent-client
extra : convert_revision : 833d0adef6cdbf43ea75283524c665e70b0ee1ee
Diffstat (limited to 'cli-authpasswd.c')
-rw-r--r-- | cli-authpasswd.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cli-authpasswd.c b/cli-authpasswd.c index 2500a25..1e0bd41 100644 --- a/cli-authpasswd.c +++ b/cli-authpasswd.c @@ -38,7 +38,9 @@ static int want_askpass() char* askpass_prog = NULL; askpass_prog = getenv("SSH_ASKPASS"); - return askpass_prog && !isatty(STDIN_FILENO) && getenv("DISPLAY"); + return askpass_prog && + ((!isatty(STDIN_FILENO) && getenv("DISPLAY") ) + || getenv("SSH_ASKPASS_ALWAYS")); } /* returns a statically allocated password from a helper app, or NULL @@ -125,10 +127,16 @@ void cli_auth_password() { cli_opts.username, cli_opts.remotehost); #ifdef ENABLE_CLI_ASKPASS_HELPER if (want_askpass()) + { password = gui_getpass(prompt); - else + if (!password) { + dropbear_exit("No password"); + } + } else #endif + { password = getpass_or_cancel(prompt); + } buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST); |