1 This preserves most of the old SunSSH locale negotiation
2 behaviour (at least the parts that are most commonly used).
4 --- hpn-ssh-hpn-18.4.2/servconf.c.orig
5 +++ hpn-ssh-hpn-18.4.2/servconf.c
7 options->client_alive_interval = -1;
8 options->client_alive_count_max = -1;
9 options->num_authkeys_files = 0;
10 - options->num_accept_env = 0;
11 + options->num_accept_env = -1;
12 options->num_setenv = 0;
13 options->permit_tun = -1;
14 options->permitted_opens = NULL;
16 options->max_sessions = DEFAULT_SESSIONS_MAX;
17 if (options->use_dns == -1)
19 + if (options->num_accept_env == -1) {
20 + options->num_accept_env = 0;
21 + opt_array_append("[default]", 0, "AcceptEnv",
22 + &options->accept_env, &options->num_accept_env,
24 + opt_array_append("[default]", 0, "AcceptEnv",
25 + &options->accept_env, &options->num_accept_env,
27 + opt_array_append("[default]", 0, "AcceptEnv",
28 + &options->accept_env, &options->num_accept_env,
30 + opt_array_append("[default]", 0, "AcceptEnv",
31 + &options->accept_env, &options->num_accept_env,
33 + opt_array_append("[default]", 0, "AcceptEnv",
34 + &options->accept_env, &options->num_accept_env,
36 + opt_array_append("[default]", 0, "AcceptEnv",
37 + &options->accept_env, &options->num_accept_env,
39 + opt_array_append("[default]", 0, "AcceptEnv",
40 + &options->accept_env, &options->num_accept_env,
42 + opt_array_append("[default]", 0, "AcceptEnv",
43 + &options->accept_env, &options->num_accept_env,
46 if (options->client_alive_interval == -1)
47 options->client_alive_interval = 0;
48 if (options->client_alive_count_max == -1)
49 @@ -2252,8 +2279,12 @@
50 fatal("%s line %d: Invalid environment name.",
53 + if (options->num_accept_env == -1)
54 + options->num_accept_env = 0;
57 + if (strcmp(arg, "none") == 0)
59 opt_array_append(filename, linenum, keyword,
60 &options->accept_env, &options->num_accept_env,
64 #define M_CP_STRARRAYOPT(s, num_s) do {\
66 - if (src->num_s != 0) { \
67 + if (src->num_s != 0 && src->num_s != -1) { \
68 for (i = 0; i < dst->num_s; i++) \
71 --- hpn-ssh-hpn-18.4.2/session.c.orig
72 +++ hpn-ssh-hpn-18.4.2/session.c
77 + * If the given environment variable is set in the daemon's environment,
78 + * push it into the new child as well. If it is unset, do nothing.
81 +child_inherit_env(char ***envp, u_int *envsizep, const char *name)
84 + if ((value = getenv(name)) != NULL)
85 + child_set_env(envp, envsizep, name, value);
89 * Reads environment variables from the given file and adds/overrides them
90 * into the environment. If the file does not exist, this does nothing.
91 * Otherwise, it must consist of empty lines, comments (line starts with '#')
92 @@ -1031,6 +1043,16 @@
93 ssh_gssapi_do_child(&env, &envsize);
96 + /* Default to the system-wide locale/language settings. */
97 + child_inherit_env(&env, &envsize, "LANG");
98 + child_inherit_env(&env, &envsize, "LC_ALL");
99 + child_inherit_env(&env, &envsize, "LC_CTYPE");
100 + child_inherit_env(&env, &envsize, "LC_COLLATE");
101 + child_inherit_env(&env, &envsize, "LC_TIME");
102 + child_inherit_env(&env, &envsize, "LC_NUMERIC");
103 + child_inherit_env(&env, &envsize, "LC_MONETARY");
104 + child_inherit_env(&env, &envsize, "LC_MESSAGES");
106 /* Set basic environment. */
107 for (i = 0; i < s->num_env; i++)
108 child_set_env(&env, &envsize, s->env[i].name, s->env[i].val);
109 @@ -1074,8 +1096,7 @@
110 /* Normal systems set SHELL by default. */
111 child_set_env(&env, &envsize, "SHELL", shell);
114 - child_set_env(&env, &envsize, "TZ", getenv("TZ"));
115 + child_inherit_env(&env, &envsize, "TZ");
117 child_set_env(&env, &envsize, "TERM", s->term);
119 --- hpn-ssh-hpn-18.4.2/sshd_config.orig
120 +++ hpn-ssh-hpn-18.4.2/sshd_config
125 +# Use the client's locale/language settings
126 +#AcceptEnv LANG LC_ALL LC_CTYPE LC_COLLATE LC_TIME LC_NUMERIC
127 +#AcceptEnv LC_MONETARY LC_MESSAGES
132 --- hpn-ssh-hpn-18.4.2/hpnsshd_config.5.orig
133 +++ hpn-ssh-hpn-18.4.2/hpnsshd_config.5
135 Be warned that some environment variables could be used to bypass restricted
137 For this reason, care should be taken in the use of this directive.
138 -The default is not to accept any environment variables.
139 +The default is to accept only
143 +family of environment variables. If any
145 +directives are present in your config file, they will replace this default
147 +ie, only the variables you list will be passed into the session's
150 +You can also use an argument of
152 +to specify that no environment variables should be passed.
154 Specifies which address family should be used by