diff -ur src-2.8.90/acinclude.m4 src-2.8.90-local/acinclude.m4
--- src-2.8.90/acinclude.m4	2002-08-09 21:32:20.000000000 +0200
+++ src-2.8.90-local/acinclude.m4	2003-05-21 13:23:31.000000000 +0200
@@ -19,3 +19,19 @@
   AC_MSG_RESULT(no)
 fi], [AC_MSG_RESULT(no)])
 ])
+
+dnl
+dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present)
+dnl
+dnl From Japhar.  Report changes to japhar@hungry.com
+dnl
+AC_DEFUN(JAPHAR_GREP_CFLAGS,
+[case "$CFLAGS" in
+"$1" | "$1 "* | *" $1" | *" $1 "* )
+  ifelse($#, 3, [$3], [:])
+  ;;
+*)
+  $2
+  ;;
+esac
+])
diff -ur src-2.8.90/configure.in src-2.8.90-local/configure.in
--- src-2.8.90/configure.in	2003-05-19 15:54:24.000000000 +0200
+++ src-2.8.90-local/configure.in	2003-06-02 14:25:23.000000000 +0200
@@ -40,8 +40,13 @@
   YPBINDIR=${libexecdir}
 fi
 AC_SUBST(YPBINDIR)
-YPMAPDIR="/var/yp"
+
+dnl Location of the NIS maps.  default: /var/yp
+AC_ARG_ENABLE(ypmapdir,
+	[  --enable-ypmapdir=path  Disable check for root password [default=/var/yp]],
+              YPMAPDIR=$enableval, YPMAPDIR=/var/yp)
 AC_SUBST(YPMAPDIR)
+
 if test ${sbindir} = '${exec_prefix}/sbin'
 then
   if test "${exec_prefix}" = "NONE"
@@ -56,8 +61,6 @@
 AC_SUBST(SBINDIR)
 
 dnl Checks for programs.
-EXTRA_CFLAGS="-W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual"
-AC_SUBST(EXTRA_CFLAGS)
 AC_PROG_CC
 AC_ISC_POSIX
 AC_PROG_CPP
@@ -65,6 +68,25 @@
 AC_PROG_MAKE_SET
 AC_PROG_RANLIB
 
+if eval "test x$GCC = xyes"; then
+   # Can not use -ansi as this make alloca() unavailable on Mac OS X 10.2
+  for flag in \
+      -pedantic \
+      -W \
+      -Wall \
+      -Wbad-function-cast \
+      -Wcast-align \
+      -Wcast-qual \
+      -Wmissing-declarations \
+      -Wmissing-prototypes \
+      -Wpointer-arith \
+      -Wreturn-type \
+      -Wstrict-prototypes
+  do
+    JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
+  done
+fi
+
 AM_WITH_DMALLOC
 AM_WITH_EFENCE
 
@@ -152,6 +174,7 @@
   AC_CHECK_HEADERS(xcrypt.h crypt.h)
 fi
 AC_SUBST(LIBCRYPT)
+AC_CHECK_LIB(rpcsvc, getrpcport)
 AC_CHECK_LIB(nsl,gethostbyname)
 AC_CHECK_LIB(socket,socket)
 AC_CHECK_LIB(resolv, res_gethostbyname, RESOLV="-lresolv", RESOLV="")
@@ -169,7 +192,7 @@
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(fcntl.h paths.h sys/file.h sys/time.h syslog.h unistd.h)
 AC_CHECK_HEADERS(getopt.h shadow.h rpc/clnt_soc.h rpc/svc_soc.h)
