1 diff -u -r ../openssh-7.5p1/session.c ./session.c
2 --- ../openssh-7.5p1/session.c 2017-03-20 03:39:27.000000000 +0100
3 +++ ./session.c 2017-06-30 22:51:57.404787949 +0200
5 temporarily_use_uid(pw);
7 /* Allocate a buffer for the socket name, and format the name. */
8 - auth_sock_dir = xstrdup("/tmp/ssh-XXXXXXXXXX");
9 + auth_sock_dir = xstrdup("@TERMUX_PREFIX@/tmp/ssh-XXXXXXXXXX");
11 /* Create private directory for socket */
12 if (mkdtemp(auth_sock_dir) == NULL) {
14 f = fopen(login_getcapstr(lc, "welcome", "/etc/motd",
17 - f = fopen("/etc/motd", "r");
18 + f = fopen("@TERMUX_PREFIX@/etc/motd", "r");
21 while (fgets(buf, sizeof(buf), f))
22 @@ -1047,8 +1047,10 @@
23 # endif /* HAVE_CYGWIN */
24 #endif /* HAVE_LOGIN_CAP */
27 snprintf(buf, sizeof buf, "%.200s/%.50s", _PATH_MAILDIR, pw->pw_name);
28 child_set_env(&env, &envsize, "MAIL", buf);
31 /* Normal systems set SHELL by default. */
32 child_set_env(&env, &envsize, "SHELL", shell);
33 @@ -1056,6 +1058,15 @@
35 child_set_env(&env, &envsize, "TZ", getenv("TZ"));
38 + char const* envs_to_keep[] = {"LD_LIBRARY_PATH", "PATH", "ANDROID_ROOT", "ANDROID_DATA", "EXTERNAL_STORAGE", "LANG", "PREFIX"};
39 + for (i = 0; i < (sizeof(envs_to_keep) / sizeof(envs_to_keep[0])); i++) {
40 + char const* env_to_keep_name = envs_to_keep[i];
41 + char const* env_to_keep_value = getenv(env_to_keep_name);
42 + if (env_to_keep_value) child_set_env(&env, &envsize, env_to_keep_name, env_to_keep_value);
46 /* Set custom environment options from RSA authentication. */
47 while (custom_environment) {
48 struct envstring *ce = custom_environment;