Bug 21146 - [patch] openssh with LOGIN_CAP don't setup LANG & MM_CHARSET into environment
Summary: [patch] openssh with LOGIN_CAP don't setup LANG & MM_CHARSET into environment
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Dirk Meyer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-09-09 12:00 UTC by Dmitry A Grigorovich
Modified: 2001-06-25 15:20 UTC (History)
0 users

See Also:


Attachments
patch-au (11.12 KB, text/plain)
2000-09-09 12:00 UTC, Dmitry A Grigorovich
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry A Grigorovich 2000-09-09 12:00:01 UTC
I builded openssh with variable LOGIN_CAP=YES
This give me a chance to using login capabilities in FreeBSD with openssh
But some of login capabilities does not work

For example, I assign russian class for user
Russian class defined at /etc/logon.conf:
russian:Russian Users Accounts:\
        :charset=KOI8-R:\
        :lang=ru_RU.KOI8-R:\
        :tc=default:

This adds two environment variables into environment of user: LANG & MM_CHARSET, when used standard login via telnet or console

However when used openssh, then sshd does not setup LANG & MM_CHARSET into environment for user in russian class

Code for this operation does not exists in openssh port !

You may apply next very small patch to already patched openssh port,
then rebuild and reinstall openssh port to fix problem

--- session.c.orig	Tue Aug 29 14:07:20 2000
+++ session.c	Tue Aug 29 15:06:09 2000
@@ -901,6 +901,10 @@
 	env[0] = NULL;
 
 	if (!options.use_login) {
+#ifdef LOGIN_CAP
+		char *var;
+#endif /* LOGIN_CAP */
+
 		/* Set basic environment. */
 		child_set_env(&env, &envsize, "USER", pw->pw_name);
 		child_set_env(&env, &envsize, "LOGNAME", pw->pw_name);
@@ -908,6 +912,12 @@
 #ifdef LOGIN_CAP
 		child_set_env(&env, &envsize, "PATH",
 		    login_getpath(lc, "path", _PATH_STDPATH));
+		var= login_getcapstr(lc, "lang", NULL, NULL);
+		if ( var ) child_set_env(&env, &envsize, "LANG", var);
+		var= login_getcapstr(lc, "charset", NULL, NULL);
+		if ( var ) child_set_env(&env, &envsize, "MM_CHARSET", var);
+		var= login_getcapstr(lc, "timezone", NULL, NULL);
+		if ( var ) child_set_env(&env, &envsize, "TZ", var);
 #else /* LOGIN_CAP */
 		child_set_env(&env, &envsize, "PATH", _PATH_STDPATH);
 #endif /* LOGIN_CAP */
@@ -919,8 +929,11 @@
 		/* Normal systems set SHELL by default. */
 		child_set_env(&env, &envsize, "SHELL", shell);
 	}
+#ifdef LOGIN_CAP
+#else /* LOGIN_CAP */
 	if (getenv("TZ"))
 		child_set_env(&env, &envsize, "TZ", getenv("TZ"));
+#endif /* LOGIN_CAP */
 
 	/* Set custom environment options from RSA authentication. */
 	while (custom_environment) {

Fix: cd /usr/ports/security/openssh/patches
Replace original patch file 'patch-au' with next file
Rebuild and reinstall openssh port
How-To-Repeat: Build and install openssh port with LOGIN_CAP:
cd /usr/ports/security/openssh
LOGIN_CAP=YES make build install

Using chpass setup russian class for user joe

Login as joe to openssh

Test environment for variables LANG & MM_CHARSET:
echo $LANG
echo $MM_CHARSET

This variables does not defined !!!
Comment 1 Ade Lovett freebsd_committer freebsd_triage 2000-09-18 22:02:03 UTC
Responsible Changed
From-To: freebsd-ports->green

Over to maintainer
Comment 2 dwcjr 2001-06-25 05:46:09 UTC
There are two new openssh ports now, does this apply to either of them 
since they have both been updated recently?
Comment 3 dwcjr freebsd_committer freebsd_triage 2001-06-25 05:46:54 UTC
Responsible Changed
From-To: green->dinoex

Over to new maintainer
Comment 4 Dirk Meyer freebsd_committer freebsd_triage 2001-06-25 07:29:10 UTC
State Changed
From-To: open->closed

Committed, Thanks
Comment 5 Dmitry A Grigorovich 2001-06-25 07:41:42 UTC
> -----Original Message-----
> From: David W. Chapman Jr. [mailto:dwcjr@inethouston.net]
> Sent: Monday, June 25, 2001 11:46 AM
> To: freebsd-gnats-submit@FreeBSD.org; odip@bionet.nsc.ru; 
> dinoex@FreeBSD.org; dwcjr@inethouston.net
> Subject: Re: ports/21146: [patch] openssh with LOGIN_CAP 
> don't setup LANG & MM_CHARSET into environment
> 
> 
> There are two new openssh ports now, does this apply to 
> either of them 
> since they have both been updated recently?

This patch applied only to FreeBSD-3-STABLE branch and openssh port on it

FreeBSD-4-STABLE have openssh inserted into main src tree
and doesn't have this bug - login and sshd rewriten 
- environments variables are setuped correctly

[ODiP] == Dmitry Grigorovich