Commit | Line | Data |
---|---|---|
10688585 LP |
1 | diff -uNr dropbear-2018.76/cli-auth.c dropbear-2018.76.mod/cli-auth.c |
2 | --- dropbear-2018.76/cli-auth.c 2018-02-27 16:25:10.000000000 +0200 | |
3 | +++ dropbear-2018.76.mod/cli-auth.c 2018-04-21 13:44:51.797063206 +0300 | |
4 | @@ -32,6 +32,38 @@ | |
5 | #include "packet.h" | |
6 | #include "runopts.h" | |
7 | ||
8 | + | |
9 | +// getpass implementation | |
10 | +#ifdef __ANDROID__ | |
11 | +#include <termios.h> | |
12 | +#include <readline/readline.h> | |
13 | + | |
14 | +static char* getpass(const char *prompt) { | |
15 | + struct termios term_old, term_new; | |
16 | + int nread; | |
17 | + | |
18 | + /* Turn echoing off and fail if we can't. */ | |
19 | + if (tcgetattr (0, &term_old) != 0) { | |
20 | + return NULL; | |
21 | + } | |
22 | + | |
23 | + term_new = term_old; | |
24 | + term_new.c_lflag &= ~ECHO; | |
25 | + | |
26 | + if (tcsetattr (0, TCSAFLUSH, &term_new) != 0) { | |
27 | + return NULL; | |
28 | + } | |
29 | + | |
30 | + /* Read the password. */ | |
31 | + char *password = readline(prompt); | |
32 | + | |
33 | + /* Restore terminal. */ | |
34 | + (void) tcsetattr (0, TCSAFLUSH, &term_old); | |
35 | + | |
36 | + return password; | |
37 | +} | |
38 | +#endif | |
39 | + | |
40 | void cli_authinitialise() { | |
41 | ||
42 | memset(&ses.authstate, 0, sizeof(ses.authstate)); |