diff options
Diffstat (limited to 'login.c')
-rw-r--r-- | login.c | 29 |
1 files changed, 18 insertions, 11 deletions
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: login.c,v 1.3 1999/11/24 13:26:22 damien Exp $"); | 21 | RCSID("$Id: login.c,v 1.4 1999/11/25 00:54:59 damien Exp $"); |
22 | 22 | ||
23 | #include <utmp.h> | 23 | #include <utmp.h> |
24 | #include "ssh.h" | 24 | #include "ssh.h" |
@@ -30,12 +30,16 @@ RCSID("$Id: login.c,v 1.3 1999/11/24 13:26:22 damien Exp $"); | |||
30 | # include <lastlog.h> | 30 | # include <lastlog.h> |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | /* Returns the time when the user last logged in. Returns 0 if the | 33 | /* |
34 | information is not available. This must be called before record_login. | 34 | * Returns the time when the user last logged in. Returns 0 if the |
35 | The host the user logged in from will be returned in buf. */ | 35 | * information is not available. This must be called before record_login. |
36 | * The host the user logged in from will be returned in buf. | ||
37 | */ | ||
36 | 38 | ||
37 | /* Returns the time when the user last logged in (or 0 if no previous login | 39 | /* |
38 | is found). The name of the host used last time is returned in buf. */ | 40 | * Returns the time when the user last logged in (or 0 if no previous login |
41 | * is found). The name of the host used last time is returned in buf. | ||
42 | */ | ||
39 | 43 | ||
40 | unsigned long | 44 | unsigned long |
41 | get_last_login_time(uid_t uid, const char *logname, | 45 | get_last_login_time(uid_t uid, const char *logname, |
@@ -64,8 +68,10 @@ get_last_login_time(uid_t uid, const char *logname, | |||
64 | return ll.ll_time; | 68 | return ll.ll_time; |
65 | } | 69 | } |
66 | 70 | ||
67 | /* Records that the user has logged in. I these parts of operating systems | 71 | /* |
68 | were more standardized. */ | 72 | * Records that the user has logged in. I these parts of operating systems |
73 | * were more standardized. | ||
74 | */ | ||
69 | 75 | ||
70 | void | 76 | void |
71 | record_login(int pid, const char *ttyname, const char *user, uid_t uid, | 77 | record_login(int pid, const char *ttyname, const char *user, uid_t uid, |
@@ -95,9 +101,10 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid, | |||
95 | 101 | ||
96 | /* Update lastlog unless actually recording a logout. */ | 102 | /* Update lastlog unless actually recording a logout. */ |
97 | if (strcmp(user, "") != 0) { | 103 | if (strcmp(user, "") != 0) { |
98 | /* It is safer to bzero the lastlog structure first | 104 | /* |
99 | because some systems might have some extra fields in it | 105 | * It is safer to bzero the lastlog structure first because |
100 | (e.g. SGI) */ | 106 | * some systems might have some extra fields in it (e.g. SGI) |
107 | */ | ||
101 | memset(&ll, 0, sizeof(ll)); | 108 | memset(&ll, 0, sizeof(ll)); |
102 | 109 | ||
103 | /* Update lastlog. */ | 110 | /* Update lastlog. */ |