-AC_CHECK_HEADERS(netinet/in.h)
+AC_CHECK_HEADERS(netinet/in.h alloca.h poll.h)
 AC_CHECK_TYPE(in_addr_t, ,[AC_DEFINE(in_addr_t,int,[Define to int if you don't have in_addr_t])],[#include <netinet/in.h>])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -192,9 +215,17 @@
 dnl Checks for library functions.
 AC_FUNC_MEMCMP
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(inet_aton vsyslog lckpwdf)
+AC_CHECK_FUNCS(inet_aton inet_pton vsyslog lckpwdf)
 AC_CHECK_FUNCS(strdup strndup strerror strstr strsep stpcpy snprintf)
 AC_CHECK_FUNCS(gethostname gettimeofday select socket uname getopt_long)
+
+AC_CHECK_FUNCS(xdr_domainname xdr_ypxfrstat xdr_ypresp_xfr xdr_ypreq_xfr)
+AC_CHECK_FUNCS(xdr_ypmap_parms xdr_ypreq_nokey xdr_ypresp_master xdr_mapname)
+AC_CHECK_FUNCS(xdr_peername xdr_ypstat xdr_ypbind_binding xdr_yppushresp_xfr)
+AC_CHECK_FUNCS(xdr_yppush_status)
+
+AC_CHECK_FUNCS(getrpcport svc_getcaller svc_getrpccaller)
+AC_CHECK_FUNCS(setenv putenv fgetpwent putpwent fgetgrent)
 AC_CHECK_FUNCS(_rpc_dtablesize getdtablesize getspnam getline getdelim)
 AC_CHECK_DECL(svc_max_pollfd,AC_DEFINE(HAVE_SVC_MAX_POLLFD, 1, [Define if the system supports svc_max_pollfd.]),, [#include <rpc/rpc.h>])
 
@@ -221,6 +252,7 @@
   Libraries:		  ${LIBS} ${LIBDBM} ${LIBCRYPT}
   Awk:                    ${AWK}
   Shell:		  ${BASH}
+  NIS map dir:            ${YPMAPDIR}
   Install path prefix:    ${prefix}"
 if test ${sysconfdir} != '${prefix}/etc'
 then
diff -ur src-2.8.90/lib/Makefile.am src-2.8.90-local/lib/Makefile.am
--- src-2.8.90/lib/Makefile.am	2003-02-04 18:06:15.000000000 +0100
+++ src-2.8.90-local/lib/Makefile.am	2003-05-21 17:53:04.000000000 +0200
@@ -12,11 +12,11 @@
 
 rpcsvc_HEADERS = ypxfrd.x
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -D_REENTRANT=1 -DCONFDIR=\"$(sysconfdir)\"
 INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
 
 libyp_a_SOURCES = log_msg.c ypserv_conf.c ypxfrd_xdr.c \
+		compat.c compat.h \
 		ypproc_match_2.c securenets.c access.c yp_db.c
 
 CLEANFILES = *~
diff -ur src-2.8.90/lib/access.c src-2.8.90-local/lib/access.c
--- src-2.8.90/lib/access.c	2003-03-03 11:43:39.000000000 +0100
+++ src-2.8.90-local/lib/access.c	2003-05-29 08:41:00.000000000 +0200
@@ -37,6 +37,7 @@
 #include "access.h"
 #include "yp_db.h"
 #include "yp.h"
+#include "compat.h"
 
 static conffile_t *conf = NULL;
 
@@ -130,7 +131,7 @@
 int
 is_valid (struct svc_req *rqstp, const char *map, const char *domain)
 {
-  struct sockaddr_in *sin;
+  const struct sockaddr_in *sin;
   int status;
   static unsigned long int oldaddr = 0;		/* so we dont log multiple times */
   static int oldstatus = -1;
Only in src-2.8.90-local/lib: compat.c
Only in src-2.8.90-local/lib: compat.h
diff -ur src-2.8.90/lib/yp.h src-2.8.90-local/lib/yp.h
--- src-2.8.90/lib/yp.h	2001-02-18 10:19:09.000000000 +0100
+++ src-2.8.90-local/lib/yp.h	2003-05-28 17:43:21.000000000 +0200
@@ -8,7 +8,9 @@
 
 #include <rpc/rpc.h>
 
+#if 0
 #include <pthread.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -30,7 +32,7 @@
 	YP_BADDB = -5,
 	YP_YPERR = -6,
 	YP_BADARGS = -7,
-	YP_VERS = -8,
+	YP_VERS = -8
 };
 typedef enum ypstat ypstat;
 
@@ -50,7 +52,7 @@
 	YPXFR_CLEAR = -11,
 	YPXFR_FORCE = -12,
 	YPXFR_XFRERR = -13,
-	YPXFR_REFUSED = -14,
+	YPXFR_REFUSED = -14
 };
 typedef enum ypxfrstat ypxfrstat;
 
@@ -176,7 +178,7 @@
 	YPPUSH_CLEAR = -11,
 	YPPUSH_FORCE = -12,
 	YPPUSH_XFRERR = -13,
-	YPPUSH_REFUSED = -14,
+	YPPUSH_REFUSED = -14
 };
 typedef enum yppush_status yppush_status;
 
@@ -188,7 +190,7 @@
 
 enum ypbind_resptype {
 	YPBIND_SUCC_VAL = 1,
-	YPBIND_FAIL_VAL = 2,
+	YPBIND_FAIL_VAL = 2
 };
 typedef enum ypbind_resptype ypbind_resptype;
 
diff -ur src-2.8.90/lib/ypserv_conf.c src-2.8.90-local/lib/ypserv_conf.c
--- src-2.8.90/lib/ypserv_conf.c	2003-05-19 15:07:20.000000000 +0200
+++ src-2.8.90-local/lib/ypserv_conf.c	2003-05-28 18:36:04.000000000 +0200
@@ -28,10 +28,14 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#ifdef HAVE_ALLOCA_H
 #include <alloca.h>
+#endif /* HAVE_ALLOCA_H */
+#include <unistd.h>
 
 #include "log_msg.h"
 #include "ypserv_conf.h"
+#include "compat.h"
 
 int dns_flag = 0;
 int xfr_check_port = 0;
@@ -396,14 +400,11 @@
 	      log_msg ("ypserv.conf: xfr_check_port: %d", xfr_check_port);
 	    break;
 	  }
-#ifdef __GNUC__
 	  /* GCC syntax shows our intent much more clearly */
-	case '1' ... '9':
-#else
+	  /* case '1' ... '9': */
 	case '1': case '2': case '3':
 	case '4': case '5': case '6':
 	case '7': case '8': case '9':
-#endif
 	case '*':
 	  {
 	    char *n, *d, *m, *s, *p, *f;
diff -uNr src-2.8.90/lib/compat.c src-2.8.90-local/lib/compat.c
--- src-2.8.90/lib/compat.c	1970-01-01 01:00:00.000000000 +0100
+++ src-2.8.90-local/lib/compat.c	2003-06-02 14:33:07.000000000 +0200
@@ -0,0 +1,597 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include "compat.h"
+
+#ifndef HAVE_STPCPY
+char *stpcpy(char *s1, const char *s2)
+{
+  /* This is a naive implementation for platforms missing the
+     function.  It should be rewritten. */
+  strcpy(s1, s2);
+  return s1 + strlen(s2);
+}
+#endif /* not HAVE_STPCPY */
+
+#ifndef HAVE_STRNDUP
+char *strndup (const char * s, int size)
+{
+  int len = strlen(s) + 1;
+  char *retval;
+
+  len = len > size ? size : len;
+  retval = malloc(len);
+  strcpy(retval, s);
+  retval[len-1] = '\0';
+  
+  return retval;
+}
+#endif /* not HAVE_STRNDUP */
+
+#ifndef HAVE_GETOPT_LONG
+int
+getopt_long (int argc, char *const *argv, const char *shortopts,
+	     const struct option *longopts, int *longind)
+{
+  return getopt(argc, argv, shortopts);
+}
+#endif /* not HAVE_GETOPT_LONG */
+
+#if !defined(HAVE_GETDELIM) && !defined(HAVE_GETLINE)
+/* copied from cvs 1.11.5 source */
+/* getline.c -- Replacement for GNU C library function getline
+
+Copyright (C) 1993 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.  */
+
+/* Written by Jan Brittenson, bson@gnu.ai.mit.edu.  */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+
+#define GETLINE_NO_LIMIT -1
+
+#if STDC_HEADERS
+#include <stdlib.h>
+#else
+char *malloc (), *realloc ();
+#endif
+
+/* Always add at least this many bytes when extending the buffer.  */
+#define MIN_CHUNK 64
+
+/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
+   + OFFSET (and null-terminate it).  If LIMIT is non-negative, then
+   read no more than LIMIT chars.
+
+   *LINEPTR is a pointer returned from malloc (or NULL), pointing to
+   *N characters of space.  It is realloc'd as necessary.  
+
+   Return the number of characters read (not including the null
+   terminator), or -1 on error or EOF.  On a -1 return, the caller
+   should check feof(), if not then errno has been set to indicate the
+   error.  */
+
+int
+getstr (char **lineptr, size_t *n, FILE *stream, int terminator,
+	int offset, int limit)
+{
+  int nchars_avail;		/* Allocated but unused chars in *LINEPTR.  */
+  char *read_pos;		/* Where we're reading into *LINEPTR. */
+  int ret;
+
+  if (!lineptr || !n || !stream)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if (!*lineptr)
+    {
+      *n = MIN_CHUNK;
+      *lineptr = malloc (*n);
+      if (!*lineptr)
+	{
+	  errno = ENOMEM;
+	  return -1;
+	}
+      *lineptr[0] = '\0';
+    }
+
+  nchars_avail = *n - offset;
+  read_pos = *lineptr + offset;
+
+  for (;;)
+    {
+      int save_errno;
+      register int c;
+
+      if (limit == 0)
+          break;
+      else
+      {
+          c = getc (stream);
+
+          /* If limit is negative, then we shouldn't pay attention to
+             it, so decrement only if positive. */
+          if (limit > 0)
+              limit--;
+      }
+
+      save_errno = errno;
+
+      /* We always want at least one char left in the buffer, since we
+	 always (unless we get an error while reading the first char)
+	 NUL-terminate the line buffer.  */
+
+      assert((*lineptr + *n) == (read_pos + nchars_avail));
+      if (nchars_avail < 2)
+	{
+	  if (*n > MIN_CHUNK)
+	    *n *= 2;
+	  else
+	    *n += MIN_CHUNK;
+
+	  nchars_avail = *n + *lineptr - read_pos;
+	  *lineptr = realloc (*lineptr, *n);
+	  if (!*lineptr)
+	    {
+	      errno = ENOMEM;
+	      return -1;
+	    }
+	  read_pos = *n - nchars_avail + *lineptr;
+	  assert((*lineptr + *n) == (read_pos + nchars_avail));
+	}
+
+      if (ferror (stream))
+	{
+	  /* Might like to return partial line, but there is no
+	     place for us to store errno.  And we don't want to just
+	     lose errno.  */
+	  errno = save_errno;
+	  return -1;
+	}
+
+      if (c == EOF)
+	{
+	  /* Return partial line, if any.  */
+	  if (read_pos == *lineptr)
+	    return -1;
+	  else
+	    break;
+	}
+
+      *read_pos++ = c;
+      nchars_avail--;
+
+      if (c == terminator)
+	/* Return the line.  */
+	break;
+    }
+
+  /* Done - NUL terminate and return the number of chars read.  */
+  *read_pos = '\0';
+
+  ret = read_pos - (*lineptr + offset);
+  return ret;
+}
+
+ssize_t
+getline (char **lineptr, size_t *n, FILE *stream)
+{
+  return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
+}
+
+int
+getline_safe (char **lineptr, size_t *n, FILE *stream, int limit)
+{
+  return getstr (lineptr, n, stream, '\n', 0, limit);
+}
+
+#endif /* not HAVE_GETDELIM and not HAVE_GETLINE */
+
+#if !defined(HAVE_SVC_GETCALLER) && !defined(svc_getcaller)
+const struct sockaddr_in *
+svc_getcaller(const SVCXPRT *xprt)
+{
+#  ifdef HAVE_SVC_GETRPCCALLER
+  const struct netbuf *addr;
+  addr = svc_getrpccaller(xprt);
+  fprintf(stderr, "warning: Bogus svc_getcaller() called\n");
+  /* XXX find out how the result from svc_getrpccaller relates to
+     svc_getcaller */
+  return addr;
+#  else /* not HAVE_SVC_GETRPCCALLER */
+#    error "Missing both svc_getcaller() and svc_getrpccaller()"
+#  endif /* not HAVE_SVC_GETRPCCALLER */
+}
+#endif /* not HAVE_SVC_GETCALLER */
+
+
+#ifndef HAVE__RPC_DTABLESIZE
+#  if HAVE_GETDTABLESIZE
+int _rpc_dtablesize()
+{
+        static int size;
+        
+        if (size == 0) {
+                size = getdtablesize();
+        }
+        return (size);
+}
+#  else
+#  include <sys/resource.h>
+int _rpc_dtablesize()
+{
+    static int size = 0;
+    struct rlimit rlb;
+
+    if (size == 0)
+    {
+        if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0)
+            size = rlb.rlim_cur;
+    }
+
+    return size;
+}
+#  endif /* not HAVE_GETDTABLESIZE */
+#endif /* not HAVE__RPC_DTABLESIZE */
+
+#ifndef HAVE_INET_ATON
+/* Source: http://mail.gnu.org/archive/html/autoconf/2002-08/msg00036.html */
+/*  $Id: ypserv-2.8.90-20030602.diff,v 1.1 2003/06/02 13:51:25 pere Exp $
+**
+**  Replacement for a missing inet_aton.
+**
+**  Written by Russ Allbery <rra@bogus.example.com>
+**  This work is hereby placed in the public domain by its author.
+**
+**  Provides the same functionality as the standard library routine
+**  inet_aton for those platforms that don't have it.  inet_aton is
+**  thread-safe.
+*/
+
+/* #include "config.h" */
+/* #include "clibrary.h" */
+#include <netinet/in.h>
+
+/* If we're running the test suite, rename inet_ntoa to avoid conflicts with
+   the system version. */
+#if TESTING
+# define inet_aton test_inet_aton
+int test_inet_aton(const char *, struct in_addr *);
+#endif
+
+int
+inet_aton(const char *s, struct in_addr *addr)
+{
+    unsigned long octet[4], address;
+    const char *p;
+    int base, i;
+    int part = 0;
+
+    if (s == NULL) return 0;
+
+    /* Step through each period-separated part of the address.  If we see
+       more than four parts, the address is invalid. */
+    for (p = s; *p != 0; part++) {
+        if (part > 3) return 0;
+
+        /* Determine the base of the section we're looking at.  Numbers are
+           represented the same as in C; octal starts with 0, hex starts
+           with 0x, and anything else is decimal. */
+        if (*p == '0') {
+            p++;
+            if (*p == 'x') {
+                p++;
+                base = 16;
+            } else {
+                base = 8;
+            }
+        } else {
+            base = 10;
+        }
+
+        /* Make sure there's actually a number.  (A section of just "0"
+           would set base to 8 and leave us pointing at a period; allow
+           that.) */
+        if (*p == '.' && base != 8) return 0;
+        octet[part] = 0;
+
+        /* Now, parse this segment of the address.  For each digit, multiply
+           the result so far by the base and then add the value of the
+           digit.  Be careful of arithmetic overflow in cases where an
+           unsigned long is 32 bits; we need to detect it *before* we
+           multiply by the base since otherwise we could overflow and wrap
+           and then not detect the error. */
+        for (; *p != 0 && *p != '.'; p++) {
+            if (octet[part] > 0xffffffffUL / base) return 0;
+
+            /* Use a switch statement to parse each digit rather than
+               assuming ASCII.  Probably pointless portability.... */
+            switch (*p) {
+                case '0':           i = 0;  break;
+                case '1':           i = 1;  break;
+                case '2':           i = 2;  break;
+                case '3':           i = 3;  break;
+                case '4':           i = 4;  break;
+                case '5':           i = 5;  break;
+                case '6':           i = 6;  break;
+                case '7':           i = 7;  break;
+                case '8':           i = 8;  break;
+                case '9':           i = 9;  break;
+                case 'A': case 'a': i = 10; break;
+                case 'B': case 'b': i = 11; break;
+                case 'C': case 'c': i = 12; break;
+                case 'D': case 'd': i = 13; break;
+                case 'E': case 'e': i = 14; break;
+                case 'F': case 'f': i = 15; break;
+                default:            return 0;
+            }
+            if (i >= base) return 0;
+            octet[part] = (octet[part] * base) + i;
+        }
+
+        /* Advance over periods; the top of the loop will increment the
+           count of parts we've seen.  We need a check here to detect an
+           illegal trailing period. */
+        if (*p == '.') {
+            p++;
+            if (*p == 0) return 0;
+        }
+    }
+    if (part == 0) return 0;
+
+    /* IPv4 allows three types of address specification:
+
+           a.b
+           a.b.c
+           a.b.c.d
+
+       If there are fewer than four segments, the final segment accounts for
+       all of the remaining portion of the address.  For example, in the a.b
+       form, b is the final 24 bits of the address.  We also allow a simple
+       number, which is interpreted as the 32-bit number corresponding to
+       the full IPv4 address.
+
+       The first for loop below ensures that any initial segments represent
+       only 8 bits of the address and builds the upper portion of the IPv4
+       address.  Then, the remaining segment is checked to make sure it's no
+       bigger than the remaining space in the address and then is added into
+       the result. */
+    address = 0;
+    for (i = 0; i < part - 1; i++) {
+        if (octet[i] > 0xff) return 0;
+        address |= octet[i] << (8 * (3 - i));
+    }
+    if (octet[i] > (0xffffffffUL >> (i * 8))) return 0;
+    address |= octet[i];
+    if (addr != NULL) addr->s_addr = htonl(address);
+    return 1;
+}
+#endif /* not HAVE_INET_ATON */
+
+
+#ifndef HAVE_INET_PTON
+#include <arpa/inet.h>
+#include <sys/socket.h>
+int
+inet_pton(int af, const char *src, void *dst)
+{
+  switch (af) {
+  case AF_INET:
+    return inet_aton(src, (struct in_addr *)dst);
+    break;
+#ifdef AF_INET6
+  case AF_INET6:
+#endif /* AF_INET6 */
+  default:
+    fprintf(stderr, "warning: Bogus inet_pton() called\n");
+    errno = EAFNOSUPPORT;
+    return -1;
+    break;
+  }
+}
+#endif /* not HAVE_INET_PTON */
+
+#ifndef HAVE_FGETPWENT
+struct passwd *
+fgetpwent(FILE *stream)
+{
+  fprintf(stderr, "warning: Bogus fgetpwent() called\n");
+  return NULL;
+}
+#endif /* not HAVE_FGETPWENT */
+
+#ifndef HAVE_PUTPWENT
+int
+putpwent(const struct passwd *p, FILE *stream)
+{
+  fprintf(stderr, "warning: Bogus putpwent() called\n");
+  return -1;
+}
+#endif /* not HAVE_PUTPWENT */
+
+#ifndef HAVE_FGETGRENT
+struct group *
+fgetgrent(FILE *stream)
+{
+  fprintf(stderr, "warning: Bogus fgetgrent() called\n");
+  return NULL;
+}
+#endif /* not HAVE_FGETGRENT */
+
+#ifndef HAVE_XDR_YPXFRSTAT
+#include <rpc/rpc.h>
+#include "yp.h"
+bool_t
+xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
+{
+    if (!xdr_enum(xdrs, (enum_t *)objp))
+	return FALSE;
+
+    return TRUE;
+}
+#endif /* not HAVE_XDR_YPXFRSTAT */
+
+#ifndef HAVE_XDR_DOMAINNAME
+#include <rpc/rpc.h>
+bool_t
+xdr_domainname(XDR *xdrs, domainname *objp)
+{
+    if (!xdr_string(xdrs, objp, YPMAXDOMAIN))
+	return FALSE;
+
+    return TRUE;
+}
+#endif /* not HAVE_XDR_DOMAINNAME */
+
+#ifndef HAVE_XDR_YPRESP_XFR
+#include <rpc/rpc.h>
+bool_t
+xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
+{
+    if (!xdr_u_int(xdrs, &objp->transid))
+	return FALSE;
+
+    if (!xdr_ypxfrstat(xdrs, &objp->xfrstat))
+	return FALSE;
+
+    return TRUE;
+}
+#endif /* not HAVE_XDR_YPRESP_XFR */
+
+#ifndef HAVE_XDR_YPMAP_PARMS
+bool_t
+xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
+{
+  if (!xdr_domainname(xdrs, &objp->domain))
+    return (FALSE);
+  if (!xdr_mapname(xdrs, &objp->map))
+    return (FALSE);
+  if (!xdr_u_int(xdrs, &objp->ordernum))
+    return (FALSE);
+  if (!xdr_peername(xdrs, &objp->peer))
+    return (FALSE);
+  return (TRUE);
+}
+#endif /* not HAVE_XDR_YPMAP_PARMS */
+
+
+#ifndef HAVE_XDR_YPREQ_XFR
+bool_t
+xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
+{ 
+  if (!xdr_ypmap_parms(xdrs, &objp->map_parms))
+    return (FALSE);
+  if (!xdr_u_int(xdrs, &objp->transid))
+    return (FALSE);
+  if (!xdr_u_int(xdrs, &objp->prog))
+    return (FALSE);
+  if (!xdr_u_int(xdrs, &objp->port))
+    return (FALSE);
+  return (TRUE);
+}
+#endif /* not HAVE_XDR_YPREQ_XFR */
+
+#ifndef HAVE_XDR_MAPNAME
+bool_t
+xdr_mapname (XDR *xdrs, mapname *objp)
+{
+  if (!xdr_string (xdrs, objp, YPMAXMAP))
+    return FALSE;
+
+  return TRUE;
+}
+#endif /* not HAVE_XDR_MAPNAME */
+
+#ifndef HAVE_XDR_PEERNAME
+bool_t
+xdr_peername (XDR *xdrs, peername *objp)
+{
+  if (!xdr_string (xdrs, objp, YPMAXPEER))
+    return (FALSE);
+  return (TRUE);
+}
+#endif /* not HAVE_XDR_PEERNAME */
+
+#ifndef HAVE_XDR_YPSTAT
+bool_t
+xdr_ypstat (XDR *xdrs, ypstat *objp)
+{
+  if (!xdr_enum (xdrs, (enum_t *) objp))
+    return FALSE;
+
+  return TRUE;
+}
+#endif /* not HAVE_XDR_YPSTAT */
+
+#ifndef HAVE_XDR_YPRESP_MASTER
+bool_t
+xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
+{
+  if (!xdr_ypstat (xdrs, &objp->stat))
+    return FALSE;
+  if (!xdr_peername (xdrs, &objp->peer))
+    return FALSE;
+  return TRUE;
+}
+#endif /* not HAVE_XDR_YPRESP_MASTER */
+
+#ifndef HAVE_XDR_YPBIND_BINDING
+bool_t
+xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
+{
+  if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
+    return FALSE;
+  if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
+    return FALSE;
+  return TRUE;
+}
+#endif /* not HAVE_XDR_YPBIND_BINDING */
+
+#ifndef HAVE_XDR_YPREQ_NOKEY
+bool_t
+xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
+{
+  if (!xdr_domainname (xdrs, &objp->domain))
+    return FALSE;
+
+  if (!xdr_mapname (xdrs, &objp->map))
+    return FALSE;
+
+  return TRUE;
+}
+#endif /* not HAVE_XDR_YPREQ_NOKEY */
+
+#ifndef HAVE_XDR_YPPUSH_STATUS
+bool_t
+xdr_yppush_status(XDR *xdrs, yppush_status *objp)
+{
+  if (!xdr_enum(xdrs, (enum_t *)objp))
+    return (FALSE);
+  return (TRUE);
+}
+#endif /* not HAVE_XDR_YPPUSH_STATUS */
+
+#ifndef HAVE_XDR_YPPUSHRESP_XFR
+bool_t
+xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
+{
+  if (!xdr_u_int(xdrs, &objp->transid))
+    return (FALSE);
+  if (!xdr_yppush_status(xdrs, &objp->status))
+    return (FALSE);
+  return (TRUE);
+}
+#endif /* not HAVE_XDR_YPPUSHRESP_XFR */
diff -uNr src-2.8.90/lib/compat.h src-2.8.90-local/lib/compat.h
--- src-2.8.90/lib/compat.h	1970-01-01 01:00:00.000000000 +0100
+++ src-2.8.90-local/lib/compat.h	2003-05-29 08:33:02.000000000 +0200
@@ -0,0 +1,82 @@
+/* Copyright (c) 2000 Thorsten Kukuk
+   Author: Thorsten Kukuk <kukuk@suse.de>
+
+   The YP Server is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The YP Server is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public
+   License along with the YP Server; see the file COPYING. If
+   not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+   Cambridge, MA 02139, USA. */
+
+#ifndef _YPSERV_COMPAT_H
+#define _YPSERV_COMPAT_H
+
+#include "config.h"
+
+/* __attribute__ is only in GCC */
+#ifdef __GNUC__
+#define UNUSED __attribute__ ((unused))
+#else
+#define UNUSED
+#endif
+
+#ifndef HAVE_STPCPY
+char *stpcpy(char *, const char *);
+#endif /* not HAVE_STPCPY */
+
+#ifndef HAVE_STRNDUP
+char *strndup (const char *, int);
+#endif /* not HAVE_STRNDUP */
+
+extern int svc_max_pollfd;
+extern struct pollfd *svc_pollfd;
+
+#ifndef HAVE_GETOPT_LONG
+struct option {
+  const char *name;
+  int has_arg;
+  int *flag;
+  int val;
+};
+
+# define no_argument            0
+# define required_argument      1
+# define optional_argument      2
+
+int getopt_long (int argc, char *const *argv, const char *shortopts,
+		 const struct option *longopts, int *longind);
+#endif /* not HAVE_GETOPT_LONG */
+
+#if !defined(HAVE_GETDELIM) && !defined(HAVE_GETLINE)
+/* Use getline() if getdelim() is missing */
+#include <unistd.h> /* size_t */
+#include <stdio.h> /* FILE */
+ssize_t getline (char **lineptr, size_t *n, FILE *stream);
+#endif /*  not HAVE_GETDELIM and not HAVE_GETLINE */
+
+#ifndef HAVE_SVC_GETCALLER
+#  include <rpc/rpc.h>
+#  if !defined(svc_getcaller)
+struct sockaddr_in;
+const struct sockaddr_in *svc_getcaller(const SVCXPRT *xprt);
+#  endif
+#endif /* not HAVE_SVC_GETCALLER */
+
+#ifndef HAVE__RPC_DTABLESIZE
+int _rpc_dtablesize(void);
+#endif
+
+#ifndef HAVE_INET_PTON
+int inet_pton(int af, const char *src, void *dst);
+#endif /* not HAVE_INET_PTON */
+
+
+#endif /* not _YPSERV_COMPAT_H */
diff -ur src-2.8.90/makedbm/Makefile.am src-2.8.90-local/makedbm/Makefile.am
--- src-2.8.90/makedbm/Makefile.am	2003-02-04 18:06:20.000000000 +0100
+++ src-2.8.90-local/makedbm/Makefile.am	2003-05-21 17:53:23.000000000 +0200
@@ -8,7 +8,6 @@
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
 	-DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"/var/yp\" \
 	-DUSE_FQDN=@USE_FQDN@
diff -ur src-2.8.90/makedbm/makedbm.c src-2.8.90-local/makedbm/makedbm.c
--- src-2.8.90/makedbm/makedbm.c	2002-12-21 14:53:26.000000000 +0100
+++ src-2.8.90-local/makedbm/makedbm.c	2003-05-30 13:01:18.000000000 +0200
@@ -22,18 +22,23 @@
 #include "config.h"
 #endif
 
+#ifdef HAVE_ALLOCA_H
 #include <alloca.h>
+#endif /* HAVE_ALLOCA_H */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
+#endif /* HAVE_GETOPT_H */
 #include <fcntl.h>
 #include <ctype.h>
 #include <netdb.h>
 #include <rpc/rpc.h>
 
 #include "yp.h"
+#include "compat.h"
 
 #if defined (__NetBSD__) || (defined(__GLIBC__) && (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0))
 /* <rpc/rpc.h> is missing the prototype */
diff -ur src-2.8.90/mknetid/Makefile.am src-2.8.90-local/mknetid/Makefile.am
--- src-2.8.90/mknetid/Makefile.am	2003-02-04 18:06:24.000000000 +0100
+++ src-2.8.90-local/mknetid/Makefile.am	2003-05-21 17:53:33.000000000 +0200
@@ -8,7 +8,6 @@
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
 	-DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"/var/yp\"
 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
@@ -25,3 +24,4 @@
 
 mknetid_SOURCES = mknetid.c netid_hash.c
 
+mknetid_LDADD =  $(top_builddir)/lib/libyp.a
diff -ur src-2.8.90/mknetid/mknetid.c src-2.8.90-local/mknetid/mknetid.c
--- src-2.8.90/mknetid/mknetid.c	2002-04-26 21:58:03.000000000 +0200
+++ src-2.8.90-local/mknetid/mknetid.c	2003-05-21 16:07:50.000000000 +0200
@@ -29,9 +29,12 @@
 #include <unistd.h>
 #include <rpc/types.h>
 #include <rpcsvc/ypclnt.h>
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
+#endif
 
 #include "mknetid.h"
+#include "compat.h"
 
 static int quiet_flag = 0;
 
@@ -156,10 +159,10 @@
 
   while (!feof (file))
     {
-#ifdef HAVE_GETLINE
-      ssize_t n = getline (&line, &length, file);
-#elif HAVE_GETDELIM
+#if HAVE_GETDELIM
       ssize_t n = getdelim (&line, &length, '\n', file);
+#else
+      ssize_t n = getline (&line, &length, file);
 #endif
       if (n < 1)
 	break;
@@ -189,10 +192,10 @@
 
   while (!feof (file))
     {
-#ifdef HAVE_GETLINE
-      ssize_t n = getline (&line, &length, file);
-#elif HAVE_GETDELIM
+#if HAVE_GETDELIM
       ssize_t n = getdelim (&line, &length, '\n', file);
+#else
+      ssize_t n = getline (&line, &length, file);
 #endif
       if (n < 1)
 	break;
@@ -224,10 +227,10 @@
 
   while (!feof (file))
     {
-#ifdef HAVE_GETLINE
-      ssize_t n = getline (&line, &length, file);
-#elif HAVE_GETDELIM
+#if HAVE_GETDELIM
       ssize_t n = getdelim (&line, &length, '\n', file);
+#else
+      ssize_t n = getline (&line, &length, file);
 #endif
       if (n < 1)
 	break;
@@ -260,10 +263,10 @@
     {
       while (!feof (file))
 	{
-#ifdef HAVE_GETLINE
-	  ssize_t n = getline (&line, &length, file);
-#elif HAVE_GETDELIM
+#if HAVE_GETDELIM
 	  ssize_t n = getdelim (&line, &length, '\n', file);
+#else
+	  ssize_t n = getline (&line, &length, file);
 #endif
 	  if (n < 1)
 	    break;
diff -ur src-2.8.90/revnetgroup/Makefile.am src-2.8.90-local/revnetgroup/Makefile.am
--- src-2.8.90/revnetgroup/Makefile.am	2003-02-04 18:06:27.000000000 +0100
+++ src-2.8.90-local/revnetgroup/Makefile.am	2003-05-21 17:53:44.000000000 +0200
@@ -8,7 +8,6 @@
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
 	-DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"/var/yp\"
 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
@@ -25,3 +24,4 @@
 
 revnetgroup_SOURCES = revnetgroup.c getnetgrent.c hash.c
 
+revnetgroup_LDADD =  $(top_builddir)/lib/libyp.a
diff -ur src-2.8.90/revnetgroup/hash.c src-2.8.90-local/revnetgroup/hash.c
--- src-2.8.90/revnetgroup/hash.c	2001-03-25 15:37:45.000000000 +0200
+++ src-2.8.90-local/revnetgroup/hash.c	2003-05-21 14:36:16.000000000 +0200
@@ -32,13 +32,10 @@
 #include <string.h>
 #include "hash.h"
 #include <assert.h>
+#include "compat.h"
 
 #define TABLESIZE 997		/*Should be a prime */
 
-#ifndef HAVE_STRDUP
-#include "compat/strdup.c"
-#endif
-
 /*
  * hash_malloc(void)
  *
@@ -143,7 +140,7 @@
  *
  */
 int
-hash_free (hash_t **table __attribute__ ((unused)))
+hash_free (hash_t **table UNUSED)
 {
   /* XXX Not implementet yet! */
 
diff -ur src-2.8.90/revnetgroup/revnetgroup.c src-2.8.90-local/revnetgroup/revnetgroup.c
--- src-2.8.90/revnetgroup/revnetgroup.c	2001-03-25 15:37:45.000000000 +0200
+++ src-2.8.90-local/revnetgroup/revnetgroup.c	2003-05-21 15:10:48.000000000 +0200
@@ -24,11 +24,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG)
+#if defined(HAVE_GETOPT_H)
 #include <getopt.h>
 #endif
 
 #include "hash.h"
+#include "compat.h"
 
 #define PARSE_FOR_USERS 0
 #define PARSE_FOR_HOSTS 1
diff -ur src-2.8.90/rpc.yppasswdd/Makefile.am src-2.8.90-local/rpc.yppasswdd/Makefile.am
--- src-2.8.90/rpc.yppasswdd/Makefile.am	2003-02-04 18:06:41.000000000 +0100
+++ src-2.8.90-local/rpc.yppasswdd/Makefile.am	2003-05-21 17:53:52.000000000 +0200
@@ -8,7 +8,6 @@
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
 	-DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"@YPMAPDIR@\" \
 	-DUSE_FQDN=@USE_FQDN@
diff -ur src-2.8.90/rpc.yppasswdd/update.c src-2.8.90-local/rpc.yppasswdd/update.c
--- src-2.8.90/rpc.yppasswdd/update.c	2001-04-08 22:40:10.000000000 +0200
+++ src-2.8.90-local/rpc.yppasswdd/update.c	2003-05-30 11:48:18.000000000 +0200
@@ -26,6 +26,10 @@
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif /* HAVE_ALLOCA_H */
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <netinet/in.h>
@@ -40,6 +44,7 @@
 #ifdef HAVE_SHADOW_H
 #include <shadow.h>
 #endif
+#include "compat.h"
 
 #ifndef CHECKROOT
 /* Set to 0 if you don't want to check against the root password
@@ -187,7 +192,7 @@
   int retries;
   static int res;                /* I hate static variables */
   char *logbuf;
-  struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+  const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
 
   /* Be careful here with the debug option. You can see the old
      and new password in clear text !! */
@@ -276,6 +281,7 @@
     }
   else
     {
+#ifdef HAVE_LCKPWDF
       /* Lock the passwd file. We retry several times. */
       retries = 0;
       while (lckpwdf () && retries < MAX_RETRIES)
@@ -290,11 +296,14 @@
 	  log_msg ("password file locked");
 	  return &res;
 	}
+#endif /* HAVE_LCKPWDF */
 
       res = update_files (yppw, logbuf, &shadow_changed, &passwd_changed,
 			  &chfn, &chsh);
 
+#ifdef HAVE_LCKPWDF
       ulckpwdf ();
+#endif /* HAVE_LCKPWDF */
     }
 
   /* Fork off process to rebuild NIS passwd.* maps. */
@@ -358,6 +367,7 @@
     {
       if (strcmp (pw->pw_passwd, "x") == 0)
 	{
+#ifdef HAVE_GETSPNAM /* shadow password */
 	  struct spwd *spw;
 
 	  if ((spw = getspnam ("root")) != NULL)
@@ -365,6 +375,7 @@
 	      rootpass = alloca (strlen (spw->sp_pwdp) + 1);
 	      strcpy (rootpass, spw->sp_pwdp);
 	    }
+#endif /* HAVE_GETSPNAM */
 	}
       else
 	{
@@ -402,6 +413,7 @@
   chmod (path_passwd_tmp, passwd_stat.st_mode);
   chown (path_passwd_tmp, passwd_stat.st_uid, passwd_stat.st_gid);
 
+#ifdef HAVE_GETSPNAM
   /* Open the shadow file for reading. */
   if ((oldsf = fopen (path_shadow, "r")) != NULL)
     {
@@ -426,6 +438,7 @@
       chmod (path_shadow_tmp, shadow_stat.st_mode);
       chown (path_shadow_tmp, shadow_stat.st_uid, shadow_stat.st_gid);
     }
+#endif /* HAVE_GETSPNAM */
 
   /* Loop over all passwd entries */
   while ((pw = fgetpwent (oldpf)) != NULL)
@@ -442,6 +455,7 @@
 	  if (oldsf != NULL &&
 	      pw->pw_passwd[0] == 'x' && pw->pw_passwd[1] == '\0')
 	    {
+#ifdef HAVE_GETSPNAM /* shadow password */
 	      /* Search for the shadow entry of this user */
 	      while ((spw = fgetspent (oldsf)) != NULL)
 		{
@@ -463,6 +477,7 @@
 		      goto error;
 		    }
 		}
+#endif /* HAVE_GETSPNAM */
 	    }
 
 	  /* We don't have a shadow password file or we don't find the
@@ -483,6 +498,7 @@
 		yppw->newpw.pw_passwd[1] == '\0') &&
 	      yppw->newpw.pw_passwd[0] != '\0')
 	    {
+#ifdef HAVE_GETSPNAM /* shadow password */
 	      if (spw)
 		{
 		  /* test if password is expired */
@@ -525,6 +541,7 @@
 		      }
 		}
 	      else /* No shadow entry */
+#endif /* HAVE_GETSPNAM */
 		{
 		  /* set the new passwd */
 		  pw->pw_passwd = yppw->newpw.pw_passwd;
@@ -593,9 +610,12 @@
   if (pw || spw)
     {
       unlink (path_passwd_tmp);
+#ifdef HAVE_GETSPNAM
       unlink (path_shadow_tmp);
+#endif /* HAVE_GETSPNAM */
       return 1;
     }
+#ifdef HAVE_GETSPNAM
   if (*shadow_changed)
     {
       unlink (path_shadow_old);
@@ -604,6 +624,7 @@
     }
   else
     unlink (path_shadow_tmp);
+#endif /* HAVE_GETSPNAM */
 
   if (*passwd_changed)
     {
@@ -634,7 +655,13 @@
     }
   else
     { /* Child - run external update program */
-#if (defined(__sun__) || defined(sun)) && defined(__svr4__)
+#if defined(HAVE_SETENV)
+      setenv ("YP_PASSWD_OLD", yppw->oldpass, 1);
+      setenv ("YP_PASSWD_NEW", yppw->newpw.pw_passwd, 1);
+      setenv ("YP_USER", yppw->newpw.pw_name, 1);
+      setenv ("YP_GECOS", yppw->newpw.pw_gecos, 1);
+      setenv ("YP_SHELL", yppw->newpw.pw_shell, 1);
+#elif defined(HAVE_PUTENV)
       char aenv[5*64], *p;
       p = aenv;
       sprintf(p, "YP_PASSWD_OLD=%s", yppw->oldpass);
@@ -652,11 +679,7 @@
       sprintf(p, "YP_SHELL=%s", yppw->newpw.pw_shell);
       putenv(p);
 #else
-      setenv ("YP_PASSWD_OLD", yppw->oldpass, 1);
-      setenv ("YP_PASSWD_NEW", yppw->newpw.pw_passwd, 1);
-      setenv ("YP_USER", yppw->newpw.pw_name, 1);
-      setenv ("YP_GECOS", yppw->newpw.pw_gecos, 1);
-      setenv ("YP_SHELL", yppw->newpw.pw_shell, 1);
+#  error "Missing both setenv() and putenv().  Need porting."
 #endif
       execlp (external_update_program, external_update_program, NULL);
       _exit (1); /* fall-through */
diff -ur src-2.8.90/rpc.yppasswdd/yppasswdd.c src-2.8.90-local/rpc.yppasswdd/yppasswdd.c
--- src-2.8.90/rpc.yppasswdd/yppasswdd.c	2001-09-02 20:23:26.000000000 +0200
+++ src-2.8.90-local/rpc.yppasswdd/yppasswdd.c	2003-05-30 13:05:12.000000000 +0200
@@ -23,6 +23,14 @@
 #include "config.h"
 #endif
 
+#if 0
+/* get sigaction */
+#define _POSIX_SOURCE
+/* #define _XOPEN_SOURCE_EXTENDED */
+#define __USE_POSIX199309
+#define __USE_UNIX98
+#endif
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
@@ -34,6 +42,7 @@
 #include <fcntl.h>
 #include <syslog.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <rpc/rpc.h>
@@ -42,21 +51,12 @@
 #include <rpc/svc_soc.h>
 #endif
 #include "yppasswd.h"
-#if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG)
+#if defined(HAVE_GETOPT_H)
 #include <getopt.h>
-#else
-#include <compat/getopt.h>
-#endif
-#ifndef HAVE_GETOPT_LONG
-#include <compat/getopt.c>
-#include <compat/getopt1.c>
-#endif
-
-#ifndef HAVE_STRERROR
-#include <compat/strerror.c>
 #endif
 
 #include "log_msg.h"
+#include "compat.h"
 
 #ifdef HAVE_PATHS_H
 #include <paths.h>
@@ -197,14 +197,14 @@
 }
 
 static void
-sig_child (int sig __attribute__ ((unused)))
+sig_child (int sig UNUSED)
 {
   wait (NULL);
 }
 
 /* Clean up if we quit the program. */
 static void
-sig_quit (int sig __attribute__ ((unused)))
+sig_quit (int sig UNUSED)
 {
   pmap_unset (YPPASSWDPROG, YPPASSWDVERS);
   unlink (_YPPASSWDD_PIDFILE);
diff -ur src-2.8.90/rpc.ypxfrd/Makefile.am src-2.8.90-local/rpc.ypxfrd/Makefile.am
--- src-2.8.90/rpc.ypxfrd/Makefile.am	2003-02-04 18:06:56.000000000 +0100
+++ src-2.8.90-local/rpc.ypxfrd/Makefile.am	2003-05-21 17:54:15.000000000 +0200
@@ -8,7 +8,6 @@
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
 	-DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"@YPMAPDIR@\" \
 	-DUSE_FQDN=@USE_FQDN@ -DXFRBLOCKSIZE=65535
diff -ur src-2.8.90/rpc.ypxfrd/ypxfrd.c src-2.8.90-local/rpc.ypxfrd/ypxfrd.c
--- src-2.8.90/rpc.ypxfrd/ypxfrd.c	2002-12-21 14:53:26.000000000 +0100
+++ src-2.8.90-local/rpc.ypxfrd/ypxfrd.c	2003-05-29 08:08:37.000000000 +0200
@@ -45,7 +45,9 @@
 #include <rpc/svc_soc.h>
 #endif
 #include <rpc/pmap_clnt.h>
+#ifdef HAVE_GETOPT_H
 #include <getopt.h>
+#endif /* HAVE_GETOPT_H */
 #include "ypxfrd.h"
 #include "access.h"
 #include "ypserv_conf.h"
@@ -55,6 +57,7 @@
 #endif
 
 #include "log_msg.h"
+#include "compat.h"
 
 extern void ypxfrd_freebsd_prog_1(struct svc_req *, SVCXPRT *);
 
@@ -73,40 +76,6 @@
 
 char *progname;
 
-#if HAVE__RPC_DTABLESIZE
-extern int _rpc_dtablesize(void);
-#elif HAVE_GETDTABLESIZE
-static int
-_rpc_dtablesize()
-{
-  static int size;
-
-  if (size == 0)
-    {
-      size = getdtablesize();
-    }
-  return (size);
-}
-#else
-
-#include <sys/resource.h>
-
-static int
-_rpc_dtablesize()
-{
-  static int size = 0;
-  struct rlimit rlb;
-
-  if (size == 0)
-    {
-      if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0)
-	size = rlb.rlim_cur;
-    }
-
-  return size;
-}
-#endif
-
 /*
 ** Needed, if we start rpc.ypxfrd from inetd
 */
@@ -135,7 +104,7 @@
 
 /* Clean up after child processes signal their termination.  */
 static void
-sig_child (int sig __attribute__ ((unused)))
+sig_child (int sig UNUSED)
 {
    int st;
 
@@ -146,7 +115,7 @@
 
 /* Clean up if we quit the program.  */
 static void
-sig_quit (int sig __attribute__ ((unused)))
+sig_quit (int sig UNUSED)
 {
   pmap_unset (YPXFRD_FREEBSD_PROG, YPXFRD_FREEBSD_VERS);
   exit (0);
@@ -156,7 +125,7 @@
 ** Reload securenets and config file
 */
 static void
-sig_hup (int sig __attribute__ ((unused)))
+sig_hup (int sig UNUSED)
 {
   load_securenets();
   load_config();
diff -ur src-2.8.90/rpc.ypxfrd/ypxfrd_server.c src-2.8.90-local/rpc.ypxfrd/ypxfrd_server.c
--- src-2.8.90/rpc.ypxfrd/ypxfrd_server.c	2002-12-21 14:53:26.000000000 +0100
+++ src-2.8.90-local/rpc.ypxfrd/ypxfrd_server.c	2003-05-29 08:39:02.000000000 +0200
@@ -40,6 +40,7 @@
 #include "ypxfrd.h"
 #include "access.h"
 #include "yp_db.h"
+#include "compat.h"
 
 static int file = 0;
 
@@ -97,7 +98,7 @@
 {
   static struct xfr result;
   char buf[MAXPATHLEN];
-  struct sockaddr_in *rqhost;
+  const struct sockaddr_in *rqhost;
   int valid;
 
   if (debug_flag)
diff -ur src-2.8.90/rpc.ypxfrd/ypxfrd_svc.c src-2.8.90-local/rpc.ypxfrd/ypxfrd_svc.c
--- src-2.8.90/rpc.ypxfrd/ypxfrd_svc.c	2001-04-08 17:21:53.000000000 +0200
+++ src-2.8.90-local/rpc.ypxfrd/ypxfrd_svc.c	2003-05-28 10:01:44.000000000 +0200
@@ -23,6 +23,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <rpc/rpc.h>
 #include <rpc/pmap_clnt.h>
 #include <string.h>
 #include <signal.h>
diff -ur src-2.8.90/yphelper/Makefile.am src-2.8.90-local/yphelper/Makefile.am
--- src-2.8.90/yphelper/Makefile.am	2003-02-04 18:07:30.000000000 +0100
+++ src-2.8.90-local/yphelper/Makefile.am	2003-05-21 17:53:58.000000000 +0200
@@ -8,7 +8,6 @@
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
 
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
@@ -25,4 +24,4 @@
 
 yphelper_SOURCES = yphelper.c
 
-yphelper_LDADD = @LIBDBM@
+yphelper_LDADD = $(top_builddir)/lib/libyp.a @LIBDBM@
diff -ur src-2.8.90/yphelper/yphelper.c src-2.8.90-local/yphelper/yphelper.c
--- src-2.8.90/yphelper/yphelper.c	2003-02-05 15:37:15.000000000 +0100
+++ src-2.8.90-local/yphelper/yphelper.c	2003-05-30 13:17:16.000000000 +0200
@@ -21,17 +21,23 @@
 #include "config.h"
 #endif
 
+#include <sys/types.h>
 #include <grp.h>
 #include <pwd.h>
 #include <netdb.h>
 #include <rpc/types.h>
 #include <strings.h>
 #include <sys/socket.h>
+#include <sys/param.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <unistd.h>
 #include <ctype.h>
-#if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG)
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif /* HAVE_ALLOCA_H */
+#include <stdlib.h>
+#if defined(HAVE_GETOPT_H)
 #include <getopt.h>
 #endif
 #if defined(HAVE_LIBGDBM)
@@ -40,6 +46,7 @@
 #include <ndbm.h>
 #endif
 #include "yp.h"
+#include "compat.h"
 #include <rpcsvc/ypclnt.h>
 #include <arpa/nameser.h>
 #ifdef HAVE_SHADOW_H
@@ -178,7 +185,7 @@
 	hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
     }
   else
-    hp = gethostbyname2 (hostname, AF_INET);
+    hp = gethostbyname (hostname);
 
   if (hp == NULL)
     fputs (hostname, stdout);
@@ -219,7 +226,7 @@
 	hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
     }
   else
-    hp = gethostbyname2 (server, AF_INET);
+    hp = gethostbyname (server);
   if (hp != NULL)
     {
       server = alloca (strlen (hp->h_name) + 1);
@@ -312,6 +319,7 @@
 	  (pwd->pw_passwd[0] == 'x' || pwd->pw_passwd[0] == '*'))
 	{
 	  pass = NULL;
+#ifdef HAVE_GETSPNAM /* shadow password */
 	  spd = fgetspent (s_input);
 	  if (spd != NULL)
 	    {
@@ -330,6 +338,7 @@
 		    }
 		}
 	    }
+#endif /* HAVE_GETSPNAM */
 	  if (pass == NULL)
 	    pass = pwd->pw_passwd;
 	}
@@ -347,6 +356,7 @@
   exit (0);
 }
 
+#ifdef HAVE_GETSPNAM /* shadow password */
 static struct __sgrp *
 fgetsgent (FILE *fp)
 {
@@ -377,6 +387,7 @@
     }
   return 0;
 }
+#endif /* HAVE_GETSPNAM */
 
 static void
 merge_group (char *group, char *gshadow)
@@ -421,6 +432,7 @@
 	  (grp->gr_passwd[0] == 'x' || grp->gr_passwd[0] == '*'))
 	{
 	  pass = NULL;
+#ifdef HAVE_GETSPNAM /* shadow password */
 	  spd = fgetsgent (s_input);
 	  if (spd != NULL)
 	    {
@@ -439,6 +451,7 @@
 		    }
 		}
 	    }
+#endif /* HAVE_GETSPNAM */
 	  if (pass == NULL)
 	    pass = grp->gr_passwd;
 	}
@@ -557,17 +570,20 @@
 	hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
     }
   else
