From d5e082f0d52f652ba50fe33c97f62442d6619045 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Mon, 22 Sep 2003 12:08:23 +1000 Subject: [PATCH] - (dtucker) [configure.ac openbsd-compat/fake-rfc2553.c openbsd-compat/fake-rfc2553.h] Bug #659: Test for and handle systems with where gai_strerror is defined as "const char *". Part of patch supplied by bugzilla-openssh at thewrittenword.com --- ChangeLog | 6 +++++- configure.ac | 19 +++++++++++++++++-- openbsd-compat/fake-rfc2553.c | 6 +++++- openbsd-compat/fake-rfc2553.h | 4 ++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index dace988b1..78a258ffe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ Patch from david.haughton at ncr.com - (dtucker) [configure.ac] Bug #659: uid swapping issues on IRIX 6. Part of patch supplied by bugzilla-openssh at thewrittenword.com + - (dtucker) [configure.ac openbsd-compat/fake-rfc2553.c + openbsd-compat/fake-rfc2553.h] Bug #659: Test for and handle systems with + where gai_strerror is defined as "const char *". Part of patch supplied + by bugzilla-openssh at thewrittenword.com 20030919 - (djm) Bug #683: Remove reference to --with-ipv4-default from INSTALL; @@ -1145,4 +1149,4 @@ - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. Report from murple@murple.net, diagnosis from dtucker@zip.com.au -$Id: ChangeLog,v 1.3015 2003/09/22 01:58:21 dtucker Exp $ +$Id: ChangeLog,v 1.3016 2003/09/22 02:08:23 dtucker Exp $ diff --git a/configure.ac b/configure.ac index b602e915b..7a4bd6ffc 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.161 2003/09/22 01:58:21 dtucker Exp $ +# $Id: configure.ac,v 1.162 2003/09/22 02:08:23 dtucker Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -731,7 +731,7 @@ dnl Checks for library functions. Please keep in alphabetical order AC_CHECK_FUNCS(\ arc4random __b64_ntop b64_ntop __b64_pton b64_pton \ bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \ - gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \ + getaddrinfo getcwd getgrouplist getnameinfo getopt \ getpeereid _getpty getrlimit getttyent glob inet_aton \ inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \ mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \ @@ -743,6 +743,21 @@ AC_CHECK_FUNCS(\ truncate utimes vhangup vsnprintf waitpid \ ) +# IRIX has a const char return value for gai_strerror() +AC_CHECK_FUNCS(gai_strerror,[ + AC_DEFINE(HAVE_GAI_STRERROR) + AC_TRY_COMPILE([ +#include +#include +#include + +const char *gai_strerror(int);],[ +char *str; + +str = gai_strerror(0);],[ + AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1, + [Define if gai_strerror() returns const char *])])]) + AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP)) dnl Make sure prototypes are defined for these before using them. diff --git a/openbsd-compat/fake-rfc2553.c b/openbsd-compat/fake-rfc2553.c index f44924836..0186b5300 100644 --- a/openbsd-compat/fake-rfc2553.c +++ b/openbsd-compat/fake-rfc2553.c @@ -37,7 +37,7 @@ #include "includes.h" -RCSID("$Id: fake-rfc2553.c,v 1.4 2003/06/13 22:43:23 djm Exp $"); +RCSID("$Id: fake-rfc2553.c,v 1.5 2003/09/22 02:08:23 dtucker Exp $"); #ifndef HAVE_GETNAMEINFO int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, @@ -77,7 +77,11 @@ int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, #endif /* !HAVE_GETNAMEINFO */ #ifndef HAVE_GAI_STRERROR +#ifdef HAVE_CONST_GAI_STRERROR_PROTO +const char * +#else char * +#endif gai_strerror(int err) { switch (err) { diff --git a/openbsd-compat/fake-rfc2553.h b/openbsd-compat/fake-rfc2553.h index b70b928f8..bf727ceac 100644 --- a/openbsd-compat/fake-rfc2553.h +++ b/openbsd-compat/fake-rfc2553.h @@ -1,4 +1,4 @@ -/* $Id: fake-rfc2553.h,v 1.6 2003/08/29 16:59:52 mouring Exp $ */ +/* $Id: fake-rfc2553.h,v 1.7 2003/09/22 02:08:23 dtucker Exp $ */ /* * Copyright (C) 2000-2003 Damien Miller. All rights reserved. @@ -137,7 +137,7 @@ int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **); #endif /* !HAVE_GETADDRINFO */ -#ifndef HAVE_GAI_STRERROR +#if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO) char *gai_strerror(int); #endif /* !HAVE_GAI_STRERROR */