Bug 1030 - sshd writes twice to wtmp when "UseLogin" is yes
Summary: sshd writes twice to wtmp when "UseLogin" is yes
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 4.0p1
Hardware: HPPA HP-UX
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks: V_7_4
  Show dependency treegraph
 
Reported: 2005-05-05 14:38 AEST by Michael selvesteen
Modified: 2021-04-23 14:55 AEST (History)
2 users (show)

See Also:


Attachments
Patch for one wtmp entry if uselogin is enabled (1.87 KB, patch)
2005-05-05 15:54 AEST, senthilkumar
no flags Details | Diff
Optimized patch for HP-UX (1008 bytes, patch)
2005-05-11 22:10 AEST, senthilkumar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael selvesteen 2005-05-05 14:38:53 AEST
When "UseLogin" is set to yes, last command shows two entries for a single user.

example: 

last -5
michael  pts/0        Wed May  4 21:32   still logged in
michael  pts/0        Wed May  4 21:32   still logged in
michael  pts/0        Wed May  4 21:22 - 21:22  (00:00)
root     pts/tb       Wed May  4 21:21   still logged in
root     pts/ta       Wed May  4 21:18   still logged in
Comment 1 senthilkumar 2005-05-05 15:54:04 AEST
Created attachment 896 [details]
Patch for one wtmp entry if uselogin is enabled

This happens because login on invocation writes its own entry in wtmp files. To
avoid I made OpenSSH code not to write in the wtmp file if uselogin is enabled.
I like to hear comments on the approach for the attached patch. This solves the
problem in my system and Im not sure about any side effects? Also Im not sure
why the function login_utmp_only() is doing entry in wtmp?
Comment 2 Darren Tucker 2005-05-05 20:06:52 AEST
(In reply to comment #1)
> I like to hear comments on the approach for the attached patch. This solves
> the problem in my system and Im not sure about any side effects?

Well it will change the behaviour on other platforms.  Not sure if that will
break anything else or not.  Perhaps it ought to be enabled only on HP-UX?

>Also Im not sure why the function login_utmp_only() is doing entry in wtmp?

Not sure.  I looked in the CVS logs.  It's been that way for a long time (at
least since 2001).
Comment 3 senthilkumar 2005-05-11 22:10:30 AEST
Created attachment 908 [details]
Optimized patch for HP-UX

The patch is optimized and tested. I feel this duplicate entry problem occurs
only in HP-UX and not sure in other platforms which have LOGIN_NEEDS_UTMPX
defined in config.h of OpenSSH.
Comment 4 Damien Miller 2016-08-19 13:20:08 AEST
UseLogin is deprecated in OpenSSH 7.4
Comment 5 Damien Miller 2021-04-23 14:55:00 AEST
closing resolved bugs as of 8.6p1 release