From owner-freebsd-bugs Fri May 10 11:10:25 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A1E8437B40A for ; Fri, 10 May 2002 11:10:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g4AIA1I81419; Fri, 10 May 2002 11:10:01 -0700 (PDT) (envelope-from gnats) Received: from nwww.freebsd.org (www.FreeBSD.org [216.136.204.117]) by hub.freebsd.org (Postfix) with ESMTP id CE1D237B400 for ; Fri, 10 May 2002 11:03:42 -0700 (PDT) Received: from www.freebsd.org (localhost [127.0.0.1]) by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g4AI5ShG005036 for ; Fri, 10 May 2002 11:05:28 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.2/8.12.2/Submit) id g4AI5SI1005035; Fri, 10 May 2002 11:05:28 -0700 (PDT) Message-Id: <200205101805.g4AI5SI1005035@www.freebsd.org> Date: Fri, 10 May 2002 11:05:28 -0700 (PDT) From: Sandeep Kumar To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/37934: w command still shows the user logged in, even after the telnet session has been closed. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 37934 >Category: bin >Synopsis: w command still shows the user logged in, even after the telnet session has been closed. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri May 10 11:10:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Sandeep Kumar >Release: 4.2 >Organization: Juniper Networks >Environment: FreeBSD foobar.juniper.net 4.2-RELEASE FreeBSD 4.2-RELEASE #0 >Description: w shows the user still logged in, because logout wtmp entry not being added by telnetd. >How-To-Repeat: Open and close telnet sessions and then execute a w command on the destination machine. You may find a "Still logged in" entry for the closed session. >Fix: Block all signals before clearing the utmp entry. We don't want to be called again after calling logout() and then not add the wtmp entry because of not finding the corresponding entry in utmp. Here is the unified diff for the fix. Index: libexec/telnetd/sys_term.c =================================================================== retrieving revision 1.3 retrieving revision 1.4 diff -p -u -r1.3 -r1.4 --- libexec/telnetd/sys_term.c 2002/01/09 18:18:13 1.3 +++ libexec/telnetd/sys_term.c 2002/02/11 21:00:28 1.4 @@ -1839,8 +1839,16 @@ cleanup(sig) #ifndef PARENT_DOES_UTMP # if (BSD > 43) || defined(convex) char *p; + sigset_t mask; p = line + sizeof(_PATH_DEV) - 1; + + /* Block all signals before clearing the utmp entry. We don't want + * to be called again after calling logout() and then not add the wtmp + * entry because of not finding the corresponding entry in utmp. + */ + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, (sigset_t *) 0); if (logout(p)) logwtmp(p, "", ""); (void)chmod(line, 0666); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message