summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Kukuk <kukuk@suse.de>2015-04-29 09:58:06 -0400
committerSteve Dickson <steved@redhat.com>2015-04-29 17:05:43 -0400
commit1270f66c8bef9f94a06a4842364970a71985ff55 (patch)
treebedcebdae902af797ca34cdccfdc677b0a60c35b
parent4ba9ce277dd6c747e17d1e746c0b58b180bc0b11 (diff)
downloadti-rpc-1270f66c8bef9f94a06a4842364970a71985ff55.tar.gz
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 <steved@redhat.com>
-rw-r--r--configure.ac2
-rw-r--r--src/getrpcent.c14
2 files changed, 15 insertions, 1 deletions
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 <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