[15695] in Athena Bugs

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

login and utmp

daemon@ATHENA.MIT.EDU (Brett David Rosen)
Mon Nov 24 18:12:31 1997

To: bugs@MIT.EDU
Date: Mon, 24 Nov 1997 18:12:27 EST
From: Brett David Rosen <bdrosen@MIT.EDU>


	This is a repeat of bugs 14795   .
In login.c, the order of pututline and pututxline is important
if you want to preserve certain information, such as the host.


ie under Solaris 2.6, non athena:
bigboote% finger
Login       Name               TTY         Idle    When    Where
root     Super-User            console     6:54 Mon 14:21  :0                  
bdrosen         ???            pts/3            Mon 17:52  COGSWORTH.MIT.EDU

on cogsworth, a 2.5.1 athenaized sun:

> /usr/bin/finger 
Login       Name               TTY         Idle    When    Where
bdrosen  Brett David Rosen     ttyp0       5:05 Mon 12:46  :0.0                
bdrosen  Brett David Rosen     pts/3            Mon 17:51 

(should say COGSWORTH.MIT.EDU under Where for the second entry)

I believe this diff should do the right thing.
(I haven't tested it)

> diff -c login.c login.c.old

*** login.c	Mon Nov 24 17:47:09 1997
--- login.c.old	Mon Nov 24 17:41:51 1997
***************
*** 1092,1098 ****
  	memcpy(utmpx.ut_id, new_id, sizeof(utmpx.ut_id));
      }
      utmpx.ut_syslen = strlen(utmpx.ut_host);
! 
      getutmp(&utmpx, &utmp); 
      setutent();
  /*  ut_tmp = getutline(&utmp); Doing this probably breaks Solaris,
--- 1092,1098 ----
  	memcpy(utmpx.ut_id, new_id, sizeof(utmpx.ut_id));
      }
      utmpx.ut_syslen = strlen(utmpx.ut_host);
!     pututxline(&utmpx);
      getutmp(&utmpx, &utmp); 
      setutent();
  /*  ut_tmp = getutline(&utmp); Doing this probably breaks Solaris,
***************
*** 1099,1105 ****
  	not doing it happens to work everywhere. You probably don't want
  	to know. */
      pututline(&utmp);
-     pututxline(&utmpx);
      if ((f = open("/usr/adm/wtmp", O_WRONLY|O_APPEND)) >= 0) {
  	write(f, (char *)&utmp, sizeof(utmp));
  	close(f);
--- 1099,1104 ----



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