diff options
Diffstat (limited to 'sshlogin.c')
-rw-r--r-- | sshlogin.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/sshlogin.c b/sshlogin.c index 15eb916d1..0059ff8d0 100644 --- a/sshlogin.c +++ b/sshlogin.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: sshlogin.c,v 1.25 2006/08/03 03:34:42 deraadt Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -39,7 +40,20 @@ | |||
39 | */ | 40 | */ |
40 | 41 | ||
41 | #include "includes.h" | 42 | #include "includes.h" |
42 | RCSID("$OpenBSD: sshlogin.c,v 1.13 2004/08/12 09:18:24 djm Exp $"); | 43 | |
44 | #include <sys/types.h> | ||
45 | #include <sys/param.h> | ||
46 | #include <sys/socket.h> | ||
47 | |||
48 | #include <netinet/in.h> | ||
49 | |||
50 | #include <errno.h> | ||
51 | #include <fcntl.h> | ||
52 | #include <stdarg.h> | ||
53 | #include <stdio.h> | ||
54 | #include <string.h> | ||
55 | #include <time.h> | ||
56 | #include <unistd.h> | ||
43 | 57 | ||
44 | #include "loginrec.h" | 58 | #include "loginrec.h" |
45 | #include "log.h" | 59 | #include "log.h" |
@@ -54,15 +68,15 @@ extern ServerOptions options; | |||
54 | * information is not available. This must be called before record_login. | 68 | * information is not available. This must be called before record_login. |
55 | * The host the user logged in from will be returned in buf. | 69 | * The host the user logged in from will be returned in buf. |
56 | */ | 70 | */ |
57 | u_long | 71 | time_t |
58 | get_last_login_time(uid_t uid, const char *logname, | 72 | get_last_login_time(uid_t uid, const char *logname, |
59 | char *buf, u_int bufsize) | 73 | char *buf, size_t bufsize) |
60 | { | 74 | { |
61 | struct logininfo li; | 75 | struct logininfo li; |
62 | 76 | ||
63 | login_get_lastlog(&li, uid); | 77 | login_get_lastlog(&li, uid); |
64 | strlcpy(buf, li.hostname, bufsize); | 78 | strlcpy(buf, li.hostname, bufsize); |
65 | return li.tv_sec; | 79 | return (time_t)li.tv_sec; |
66 | } | 80 | } |
67 | 81 | ||
68 | /* | 82 | /* |
@@ -103,7 +117,7 @@ store_lastlog_message(const char *user, uid_t uid) | |||
103 | */ | 117 | */ |
104 | void | 118 | void |
105 | record_login(pid_t pid, const char *tty, const char *user, uid_t uid, | 119 | record_login(pid_t pid, const char *tty, const char *user, uid_t uid, |
106 | const char *host, struct sockaddr * addr, socklen_t addrlen) | 120 | const char *host, struct sockaddr *addr, socklen_t addrlen) |
107 | { | 121 | { |
108 | struct logininfo *li; | 122 | struct logininfo *li; |
109 | 123 | ||
@@ -119,7 +133,7 @@ record_login(pid_t pid, const char *tty, const char *user, uid_t uid, | |||
119 | #ifdef LOGIN_NEEDS_UTMPX | 133 | #ifdef LOGIN_NEEDS_UTMPX |
120 | void | 134 | void |
121 | record_utmp_only(pid_t pid, const char *ttyname, const char *user, | 135 | record_utmp_only(pid_t pid, const char *ttyname, const char *user, |
122 | const char *host, struct sockaddr * addr, socklen_t addrlen) | 136 | const char *host, struct sockaddr *addr, socklen_t addrlen) |
123 | { | 137 | { |
124 | struct logininfo *li; | 138 | struct logininfo *li; |
125 | 139 | ||