2018-04-22 21:22:48 +02:00
|
|
|
diff -uNr dropbear-2018.76/svr-chansession.c dropbear-2018.76.mod/svr-chansession.c
|
|
|
|
--- dropbear-2018.76/svr-chansession.c 2018-02-27 16:25:12.000000000 +0200
|
|
|
|
+++ dropbear-2018.76.mod/svr-chansession.c 2018-04-21 13:45:06.707063974 +0300
|
2021-12-15 02:36:15 +01:00
|
|
|
@@ -607,7 +607,11 @@
|
|
|
|
dropbear_exit("Out of memory"); /* TODO disconnect */
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef __ANDROID__
|
|
|
|
+ pw = getpwuid(getuid());
|
|
|
|
+#else
|
|
|
|
pw = getpwnam(ses.authstate.pw_name);
|
|
|
|
+#endif
|
|
|
|
if (!pw)
|
|
|
|
dropbear_exit("getpwnam failed after succeeding previously");
|
|
|
|
pty_setowner(pw, chansess->tty);
|
|
|
|
@@ -919,6 +923,8 @@
|
2018-04-22 21:22:48 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* clear environment */
|
|
|
|
+ /* termux: do not clear environment on android */
|
|
|
|
+#ifndef __ANDROID__
|
|
|
|
/* if we're debugging using valgrind etc, we need to keep the LD_PRELOAD
|
|
|
|
* etc. This is hazardous, so should only be used for debugging. */
|
|
|
|
#ifndef DEBUG_VALGRIND
|
2021-12-15 02:36:15 +01:00
|
|
|
@@ -931,6 +937,7 @@
|
2018-04-22 21:22:48 +02:00
|
|
|
}
|
|
|
|
#endif /* HAVE_CLEARENV */
|
|
|
|
#endif /* DEBUG_VALGRIND */
|
|
|
|
+#endif /* __ANDROID__ */
|
|
|
|
|
|
|
|
/* We can only change uid/gid as root ... */
|
|
|
|
if (getuid() == 0) {
|
2021-12-15 02:36:15 +01:00
|
|
|
@@ -956,12 +963,14 @@
|
2018-04-22 21:22:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ /* termux: do not modify environment since we did not clean it */
|
|
|
|
+#ifndef __ANDROID__
|
|
|
|
/* set env vars */
|
|
|
|
addnewvar("USER", ses.authstate.pw_name);
|
|
|
|
addnewvar("LOGNAME", ses.authstate.pw_name);
|
|
|
|
addnewvar("HOME", ses.authstate.pw_dir);
|
|
|
|
addnewvar("SHELL", get_user_shell());
|
|
|
|
- addnewvar("PATH", DEFAULT_PATH);
|
|
|
|
+#endif /* __ANDROID__ */
|
|
|
|
if (chansess->term != NULL) {
|
|
|
|
addnewvar("TERM", chansess->term);
|
|
|
|
}
|