Mercurial > dropbear
diff cli-auth.c @ 330:5488db2e9e4e
merge of 332f709a4cb39cde4cedab7c3be89e05f3023067
and ca4ca78b82c5d430c69ce01bf794e8886ce81431
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 10 Jun 2006 16:39:40 +0000 |
parents | baea1d43e7eb |
children | 8f3ec7c104d9 |
line wrap: on
line diff
--- a/cli-auth.c Sat Jun 10 16:39:37 2006 +0000 +++ b/cli-auth.c Sat Jun 10 16:39:40 2006 +0000 @@ -236,8 +236,8 @@ void cli_auth_try() { + int finished = 0; TRACE(("enter cli_auth_try")) - int finished = 0; CHECKCLEARTOWRITE(); @@ -278,3 +278,18 @@ TRACE(("leave cli_auth_try")) } + +/* A helper for getpass() that exits if the user cancels. The returned + * password is statically allocated by getpass() */ +char* getpass_or_cancel() +{ + char* password = NULL; + + password = getpass("Password: "); + + /* 0x03 is a ctrl-c character in the buffer. */ + if (password == NULL || strchr(password, '\3') != NULL) { + dropbear_close("Interrupted."); + } + return password; +}