openssh: keep TMPDIR and PS1

This commit is contained in:
Tom Yan 2018-04-23 20:10:35 +08:00 committed by Fredrik Fornwall
parent b1ba7dbf95
commit 9cd99e6e02
2 changed files with 10 additions and 9 deletions

View File

@ -1,7 +1,7 @@
TERMUX_PKG_HOMEPAGE=https://www.openssh.com/
TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
TERMUX_PKG_VERSION=7.7p1
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SHA256=d73be7e684e99efcd024be15a30bffcbe41b012b2f7b3c9084aed621775e6b8f
TERMUX_PKG_SRCURL=https://fastly.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, libutil"

View File

@ -1,7 +1,8 @@
diff -u -r ../openssh-7.7p1/session.c ./session.c
--- ../openssh-7.7p1/session.c 2018-04-02 07:38:28.000000000 +0200
+++ ./session.c 2018-04-03 23:46:30.670337636 +0200
@@ -199,7 +199,7 @@
diff --git a/session.c.orig b/session.c
index 58826db..c251ee9 100644
--- a/session.c.orig
+++ b/session.c
@@ -199,7 +199,7 @@ auth_input_request_forwarding(struct ssh *ssh, struct passwd * pw)
temporarily_use_uid(pw);
/* Allocate a buffer for the socket name, and format the name. */
@ -10,7 +11,7 @@ diff -u -r ../openssh-7.7p1/session.c ./session.c
/* Create private directory for socket */
if (mkdtemp(auth_sock_dir) == NULL) {
@@ -802,7 +802,7 @@
@@ -802,7 +802,7 @@ do_motd(void)
f = fopen(login_getcapstr(lc, "welcome", "/etc/motd",
"/etc/motd"), "r");
#else
@ -19,7 +20,7 @@ diff -u -r ../openssh-7.7p1/session.c ./session.c
#endif
if (f) {
while (fgets(buf, sizeof(buf), f))
@@ -1044,8 +1044,10 @@
@@ -1044,8 +1044,10 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
# endif /* HAVE_CYGWIN */
#endif /* HAVE_LOGIN_CAP */
@ -30,12 +31,12 @@ diff -u -r ../openssh-7.7p1/session.c ./session.c
/* Normal systems set SHELL by default. */
child_set_env(&env, &envsize, "SHELL", shell);
@@ -1053,6 +1055,15 @@
@@ -1053,6 +1055,15 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
if (getenv("TZ"))
child_set_env(&env, &envsize, "TZ", getenv("TZ"));
+#ifdef __ANDROID__
+ char const* envs_to_keep[] = {"LD_LIBRARY_PATH", "PATH", "ANDROID_ROOT", "ANDROID_DATA", "EXTERNAL_STORAGE", "LANG", "PREFIX"};
+ char const* envs_to_keep[] = {"LD_LIBRARY_PATH", "PATH", "ANDROID_ROOT", "ANDROID_DATA", "EXTERNAL_STORAGE", "LANG", "PREFIX", "TMPDIR", "PS1"};
+ for (i = 0; i < (sizeof(envs_to_keep) / sizeof(envs_to_keep[0])); i++) {
+ char const* env_to_keep_name = envs_to_keep[i];
+ char const* env_to_keep_value = getenv(env_to_keep_name);