More NetBSD patches

David Rankin drankin at bohemians.lexington.ky.us
Wed Jan 19 02:56:55 EST 2000


Here's a unified diff, proposed by Christos Zoulas (with a little
reworking to get the configure.in part a bit cleaner). The main target of
the patches are NetBSD compatability, although there are some changes
making
  if (pointer X)
into
  if (X != NULL)
as well. Christos also proposed a change to Makefile.in, but I'll send
that as a seperate mail.

Thanks,
David


Index: configure.in
===================================================================
RCS file: /usr/local/cvs/openssh/configure.in,v
retrieving revision 1.22
diff -u -r1.22 configure.in
--- configure.in	2000/01/17 19:34:14	1.22
+++ configure.in	2000/01/18 15:16:18
@@ -51,6 +51,31 @@
 
 AC_C_INLINE
 
+dnl Check for OpenSSL/SSLeay directories.
+AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
+for ssldir in $prefix /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg ; do
+	if test -f "$ssldir/include/openssl/crypto.h"; then
+		AC_DEFINE(HAVE_OPENSSL)
+		GOT_SSL="yes"
+		break
+	fi
+	if test -f "$ssldir/include/ssl/crypto.h"; then
+		AC_DEFINE(HAVE_SSL)
+		GOT_SSL="yes"
+		break
+	fi
+done
+if test -z "$GOT_SSL" ; then
+	AC_MSG_ERROR([Could not find SSLeay / OpenSSL libraries, please install])	
+fi
+AC_SUBST(ssldir)
+AC_DEFINE_UNQUOTED(ssldir, "$ssldir")
+if test "$ssldir" != "/usr"; then
+	CFLAGS="$CFLAGS -I$ssldir/include"
+	LDFLAGS="$LDFLAGS -L$ssldir/lib"
+fi
+AC_MSG_RESULT($ssldir)
+
 dnl Check for some target-specific stuff
 case "$host" in
 *-*-aix*)
@@ -92,32 +117,12 @@
 *-*-sysv*)
 	LIBS="$LIBS -lgen -lsocket"
 	;;
-esac
-
-dnl Check for OpenSSL/SSLeay directories.
-AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
-for ssldir in /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local $prefix /usr/pkg ; do
-	if test -f "$ssldir/include/openssl/crypto.h"; then
-		AC_DEFINE(HAVE_OPENSSL)
-		GOT_SSL="yes"
-		break
-	fi
-	if test -f "$ssldir/include/ssl/crypto.h"; then
-		AC_DEFINE(HAVE_SSL)
-		GOT_SSL="yes"
-		break
+*-*-netbsd*)
+	if test "$GOT_SSL" = "yes"; then
+		LDFLAGS="$LDFLAGS -R$ssldir/lib"
 	fi
-done
-if test -z "$GOT_SSL" ; then
-	AC_MSG_ERROR([Could not find SSLeay / OpenSSL libraries, please install])	
-fi
-AC_SUBST(ssldir)
-AC_DEFINE_UNQUOTED(ssldir, "$ssldir")
-if test "$ssldir" != "/usr"; then
-	CFLAGS="$CFLAGS -I$ssldir/include"
-	LDFLAGS="$LDFLAGS -L$ssldir/lib"
-fi
-AC_MSG_RESULT($ssldir)
+	;;
+esac
 
 dnl Check for RSAref library.
 AC_MSG_CHECKING([for RSAref library])
