support of locale

Darren Tucker dtucker at zip.com.au
Wed Jan 24 12:21:53 EST 2007


On Tue, Jan 23, 2007 at 04:37:23PM -0800, Carson Gaspar wrote:
> Darren Tucker wrote:
> > Cynthia K MULLIS wrote:
> >> When I ssh to a server, the locale information is set to "C" regardless
> >> of the settings in the /etc/default/init. 
> > 
> > OpenSSH's sshd does not parse /etc/default/init, so unless your shell 
> > does then you won't see them.
> > 
> > I don't know what normally parses it on Solaris, but if it's a PAM 
> > module then enabling PAM might help.
> 
> It's parsed by "init", oddly enough ;-)

Ah, right.  That would make sense :-)

> If you change /etc/default/init, you need to reboot (sadly, there is no 
> way to get init to re-read the config file). Then init will have the new 
> settings, and all children of init will inherit them.

OK, but unless you have sshd spawned out of inittab that still won't help
much.

> I haven't looked at the source to see if sshd will pass said environment 
> along to its children or not.

It doesn't, but it's not hard to make it do so, eg:

Index: session.c
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh/session.c,v
retrieving revision 1.349
diff -u -p -r1.349 session.c
--- session.c	23 Oct 2006 17:01:56 -0000	1.349
+++ session.c	24 Jan 2007 01:18:13 -0000
@@ -1024,6 +1024,15 @@ do_setup_env(Session *s, const char *she
 		free_windows_environment(p);
 	}
 #endif
+	{
+		char *var, *val, *localevar[] = { "LANG", "LC_CTYPE",
+		    "LC_NUMERIC", "LC_TIME", "LC_COLLATE", "LC_MONETARY",
+		    "LC_MESSAGES", "LC_ALL", NULL };
+
+		for (i = 0; (var = localevar[i]) != NULL; i++)
+			if ((val = getenv(var)) != NULL)
+				child_set_env(&env, &envsize, var, val);
+	}
 
 #ifdef GSSAPI
 	/* Allow any GSSAPI methods that we've used to alter

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list