Submitted By:            Bruce Dubbs <bdubbs_at_linuxfromscratch_dot_org>
Date:                    2011-11-14
Initial Package Version: 0.2.2
Upstream Status:         Not submitted
Origin:                  Upstream and LFS
Description:             This patch contains Debian patch numbers 01 thru 04
                         and removes two other packages that depend on nis.h
                         that is no longer available from glibc.

diff -Naur libtirpc-0.2.2.orig/aclocal.m4 libtirpc-0.2.2/aclocal.m4
--- libtirpc-0.2.2.orig/aclocal.m4	2011-05-02 07:31:52.000000000 -0500
+++ libtirpc-0.2.2/aclocal.m4	2011-11-14 14:57:34.000000000 -0600
@@ -2476,6 +2476,7 @@
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
@@ -2625,14 +2626,10 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Add ABI-specific directories to the system library path.
-  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
-
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
-
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -2644,6 +2641,18 @@
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
@@ -3249,7 +3258,7 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd*)
+netbsd* | netbsdelf*-gnu)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
   else
@@ -4060,7 +4069,7 @@
 	    ;;
 	esac
 	;;
-      netbsd*)
+      netbsd* | netbsdelf*-gnu)
 	;;
       *qnx* | *nto*)
         # QNX uses GNU C++, but need to define -shared option too, otherwise
@@ -4518,6 +4527,9 @@
       ;;
     esac
     ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
     ;;
@@ -4581,6 +4593,9 @@
   openbsd*)
     with_gnu_ld=no
     ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
@@ -4803,7 +4818,7 @@
       fi
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -4980,6 +4995,7 @@
 	if test "$aix_use_runtimelinking" = yes; then
 	  shared_flag="$shared_flag "'${wl}-G'
 	fi
+	_LT_TAGVAR(link_all_deplibs, $1)=no
       else
 	# not using gcc
 	if test "$host_cpu" = ia64; then
@@ -5288,7 +5304,7 @@
       _LT_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -8478,7 +8494,8 @@
 # ----------------------------------
 AC_DEFUN([PKG_PROG_PKG_CONFIG],
 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
@@ -8524,7 +8541,8 @@
     pkg_cv_[]$1="$$1"
  elif test -n "$PKG_CONFIG"; then
     PKG_CHECK_EXISTS([$3],
-                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes ],
 		     [pkg_failed=yes])
  else
     pkg_failed=untried
@@ -8572,9 +8590,9 @@
    	AC_MSG_RESULT([no])
         _PKG_SHORT_ERRORS_SUPPORTED
         if test $_pkg_short_errors_supported = yes; then
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
         else 
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
@@ -8587,7 +8605,7 @@
 Consider adjusting the PKG_CONFIG_PATH environment variable if you
 installed software in a non-standard prefix.
 
-_PKG_TEXT])
+_PKG_TEXT])[]dnl
         ])
 elif test $pkg_failed = untried; then
      	AC_MSG_RESULT([no])
@@ -8598,7 +8616,7 @@
 
 _PKG_TEXT
 
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
         ])
 else
 	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
diff -Naur libtirpc-0.2.2.orig/configure libtirpc-0.2.2/configure
--- libtirpc-0.2.2.orig/configure	2011-05-02 07:31:55.000000000 -0500
+++ libtirpc-0.2.2/configure	2011-11-14 14:57:34.000000000 -0600
@@ -3782,6 +3782,7 @@
 
 
 
+
 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 	if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
@@ -3910,6 +3911,7 @@
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_GSSGLUE_CFLAGS=`$PKG_CONFIG --cflags "libgssglue" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
 fi
@@ -3926,6 +3928,7 @@
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
   pkg_cv_GSSGLUE_LIBS=`$PKG_CONFIG --libs "libgssglue" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
 fi
@@ -3945,9 +3948,9 @@
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libgssglue" 2>&1`
+	        GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libgssglue" 2>&1`
         else
