Subject: lib/17803: logout() does not log out a tty logged in with login()
To: None <>
From: None <>
List: netbsd-bugs
Date: 08/02/2002 03:16:56
>Number:         17803
>Category:       lib
>Synopsis:       logout() does not seem to log out a tty logged in with login()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 01 20:17:00 PDT 2002
>Originator:     dive
>Release:        NetBSD 1.6E
System: NetBSD 1.6E NetBSD 1.6E (EROS) #360: Sat Jul 27 06:51:10 EDT 2002 i386
Architecture: i386
Machine: i386
>Description:'s ssh 3.2.0 sshd2 server uses libutil login() and logout() to log
users in and out of utmp. For as long as I have been running's
sshd2, utmp hasn't been updated right (or at all)
at first, up to today, users never got entered into utmp at all when logging
in over ssh. a user could log in, and would never show up in w. this changed
after updating this morning, i believe due to the utmpx stuff. Now when a
user logs in to ssh, they show up in w/who correctly, but when they log out,
they leave a stale utmp entry, and w complains as such. I have tested with a
hand-rolled program to call logout("ttyXX"), and logout never logs out a
tty, no matter what it is called with. For example, I had 'ttyp2' with a
stale utmp entry, and tried logout("ttyp2") which returned 0, logout("p2")
returned 0, logout("/dev/ttyp2") returned 0.
I strings'd /var/run/utmpx and found ttyp2 with a '2' nearby, so tried
logoutx("ttyp2",2,2) (I am almost positive that the second and third
arguments aren't technically right, but there is no man page for logoutx)
and it worked.
To summarize, logout() should log out a tty if it was logged in with
login(). I checked through the ssh 3.2.0 server source, and it does *not*
use loginx, so there is no reason it should have to use logoutx to log the
tty out.
install ssh 3.2.0 from on a -current machine. observe problems with
utmp when users log in/out.
a workaround, albiet a kludgy one, is to make lib/sshsession/wtmp.c call
logoutx((char *)line,2,2) instead of logout((char *)line)
 current as of 20020801