chiark / gitweb /
debianutils: Update from 4.8.3 to 4.8.4
[termux-packages] / packages / openssh / session.c.patch
1 diff -u -r ../openssh-7.7p1/session.c ./session.c
2 --- ../openssh-7.7p1/session.c  2018-04-02 07:38:28.000000000 +0200
3 +++ ./session.c 2018-04-03 23:46:30.670337636 +0200
4 @@ -199,7 +199,7 @@
5         temporarily_use_uid(pw);
6  
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");
10  
11         /* Create private directory for socket */
12         if (mkdtemp(auth_sock_dir) == NULL) {
13 @@ -802,7 +802,7 @@
14                 f = fopen(login_getcapstr(lc, "welcome", "/etc/motd",
15                     "/etc/motd"), "r");
16  #else
17 -               f = fopen("/etc/motd", "r");
18 +               f = fopen("@TERMUX_PREFIX@/etc/motd", "r");
19  #endif
20                 if (f) {
21                         while (fgets(buf, sizeof(buf), f))
22 @@ -1044,8 +1044,10 @@
23  # endif /* HAVE_CYGWIN */
24  #endif /* HAVE_LOGIN_CAP */
25  
26 +#ifdef _PATH_MAILDIR
27         snprintf(buf, sizeof buf, "%.200s/%.50s", _PATH_MAILDIR, pw->pw_name);
28         child_set_env(&env, &envsize, "MAIL", buf);
29 +#endif
30  
31         /* Normal systems set SHELL by default. */
32         child_set_env(&env, &envsize, "SHELL", shell);
33 @@ -1053,6 +1055,15 @@
34         if (getenv("TZ"))
35                 child_set_env(&env, &envsize, "TZ", getenv("TZ"));
36  
37 +#ifdef __ANDROID__
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);
43 +       }
44 +#endif
45 +
46         /* Set custom environment options from pubkey authentication. */
47         if (options.permit_user_env) {
48                 for (n = 0 ; n < auth_opts->nenv; n++) {