From 51cb4eba5421bd0cbd8bc791dfb243c20eb1bdee Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 25 Jun 2001 13:22:33 +0000 Subject: [PATCH] aix & hp --- lib/bind/configure.in | 27 +++++++++++++++++++++++++-- lib/bind/irs/getnetgrent_r.c | 18 +++++++++++++++++- lib/bind/port_after.h.in | 1 + lib/bind/port_before.h.in | 3 ++- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/lib/bind/configure.in b/lib/bind/configure.in index 9a03eebd5f..9823437ecc 100644 --- a/lib/bind/configure.in +++ b/lib/bind/configure.in @@ -19,7 +19,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.54 $) +AC_REVISION($Revision: 1.55 $) AC_INIT(resolv/herror.c) AC_PREREQ(2.13) @@ -1646,6 +1646,24 @@ NGR_R_OK="#define NGR_R_OK 1" NGR_R_RETURN="#define NGR_R_RETURN int" ] , +AC_TRY_COMPILE( +[ +#include +extern int getnetgrent_r( char **, char **, char **, void **); +] +, +[return (0);], +[ +NGR_R_ARGS="#define NGR_R_ARGS void **buf" +NGR_R_BAD="#define NGR_R_BAD (0)" +NGR_R_COPY="#define NGR_R_COPY buf" +NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS" +NGR_R_OK="#define NGR_R_OK 1" +NGR_R_RETURN="#define NGR_R_RETURN int" +NGR_R_PRIVATE="#define NGR_R_PRIVATE 1" +] +, +) ) ) , @@ -1662,8 +1680,12 @@ AC_SUBST(NGR_R_COPY) AC_SUBST(NGR_R_COPY_ARGS) AC_SUBST(NGR_R_OK) AC_SUBST(NGR_R_RETURN) +AC_SUBST(NGR_R_PRIVATE) AC_CHECK_FUNC(endnetgrent_r, +NGR_R_END_RESULT="#define NGR_R_END_RESULT(x) return (x)" +NGR_R_END_RETURN="#define NGR_R_END_RETURN int" +NGR_R_ENT_ARGS="#define NGR_R_ENT_ARGS NGR_R_ARGS" , NGR_R_END_RESULT="#define NGR_R_END_RESULT(x) /*empty*/" NGR_R_END_RETURN="#define NGR_R_END_RETURN void" @@ -1675,10 +1697,11 @@ AC_SUBST(NGR_R_END_RETURN) AC_SUBST(NGR_R_ENT_ARGS) AC_CHECK_FUNC(setnetgrent_r, +NGR_R_SET_RESULT="#define NGR_R_SET_RESULT NGR_R_OK" +NGR_R_SET_RETURN="#define NGR_R_SET_RETURN int" , NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /*empty*/" NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void" -AC_DEFINE(NEED_SETNETGRENT_R) ) AC_SUBST(NGR_R_SET_RESULT) AC_SUBST(NGR_R_SET_RETURN) diff --git a/lib/bind/irs/getnetgrent_r.c b/lib/bind/irs/getnetgrent_r.c index 06d7af8e50..79554cdc81 100644 --- a/lib/bind/irs/getnetgrent_r.c +++ b/lib/bind/irs/getnetgrent_r.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.2 2001/06/22 05:11:01 marka Exp $"; +static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.3 2001/06/25 13:22:29 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -29,6 +29,7 @@ static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.2 2001/06/22 05:11:01 mark #include #include #include +#include #include #ifdef NGR_R_RETURN @@ -70,6 +71,9 @@ setnetgrent_r(const char *netgroup) #endif { setnetgrent(netgroup); +#ifdef NGR_R_PRIVATE + *buf = NULL; +#endif #ifdef NGR_R_SET_RESULT return (NGR_R_SET_RESULT); #endif @@ -83,6 +87,11 @@ endnetgrent_r(void) #endif { endnetgrent(); +#ifdef NGR_R_PRIVATE + if (*buf != NULL) + free(*buf); + *buf = NULL; +#endif NGR_R_END_RESULT(NGR_R_OK); } @@ -102,10 +111,17 @@ copy_protoent(char **machinep, char **userp, char **domainp, if (up != NULL) len += strlen(up) + 1; if (dp != NULL) len += strlen(dp) + 1; +#ifdef NGR_R_PRIVATE + free(*buf); + *buf = malloc(len); + if (*buf == NULL) + return(NGR_R_BAD); +#else if (len > buflen) { errno = ERANGE; return (NGR_R_BAD); } +#endif cp = buf; diff --git a/lib/bind/port_after.h.in b/lib/bind/port_after.h.in index b8404216f3..ca2b46d40c 100644 --- a/lib/bind/port_after.h.in +++ b/lib/bind/port_after.h.in @@ -297,6 +297,7 @@ void endpwent_r(void); int setpassent(int stayopen); #endif +#define gettimeofday isc__gettimeofday struct timeval; /* silence warning */ struct timezone; /* silence warning */ int isc__gettimeofday(struct timeval *tp, struct timezone *tzp); diff --git a/lib/bind/port_before.h.in b/lib/bind/port_before.h.in index 263dc71f27..5faf276f92 100644 --- a/lib/bind/port_before.h.in +++ b/lib/bind/port_before.h.in @@ -4,13 +4,13 @@ #ifdef HAVE_SYS_TIMERS_H #include #endif +#include @WANT_IRS_GR@ @WANT_IRS_NIS@ @WANT_IRS_PW@ -#define gettimeofday isc__gettimeofday @BSD_COMP@ @DO_PTHREADS@ @@ -66,6 +66,7 @@ @NGR_R_RETURN@ @NGR_R_SET_RESULT@ @NGR_R_SET_RETURN@ +@NGR_R_PRIVATE@ @PROTO_R_ARGS@ @PROTO_R_BAD@