Bug 488271 - telnetd does not update utmp before spawning login
Summary: telnetd does not update utmp before spawning login
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: telnet
Version: 5.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Adam Tkac
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks: 748705
TreeView+ depends on / blocked
 
Reported: 2009-03-03 16:12 UTC by Olivier Fourdan
Modified: 2018-11-14 18:34 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 748705 (view as bug list)
Environment:
Last Closed: 2009-12-23 01:39:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (1.48 KB, patch)
2009-03-03 16:12 UTC, Olivier Fourdan
no flags Details | Diff

Description Olivier Fourdan 2009-03-03 16:12:14 UTC
Created attachment 333884 [details]
Proposed patch

Description of problem:

telnetd does not create an appropriate entry in utmp file before spawning login.

As a result, it leaves empty entries in the utmp file that get never reused.

Version-Release number of selected component (if applicable):

telnet-server-0.17-39.el5.i386.rpm

How reproducible:

100% reprducible

Steps to Reproduce:
1. open several login with telnet
2. close
3. reopen new connections
  
Actual results:

=> An new entry is added instead of reusing the previous emptied one.

1. On a testsystem, empty the utmp log entirely (not required, but easier to read)

    # > /var/run/utmp
    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp

2. Login from telnet

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28326] [5   ] [ofourdan] [pts/5       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:36 2009 BST]

3. Again

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28326] [5   ] [ofourdan] [pts/5       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:36 2009 BST]
    [7] [28363] [6   ] [ofourdan] [pts/6       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:48 2009 BST]


4. And again

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28326] [5   ] [ofourdan] [pts/5       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:36 2009 BST]
    [7] [28363] [6   ] [ofourdan] [pts/6       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:48 2009 BST]
    [7] [28400] [8   ] [ofourdan] [pts/8       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:56 2009 BST]

5. Close first connection

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28326] [5   ] [ofourdan] [pts/5       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:36 2009 BST]
    [8] [28363] [6   ] [        ] [pts/6       ] [                    ] [127.0.0.1      ] [Tue Mar 03 19:47:04 2009 BST]
    [7] [28400] [8   ] [ofourdan] [pts/8       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:56 2009 BST]

6. Relogin

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28326] [5   ] [ofourdan] [pts/5       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:36 2009 BST]
    [8] [28363] [6   ] [        ] [pts/6       ] [                    ] [127.0.0.1      ] [Tue Mar 03 19:47:04 2009 BST]
    [7] [28400] [8   ] [ofourdan] [pts/8       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:46:56 2009 BST]
    [7] [28440] [6   ] [ofourdan] [pts/6       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:47:12 2009 BST]

Expected results:

The empty entries get reused.

1. On a testsystem, empty the utmp log entirely (not required, but easier to read)

    # > /var/run/utmp
    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp

2. Login from telnet

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28550] [8   ] [ofourdan] [pts/8       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:48:54 2009 BST]

3. Again

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28550] [8   ] [ofourdan] [pts/8       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:48:54 2009 BST]
    [7] [28587] [9   ] [ofourdan] [pts/9       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:49:13 2009 BST]

4. And again

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28550] [8   ] [ofourdan] [pts/8       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:48:54 2009 BST]
    [7] [28587] [9   ] [ofourdan] [pts/9       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:49:13 2009 BST]
    [7] [28624] [10  ] [ofourdan] [pts/10      ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:49:23 2009 BST]

5. Close first connection

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [8] [28550] [8   ] [        ] [pts/8       ] [                    ] [127.0.0.1      ] [Tue Mar 03 19:49:33 2009 BST]
    [7] [28587] [9   ] [ofourdan] [pts/9       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:49:13 2009 BST]
    [7] [28624] [10  ] [ofourdan] [pts/10      ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:49:23 2009 BST]

6. Relogin

    # utmpdump /var/run/utmp | tail -10
    Utmp dump of /var/run/utmp
    [7] [28664] [8   ] [ofourdan] [pts/8       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:49:43 2009 BST]
    [7] [28587] [9   ] [ofourdan] [pts/9       ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:49:13 2009 BST]
    [7] [28624] [10  ] [ofourdan] [pts/10      ] [localhost.localdomain] [127.0.0.1      ] [Tue Mar 03 19:49:23 2009 BST]

Additional info:

Other daemons (agetty, sshd) prepare an appropriate entry in utmp for login to pick up, but telnetd doesn't.

As a result, login itself will add a new entry inutmp each time a telnet connection is initiated.

The proposed patch adds this missing bit to telnetd so that no "hole" is created in utmp when using telnet.

Please note that the problem is present in upstream code also.

Comment 3 Adam Tkac 2009-05-11 14:07:19 UTC
I haven't tested patch yet but it looks fine. Thanks.


Note You need to log in before you can comment on or make changes to this bug.