void-packages/srcpkgs/udptunnel/patches/rpc.patch

55 lines
1.5 KiB
Diff

# reason: rpcsvc/ypclnt.h is only present in glibc, so check for it
--- a/configure.in
+++ b/configure.in
@@ -19,6 +19,7 @@
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)
+AC_CHECK_HEADERS(rpcsvc/ypclnt.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_SIZEOF(short)
--- a/host2ip.c
+++ b/host2ip.c
@@ -4,7 +4,9 @@
#include <netdb.h> /* gethostbyname() */
#include <netinet/in.h> /* sockaddr_in */
#include <arpa/inet.h> /* inet_addr() */
+#ifdef HAVE_RPCSVC_YPCLNT_H
#include <rpcsvc/ypclnt.h> /* YP */
+#endif
#include <ctype.h> /* isspace() */
#include <string.h> /* strlen() */
@@ -27,6 +29,8 @@
while (*host && isspace((int)*host)) host++;
}
+ /* pre-set */
+ in.s_addr = INADDR_ANY;
/* Check whether this is a dotted decimal. */
if (!host) {
in.s_addr = INADDR_ANY;
@@ -38,6 +42,7 @@
else if ((hep = gethostbyname(host))) {
in = *(struct in_addr *)(hep->h_addr_list[0]);
}
+#ifdef HAVE_RPCSVC_YPCLNT_H && USE_NIS
/* As a last resort, try YP. */
else {
static char *domain = 0; /* YP domain */
@@ -47,10 +52,8 @@
if (!domain) yp_get_default_domain(&domain);
if (yp_match(domain, "hosts.byname", host, strlen(host), &value, &value_len) == 0) {
in.s_addr = inet_addr(value);
- } else {
- /* Everything failed */
- in.s_addr = INADDR_ANY;
}
}
+#endif
return in;
} /* host2ip */