More patches to fix NetBSD compiling
David Rankin
drankin at bohemians.lexington.ky.us
Tue Dec 28 03:30:42 EST 1999
Unfortunately, the login.c changes after pre-19 have exposed some more
NetBSD-centric problems concerning the lack of several fields in struct utmp.
Here's another set of patches to fix NetBSD compiling (although they may also
help some other UNIXes as well).
Thanks,
David
--- configure.in.orig Mon Dec 27 09:09:05 1999
+++ configure.in Mon Dec 27 09:13:39 1999
@@ -264,6 +264,16 @@
[AC_DEFINE(HAVE_SYSLEN_IN_UTMPX) AC_MSG_RESULT(yes); ],
[AC_MSG_RESULT(no)]
)
+AC_MSG_CHECKING([whether utmp.h has ut_pid field])
+AC_EGREP_HEADER(ut_pid, utmp.h,
+ [AC_DEFINE(HAVE_PID_IN_UTMP) AC_MSG_RESULT(yes); ],
+ [AC_MSG_RESULT(no)]
+)
+AC_MSG_CHECKING([whether utmp.h has ut_type field])
+AC_EGREP_HEADER(ut_type, utmp.h,
+ [AC_DEFINE(HAVE_TYPE_IN_UTMP) AC_MSG_RESULT(yes); ],
+ [AC_MSG_RESULT(no)]
+)
dnl Look for lastlog location
AC_ARG_WITH(lastlog,
--- configure.orig Mon Dec 27 09:15:10 1999
+++ configure Mon Dec 27 09:15:17 1999
@@ -2348,6 +2348,48 @@
fi
rm -f conftest*
+echo $ac_n "checking whether utmp.h has ut_pid field""... $ac_c" 1>&6
+echo "configure:2353: checking whether utmp.h has ut_pid field" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2355 "configure"
+#include "confdefs.h"
+#include <utmp.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "ut_pid" >/dev/null 2>&1; then
+ rm -rf conftest*
+ cat >> confdefs.h <<\EOF
+#define HAVE_PID_IN_UTMP 1
+EOF
+ echo "$ac_t""yes" 1>&6;
+else
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+
+fi
+rm -f conftest*
+
+echo $ac_n "checking whether utmp.h has ut_type field""... $ac_c" 1>&6
+echo "configure:2374: checking whether utmp.h has ut_type field" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2376 "configure"
+#include "confdefs.h"
+#include <utmp.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "ut_type" >/dev/null 2>&1; then
+ rm -rf conftest*
+ cat >> confdefs.h <<\EOF
+#define HAVE_TYPE_IN_UTMP 1
+EOF
+ echo "$ac_t""yes" 1>&6;
+else
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+
+fi
+rm -f conftest*
+
# Check whether --with-lastlog or --without-lastlog was given.
if test "${with_lastlog+set}" = set; then
--- acconfig.h.orig Mon Dec 27 09:17:11 1999
+++ acconfig.h Mon Dec 27 09:18:09 1999
@@ -33,6 +33,12 @@
/* Define is utmpx.h has a syslen field */
#undef HAVE_SYSLEN_IN_UTMPX
+/* Define is utmp.h has a ut_pid field */
+#undef HAVE_PID_IN_UTMP
+
+/* Define is utmp.h has a ut_type field */
+#undef HAVE_TYPE_IN_UTMP
+
/* Define if you want to use utmpx */
#undef USE_UTMPX
--- config.h.in.orig Mon Dec 27 09:16:31 1999
+++ config.h.in Mon Dec 27 09:18:28 1999
@@ -36,6 +36,12 @@
/* Define is utmpx.h has a syslen field */
#undef HAVE_SYSLEN_IN_UTMPX
+/* Define is utmp.h has a ut_pid field */
+#undef HAVE_PID_IN_UTMP
+
+/* Define is utmp.h has a ut_type field */
+#undef HAVE_TYPE_IN_UTMP
+
/* Define if you want to use utmpx */
#undef USE_UTMPX
--- login.c.orig Mon Dec 27 09:22:55 1999
+++ login.c Mon Dec 27 09:23:00 1999
@@ -141,10 +141,14 @@
/* Construct an utmp/wtmp entry. */
memset(&u, 0, sizeof(u));
strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line));
+#if defined(HAVE_PID_IN_UTMP)
u.ut_pid = (pid_t)pid;
+#endif /* HAVE_PID_IN_UTMP */
u.ut_time = time(NULL);
strncpy(u.ut_name, user, sizeof(u.ut_name));
+#if defined(HAVE_TYPE_IN_UTMP)
u.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS;
+#endif /* HAVE_TYPE_IN_UTMP */
#if defined(HAVE_HOST_IN_UTMP)
strncpy(u.ut_host, host, sizeof(u.ut_host));
#endif
More information about the openssh-unix-dev
mailing list