aboutsummaryrefslogtreecommitdiffstats
path: root/authenticate.c
diff options
context:
space:
mode:
authorDylan Simon <dylan@dylex.net>2010-03-08 22:01:26 -0500
committerMichael Bestas <mikeioannina@gmail.com>2015-08-19 00:12:12 +0300
commit432373ecf8e1f702e4c82afac9a61d2b96445187 (patch)
tree9f6430d4d1145395134a549cfdeb0274333ded48 /authenticate.c
parent7cb0de6326c915a72253fd103dae93308031ec3f (diff)
downloadandroid_external_rsync-432373ecf8e1f702e4c82afac9a61d2b96445187.tar.gz
android_external_rsync-432373ecf8e1f702e4c82afac9a61d2b96445187.tar.bz2
android_external_rsync-432373ecf8e1f702e4c82afac9a61d2b96445187.zip
Android build, static config, and changes
Works fine on emulator both for local copies and in daemon mode. Very few changes necessary. Change-Id: I6ef54769b00333f84eabd1306381eac80b3d5f09
Diffstat (limited to 'authenticate.c')
-rw-r--r--authenticate.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/authenticate.c b/authenticate.c
index c92746c6..f363e72e 100644
--- a/authenticate.c
+++ b/authenticate.c
@@ -343,6 +343,36 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
return strdup(line);
}
+#ifdef __BIONIC__
+#include <termios.h>
+static const char *getpass(char *prompt)
+{
+ struct termios old, new;
+ static char res[256];
+ char *p;
+
+ /* Turn echoing off and fail if we can't. */
+ if (tcgetattr (0, &old) != 0)
+ return NULL;
+ new = old;
+ new.c_lflag &= ~ECHO;
+ if (tcsetattr (0, TCSAFLUSH, &new) != 0)
+ return NULL;
+
+ fprintf(stderr, "%s", prompt);
+ fflush(stderr);
+ fgets(res, 256, stdin);
+ if ((p = strchr(res, '\n')))
+ *p = 0;
+
+ /* Restore terminal. */
+ tcsetattr (0, TCSAFLUSH, &old);
+
+ return res;
+}
+
+#endif
+
void auth_client(int fd, const char *user, const char *challenge)
{
const char *pass;