[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-inetutils] Bits on OpenBSD
From: |
Mats Erik Andersson |
Subject: |
[bug-inetutils] Bits on OpenBSD |
Date: |
Thu, 19 Aug 2010 20:22:05 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hello,
as a side dish I have begun to hunt down quirks needed to
get compileable source for OpenBSD. This is the first
installment on that track. Please tell me, if you regard
this as futile, then I will stop bothering.
This first taster is the outcome of getting utmp logging
to work on OpenBSD. The result is a compilable telnetd
service, although not yet free from pty problems yet.
That must be resolved later.
By the way, the ifconfig code is a mess as regards OpenBSD,
and it is far from compiling at all.
I will need help from someone on autotools in order to finalize
what I will outline now using the following patching snippets.
1. A test in 'configure' must include 'sys/types.h'
in order to be meaningful at all.
2. For 'src/logger.c' and 'ifconfig/flags.h' some prototypes
must be augmented.
3. The introduction of two macros HAVE_UTMP_LOGIN and HAVE_GETUTENT
would facilitate the needed infrastructure to accomodate OpenBSD.
The first of these was forcefully set in the text below.
4. In order to properly register a telnet logoff, it is necessary
to use calls to logout(3) __and__ logwtmp(3). Only the latter
is insufficient.
Regards for now,
Mats E A
################################
--- configure.orig
+++ configure
@@ -39998,6 +39998,7 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef HAVE_UTMP_H
+# include <sys/types.h>
# include <utmp.h>
#endif
--- src/logger.c.orig
+++ src/logger.c
@@ -23,6 +23,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
+#include <sys/uio.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <netdb.h>
--- ifconfig/flags.h.orig
+++ ifconfig/flags.h
@@ -22,6 +22,8 @@
#ifndef IFCONFIG_FLAGS_H
# define IFCONFIG_FLAGS_H
+#include <sys/types.h>
+
/* Using these avoid strings with if_flagtoname, the caller can set a
preference on returned flag names. If one of the names in the list
is found for the flag, the search continues to attempt a better
--- libinetutils/utmp_init.c.orig
+++ libinetutils/utmp_init.c
@@ -55,10 +55,13 @@
# include <utmpx.h>
#else
# include <utmp.h>
+# include <util.h>
#endif
#include <string.h>
#include <unistd.h>
+#define HAVE_UTMP_LOGIN 1
+
/* utmp_init - update utmp and wtmp before login */
void
@@ -93,7 +96,7 @@ utmp_init (char *line, char *user, char *id)
gettimeofday (&tv, 0);
utx.ut_tv.tv_sec = tv.tv_sec;
utx.ut_tv.tv_usec = tv.tv_usec;
-#else
+#else /* !HAVE_STRUCT_UTMPX_UT_TV */
time (&(utx.ut_time));
#endif
#ifdef HAVE_UTMPX_H
@@ -102,15 +105,21 @@ utmp_init (char *line, char *user, char *id)
updwtmpx (PATH_WTMPX, &utx);
# endif
endutxent ();
-#else
+#else /* !HAVE_UTMPX_H */
+# ifdef HAVE_GETUTENT
pututline (&utx);
+# endif
# ifdef HAVE_UPDWTMP
updwtmp (PATH_WTMP, &utx);
-# else
+# elif HAVE_UTMP_LOGIN
+ login (&utx);
+# else /* !HAVE_UPDWTMP && !HAVE_UTMP_LOGIN */
logwtmp (line, user, id);
# endif
+# ifdef HAVE_GETUTENT
endutent ();
-#endif
+# endif
+#endif /* !HAVE_UTMPX_H */
}
/* utmp_ptsid - generate utmp id for pseudo terminal */
--- libinetutils/utmp_logout.c.orig
+++ libinetutils/utmp_logout.c
@@ -52,6 +52,7 @@
# include <utmpx.h>
#else
# include <utmp.h>
+# include <util.h>
#endif
#include <string.h>
@@ -81,7 +82,7 @@ utmp_logout (char *line)
updwtmpx (PATH_WTMPX, ut);
}
endutxent ();
-#else
+#elif HAVE_GETUTENT /* !UTMPX */
struct utmp utx;
struct utmp *ut;
@@ -118,5 +119,8 @@ utmp_logout (char *line)
# endif
}
endutent ();
+#else /* !UTMPX && !HAVE_GETUTENT */
+ logout (line);
+ logwtmp (line, "", "");
#endif
}
- [bug-inetutils] Bits on OpenBSD,
Mats Erik Andersson <=