version 1.9, 1999/11/24 00:26:02 |
version 1.10, 1999/11/24 19:53:47 |
|
|
#include <utmp.h> |
#include <utmp.h> |
#include "ssh.h" |
#include "ssh.h" |
|
|
/* Returns the time when the user last logged in. Returns 0 if the |
/* |
information is not available. This must be called before record_login. |
* Returns the time when the user last logged in. Returns 0 if the |
The host the user logged in from will be returned in buf. */ |
* information is not available. This must be called before record_login. |
|
* The host the user logged in from will be returned in buf. |
|
*/ |
|
|
/* Returns the time when the user last logged in (or 0 if no previous login |
/* |
is found). The name of the host used last time is returned in buf. */ |
* Returns the time when the user last logged in (or 0 if no previous login |
|
* is found). The name of the host used last time is returned in buf. |
|
*/ |
|
|
unsigned long |
unsigned long |
get_last_login_time(uid_t uid, const char *logname, |
get_last_login_time(uid_t uid, const char *logname, |
|
|
return ll.ll_time; |
return ll.ll_time; |
} |
} |
|
|
/* Records that the user has logged in. I these parts of operating systems |
/* |
were more standardized. */ |
* Records that the user has logged in. I these parts of operating systems |
|
* were more standardized. |
|
*/ |
|
|
void |
void |
record_login(int pid, const char *ttyname, const char *user, uid_t uid, |
record_login(int pid, const char *ttyname, const char *user, uid_t uid, |
|
|
|
|
/* Update lastlog unless actually recording a logout. */ |
/* Update lastlog unless actually recording a logout. */ |
if (strcmp(user, "") != 0) { |
if (strcmp(user, "") != 0) { |
/* It is safer to bzero the lastlog structure first |
/* |
because some systems might have some extra fields in it |
* It is safer to bzero the lastlog structure first because |
(e.g. SGI) */ |
* some systems might have some extra fields in it (e.g. SGI) |
|
*/ |
memset(&ll, 0, sizeof(ll)); |
memset(&ll, 0, sizeof(ll)); |
|
|
/* Update lastlog. */ |
/* Update lastlog. */ |