-    hp = gethostbyname2 (hostname, AF_INET);
+    hp = gethostbyname (hostname);
 
   if (hp != NULL)
-    hostname = strdupa (hp->h_name);
+    hostname = strdup (hp->h_name);
 #endif
 
   if (strcasecmp (hostname,
 		  get_dbm_entry ("YP_MASTER_NAME", map, domainname)) == 0)
-    exit (0);
+    ret = 0;
   else
-    exit (1);
+    ret = 1;
+
+  free(hostname);
+  exit (ret);
 }
 
 static void
diff -ur src-2.8.90/yppush/Makefile.am src-2.8.90-local/yppush/Makefile.am
--- src-2.8.90/yppush/Makefile.am	2003-02-04 18:07:43.000000000 +0100
+++ src-2.8.90-local/yppush/Makefile.am	2003-05-21 17:54:05.000000000 +0200
@@ -8,7 +8,6 @@
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
 	-DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"/var/yp\" \
 	-DUSE_FQDN=@USE_FQDN@
diff -ur src-2.8.90/yppush/yppush.c src-2.8.90-local/yppush/yppush.c
--- src-2.8.90/yppush/yppush.c	2003-05-19 15:12:49.000000000 +0200
+++ src-2.8.90-local/yppush/yppush.c	2003-05-29 08:43:07.000000000 +0200
@@ -29,6 +29,7 @@
 #include <time.h>
 #include "yp.h"
 #include <rpcsvc/ypclnt.h>
