diff options
Diffstat (limited to 'login.c')
-rw-r--r-- | login.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -18,9 +18,14 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: login.c,v 1.5 1999/11/25 02:08:31 damien Exp $"); | 21 | RCSID("$Id: login.c,v 1.6 1999/12/08 23:16:55 damien Exp $"); |
22 | 22 | ||
23 | #include <utmp.h> | 23 | #ifdef HAVE_UTMPX_H |
24 | # include <utmpx.h> | ||
25 | #endif | ||
26 | #ifdef HAVE_UTMP_H | ||
27 | # include <utmp.h> | ||
28 | #endif | ||
24 | #include "ssh.h" | 29 | #include "ssh.h" |
25 | 30 | ||
26 | #ifdef HAVE_UTIL_H | 31 | #ifdef HAVE_UTIL_H |
@@ -83,15 +88,20 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid, | |||
83 | int fd; | 88 | int fd; |
84 | struct lastlog ll; | 89 | struct lastlog ll; |
85 | char *lastlog; | 90 | char *lastlog; |
86 | struct utmp u; | 91 | struct UTMP_STR u; |
87 | const char *utmp, *wtmp; | 92 | const char *utmp, *wtmp; |
88 | 93 | ||
89 | /* Construct an utmp/wtmp entry. */ | 94 | /* Construct an utmp/wtmp entry. */ |
90 | memset(&u, 0, sizeof(u)); | 95 | memset(&u, 0, sizeof(u)); |
91 | strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line)); | 96 | strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line)); |
97 | #ifdef HAVE_UTMPX_H | ||
98 | u.ut_tv.tv_sec = time(NULL); | ||
99 | strncpy(u.ut_user, user, sizeof(u.ut_name)); | ||
100 | #else | ||
92 | u.ut_time = time(NULL); | 101 | u.ut_time = time(NULL); |
93 | strncpy(u.ut_name, user, sizeof(u.ut_name)); | 102 | strncpy(u.ut_name, user, sizeof(u.ut_name)); |
94 | #ifdef HAVE_HOST_IN_UTMP | 103 | #endif |
104 | #if defined(HAVE_HOST_IN_UTMP) || defined(HAVE_HOST_IN_UTMPX) | ||
95 | strncpy(u.ut_host, host, sizeof(u.ut_host)); | 105 | strncpy(u.ut_host, host, sizeof(u.ut_host)); |
96 | #endif | 106 | #endif |
97 | 107 | ||