Bug 1032

Summary: PrintLastLog is not working with UseLogin yes
Product: Portable OpenSSH Reporter: senthilkumar <senthilkumar_sen>
Component: sshdAssignee: OpenSSH Bugzilla mailing list <openssh-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm, senthilkumar_sen
Priority: P2    
Version: 4.0p1   
Hardware: All   
OS: HP-UX   
Bug Depends on:    
Bug Blocks: 2594    
Attachments:
Description Flags
Print the Login messages if UseLogin is enabled
none
Update on patch for hpux
none
Optimized Patch for HP-UX
none
Patch with removed OS dependent prototypes none

Description senthilkumar 2005-05-06 17:33:11 AEST
The PrintLastLog directive is not displaying the Last Login messages when 
UseLogin is enabled.
Comment 1 senthilkumar 2005-05-06 18:34:36 AEST
Created attachment 899 [details]
Print the Login messages if UseLogin is enabled

The attached patch solves the problem in HP-UX. Im not sure about portability
problems on other platforms. Comments are welcome for the Patch. The problem is
that searching the wtmp record for Last Login is skipped when UseLogin is
enabled.
Comment 2 senthilkumar 2005-05-06 22:18:28 AEST
Created attachment 901 [details]
Update on patch for hpux

I feel it is specific for HP-UX. Hence a update in patch.
Comment 3 senthilkumar 2005-05-10 21:54:50 AEST
Created attachment 905 [details]
Optimized Patch for HP-UX

The current Patch is optimized and tested. Some unwanted declarations are
removed from the previous patch.
Comment 4 Damien Miller 2005-05-19 12:17:04 AEST
Comment on attachment 905 [details]
Optimized Patch for HP-UX

> #ifdef LOGIN_NEEDS_UTMPX
>-void   record_utmp_only(pid_t, const char *, const char *, const char *,
>+#ifdef __hpux
>+void   record_utmp_only(pid_t, const char *, const char *, uid_t, const char *,
>                struct sockaddr *, socklen_t);
>+#else
>+void    record_utmp_only(pid_t, const char *, const char *, const char *,
>+               struct sockaddr *, socklen_t);
>+#endif

The prototype should never be dependant on the OS in use - that is the whole
point of the loginrec.c code. Please read the long coment at the top of
loginrec.c.
Comment 5 senthilkumar 2005-05-24 22:11:06 AEST
Ok,let me remove the OS tag and make the change as global. Will this addition of 
one more argument creates problem in other platforms?

 u_long         get_last_login_time(uid_t, const char *, char *, u_int);

 #ifdef LOGIN_NEEDS_UTMPX
-void   record_utmp_only(pid_t, const char *, const char *, const char *,
+void   record_utmp_only(pid_t, const char *, const char *, uid_t, const char *,
                struct sockaddr *, socklen_t);
 #endif

Comment 6 Damien Miller 2005-05-24 22:39:52 AEST
Yes, that approach is fine - it is better to pass arguments that are unused on
some systems than make the list of arguments system dependant.
Comment 7 senthilkumar 2005-05-25 17:15:32 AEST
Created attachment 921 [details]
Patch with removed OS dependent prototypes

The patch is modified based on Damien's feedback. Let me know the comments.
Comment 8 Damien Miller 2016-08-19 13:20:35 AEST
UseLogin is deprecated in OpenSSH 7.4
Comment 9 Damien Miller 2021-04-23 14:58:49 AEST
closing resolved bugs as of 8.6p1 release