Package: libtirpc
Version: 0.2.2-5
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi.

The libtirpc package is needed to get rpcbind working on Hurd, but it
currently fail to build.  The issues are minor, and the attached patch
solve the build problems.  The new configure check for sys/user.h will
need to regenerate configure from configure.ac.  The rest of the patch
should be straight forward. :)

-- 
Happy hacking
Petter Reinholdtsen
Description: Get source building on Hurd
 - Look for <sys/user.h> before using it.
 - Define MAXHOSTNAMELEN to 64 if missing.
 - Bind sockets on Hurd like on Linux.
Author: Petter Reinholdtsen <p...@hungry.com>

--- libtirpc-0.2.2.orig/configure.ac
+++ libtirpc-0.2.2/configure.ac
@@ -21,7 +21,7 @@ AM_CONFIG_HEADER(config.h)
 AC_PROG_LIBTOOL
 AC_HEADER_DIRENT
 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])
+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 sys/user.h])
 AC_CHECK_LIB([pthread], [pthread_create])
 
 
--- libtirpc-0.2.2.orig/src/auth_unix.c
+++ libtirpc-0.2.2/src/auth_unix.c
@@ -57,6 +57,11 @@
 #include <rpc/auth.h>
 #include <rpc/auth_unix.h>
 
+/* Workaround for Hurd */
+#ifndef MAXHOSTNAMELEN
+#  define MAXHOSTNAMELEN   64
+#endif
+
 /* auth_unix.c */
 static void authunix_nextverf (AUTH *);
 static bool_t authunix_marshal (AUTH *, XDR *);
--- libtirpc-0.2.2.orig/src/bindresvport.c
+++ libtirpc-0.2.2/src/bindresvport.c
@@ -58,7 +58,7 @@ bindresvport(sd, sin)
         return bindresvport_sa(sd, (struct sockaddr *)sin);
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__)
 
 #define STARTPORT 600
 #define LOWPORT 512
--- libtirpc-0.2.2.orig/src/getpeereid.c
+++ libtirpc-0.2.2/src/getpeereid.c
@@ -29,7 +29,9 @@
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <sys/user.h>
+#ifdef HAVE_SYS_USER_H
+#  include <sys/user.h>
+#endif /* HAVE_SYS_USER_H */
 
 #include <errno.h>
 #include <unistd.h>
@@ -37,6 +39,9 @@
 int
 getpeereid(int s, uid_t *euid, gid_t *egid)
 {
+#ifndef HAVE_SYS_USER_H
+        return(-1);
+#else
 #ifdef XUCRED_VERSION
        struct xucred uc;
 #define uid  cr_uid
@@ -60,4 +65,5 @@ getpeereid(int s, uid_t *euid, gid_t *eg
        *euid = uc.uid;
        *egid = uc.gid;
        return (0);
+#endif /* HAVE_SYS_USER_H */
  }

Reply via email to