Summary: | wtmp or utmp entry not being cleaned up after telnet session | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Jon M. Hanson <hansonj> |
Component: | [OLD] Core system | Assignee: | Gentoo Linux bug wranglers <bug-wranglers> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | CC: | bartron, seemant |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Jon M. Hanson
2003-05-09 11:57:32 UTC
what version of the telnet server ? how are you running the telnet server ? why are you using telnet ? :) Telnet server is version 0.17-r3. Telnet is spawned through xinetd (version 2.3.11). This is inside a trusted network (my home LAN) so I'm not concerned about using telnet in here. Over the Internet I always use SSH. Try enabling `Unix98 PTY support' (under Character devices) in the kernel config on the machine running telnetd (not to be confused with `/dev/pts' support under File systems). In case of the telnet connection, * telnetd calls openpty() to allocate a pty pair. * telnetd launches login, which calls ttyname(stdin) to obtain its terminal name. * login uses that info when filling in the utmp entry * after the session ends, telnetd tries to locate and clear its utmp entry by line name (using the value returned from openpty()) Without Unix98 PTYs, openpty() uses the bsd-style (non-devfs) naming when finding a free master pty (getpt) as well as when calculating the name of the slave (ptsname) and returns that name to the caller. But, since that's a symbolic link under devfs, ttyname() sees the dereferenced value when looking it up in `/proc/self/fd/'. In the above scenario, login writes `pty/s0' to utmp, while telnetd tries to wipe `ttyp0'. (with CONFIG_UNIX98_PTYS=y they'd both see `pts/0') Test program that demostrates this, run with Unix98 PTY support disabled: --- /* gcc -lutil -o pty_test pty_test.c */ #include <pty.h> #include <stdio.h> int main() { int masterfd,slavefd; char sname[4096]; if(openpty(&masterfd, &slavefd, sname, NULL, NULL)) { perror("openpty()"); return 1; } printf("openpty(): %s\n" "ttyname(): %s\n", sname, ttyname(slavefd)); return 0; } --- no feedback from user and proposed solution seems to work |