@@ -246,7 +251,10 @@
 
 AC_MSG_CHECKING([for struct sockaddr_storage])
 AC_TRY_COMPILE(
-	[#include <sys/socket.h>],
+	[
+#include <sys/types.h>
+#include <sys/socket.h>
+	],
 	[struct sockaddr_storage s;],
 	[
 		AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
@@ -257,7 +265,10 @@
 
 AC_MSG_CHECKING([for struct sockaddr_in6])
 AC_TRY_COMPILE(
-	[#include <netinet/in.h>],
+	[
+#include <sys/types.h>
+#include <netinet/in.h>
+	],
 	[struct sockaddr_in6 s; s.sin6_family = 0;],
 	[
 		AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
@@ -268,7 +279,10 @@
 
 AC_MSG_CHECKING([for struct in6_addr])
 AC_TRY_COMPILE(
-	[#include <netinet/in.h>],
+	[
+#include <sys/types.h>
+#include <netinet/in.h>
+	],
 	[struct in6_addr s; s.s6_addr[0] = 0;],
 	[
 		AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
@@ -280,6 +294,7 @@
 AC_MSG_CHECKING([for struct addrinfo])
 AC_TRY_COMPILE(
 	[
+		#include <sys/types.h>
 		#include <sys/socket.h>
 		#include <netdb.h>
 	],
Index: fake-getaddrinfo.c
===================================================================
RCS file: /usr/local/cvs/openssh/fake-getaddrinfo.c,v
retrieving revision 1.1
diff -u -r1.1 fake-getaddrinfo.c
--- fake-getaddrinfo.c	2000/01/17 19:24:04	1.1
+++ fake-getaddrinfo.c	2000/01/18 15:16:49
@@ -41,7 +41,7 @@
   do {
     next = ai->ai_next;
     free(ai);
-  } while (ai = next);
+  } while ((ai = next) != NULL);
 }
 #endif /* !HAVE_FREEADDRINFO */
 
@@ -53,8 +53,8 @@
 {
   struct addrinfo *ai;
 
-  if (ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) +
-				     sizeof(struct sockaddr_in))) {
+  if ((ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) +
+				     sizeof(struct sockaddr_in))) != NULL) {
     memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_in));
     ai->ai_addr = (struct sockaddr *)(ai + 1);
     /* XXX -- ssh doesn't use sa_len */
@@ -83,25 +83,27 @@
   else
     port = 0;
   if (hints && hints->ai_flags & AI_PASSIVE)
-    if (*res = malloc_ai(port, htonl(0x00000000)))
+    if ((*res = malloc_ai(port, htonl(0x00000000))) != NULL)
       return 0;
     else
       return EAI_MEMORY;
-  if (!hostname)
-    if (*res = malloc_ai(port, htonl(0x7f000001)))
+  if (!hostname) {
+    if ((*res = malloc_ai(port, htonl(0x7f000001))) != NULL)
       return 0;
     else
       return EAI_MEMORY;
-  if (inet_addr(hostname) != -1)
-    if (*res = malloc_ai(port, inet_addr(hostname)))
+  }
+  if (inet_addr(hostname) != -1) {
+    if ((*res = malloc_ai(port, inet_addr(hostname))) != NULL)
       return 0;
     else
       return EAI_MEMORY;
+  }
   if ((hp = gethostbyname(hostname)) &&
       hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
     for (i = 0; hp->h_addr_list[i]; i++)
-      if (cur = malloc_ai(port,
-			  ((struct in_addr *)hp->h_addr_list[i])->s_addr)) {
+      if ((cur = malloc_ai(port,
+			  ((struct in_addr *)hp->h_addr_list[i])->s_addr)) != NULL) {
 	if (prev)
 	  prev->ai_next = cur;
 	else
Index: fake-getnameinfo.c
===================================================================
RCS file: /usr/local/cvs/openssh/fake-getnameinfo.c,v
retrieving revision 1.1
diff -u -r1.1 fake-getnameinfo.c
--- fake-getnameinfo.c	2000/01/17 19:24:05	1.1
+++ fake-getnameinfo.c	2000/01/18 15:21:32
@@ -46,8 +46,8 @@
 	return 0;
       }
     else
-      if (hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr),
-			     AF_INET))
+      if ((hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr),
+			     AF_INET)) != NULL)
 	if (strlen(hp->h_name) > hostlen)
 	  return EAI_MEMORY;
 	else {
Index: log-client.c
===================================================================
RCS file: /usr/local/cvs/openssh/log-client.c,v
retrieving revision 1.3
diff -u -r1.3 log-client.c
--- log-client.c	2000/01/17 16:53:09	1.3
+++ log-client.c	2000/01/18 15:21:54
@@ -45,12 +45,12 @@
 	}
 }
 
-#define MSGBUFSIZE 1024
+#define SSH_MSGBUFSIZE 1024
 
 void
 do_log(LogLevel level, const char *fmt, va_list args)
 {
-	char msgbuf[MSGBUFSIZE];
+	char msgbuf[SSH_MSGBUFSIZE];
 
 	if (level > log_level)
 		return;
Index: log-server.c
===================================================================
RCS file: /usr/local/cvs/openssh/log-server.c,v
retrieving revision 1.4
diff -u -r1.4 log-server.c
--- log-server.c	2000/01/17 16:53:10	1.4
+++ log-server.c	2000/01/18 15:22:24
@@ -97,13 +97,13 @@
 	log_on_stderr = on_stderr;
 }
 
-#define MSGBUFSIZE 1024
+#define SSH_MSGBUFSIZE 1024
 
 void
 do_log(LogLevel level, const char *fmt, va_list args)
 {
-	char msgbuf[MSGBUFSIZE];
-	char fmtbuf[MSGBUFSIZE];
+	char msgbuf[SSH_MSGBUFSIZE];
+	char fmtbuf[SSH_MSGBUFSIZE];
 	char *txt = NULL;
 	int pri = LOG_INFO;
 
Index: uidswap.c
===================================================================
RCS file: /usr/local/cvs/openssh/uidswap.c,v
retrieving revision 1.2
diff -u -r1.2 uidswap.c
--- uidswap.c	2000/01/17 16:53:38	1.2
+++ uidswap.c	2000/01/18 15:23:27
@@ -27,8 +27,10 @@
 #define SAVED_IDS_WORK_WITH_SETEUID
 #endif /* _POSIX_SAVED_IDS */
 
+#ifdef SAVED_IDS_WORK_WITH_SETEUID
 /* Saved effective uid. */
 static uid_t saved_euid = 0;
+#endif
 
 /*
  * Temporarily changes to the given uid.  If the effective user





More information about the openssh-unix-dev mailing list