From: Thorsten Kukuk Date: Wed, 29 Apr 2015 13:58:06 +0000 (-0400) Subject: disable *rpcent functions if they exist in libc X-Git-Tag: libtirpc-0-2-6-rc4~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1270f66c8bef9f94a06a4842364970a71985ff55;p=libtirpc disable *rpcent functions if they exist in libc Per default we disable getrpcbyname and getrpcbynumber, if this functions are available in libc. But with glibc, all *rpcent* functions are using NSS, inside tirpc only /etc/rpc. What happens now is that getrpcbyname/getrpcbynumber can return other results as getrpcent. This should not happen. So check for all functions if available from libc and don't use them if this is the case. Signed-off-by: Steve Dickson --- diff --git a/configure.ac b/configure.ac index fe35afa..2bdecc5 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ AC_PREFIX_DEFAULT(/usr) AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h features.h]) AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([nsl], [yp_get_default_domain]) -AC_CHECK_FUNCS([getrpcbyname getrpcbynumber]) +AC_CHECK_FUNCS([getrpcbyname getrpcbynumber setrpcent endrpcent getrpcent]) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile doc/Makefile]) AC_OUTPUT(libtirpc.pc) diff --git a/src/getrpcent.c b/src/getrpcent.c index c374673..cba4cd8 100644 --- a/src/getrpcent.c +++ b/src/getrpcent.c @@ -54,6 +54,13 @@ #include #endif +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#if !HAVE_GETRPCBYNAME || !HAVE_GETRPCBYNUMBER || \ + !HAVE_SETRPCENT || !HAVE_ENDRPCENT || !HAVE_GETRPCENT + /* * Internet version. */ @@ -166,6 +173,7 @@ done: } #endif /* !HAVE_GETRPCBYNAME */ +#if !HAVE_SETRPCENT void setrpcent(f) int f; @@ -190,7 +198,9 @@ setrpcent(f) rewind(d->rpcf); d->stayopen |= f; } +#endif +#if !HAVE_ENDRPCENT void endrpcent() { @@ -213,7 +223,9 @@ endrpcent() d->rpcf = NULL; } } +#endif +#if !HAVE_GETRPCENT struct rpcent * getrpcent() { @@ -264,6 +276,7 @@ no_yp: return (NULL); return (interpret(d->line, strlen(d->line))); } +#endif static struct rpcent * interpret(val, len) @@ -316,3 +329,4 @@ interpret(val, len) return (&d->rpc); } +#endif