diff options
author | markm <markm@FreeBSD.org> | 1999-09-19 14:19:32 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 1999-09-19 14:19:32 +0000 |
commit | fe83e8abf357ee11114856a5278bb38431a9517c (patch) | |
tree | 36ce70fe2e8419130e546c38a7790e8ab224a362 /crypto/kerberosIV/appl/ftp/ftpd/logwtmp.c | |
parent | a8a89cfaf983bc64f4b42f7c35209a5a36dd0fe8 (diff) | |
download | FreeBSD-src-fe83e8abf357ee11114856a5278bb38431a9517c.zip FreeBSD-src-fe83e8abf357ee11114856a5278bb38431a9517c.tar.gz |
Clean import of KTH krb4-0.10.1.
Diffstat (limited to 'crypto/kerberosIV/appl/ftp/ftpd/logwtmp.c')
-rw-r--r-- | crypto/kerberosIV/appl/ftp/ftpd/logwtmp.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/crypto/kerberosIV/appl/ftp/ftpd/logwtmp.c b/crypto/kerberosIV/appl/ftp/ftpd/logwtmp.c index 95ab216..d948a5a 100644 --- a/crypto/kerberosIV/appl/ftp/ftpd/logwtmp.c +++ b/crypto/kerberosIV/appl/ftp/ftpd/logwtmp.c @@ -38,7 +38,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> -RCSID("$Id: logwtmp.c,v 1.10 1997/05/25 15:17:56 assar Exp $"); +RCSID("$Id: logwtmp.c,v 1.13 1999/03/01 09:49:37 joda Exp $"); #endif #include <stdio.h> @@ -74,18 +74,20 @@ RCSID("$Id: logwtmp.c,v 1.10 1997/05/25 15:17:56 assar Exp $"); #endif void -logwtmp(char *line, char *name, char *host) +ftpd_logwtmp(char *line, char *name, char *host) { static int init = 0; - static int fd, fdx; - struct timeval tv; + static int fd; +#ifdef WTMPX_FILE + static int fdx; +#endif struct utmp ut; #ifdef WTMPX_FILE struct utmpx utx; #endif memset(&ut, 0, sizeof(struct utmp)); -#ifdef HAVE_UT_TYPE +#ifdef HAVE_STRUCT_UTMP_UT_TYPE if(name[0]) ut.ut_type = USER_PROCESS; else @@ -93,10 +95,10 @@ logwtmp(char *line, char *name, char *host) #endif strncpy(ut.ut_line, line, sizeof(ut.ut_line)); strncpy(ut.ut_name, name, sizeof(ut.ut_name)); -#ifdef HAVE_UT_PID +#ifdef HAVE_STRUCT_UTMP_UT_PID ut.ut_pid = getpid(); #endif -#ifdef HAVE_UT_HOST +#ifdef HAVE_STRUCT_UTMP_UT_HOST strncpy(ut.ut_host, host, sizeof(ut.ut_host)); #endif ut.ut_time = time(NULL); @@ -105,14 +107,18 @@ logwtmp(char *line, char *name, char *host) strncpy(utx.ut_line, line, sizeof(utx.ut_line)); strncpy(utx.ut_user, name, sizeof(utx.ut_user)); strncpy(utx.ut_host, host, sizeof(utx.ut_host)); -#ifdef HAVE_UT_SYSLEN +#ifdef HAVE_STRUCT_UTMPX_UT_SYSLEN utx.ut_syslen = strlen(host) + 1; if (utx.ut_syslen > sizeof(utx.ut_host)) utx.ut_syslen = sizeof(utx.ut_host); #endif - gettimeofday (&tv, 0); - utx.ut_tv.tv_sec = tv.tv_sec; - utx.ut_tv.tv_usec = tv.tv_usec; + { + struct timeval tv; + + gettimeofday (&tv, 0); + utx.ut_tv.tv_sec = tv.tv_sec; + utx.ut_tv.tv_usec = tv.tv_usec; + } if(name[0]) utx.ut_type = USER_PROCESS; |