-	        GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --print-errors "libgssglue" 2>&1`
+	        GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libgssglue" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$GSSGLUE_PKG_ERRORS" >&5
@@ -5962,7 +5965,7 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd*)
+netbsd* | netbsdelf*-gnu)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
   else
@@ -9299,6 +9302,9 @@
   openbsd*)
     with_gnu_ld=no
     ;;
+  linux* | k*bsd*-gnu | gnu*)
+    link_all_deplibs=no
+    ;;
   esac
 
   ld_shlibs=yes
@@ -9521,7 +9527,7 @@
       fi
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -9698,6 +9704,7 @@
 	if test "$aix_use_runtimelinking" = yes; then
 	  shared_flag="$shared_flag "'${wl}-G'
 	fi
+	link_all_deplibs=no
       else
 	# not using gcc
 	if test "$host_cpu" = ia64; then
@@ -10154,7 +10161,7 @@
       link_all_deplibs=yes
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -11007,6 +11014,7 @@
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
@@ -11175,14 +11183,10 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Add ABI-specific directories to the system library path.
-  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
-
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
-
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -11194,6 +11198,18 @@
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
diff -Naur libtirpc-0.2.2.orig/src/Makefile.am libtirpc-0.2.2/src/Makefile.am
--- libtirpc-0.2.2.orig/src/Makefile.am	2011-05-02 07:10:40.000000000 -0500
+++ libtirpc-0.2.2/src/Makefile.am	2011-11-14 14:57:25.000000000 -0600
@@ -50,7 +50,7 @@
         rpc_callmsg.c rpc_generic.c rpc_soc.c rpcb_clnt.c rpcb_prot.c \
         rpcb_st_xdr.c svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_generic.c \
         svc_raw.c svc_run.c svc_simple.c svc_vc.c getpeereid.c \
-        auth_time.c auth_des.c authdes_prot.c des_crypt.c
+        authdes_prot.c
 
 ## XDR
 libtirpc_la_SOURCES += xdr.c xdr_rec.c xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c
diff -Naur libtirpc-0.2.2.orig/src/Makefile.in libtirpc-0.2.2/src/Makefile.in
--- libtirpc-0.2.2.orig/src/Makefile.in	2011-05-02 07:31:55.000000000 -0500
+++ libtirpc-0.2.2/src/Makefile.in	2011-11-14 14:57:34.000000000 -0600
@@ -82,8 +82,8 @@
 	rpcb_clnt.c rpcb_prot.c rpcb_st_xdr.c svc.c svc_auth.c \
 	svc_dg.c svc_auth_unix.c svc_generic.c svc_raw.c svc_run.c \
 	svc_simple.c svc_vc.c getpeereid.c auth_time.c auth_des.c \
-	authdes_prot.c des_crypt.c xdr.c xdr_rec.c xdr_array.c \
-	xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c auth_gss.c \
+	authdes_prot.c xdr.c xdr_rec.c xdr_array.c xdr_float.c \
+	xdr_mem.c xdr_reference.c xdr_stdio.c auth_gss.c \
 	authgss_prot.c svc_auth_gss.c svc_auth_none.c
 @GSS_TRUE@am__objects_1 = libtirpc_la-auth_gss.lo \
 @GSS_TRUE@	libtirpc_la-authgss_prot.lo \
@@ -111,11 +111,11 @@
 	libtirpc_la-svc_run.lo libtirpc_la-svc_simple.lo \
 	libtirpc_la-svc_vc.lo libtirpc_la-getpeereid.lo \
 	libtirpc_la-auth_time.lo libtirpc_la-auth_des.lo \
-	libtirpc_la-authdes_prot.lo libtirpc_la-des_crypt.lo \
-	libtirpc_la-xdr.lo libtirpc_la-xdr_rec.lo \
-	libtirpc_la-xdr_array.lo libtirpc_la-xdr_float.lo \
-	libtirpc_la-xdr_mem.lo libtirpc_la-xdr_reference.lo \
-	libtirpc_la-xdr_stdio.lo $(am__objects_1)
+	libtirpc_la-authdes_prot.lo libtirpc_la-xdr.lo \
+	libtirpc_la-xdr_rec.lo libtirpc_la-xdr_array.lo \
+	libtirpc_la-xdr_float.lo libtirpc_la-xdr_mem.lo \
+	libtirpc_la-xdr_reference.lo libtirpc_la-xdr_stdio.lo \
+	$(am__objects_1)
 libtirpc_la_OBJECTS = $(am_libtirpc_la_OBJECTS)
 libtirpc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libtirpc_la_CFLAGS) \
@@ -303,9 +303,8 @@
 	rpcb_clnt.c rpcb_prot.c rpcb_st_xdr.c svc.c svc_auth.c \
 	svc_dg.c svc_auth_unix.c svc_generic.c svc_raw.c svc_run.c \
 	svc_simple.c svc_vc.c getpeereid.c auth_time.c auth_des.c \
-	authdes_prot.c des_crypt.c xdr.c xdr_rec.c xdr_array.c \
-	xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c \
-	$(am__append_1)
+	authdes_prot.c xdr.c xdr_rec.c xdr_array.c xdr_float.c \
+	xdr_mem.c xdr_reference.c xdr_stdio.c $(am__append_1)
 @GSS_TRUE@libtirpc_la_CFLAGS = -DHAVE_RPCSEC_GSS $(GSSGLUE_CFLAGS)
 all: all-am
 
@@ -397,7 +396,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtirpc_la-clnt_raw.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtirpc_la-clnt_simple.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtirpc_la-clnt_vc.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtirpc_la-des_crypt.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtirpc_la-getnetconfig.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtirpc_la-getnetpath.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtirpc_la-getpeereid.Plo@am__quote@
@@ -767,13 +765,6 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtirpc_la_CFLAGS) $(CFLAGS) -c -o libtirpc_la-authdes_prot.lo `test -f 'authdes_prot.c' || echo '$(srcdir)/'`authdes_prot.c
 
-libtirpc_la-des_crypt.lo: des_crypt.c
-@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtirpc_la_CFLAGS) $(CFLAGS) -MT libtirpc_la-des_crypt.lo -MD -MP -MF $(DEPDIR)/libtirpc_la-des_crypt.Tpo -c -o libtirpc_la-des_crypt.lo `test -f 'des_crypt.c' || echo '$(srcdir)/'`des_crypt.c
-@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libtirpc_la-des_crypt.Tpo $(DEPDIR)/libtirpc_la-des_crypt.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='des_crypt.c' object='libtirpc_la-des_crypt.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtirpc_la_CFLAGS) $(CFLAGS) -c -o libtirpc_la-des_crypt.lo `test -f 'des_crypt.c' || echo '$(srcdir)/'`des_crypt.c
-
 libtirpc_la-xdr.lo: xdr.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtirpc_la_CFLAGS) $(CFLAGS) -MT libtirpc_la-xdr.lo -MD -MP -MF $(DEPDIR)/libtirpc_la-xdr.Tpo -c -o libtirpc_la-xdr.lo `test -f 'xdr.c' || echo '$(srcdir)/'`xdr.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libtirpc_la-xdr.Tpo $(DEPDIR)/libtirpc_la-xdr.Plo
diff -Naur libtirpc-0.2.2.orig/src/clnt_vc.c libtirpc-0.2.2/src/clnt_vc.c
--- libtirpc-0.2.2.orig/src/clnt_vc.c	2011-05-02 07:10:40.000000000 -0500
+++ libtirpc-0.2.2/src/clnt_vc.c	2011-11-14 14:57:40.000000000 -0600
@@ -70,6 +70,7 @@
 #define MCALL_MSG_SIZE 24
 
 #define CMGROUP_MAX    16
+#ifndef SCM_CREDS
 #define SCM_CREDS      0x03            /* process creds (struct cmsgcred) */
 
 /*
@@ -87,6 +88,7 @@
         short   cmcred_ngroups;         /* number or groups */
         gid_t   cmcred_groups[CMGROUP_MAX];     /* groups */
 };
+#endif
 
 struct cmessage {
         struct cmsghdr cmsg;
diff -Naur libtirpc-0.2.2.orig/src/getpeereid.c libtirpc-0.2.2/src/getpeereid.c
--- libtirpc-0.2.2.orig/src/getpeereid.c	2011-05-02 07:10:40.000000000 -0500
+++ libtirpc-0.2.2/src/getpeereid.c	2011-11-14 14:57:40.000000000 -0600
@@ -29,6 +29,7 @@
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <sys/user.h>
 
 #include <errno.h>
 #include <unistd.h>
@@ -36,12 +37,22 @@
 int
 getpeereid(int s, uid_t *euid, gid_t *egid)
 {
+#ifdef XUCRED_VERSION
+	struct xucred uc;
+#define uid  cr_uid
+#define gid  cr_gid
+#else
 	struct ucred uc;
+#endif
 	socklen_t uclen;
 	int error;
 
 	uclen = sizeof(uc); 
+#ifdef XUCRED_VERSION
+	error = getsockopt(s, 0, LOCAL_PEERCRED, &uc, &uclen);
+#else
 	error = getsockopt(s, SOL_SOCKET, SO_PEERCRED, &uc, &uclen); /*  SCM_CREDENTIALS */
+#endif
 	if (error != 0)
 		return (error);
 	//	if (uc.cr_version != XUCRED_VERSION)
diff -Naur libtirpc-0.2.2.orig/src/rpc_soc.c libtirpc-0.2.2/src/rpc_soc.c
--- libtirpc-0.2.2.orig/src/rpc_soc.c	2011-05-02 07:10:40.000000000 -0500
+++ libtirpc-0.2.2/src/rpc_soc.c	2011-11-14 14:57:40.000000000 -0600
@@ -105,6 +105,7 @@
 		static int have_cloexec;
 		fd = __rpc_nconf2fd_flags(nconf, flags);
 		if (fd == -1) {
+#ifdef SOCK_CLOEXEC		
 			if ((flags & SOCK_CLOEXEC) && have_cloexec <= 0) {
 				fd = __rpc_nconf2fd(nconf);
 				if (fd == -1)
@@ -117,6 +118,10 @@
 				goto syserror;
 		} else if (flags & SOCK_CLOEXEC)
 			have_cloexec = 1;
+#else
+                        goto syserror;
+                }        
+#endif			
 		madefd = TRUE;
 	}
 
diff -Naur libtirpc-0.2.2.orig/src/svc_auth_gss.c libtirpc-0.2.2/src/svc_auth_gss.c
--- libtirpc-0.2.2.orig/src/svc_auth_gss.c	2011-05-02 07:10:40.000000000 -0500
+++ libtirpc-0.2.2/src/svc_auth_gss.c	2011-11-14 14:57:47.000000000 -0600
@@ -386,6 +386,7 @@
 			return (AUTH_FAILED);
 		}
 		if ((gd = calloc(sizeof(*gd), 1)) == NULL) {
+			free(auth);
 			fprintf(stderr, "svcauth_gss: out_of_memory\n");
 			return (AUTH_FAILED);
 		}
diff -Naur libtirpc-0.2.2.orig/src/svc_dg.c libtirpc-0.2.2/src/svc_dg.c
--- libtirpc-0.2.2.orig/src/svc_dg.c	2011-05-02 07:10:40.000000000 -0500
+++ libtirpc-0.2.2/src/svc_dg.c	2011-11-14 14:57:40.000000000 -0600
@@ -620,6 +620,7 @@
 void
 svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
 {
+#ifdef __linux__
 	int val = 1;
 
 	switch (si->si_af) {
@@ -631,6 +632,7 @@
 		(void) setsockopt(fd, SOL_IPV6, IPV6_PKTINFO, &val, sizeof(val));
 		break;
 	}
+#endif	
 }
 
 /*
@@ -641,6 +643,7 @@
 int
 svc_dg_valid_pktinfo(struct msghdr *msg)
 {
+#ifdef __linux__
 	struct cmsghdr *cmsg;
 
 	if (!msg->msg_name)
@@ -685,4 +688,7 @@
 	}
 
 	return 1;
+#else
+        return 0;
+#endif        	
 }
diff -Naur libtirpc-0.2.2.orig/tirpc/reentrant.h libtirpc-0.2.2/tirpc/reentrant.h
--- libtirpc-0.2.2.orig/tirpc/reentrant.h	2011-05-02 07:10:40.000000000 -0500
+++ libtirpc-0.2.2/tirpc/reentrant.h	2011-11-14 14:57:40.000000000 -0600
@@ -36,7 +36,7 @@
  * These definitions are only guaranteed to be valid on Linux. 
  */
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GLIBC__)
 
 #include <pthread.h>
 