+#include <rpc/svc.h>
 #include <arpa/inet.h>
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -48,22 +49,10 @@
 #if defined(HAVE_GETOPT_H)
 #include <getopt.h>
 #endif /* HAVE_GETOPT_H */
+#include "compat.h"
 
 #include "log_msg.h"
 
-#ifndef HAVE_STRDUP
-#include <compat/strdup.c>
-#endif
-
-#ifndef HAVE_GETOPT_LONG
-#include <compat/getopt.c>
-#include <compat/getopt1.c>
-#endif
-
-#ifndef HAVE_STRERROR
-#include <compat/strerror.c>
-#endif
-
 #ifndef YPMAPDIR
 #define YPMAPDIR "/var/yp"
 #endif
@@ -85,39 +74,6 @@
 static u_int maxchildren = 1;
 static u_int children = 0;
 
-#if HAVE__RPC_DTABLESIZE
-extern int _rpc_dtablesize (void);
-#elif HAVE_GETDTABLESIZE
-
-int
-_rpc_dtablesize ()
-{
-  static int size;
-
-  if (size == 0)
-    size = getdtablesize ();
-
-  return size;
-}
-#else
-
-#include <sys/resource.h>
-
-int
-_rpc_dtablesize ()
-{
-  static int size = 0;
-  struct rlimit rlb;
-
-
-  if (size == 0)
-    if (getrlimit (RLIMIT_NOFILE, &rlb) >= 0)
-      size = rlb.rlim_cur;
-
-  return size;
-}
-#endif
-
 static char *
 yppush_err_string (enum yppush_status status)
 {
@@ -160,9 +116,9 @@
 }
 
 bool_t
