Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 May 2002 11:05:28 -0700 (PDT)
From:      Sandeep Kumar <skumar@juniper.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/37934: w command still shows the user logged in, even after the telnet session has been closed.
Message-ID:  <200205101805.g4AI5SI1005035@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205101805.g4AI5SI1005035>