add some more #ifdefs to compile on utmpx only systems
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
This commit is contained in:

committed by
Love Hornquist Astrand

parent
ef90819a9a
commit
6f5b42957e
@@ -64,6 +64,7 @@ RCSID("$Id$");
|
|||||||
#include <roken.h>
|
#include <roken.h>
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_UTMPX_H
|
||||||
#ifndef WTMP_FILE
|
#ifndef WTMP_FILE
|
||||||
#ifdef _PATH_WTMP
|
#ifdef _PATH_WTMP
|
||||||
#define WTMP_FILE _PATH_WTMP
|
#define WTMP_FILE _PATH_WTMP
|
||||||
@@ -71,6 +72,7 @@ RCSID("$Id$");
|
|||||||
#define WTMP_FILE "/var/adm/wtmp"
|
#define WTMP_FILE "/var/adm/wtmp"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ASL_H
|
#ifdef HAVE_ASL_H
|
||||||
|
|
||||||
@@ -109,11 +111,17 @@ ftpd_logwtmp_wtmp(char *line, char *name, char *host)
|
|||||||
#ifdef WTMPX_FILE
|
#ifdef WTMPX_FILE
|
||||||
static int fdx;
|
static int fdx;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_UTMP_H
|
||||||
struct utmp ut;
|
struct utmp ut;
|
||||||
#ifdef WTMPX_FILE
|
#endif
|
||||||
|
#if defined(WTMPX_FILE) || defined(HAVE_UTMPX_H)
|
||||||
struct utmpx utx;
|
struct utmpx utx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UTMPX_H
|
||||||
|
memset(&utx, 0, sizeof(struct utmpx));
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UTMP_H
|
||||||
memset(&ut, 0, sizeof(struct utmp));
|
memset(&ut, 0, sizeof(struct utmp));
|
||||||
#ifdef HAVE_STRUCT_UTMP_UT_TYPE
|
#ifdef HAVE_STRUCT_UTMP_UT_TYPE
|
||||||
if(name[0])
|
if(name[0])
|
||||||
@@ -130,8 +138,9 @@ ftpd_logwtmp_wtmp(char *line, char *name, char *host)
|
|||||||
strncpy(ut.ut_host, host, sizeof(ut.ut_host));
|
strncpy(ut.ut_host, host, sizeof(ut.ut_host));
|
||||||
#endif
|
#endif
|
||||||
ut.ut_time = time(NULL);
|
ut.ut_time = time(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WTMPX_FILE
|
#if defined(WTMPX_FILE) || defined(HAVE_UTMPX_H)
|
||||||
strncpy(utx.ut_line, line, sizeof(utx.ut_line));
|
strncpy(utx.ut_line, line, sizeof(utx.ut_line));
|
||||||
strncpy(utx.ut_user, name, sizeof(utx.ut_user));
|
strncpy(utx.ut_user, name, sizeof(utx.ut_user));
|
||||||
strncpy(utx.ut_host, host, sizeof(utx.ut_host));
|
strncpy(utx.ut_host, host, sizeof(utx.ut_host));
|
||||||
@@ -154,15 +163,23 @@ ftpd_logwtmp_wtmp(char *line, char *name, char *host)
|
|||||||
utx.ut_type = DEAD_PROCESS;
|
utx.ut_type = DEAD_PROCESS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UTMPX_H
|
||||||
|
pututxline(&utx);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(!init){
|
if(!init){
|
||||||
|
#ifdef WTMP_FILE
|
||||||
fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0);
|
fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0);
|
||||||
|
#endif
|
||||||
#ifdef WTMPX_FILE
|
#ifdef WTMPX_FILE
|
||||||
fdx = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0);
|
fdx = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0);
|
||||||
#endif
|
#endif
|
||||||
init = 1;
|
init = 1;
|
||||||
}
|
}
|
||||||
if(fd >= 0) {
|
if(fd >= 0) {
|
||||||
|
#ifdef WTMP_FILE
|
||||||
write(fd, &ut, sizeof(struct utmp)); /* XXX */
|
write(fd, &ut, sizeof(struct utmp)); /* XXX */
|
||||||
|
#endif
|
||||||
#ifdef WTMPX_FILE
|
#ifdef WTMPX_FILE
|
||||||
write(fdx, &utx, sizeof(struct utmpx));
|
write(fdx, &utx, sizeof(struct utmpx));
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user