-yppushproc_null_1_svc (void *req __attribute__ ((unused)),
-		       void *resp __attribute__ ((unused)),
-		       struct svc_req *rqstp __attribute__ ((unused)))
+yppushproc_null_1_svc (void *req UNUSED,
+		       void *resp UNUSED,
+		       struct svc_req *rqstp UNUSED)
 {
   resp = NULL;
 
@@ -176,7 +132,7 @@
 bool_t
 yppushproc_xfrresp_1_svc (yppushresp_xfr *req, void *resp, struct svc_req *rqstp)
 {
-  struct sockaddr_in *sin;
+  const struct sockaddr_in *sin;
   char *h;
   struct hostent *hp;
 
@@ -209,6 +165,7 @@
     yppushresp_xfr yppushproc_xfrresp_1_arg;
   } argument;
   union {
+    char *dummy; /* What was going on here?  Empty union? */
   } result;
   bool_t retval;
   xdrproc_t _xdr_argument, _xdr_result;
@@ -388,11 +345,11 @@
 #if defined(__NetBSD__)
 static int
 add_slave_server (u_long status, char *key, int keylen,
-		  char *val, int vallen, void *data __attribute__ ((unused)))
+		  char *val, int vallen, void *data UNUSED)
 #else
 static int
 add_slave_server (int status, char *key, int keylen,
-		  char *val, int vallen, char *data __attribute__ ((unused)))
+		  char *val, int vallen, char *data UNUSED)
 #endif
 {
   char host[YPMAXPEER + 2];
@@ -438,7 +395,7 @@
 }
 
 static void
