You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
1018 B

diff -uNr dropbear-2018.76/cli-auth.c dropbear-2018.76.mod/cli-auth.c
--- dropbear-2018.76/cli-auth.c 2018-02-27 16:25:10.000000000 +0200
+++ dropbear-2018.76.mod/cli-auth.c 2018-04-21 13:44:51.797063206 +0300
@@ -32,6 +32,38 @@
#include "packet.h"
#include "runopts.h"
+
+// getpass implementation
+#ifdef __ANDROID__
+#include <termios.h>
+#include <readline/readline.h>
+
+static char* getpass(const char *prompt) {
+ struct termios term_old, term_new;
+ int nread;
+
+ /* Turn echoing off and fail if we can't. */
+ if (tcgetattr (0, &term_old) != 0) {
+ return NULL;
+ }
+
+ term_new = term_old;
+ term_new.c_lflag &= ~ECHO;
+
+ if (tcsetattr (0, TCSAFLUSH, &term_new) != 0) {
+ return NULL;
+ }
+
+ /* Read the password. */
+ char *password = readline(prompt);
+
+ /* Restore terminal. */
+ (void) tcsetattr (0, TCSAFLUSH, &term_old);
+
+ return password;
+}
+#endif
+
void cli_authinitialise() {
memset(&ses.authstate, 0, sizeof(ses.authstate));