]> granicus.if.org Git - libtirpc/commitdiff
disable *rpcent functions if they exist in libc
authorThorsten Kukuk <kukuk@suse.de>
Wed, 29 Apr 2015 13:58:06 +0000 (09:58 -0400)
committerSteve Dickson <steved@redhat.com>
Wed, 29 Apr 2015 21:05:43 +0000 (17:05 -0400)
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 <steved@redhat.com>
configure.ac
src/getrpcent.c

index fe35afa10a2b3408279638328bf7c1ab6bf613e5..2bdecc5d59ed9eb0b251f5c561d0e9f214edc7a9 100644 (file)
@@ -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)
index c3746735f3771d31d67cbf4eb7a4e93e664f7120..cba4cd813ab09a8b1ea73f27c156133f6a3d40c1 100644 (file)
 #include <libc_private.h>
 #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