termux-packages/packages/openssh/session_c_tmpdir.patch

48 lines
1.7 KiB
Diff
Raw Normal View History

diff -u -r ../openssh-7.2p2/session.c ./session.c
--- ../openssh-7.2p2/session.c 2016-03-09 13:04:48.000000000 -0500
+++ ./session.c 2016-06-26 17:17:15.988592104 -0400
@@ -196,7 +196,7 @@
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) {
@@ -939,7 +939,7 @@
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))
@@ -1242,6 +1242,15 @@
if (getenv("TZ"))
child_set_env(&env, &envsize, "TZ", getenv("TZ"));
2015-06-13 01:03:31 +02:00
+#ifdef __ANDROID__
+ char const* envs_to_keep[] = {"LD_LIBRARY_PATH", "PATH", "ANDROID_ROOT", "ANDROID_DATA", "EXTERNAL_STORAGE", "LANG", "PREFIX"};
+ 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
+
/* Set custom environment options from RSA authentication. */
if (!options.use_login) {
while (custom_environment) {
@@ -1664,7 +1673,9 @@
2015-06-13 01:03:31 +02:00
* Close any extra file descriptors. Note that there may still be
* descriptors left by system functions. They will be closed later.
*/
+#ifndef __ANDROID__
endpwent();
+#endif
/*
* Close any extra open file descriptors so that we don't have them