NetBSD Problem Report #17803

Received: (qmail 24667 invoked by uid 605); 2 Aug 2002 03:16:58 -0000
Message-Id: <>
Date: 2 Aug 2002 03:16:56 -0000
Subject: logout() does not log out a tty logged in with login()
X-Send-Pr-Version: 3.95

>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:   Fri Aug 02 03:17:00 +0000 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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.