Browse Source

openssh: fix path for /tmp/sshauth.XXXXXXXXXXXXXXX

android-5
Leonid Plyushch 6 years ago
parent
commit
f6ce4561fb
  1. 2
      packages/openssh/build.sh
  2. 38
      packages/openssh/session.c.patch

2
packages/openssh/build.sh

@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://www.openssh.com/
TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine" TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
TERMUX_PKG_LICENSE="BSD" TERMUX_PKG_LICENSE="BSD"
TERMUX_PKG_VERSION=7.9p1 TERMUX_PKG_VERSION=7.9p1
TERMUX_PKG_REVISION=4 TERMUX_PKG_REVISION=5
TERMUX_PKG_SHA256=6b4b3ba2253d84ed3771c8050728d597c91cfce898713beb7b64a305b6f11aad TERMUX_PKG_SHA256=6b4b3ba2253d84ed3771c8050728d597c91cfce898713beb7b64a305b6f11aad
TERMUX_PKG_SRCURL=https://fastly.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz 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, termux-auth, krb5" TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, libutil, termux-auth, krb5"

38
packages/openssh/session.c.patch

@ -1,17 +1,25 @@
diff --git a/session.c.orig b/session.c diff -uNr openssh-7.9p1/session.c openssh-7.9p1.mod/session.c
index 58826db..890e452 100644 --- openssh-7.9p1/session.c 2018-10-17 03:01:20.000000000 +0300
--- a/session.c.orig +++ openssh-7.9p1.mod/session.c 2019-03-01 23:13:36.360949253 +0200
+++ b/session.c @@ -200,7 +200,7 @@
@@ -199,7 +199,7 @@ auth_input_request_forwarding(struct ssh *ssh, struct passwd * pw)
temporarily_use_uid(pw); temporarily_use_uid(pw);
/* Allocate a buffer for the socket name, and format the name. */ /* Allocate a buffer for the socket name, and format the name. */
- auth_sock_dir = xstrdup("/tmp/ssh-XXXXXXXXXX"); - auth_sock_dir = xstrdup("/tmp/ssh-XXXXXXXXXX");
+ auth_sock_dir = xstrdup("@TERMUX_PREFIX@/tmp/ssh-XXXXXXXXXX"); + auth_sock_dir = xstrdup("@TERMUX_PREFIX@/tmp/ssh-XXXXXXXXXX");
/* Create private directory for socket */ /* Create private directory for socket */
if (mkdtemp(auth_sock_dir) == NULL) { if (mkdtemp(auth_sock_dir) == NULL) {
@@ -802,7 +802,7 @@ do_motd(void) @@ -268,7 +268,7 @@
return;
temporarily_use_uid(pw);
- auth_info_file = xstrdup("/tmp/sshauth.XXXXXXXXXXXXXXX");
+ auth_info_file = xstrdup("@TERMUX_PREFIX@/tmp/sshauth.XXXXXXXXXXXXXXX");
if ((fd = mkstemp(auth_info_file)) == -1) {
error("%s: mkstemp: %s", __func__, strerror(errno));
goto out;
@@ -833,7 +833,7 @@
f = fopen(login_getcapstr(lc, "welcome", "/etc/motd", f = fopen(login_getcapstr(lc, "welcome", "/etc/motd",
"/etc/motd"), "r"); "/etc/motd"), "r");
#else #else
@ -20,21 +28,21 @@ index 58826db..890e452 100644
#endif #endif
if (f) { if (f) {
while (fgets(buf, sizeof(buf), f)) while (fgets(buf, sizeof(buf), f))
@@ -1044,8 +1044,10 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell) @@ -1082,8 +1082,10 @@
# endif /* HAVE_CYGWIN */ # endif /* HAVE_CYGWIN */
#endif /* HAVE_LOGIN_CAP */ #endif /* HAVE_LOGIN_CAP */
+#ifdef _PATH_MAILDIR +#ifdef _PATH_MAILDIR
snprintf(buf, sizeof buf, "%.200s/%.50s", _PATH_MAILDIR, pw->pw_name); snprintf(buf, sizeof buf, "%.200s/%.50s", _PATH_MAILDIR, pw->pw_name);
child_set_env(&env, &envsize, "MAIL", buf); child_set_env(&env, &envsize, "MAIL", buf);
+#endif +#endif
/* Normal systems set SHELL by default. */ /* Normal systems set SHELL by default. */
child_set_env(&env, &envsize, "SHELL", shell); child_set_env(&env, &envsize, "SHELL", shell);
@@ -1053,6 +1055,15 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell) @@ -1127,6 +1129,15 @@
if (getenv("TZ")) auth_sock_name);
child_set_env(&env, &envsize, "TZ", getenv("TZ"));
+#ifdef __ANDROID__ +#ifdef __ANDROID__
+ char const* envs_to_keep[] = {"LD_LIBRARY_PATH", "PATH", "ANDROID_ROOT", "ANDROID_DATA", "EXTERNAL_STORAGE", "LANG", "PREFIX", "TMPDIR"}; + char const* envs_to_keep[] = {"LD_LIBRARY_PATH", "PATH", "ANDROID_ROOT", "ANDROID_DATA", "EXTERNAL_STORAGE", "LANG", "PREFIX", "TMPDIR"};
+ for (i = 0; i < (sizeof(envs_to_keep) / sizeof(envs_to_keep[0])); i++) { + for (i = 0; i < (sizeof(envs_to_keep) / sizeof(envs_to_keep[0])); i++) {

Loading…
Cancel
Save