-child_sig_int (int sig __attribute__ ((unused)))
+child_sig_int (int sig UNUSED)
 {
   if (CallbackProg != 0)
     svc_unregister (CallbackProg, 1);
@@ -557,7 +514,7 @@
 }
 
 static void
-sig_child (int sig __attribute__ ((unused)))
+sig_child (int sig UNUSED)
 {
   int status;
 
diff -ur src-2.8.90/ypserv/Makefile.am src-2.8.90-local/ypserv/Makefile.am
--- src-2.8.90/ypserv/Makefile.am	2003-02-04 18:42:33.000000000 +0100
+++ src-2.8.90-local/ypserv/Makefile.am	2003-05-21 17:54:22.000000000 +0200
@@ -10,7 +10,6 @@
 
 MAXCHILDREN = 40
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
 	-DYPMAPDIR=\"@YPMAPDIR@\" -DMAX_CHILDREN=$(MAXCHILDREN)
 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
diff -ur src-2.8.90/ypserv/server.c src-2.8.90-local/ypserv/server.c
--- src-2.8.90/ypserv/server.c	2003-05-15 16:47:34.000000000 +0200
+++ src-2.8.90-local/ypserv/server.c	2003-05-29 08:42:30.000000000 +0200
@@ -23,32 +23,37 @@
 #define _GNU_SOURCE
 
 #include <string.h>
+#include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif /* HAVE_ALLOCA_H */
 #include "yp.h"
 #include "yp_db.h"
 #include "access.h"
 #include "ypserv_conf.h"
 #include "log_msg.h"
+#include "compat.h"
 
 extern volatile int children; /* ypserv.c  */
 extern int forked; /* ypserv.c  */
 
 bool_t
-ypproc_null_2_svc (void *argp __attribute__ ((unused)),
-		   void *result __attribute__ ((unused)),
+ypproc_null_2_svc (void *argp UNUSED,
+		   void *result UNUSED,
 		   struct svc_req *rqstp)
 {
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
       log_msg ("ypproc_null() [From: %s:%d]",
 	       inet_ntoa (rqhost->sin_addr),
 	       ntohs (rqhost->sin_port));
@@ -67,7 +72,7 @@
 {
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
       log_msg ("ypproc_domain(\"%s\") [From: %s:%d]",
 	       *argp, inet_ntoa (rqhost->sin_addr),
 	       ntohs (rqhost->sin_port));
@@ -102,7 +107,7 @@
 {
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
       log_msg ("ypproc_domain_nonack(\"%s\") [From: %s:%d]",
 	       *argp, inet_ntoa (rqhost->sin_addr),
 	       ntohs (rqhost->sin_port));
@@ -142,7 +147,7 @@
 
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
 
       log_msg ("ypproc_match(): [From: %s:%d]",
 	       inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
@@ -230,7 +235,7 @@
 
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
       log_msg ("ypproc_first(): [From: %s:%d]",
 	       inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
 
@@ -325,7 +330,7 @@
 
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
 
       log_msg ("ypproc_next(): [From: %s:%d]",
 	       inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
@@ -422,7 +427,7 @@
 		  struct svc_req *rqstp)
 {
   DB_FILE dbp;
-  struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+  const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
   int valid;
 
   if (debug_flag)
@@ -507,7 +512,7 @@
           if ((size_t)val.dsize != strlen (argp->map_parms.peer) ||
               strncmp (val.dptr, argp->map_parms.peer, val.dsize) != 0)
             {
-	      char buf[val.dsize + 1];
+	      char *buf = alloca(val.dsize + 1);
 
 	      strncpy (buf, val.dptr, val.dsize);
 	      buf[val.dsize] = '\0';
@@ -617,13 +622,13 @@
   return TRUE;
 }
 
-bool_t ypproc_clear_2_svc (void *argp __attribute__ ((unused)),
-			   void *result __attribute__ ((unused)),
+bool_t ypproc_clear_2_svc (void *argp UNUSED,
+			   void *result UNUSED,
 			   struct svc_req *rqstp)
 {
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
       log_msg ("ypproc_clear_2_svc() [From: %s:%d]",
 	       inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
     }
@@ -725,7 +730,7 @@
 
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost;
+      const struct sockaddr_in *rqhost;
 
       rqhost = svc_getcaller (rqstp->rq_xprt);
       log_msg ("ypproc_all_2_svc(): [From: %s:%d]",
@@ -889,7 +894,7 @@
 
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
       log_msg ("ypproc_master_2_svc(): [From: %s:%d]",
 	       inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
 
@@ -996,7 +1001,7 @@
 
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost;
+      const struct sockaddr_in *rqhost;
 
       rqhost = svc_getcaller (rqstp->rq_xprt);
 
@@ -1120,7 +1125,7 @@
 
   if (debug_flag)
     {
-      struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
+      const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
 
       log_msg ("ypproc_maplist_2_svc(): [From: %s:%d]",
 	       inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
@@ -1203,7 +1208,7 @@
 }
 
 int
-ypprog_2_freeresult (SVCXPRT *transp __attribute__ ((unused)),
+ypprog_2_freeresult (SVCXPRT *transp UNUSED,
 		     xdrproc_t xdr_result, caddr_t result)
 {
   xdr_free (xdr_result, result);
diff -ur src-2.8.90/ypserv/ypserv.c src-2.8.90-local/ypserv/ypserv.c
--- src-2.8.90/ypserv/ypserv.c	2003-05-20 09:08:47.000000000 +0200
+++ src-2.8.90-local/ypserv/ypserv.c	2003-05-28 18:16:09.000000000 +0200
@@ -32,11 +32,14 @@
 #if defined(HAVE_GETOPT_H)
 #include <getopt.h>
 #endif
+#ifdef HAVE_POLL_H
 #include <poll.h>
+#endif /* HAVE_POLL_H */
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/socket.h>
+#define _AIX_TIRPC /* make svc_getreq_poll() available on AIX */
 #include <rpc/rpc.h>
 #include <rpc/pmap_clnt.h>
 
@@ -44,6 +47,7 @@
 #include "access.h"
 #include "log_msg.h"
 #include "ypserv_conf.h"
+#include "compat.h"
 
 #ifdef HAVE_PATHS_H
 #include <paths.h>
@@ -369,7 +373,7 @@
 extern FILE *debug_output;
 /* SIGUSR1: enable/disable debug output.  */
 static void
-sig_usr1 (int sig __attribute__ ((unused)))
+sig_usr1 (int sig UNUSED)
 {
   if (debug_flag)
     {
@@ -388,7 +392,7 @@
 
 /* Clean up if we quit the program. */
 static void
-sig_quit (int sig __attribute__ ((unused)))
+sig_quit (int sig UNUSED)
 {
   pmap_unset (YPPROG, YPVERS);
   pmap_unset (YPPROG, YPOLDVERS);
@@ -399,7 +403,7 @@
 
 /* Reload securenets and config file */
 static void
-sig_hup (int sig __attribute__ ((unused)))
+sig_hup (int sig UNUSED)
 {
   int old_cached_filehandles = cached_filehandles;
 
@@ -468,7 +472,6 @@
 	{"help", no_argument, NULL, 'h'},
 	{NULL, 0, NULL, '\0'}
       };
-
       c = getopt_long (argc, argv, "vdp:buh", long_options, &option_index);
       if (c == -1)
 	break;
diff -ur src-2.8.90/ypxfr/Makefile.am src-2.8.90-local/ypxfr/Makefile.am
--- src-2.8.90/ypxfr/Makefile.am	2003-02-04 18:08:25.000000000 +0100
+++ src-2.8.90-local/ypxfr/Makefile.am	2003-05-21 17:54:30.000000000 +0200
@@ -8,7 +8,6 @@
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = @EXTRA_CFLAGS@
 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
 
diff -ur src-2.8.90/ypxfr/ypxfr.c src-2.8.90-local/ypxfr/ypxfr.c
--- src-2.8.90/ypxfr/ypxfr.c	2003-05-19 15:31:56.000000000 +0200
+++ src-2.8.90-local/ypxfr/ypxfr.c	2003-05-30 12:41:23.000000000 +0200
@@ -34,13 +34,18 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <ctype.h>
+#ifdef HAVE_ALLOCA_H
 #include <alloca.h>
+#endif /* HAVE_ALLOCA_H */
+#include <stdlib.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 #include "log_msg.h"
 #include "yp.h"
 #include "ypxfr.h"
 #include "ypxfrd.h"
 #include <rpcsvc/ypclnt.h>
+#include "compat.h"
 
 #if defined(HAVE_LIBGDBM)
 #include <gdbm.h>
@@ -280,11 +285,11 @@
 #if defined(__NetBSD__)
 static int
 ypxfr_foreach (u_long status, char *key, int keylen,
-               char *val, int vallen, void *data __attribute__ ((unused)))
+               char *val, int vallen, void *data UNUSED)
 #else
 static int
 ypxfr_foreach (int status, char *key, int keylen,
-               char *val, int vallen, char *data __attribute__ ((unused)))
+               char *val, int vallen, char *data UNUSED)
 #endif
 {
   datum outKey, outData;
@@ -350,7 +355,7 @@
   struct sockaddr_in sockaddr, sockaddr_udp;
   struct ypresp_order resp_order;
   struct ypreq_nokey req_nokey;
-  uint32_t masterOrderNum;
+  time_t masterOrderNum;
   struct hostent *h;
   int sock, result;
 
@@ -450,7 +455,7 @@
   /* If we doesn't force the map, look, if the new map is really newer */
   if (!force)
     {
-      uint32_t localOrderNum = 0;
+      time_t localOrderNum = 0;
       datum inKey, inVal;
 
 #if defined(HAVE_LIBGDBM)
@@ -688,7 +693,7 @@
   struct in_addr remote_addr;
   unsigned int transid = 0;
   unsigned short int remote_port = 0;
-  uint32_t program_number = 0;
+  unsigned long program_number = 0;
   int force = 0;
   int noclear = 0;
 
diff -ur src-2.8.90/ypxfr/ypxfr_xdr.c src-2.8.90-local/ypxfr/ypxfr_xdr.c
--- src-2.8.90/ypxfr/ypxfr_xdr.c	2003-02-05 15:37:15.000000000 +0100
+++ src-2.8.90-local/ypxfr/ypxfr_xdr.c	2003-05-30 14:59:02.000000000 +0200
@@ -30,7 +30,7 @@
 
 struct {
   union {
-    ypstat (*encoder) (char *, int, char **, int *, char **, int *);
+    ypstat (*encoder) (char *, int, char **, u_int *, char **, u_int *);
     int (*decoder) (int, char *, int, char *, int, char *);
   }
   foreach;
@@ -39,32 +39,6 @@
 
 
 bool_t
-xdr_domainname (XDR *xdrs, domainname *objp)
-{
-  if (!xdr_string (xdrs, objp, YPMAXDOMAIN))
-    return (FALSE);
-
-  return (TRUE);
-}
-
-bool_t
-xdr_mapname (XDR *xdrs, mapname *objp)
-{
-  if (!xdr_string (xdrs, objp, YPMAXMAP))
-    return FALSE;
-
-  return TRUE;
-}
-
-bool_t
-xdr_peername (XDR *xdrs, peername *objp)
-{
-  if (!xdr_string (xdrs, objp, YPMAXPEER))
-    return (FALSE);
-  return (TRUE);
-}
-
-bool_t
 xdr_keydat (XDR *xdrs, keydat *objp)
 {
   if (!xdr_bytes (xdrs, (char **) &objp->keydat_val,
@@ -108,16 +82,6 @@
 }
 
 bool_t
-xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
-{
-  if (!xdr_ypstat (xdrs, &objp->stat))
-    return FALSE;
-  if (!xdr_peername (xdrs, &objp->peer))
-    return FALSE;
-  return TRUE;
-}
-
-bool_t
 xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
 {
   if (!xdr_ypstat (xdrs, &objp->stat))
@@ -128,16 +92,6 @@
 }
 
 bool_t
-xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
-{
-  if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
-    return FALSE;
-  if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
-    return FALSE;
-  return TRUE;
-}
-
-bool_t
 xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
 {
   if (!xdr_domainname (xdrs, &objp->ypsetdom_domain))
@@ -168,46 +122,6 @@
 }
 
 bool_t
-xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
-{
-  if (!xdr_domainname (xdrs, &objp->domain))
-    return FALSE;
-
-  if (!xdr_mapname (xdrs, &objp->map))
-    return FALSE;
-
-  return TRUE;
-}
-
-bool_t
-xdr_ypstat (XDR *xdrs, ypstat *objp)
-{
-  if (!xdr_enum (xdrs, (enum_t *) objp))
-    return FALSE;
-
-  return TRUE;
-}
-
-bool_t
-xdr_ypxfrstat (XDR *xdrs, ypxfrstat *objp)
-{
-  if (!xdr_enum (xdrs, (enum_t *) objp))
-    return FALSE;
-
-  return TRUE;
-}
-
-bool_t
-xdr_ypresp_xfr (XDR * xdrs, ypresp_xfr * objp)
-{
-  if (!xdr_u_int (xdrs, &objp->transid))
-    return FALSE;
-  if (!xdr_ypxfrstat (xdrs, &objp->xfrstat))
-    return FALSE;
-  return TRUE;
-}
-
-bool_t
 ypxfr_xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)
 {
   int CallAgain = 0;
