Bug 1032 - PrintLastLog is not working with UseLogin yes
Summary: PrintLastLog is not working with UseLogin yes
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 4.0p1
Hardware: All HP-UX
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks: V_7_4
  Show dependency treegraph
 
Reported: 2005-05-06 17:33 AEST by senthilkumar
Modified: 2021-04-23 14:58 AEST (History)
2 users (show)

See Also:


Attachments
Print the Login messages if UseLogin is enabled (2.21 KB, patch)
2005-05-06 18:34 AEST, senthilkumar
no flags Details | Diff
Update on patch for hpux (3.04 KB, patch)
2005-05-06 22:18 AEST, senthilkumar
no flags Details | Diff
Optimized Patch for HP-UX (2.62 KB, patch)
2005-05-10 21:54 AEST, senthilkumar
no flags Details | Diff
Patch with removed OS dependent prototypes (2.13 KB, patch)
2005-05-25 17:15 AEST, senthilkumar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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