# HG changeset patch # User Matt Johnston # Date 1150123292 0 # Node ID 8f3ec7c104d9ea3579ff3fca28558f5f126a5c06 # Parent 9341570412e5d09bf84072e42010460edc3f2dff Make the dbclient password prompt more useful diff -r 9341570412e5 -r 8f3ec7c104d9 auth.h --- a/auth.h Mon Jun 12 03:51:40 2006 +0000 +++ b/auth.h Mon Jun 12 14:41:32 2006 +0000 @@ -52,7 +52,7 @@ void cli_auth_password(); int cli_auth_pubkey(); void cli_auth_interactive(); -char* getpass_or_cancel(); +char* getpass_or_cancel(char* prompt); #define MAX_USERNAME_LEN 25 /* arbitrary for the moment */ diff -r 9341570412e5 -r 8f3ec7c104d9 cli-auth.c --- a/cli-auth.c Mon Jun 12 03:51:40 2006 +0000 +++ b/cli-auth.c Mon Jun 12 14:41:32 2006 +0000 @@ -281,11 +281,11 @@ /* A helper for getpass() that exits if the user cancels. The returned * password is statically allocated by getpass() */ -char* getpass_or_cancel() +char* getpass_or_cancel(char* prompt) { char* password = NULL; - password = getpass("Password: "); + password = getpass(prompt); /* 0x03 is a ctrl-c character in the buffer. */ if (password == NULL || strchr(password, '\3') != NULL) { diff -r 9341570412e5 -r 8f3ec7c104d9 cli-authpasswd.c --- a/cli-authpasswd.c Mon Jun 12 03:51:40 2006 +0000 +++ b/cli-authpasswd.c Mon Jun 12 14:41:32 2006 +0000 @@ -116,16 +116,19 @@ 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: "); + password = gui_getpass(prompt); else #endif - password = getpass_or_cancel("Password: "); + password = getpass_or_cancel(prompt); buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);