version 1.13.6.1, 2006/10/06 03:19:33 |
version 1.14, 2006/03/19 18:51:19 |
|
|
/* $OpenBSD$ */ |
|
/* |
/* |
* Author: Tatu Ylonen <ylo@cs.hut.fi> |
* Author: Tatu Ylonen <ylo@cs.hut.fi> |
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
*/ |
|
|
#include <sys/types.h> |
#include "includes.h" |
#include <sys/param.h> |
|
#include <sys/socket.h> |
|
|
|
#include <errno.h> |
|
#include <fcntl.h> |
|
#include <stdio.h> |
|
#include <string.h> |
|
#include <time.h> |
|
#include <unistd.h> |
|
#include <util.h> |
#include <util.h> |
#include <utmp.h> |
#include <utmp.h> |
#include <stdarg.h> |
|
|
|
#include "sshlogin.h" |
#include "sshlogin.h" |
#include "log.h" |
#include "log.h" |
#include "buffer.h" |
#include "buffer.h" |
|
|
* information is not available. This must be called before record_login. |
* information is not available. This must be called before record_login. |
* The host the user logged in from will be returned in buf. |
* The host the user logged in from will be returned in buf. |
*/ |
*/ |
time_t |
u_long |
get_last_login_time(uid_t uid, const char *logname, |
get_last_login_time(uid_t uid, const char *logname, |
char *buf, size_t bufsize) |
char *buf, u_int bufsize) |
{ |
{ |
struct lastlog ll; |
struct lastlog ll; |
char *lastlog; |
char *lastlog; |
|
|
bufsize = sizeof(ll.ll_host) + 1; |
bufsize = sizeof(ll.ll_host) + 1; |
strncpy(buf, ll.ll_host, bufsize - 1); |
strncpy(buf, ll.ll_host, bufsize - 1); |
buf[bufsize - 1] = '\0'; |
buf[bufsize - 1] = '\0'; |
return (time_t)ll.ll_time; |
return ll.ll_time; |
} |
} |
|
|
/* |
/* |
|
|
*/ |
*/ |
void |
void |
record_login(pid_t pid, const char *tty, const char *user, uid_t uid, |
record_login(pid_t pid, const char *tty, const char *user, uid_t uid, |
const char *host, struct sockaddr *addr, socklen_t addrlen) |
const char *host, struct sockaddr * addr, socklen_t addrlen) |
{ |
{ |
int fd; |
int fd; |
struct lastlog ll; |
struct lastlog ll; |