2018-04-23 14:10:35 +02:00
|
|
|
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)
|
2015-06-13 01:03:31 +02:00
|
|
|
temporarily_use_uid(pw);
|
|
|
|
|
|
|
|
/* Allocate a buffer for the socket name, and format the name. */
|
|
|
|
- auth_sock_dir = xstrdup("/tmp/ssh-XXXXXXXXXX");
|
|
|
|
+ auth_sock_dir = xstrdup("@TERMUX_PREFIX@/tmp/ssh-XXXXXXXXXX");
|
|
|
|
|
|
|
|
/* Create private directory for socket */
|
|
|
|
if (mkdtemp(auth_sock_dir) == NULL) {
|
2018-04-23 14:10:35 +02:00
|
|
|
@@ -802,7 +802,7 @@ do_motd(void)
|
2015-06-13 01:03:31 +02:00
|
|
|
f = fopen(login_getcapstr(lc, "welcome", "/etc/motd",
|
|
|
|
"/etc/motd"), "r");
|
|
|
|
#else
|
|
|
|
- f = fopen("/etc/motd", "r");
|
|
|
|
+ f = fopen("@TERMUX_PREFIX@/etc/motd", "r");
|
|
|
|
#endif
|
|
|
|
if (f) {
|
|
|
|
while (fgets(buf, sizeof(buf), f))
|
2018-04-23 14:10:35 +02:00
|
|
|
@@ -1044,8 +1044,10 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
|
2017-06-30 22:55:31 +02:00
|
|
|
# endif /* HAVE_CYGWIN */
|
|
|
|
#endif /* HAVE_LOGIN_CAP */
|
|
|
|
|
|
|
|
+#ifdef _PATH_MAILDIR
|
|
|
|
snprintf(buf, sizeof buf, "%.200s/%.50s", _PATH_MAILDIR, pw->pw_name);
|
|
|
|
child_set_env(&env, &envsize, "MAIL", buf);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* Normal systems set SHELL by default. */
|
|
|
|
child_set_env(&env, &envsize, "SHELL", shell);
|
2018-04-23 14:10:35 +02:00
|
|
|
@@ -1053,6 +1055,15 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
|
2016-06-26 23:56:11 +02:00
|
|
|
if (getenv("TZ"))
|
|
|
|
child_set_env(&env, &envsize, "TZ", getenv("TZ"));
|
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
+#ifdef __ANDROID__
|
2018-04-23 14:10:35 +02:00
|
|
|
+ char const* envs_to_keep[] = {"LD_LIBRARY_PATH", "PATH", "ANDROID_ROOT", "ANDROID_DATA", "EXTERNAL_STORAGE", "LANG", "PREFIX", "TMPDIR", "PS1"};
|
2016-06-26 23:56:11 +02:00
|
|
|
+ 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);
|
|
|
|
+ if (env_to_keep_value) child_set_env(&env, &envsize, env_to_keep_name, env_to_keep_value);
|
|
|
|
+ }
|
2015-06-13 01:03:31 +02:00
|
|
|
+#endif
|
2016-06-26 23:56:11 +02:00
|
|
|
+
|
2018-04-04 00:09:47 +02:00
|
|
|
/* Set custom environment options from pubkey authentication. */
|
|
|
|
if (options.permit_user_env) {
|
|
|
|
for (n = 0 ; n < auth_opts->nenv; n++) {
|