From ec496817f8fa28369c608eb1651dc24d0aee0e78 Mon Sep 17 00:00:00 2001 From: Mark Eichin Date: Tue, 26 Jul 1994 06:18:07 +0000 Subject: [PATCH] some more solaris cleanup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4016 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 7 +++++++ src/appl/bsd/configure.in | 13 +++++++++++++ src/appl/bsd/krlogin.c | 3 ++- src/appl/bsd/logutil.c | 28 ++++++++++++++++------------ 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index d2bc139d4..a0dac85f0 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,5 +1,12 @@ Tue Jul 26 00:25:57 1994 Mark Eichin (eichin@cygnus.com) + * krlogin.c: include + + * configure.in: Added tests for NO_UT_HOST, NO_UT_EXIT. + * logutil.c: use them. + + * configure.in: add CHECK_DIRENT, CHECK_FCNTL. + * configure.in: Added tests for HAVE_SETOWN, HAVE_SYS_FILIO_H. * krlogin.c, krsh.c, krshd.c, krlogin.c, krlogind.c: use them. diff --git a/src/appl/bsd/configure.in b/src/appl/bsd/configure.in index bbba8b8bd..cf1322d45 100644 --- a/src/appl/bsd/configure.in +++ b/src/appl/bsd/configure.in @@ -8,12 +8,25 @@ AC_PROG_INSTALL AC_HAVE_LIBRARY(socket) AC_HAVE_LIBRARY(nsl) AC_FUNC_CHECK(utimes,AC_DEFINE(HAS_UTIMES)) +AC_FUNC_CHECK(getutent,AC_DEFINE(HAVE_GETUTENT)) AC_HAVE_HEADERS(sys/filio.h) +CHECK_DIRENT +CHECK_FCNTL AC_COMPILE_CHECK([F_SETOWN], [#include #include ], [1+F_SETOWN;], AC_DEFINE(HAVE_SETOWN)) +AC_COMPILE_CHECK([ut_host in struct utmp], +[#include ], +[struct utmp ut; ut.ut_host;], +, +AC_DEFINE(NO_UT_HOST)) +AC_COMPILE_CHECK([ut_exit in struct utmp], +[#include ], +[struct utmp ut; ut.ut_exit;], +, +AC_DEFINE(NO_UT_EXIT)) KRB_INCLUDE WITH_KRB5ROOT WITH_KRB4 diff --git a/src/appl/bsd/krlogin.c b/src/appl/bsd/krlogin.c index a9f02be62..ffd8b7996 100644 --- a/src/appl/bsd/krlogin.c +++ b/src/appl/bsd/krlogin.c @@ -49,7 +49,8 @@ static char sccsid[] = "@(#)rlogin.c 5.12 (Berkeley) 9/19/88"; #include #include #include - +#include + #include #include diff --git a/src/appl/bsd/logutil.c b/src/appl/bsd/logutil.c index fd8a4301a..f2cbaae17 100644 --- a/src/appl/bsd/logutil.c +++ b/src/appl/bsd/logutil.c @@ -17,16 +17,17 @@ #include #include -#if defined (CRAY) || defined (sgi) -#include -#define L_SET 0 -#define L_INCR 1 -#endif #include #include #include #include #include +#ifdef NEED_SYS_FCNTL_H +#include +#endif +#ifdef USE_UNISTD_H +#include +#endif #ifndef UTMP_FILE #define UTMP_FILE "/etc/utmp" @@ -46,7 +47,7 @@ void login(ut) struct utmp utmp; int tty; -#if defined(_AIX) +#ifdef HAVE_GETUTENT if (!ut->ut_pid) ut->ut_pid = getppid(); ut->ut_type = USER_PROCESS; @@ -63,7 +64,7 @@ void login(ut) #else tty = ttyslot(); if (tty > 0 && (fd = open(UTMP_FILE, O_WRONLY, 0)) >= 0) { - (void)lseek(fd, (long)(tty * sizeof(struct utmp)), L_SET); + (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET); (void)write(fd, (char *)ut, sizeof(struct utmp)); (void)close(fd); } @@ -93,14 +94,17 @@ logout(line) memset(ut.ut_host,0, sizeof(ut.ut_host)); #endif (void)time(&ut.ut_time); -#if defined(_AIX) +#ifdef HAVE_GETUTENT memset(ut.ut_id, 0, sizeof(ut.ut_id)); - ut.ut_pid = ut.ut_exit.e_exit = 0; + ut.ut_pid = 0; +#ifndef NO_UT_EXIT + ut.ut_exit.e_exit = 0; +#endif ut.ut_type = EMPTY; #endif - (void)fseek(fp, (long)-sizeof(struct utmp), L_INCR); + (void)fseek(fp, (off_t)-sizeof(struct utmp), SEEK_CUR); (void)fwrite((char *)&ut, sizeof(struct utmp), 1, fp); - (void)fseek(fp, (long)0, L_INCR); + (void)fseek(fp, (off_t)0, SEEK_CUR); rval = 0; } (void)fclose(fp); @@ -140,7 +144,7 @@ logwtmp(line, name, host, keep_open, logingin) ut.ut_pid = getpid(); #endif (void)time(&ut.ut_time); -#if defined(_AIX) +#ifdef HAVE_GETUTENT if (*name) { if (!ut.ut_pid) ut.ut_pid = getpid(); -- 2.26.2