| 1 | diff -u -r ../isync-1.3.0.orig/src/compat/config.c ./src/compat/config.c |
| 2 | --- ../isync-1.3.0.orig/src/compat/config.c 2017-10-01 17:42:35.000000000 +0900 |
| 3 | +++ ./src/compat/config.c 2018-02-06 08:41:15.750006264 +0900 |
| 4 | @@ -451,7 +451,7 @@ |
| 5 | goto gotstor; |
| 6 | box->local_store_path = my_strndup( path, pl ); |
| 7 | /* derive a suitable name */ |
| 8 | - if (!strcmp( box->local_store_path, "/var/mail/" ) || !strcmp( box->local_store_path, "/var/spool/mail/" )) { |
| 9 | + if (!strcmp( box->local_store_path, "@TERMUX_PREFIX@/var/mail/" ) || !strcmp( box->local_store_path, "@TERMUX_PREFIX@/var/spool/mail/" )) { |
| 10 | local_store = nfstrdup( "spool" ); |
| 11 | } else if (!strcmp( box->local_store_path, "~/" )) { |
| 12 | local_store = nfstrdup( "home" ); |
| 13 | diff -u -r ../isync-1.3.0.orig/src/compat/main.c ./src/compat/main.c |
| 14 | --- ../isync-1.3.0.orig/src/compat/main.c 2017-10-01 17:42:35.000000000 +0900 |
| 15 | +++ ./src/compat/main.c 2018-02-06 08:41:15.750006264 +0900 |
| 16 | @@ -384,7 +384,7 @@ |
| 17 | return 1; |
| 18 | } |
| 19 | } else { |
| 20 | - strcpy( path2, "/tmp/mbsyncrcXXXXXX" ); |
| 21 | + strcpy( path2, "@TERMUX_PREFIX@/tmp/mbsyncrcXXXXXX" ); |
| 22 | if ((fd = mkstemp( path2 )) < 0) { |
| 23 | sys_error( "Error: cannot create temporary config file" ); |
| 24 | return 1; |
| 25 | diff -u -r ../isync-1.3.0.orig/src/drv_imap.c ./src/drv_imap.c |
| 26 | --- ../isync-1.3.0.orig/src/drv_imap.c 2017-10-01 17:42:35.000000000 +0900 |
| 27 | +++ ./src/drv_imap.c 2018-02-06 08:41:15.750006264 +0900 |
| 28 | @@ -36,6 +36,9 @@ |
| 29 | #include <time.h> |
| 30 | #include <sys/wait.h> |
| 31 | |
| 32 | +#include <termios.h> |
| 33 | +#include <readline/readline.h> |
| 34 | + |
| 35 | #ifdef HAVE_LIBSASL |
| 36 | # include <sasl/sasl.h> |
| 37 | # include <sasl/saslutil.h> |
| 38 | @@ -251,6 +254,33 @@ |
| 39 | "Deleted", |
| 40 | }; |
| 41 | |
| 42 | +#ifdef __ANDROID__ |
| 43 | +static char* getpass(const char *prompt) { |
| 44 | + struct termios term_old, term_new; |
| 45 | + int nread; |
| 46 | + |
| 47 | + /* Turn echoing off and fail if we can't. */ |
| 48 | + if (tcgetattr (0, &term_old) != 0) { |
| 49 | + return NULL; |
| 50 | + } |
| 51 | + |
| 52 | + term_new = term_old; |
| 53 | + term_new.c_lflag &= ~ECHO; |
| 54 | + |
| 55 | + if (tcsetattr (0, TCSAFLUSH, &term_new) != 0) { |
| 56 | + return NULL; |
| 57 | + } |
| 58 | + |
| 59 | + /* Read the password. */ |
| 60 | + char *password = readline(prompt); |
| 61 | + |
| 62 | + /* Restore terminal. */ |
| 63 | + (void) tcsetattr (0, TCSAFLUSH, &term_old); |
| 64 | + |
| 65 | + return password; |
| 66 | +} |
| 67 | +#endif |
| 68 | + |
| 69 | static imap_cmd_t * |
| 70 | new_imap_cmd( int size ) |
| 71 | { |
| 72 | diff -u -r ../isync-1.3.0.orig/src/socket.c ./src/socket.c |
| 73 | --- ../isync-1.3.0.orig/src/socket.c 2017-10-01 17:42:35.000000000 +0900 |
| 74 | +++ ./src/socket.c 2018-02-06 08:41:15.750006264 +0900 |
| 75 | @@ -398,7 +398,7 @@ |
| 76 | _exit( 127 ); |
| 77 | close( a[0] ); |
| 78 | close( a[1] ); |
| 79 | - execl( "/bin/sh", "sh", "-c", conf->tunnel, (char *)0 ); |
| 80 | + execl( "@TERMUX_PREFIX@/bin/sh", "sh", "-c", conf->tunnel, (char *)0 ); |
| 81 | _exit( 127 ); |
| 82 | } |
| 83 | |