Bug 3931

Summary: Busybox issue: utmp not getting updated on exit for telnet command
Product: Busybox Reporter: Chandra <chandrak>
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

Description Chandra 2011-06-27 15:33:41 UTC
Linux@testing ~ # busybox
BusyBox v1.11.1 (2011-06-30 14:25:06 IST) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.



Unable to delete a non-root user by a root user. Throws error as the user is currently logged in, though it is not.

saying, userdel: user testmcc is currently logged in.  However,  the user session was no where active.


Linux@testing ~ # who
USER       TTY      IDLE      TIME            HOST
root       ttyS0    00:00     Jun 23 23:19:35
user1      pts/1    ?         Jun 24 00:39:27
testmcc    pts/0    ?         Jun 24 03:36:49
root       ttyS0    00:00     Jun 24 06:02:42
Linux@testing ~ # userdel testmcc
userdel: user testmcc is currently logged in
Linux@testing ~ #

Steps:
Can be reproduced using two systems ( one host and other target )

1. Add/create a user say "solution" (on target)
2. Set password for the same
3. From host, establish telnet session on to the target as non root user say, solution.
4, After successful connection establishment, logout of the session with exit.
5. Now, log on to the target as root user, delete user "solution"

Observe, the error as mentioned above,.

Dont hesitate to ask for more details to reproduce or debugging information. I would be glad to provide information and get resolution.

P.S: When ssh is used to connect the target system and logout, the utmp is getting updated. so i guess this issue is persistant only with Telnet.

Thanks,
Chandra K.
Comment 1 John Ata 2015-08-17 22:59:00 UTC
Is telnet using libutil's logout() routine to clear the utmp entries?  There is a limitation with the utmp routines (getutline, pututline) where the static buffer returned by getutline cannot be used as input into pututline since pututline reads the existing utmp entry into the static buffer before writing it.  If openssh is compiled to use libutil's logout, it has the same problem.  See bug #8306
Comment 2 Denys Vlasenko 2015-08-24 14:46:32 UTC
I think it is fixed in 1.17, specifically by this coomit:

commit 3a41611bc5ddeda6044e1f1e2956174b25389ce0
Author: Denys Vlasenko <vda.linux@googlemail.com>
Date:   Mon Apr 5 22:10:38 2010 +0200

    telnetd: write LOGIN/DEAD_PROCESS utmp records. Closes bug 1363