Patch to make pre19 work with NetBSD

David Rankin drankin at bohemians.lexington.ky.us
Fri Dec 24 06:26:20 EST 1999


The pre19 code assumes that struct lastlog either exists in lastlog.h or
isn't there. On NetBSD, struct lastlog is defined in utmp.h. Even worse,
the non-lastlog code in login.h is terrible on NetBSD (since NetBSD
doesn't have a ut_type struct member).

With the patch below, openssh will compile and run on NetBSD again.

Thanks,
David


--- configure.orig	Tue Dec 21 06:51:22 1999
+++ configure	Thu Dec 23 14:15:16 1999
@@ -2073,12 +2073,43 @@
 fi
 rm -f conftest* 
 
-echo $ac_n "checking whether pam_strerror takes only one argument""... $ac_c" 1>&6
-echo "configure:2078: checking whether pam_strerror takes only one argument" >&5
+echo $ac_n "checking For struct lastlog in utmp.h""... $ac_c" 1>&6
+echo "configure:2078: checking For struct lastlog in utmp.h" >&5
 cat > conftest.$ac_ext <<EOF
 #line 2080 "configure"
 #include "confdefs.h"
 
+		#include <sys/types.h>
+		#include <utmp.h>
+	
+int main() {
+struct lastlog c; c.ll_time = 0;
+; return 0; }
+EOF
+if { (eval echo configure:2090: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+		cat >> confdefs.h <<\EOF
+#define HAVE_LASTLOG 1
+EOF
+
+		echo "$ac_t""yes" 1>&6
+	
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+
+fi
+rm -f conftest*
+
+echo $ac_n "checking whether pam_strerror takes only one argument""... $ac_c" 1>&6
+echo "configure:2109: checking whether pam_strerror takes only one argument" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2111 "configure"
+#include "confdefs.h"
+
 		#include <stdlib.h>
 		#include <security/pam_appl.h>
 	
--- config.h.in.orig	Thu Dec 23 13:50:18 1999
+++ config.h.in	Thu Dec 23 13:59:23 1999
@@ -148,6 +148,9 @@
 /* Define if you have the <lastlog.h> header file.  */
 #undef HAVE_LASTLOG_H
 
+/* Define if you don't have the <lastlog.h> header file but have lastlog. */
+#undef HAVE_LASTLOG
+
 /* Define if you have the <login.h> header file.  */
 #undef HAVE_LOGIN_H
 
@@ -405,3 +408,7 @@
 #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
 # define seteuid(a) setreuid(-1,a)
 #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */
+
+#if defined(HAVE_LASTLOG_H) && !defined(HAVE_LASTLOG)
+# define HAVE_LASTLOG
+#endif /* defined (HAVE_LASTLOG_H) && !defined(HAVE_LASTLOG) */
--- login.c.orig	Thu Dec 23 13:34:04 1999
+++ login.c	Thu Dec 23 13:40:37 1999
@@ -53,7 +53,7 @@
 get_last_login_time(uid_t uid, const char *logname,
 		    char *buf, unsigned int bufsize)
 {
-#if defined(HAVE_LASTLOG_H) && !defined(DISABLE_LASTLOG)
+#if defined(HAVE_LASTLOG) && !defined(DISABLE_LASTLOG)
 	struct lastlog ll;
 	char *lastlog;
 	int fd;
--- configure.in.orig	Thu Dec 23 13:41:02 1999
+++ configure.in	Thu Dec 23 13:48:33 1999
@@ -151,6 +151,18 @@
 	[AC_MSG_RESULT(no)]
 ) 
 
+dnl On NetBSD (at least), lastlog is in utmp.h
+AC_MSG_CHECKING([For struct lastlog in utmp.h])
+AC_TRY_COMPILE(
+	[#include <utmp.h>],
+	[struct lastlog c; c.ll_time = 0;],
+	[
+		AC_DEFINE(HAVE_LASTLOG)
+		AC_MSG_RESULT(yes)
+	],
+	[AC_MSG_RESULT(no)]
+)
+
 dnl Check PAM strerror arguments
 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
 AC_TRY_COMPILE(





More information about the openssh-unix-dev mailing list