summaryrefslogtreecommitdiffhomepage
path: root/cli-authpasswd.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli-authpasswd.c')
-rw-r--r--cli-authpasswd.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/cli-authpasswd.c b/cli-authpasswd.c
index 5dffac4..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
@@ -116,16 +118,25 @@ static char *gui_getpass(const char *prompt) {
void cli_auth_password() {
char* password = NULL;
+ char prompt[80];
TRACE(("enter cli_auth_password"))
CHECKCLEARTOWRITE();
+ snprintf(prompt, sizeof(prompt), "%s@%s's password: ",
+ cli_opts.username, cli_opts.remotehost);
#ifdef ENABLE_CLI_ASKPASS_HELPER
if (want_askpass())
- password = gui_getpass("Password: ");
- else
+ {
+ password = gui_getpass(prompt);
+ if (!password) {
+ dropbear_exit("No password");
+ }
+ } else
#endif
- password = getpass_or_cancel("Password: ");
+ {
+ password = getpass_or_cancel(prompt);
+ }
buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);