[1040] in SIPB_Linux_Development

home help back first fref pref prev next nref lref last post

tracking down bug in rlogind

daemon@ATHENA.MIT.EDU (Daniel Bromberg)
Thu Aug 10 00:35:15 1995

To: linux-dev@MIT.EDU
Reply-To: ddaniel@vigor.jpl.nasa.gov
Date: Wed, 09 Aug 1995 21:34:53 PDT
From: Daniel Bromberg <ddaniel@yugo.MIT.EDU>


Hi, I've been figuring out why TERM isn't properly propogated from the
linux rlogind to the user's login environment.

In login.c of /mit/linux-athena/login.krb, we have:

#ifdef linux
	/* I dont understand how TERM is supposed to get set. */
	setenv("TERM", "console", 0);
#else
	if (term[0] == '\0')
		(void) strncpy(term, stypeof(tty), sizeof(term));
	(void)setenv("TERM", term, 0);
#endif

Regardless of whether the author (ghudson) understood at the time,
the else clause actually works. rlogind.c does this:

#ifdef KERBEROS
	if (eklogin)
	    (void) write(p, term, strlen(term)+1); /* stuff term info down
						      to login */
#endif /* KERBEROS */

then, login is exec'd, and login.c does this:
	getstr(term, sizeof(term), "Terminal type");

Thus term is properly initialized and the #ifdef linux part can be
taken out. I verified this in a short discussion with eichin and a
single test. Here's a patch.

--begin patch--
*** /mit/linux-athena/login.krb/login.c	Sat Aug 20 13:30:22 1994
--- login.krb/login.c	Wed Aug  9 21:16:00 1995
***************
*** 899,912 ****
  	setenv("USER", pwd->pw_name, 0);
  	setenv("SHELL", pwd->pw_shell, 0);
  
- #ifdef linux
- 	/* I dont understand how TERM is supposed to get set. */
- 	setenv("TERM", "console", 0);
- #else
  	if (term[0] == '\0')
  		(void) strncpy(term, stypeof(tty), sizeof(term));
  	(void)setenv("TERM", term, 0);
! #endif
  #ifdef KERBEROS
  	/* tkfile[0] is only set if we got tickets above */
  	if (tkfile[0])
--- 899,908 ----
  	setenv("USER", pwd->pw_name, 0);
  	setenv("SHELL", pwd->pw_shell, 0);
  
  	if (term[0] == '\0')
  		(void) strncpy(term, stypeof(tty), sizeof(term));
  	(void)setenv("TERM", term, 0);
! 
  #ifdef KERBEROS
  	/* tkfile[0] is only set if we got tickets above */
  	if (tkfile[0])
--end patch--

(Also, Sal, can you put the fixed compiled version of athena-login
into /mit/linux-athena/packages/athena-login so future installers
benefit from the bug fix? Thanks)

Cheers,
							Daniel

home help back first fref pref prev next nref lref last post