--- inetutils-1.3.2g/telnetd/sys_term.c 2001-10-30 03:22:54.000000000 -0500 +++ inetutils-1.3.2g/telnetd-mk/sys_term.c 2002-04-01 23:33:48.000000000 -0500 @@ -2161,13 +2161,27 @@ SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1); utxp = getutxline(&utmpx); if (utxp) { + /* Hacked by Michael Kuyper + * It seems that telnetd doesn't update utmp/wtmp + * correctly. This patch fixes this. Now, the utmp + * record is updated with a record that has user and + * host set to NULL, and the same record is also + * appended to wtmp. + */ + utxp->ut_type = DEAD_PROCESS; utxp->ut_exit.e_termination = 0; utxp->ut_exit.e_exit = 0; - (void) time(&utmpx.ut_tv.tv_sec); - utmpx.ut_tv.tv_usec = 0; - //modutx(utxp); - updwtmpx(PATH_UTMP, utxp); + (void) time(&(utxp->ut_tv.tv_sec)); + utxp->ut_tv.tv_usec = 0; + + memset(utxp->ut_user,0,__UT_NAMESIZE); + memset(utxp->ut_host,0,__UT_HOSTSIZE); + + setutent(); + pututline(utxp); + + updwtmpx(PATH_WTMP, utxp); } endutxent(); } /* end of rmut */