From a263cc6bc3c45726e0d456647a2443176badbea2 Mon Sep 17 00:00:00 2001 From: Tom Yan Date: Mon, 23 Apr 2018 20:10:35 +0800 Subject: [PATCH] openssh: keep TMPDIR and PS1 --- packages/openssh/build.sh | 2 +- packages/openssh/session.c.patch | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/openssh/build.sh b/packages/openssh/build.sh index be47bd0ca..1e7cd4a14 100755 --- a/packages/openssh/build.sh +++ b/packages/openssh/build.sh @@ -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" diff --git a/packages/openssh/session.c.patch b/packages/openssh/session.c.patch index dda7c8759..4cfba03f3 100644 --- a/packages/openssh/session.c.patch +++ b/packages/openssh/session.c.patch @@ -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);