Bugzilla – Attachment 29 Details for
Bug 87
Last logon that gets reported upon login is the current login time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
There was an error in the previous patch - use this one
PATCH_2 (text/plain), 2.62 KB, created by
William Knox
on 2002-02-26 07:51:10 AEDT
(
hide
)
Description:
There was an error in the previous patch - use this one
Filename:
MIME Type:
Creator:
William Knox
Created:
2002-02-26 07:51:10 AEDT
Size:
2.62 KB
patch
obsolete
>--- session.c~ Sat Dec 1 18:37:08 2001 >+++ session.c Tue Jan 29 16:14:25 2002 >@@ -128,7 +128,7 @@ > void do_exec_pty(Session *, const char *); > void do_exec_no_pty(Session *, const char *); > void do_exec(Session *, const char *); >-void do_login(Session *, const char *); >+void do_login(Session *, const char *, const time_t, const char *); > #ifdef LOGIN_NEEDS_UTMPX > static void do_pre_login(Session *s); > #endif >@@ -548,11 +548,17 @@ > { > int fdout, ptyfd, ttyfd, ptymaster; > pid_t pid; >+ char hostname[MAXHOSTNAMELEN]; >+ time_t last_login_time; > > if (s == NULL) > fatal("do_exec_pty: no session"); > ptyfd = s->ptyfd; > ttyfd = s->ttyfd; >+ /* Get the time and hostname when the user last logged in. */ >+ hostname[0] = '\0'; >+ last_login_time = get_last_login_time(s->pw->pw_uid, s->pw->pw_name, >+ hostname, sizeof(hostname)); > > #if defined(USE_PAM) > do_pam_session(s->pw->pw_name, s->tty); >@@ -584,7 +590,7 @@ > /* record login, etc. similar to login(1) */ > #ifndef HAVE_OSF_SIA > if (!(options.use_login && command == NULL)) >- do_login(s, command); >+ do_login(s, command, last_login_time, hostname); > # ifdef LOGIN_NEEDS_UTMPX > else > do_pre_login(s); >@@ -682,13 +688,11 @@ > > /* administrative, login(1)-like work */ > void >-do_login(Session *s, const char *command) >+do_login(Session *s, const char *command, const time_t found_last_login_time, const char *last_host) > { > char *time_string; >- char hostname[MAXHOSTNAMELEN]; > socklen_t fromlen; > struct sockaddr_storage from; >- time_t last_login_time; > struct passwd * pw = s->pw; > pid_t pid = getpid(); > >@@ -706,13 +710,6 @@ > } > } > >- /* Get the time and hostname when the user last logged in. */ >- if (options.print_lastlog) { >- hostname[0] = '\0'; >- last_login_time = get_last_login_time(pw->pw_uid, pw->pw_name, >- hostname, sizeof(hostname)); >- } >- > /* Record that there was a login on that tty from the remote host. */ > record_login(pid, s->tty, pw->pw_name, pw->pw_uid, > get_remote_name_or_ip(utmp_len, options.reverse_mapping_check), >@@ -741,14 +738,14 @@ > printf("%s\n", aixloginmsg); > #endif /* WITH_AIXAUTHENTICATE */ > >- if (options.print_lastlog && last_login_time != 0) { >- time_string = ctime(&last_login_time); >+ if (options.print_lastlog && found_last_login_time != 0) { >+ time_string = ctime(&found_last_login_time); > if (strchr(time_string, '\n')) > *strchr(time_string, '\n') = 0; >- if (strcmp(hostname, "") == 0) >+ if (strcmp(last_host, "") == 0) > printf("Last login: %s\r\n", time_string); > else >- printf("Last login: %s from %s\r\n", time_string, hostname); >+ printf("Last login: %s from %s\r\n", time_string, last_host); > } > > do_motd();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 87
:
25
| 29