3da827
diff --git a/.gitignore b/.gitignore
3da827
index 5a7546c..bee4bab 100644
3da827
--- a/.gitignore
3da827
+++ b/.gitignore
3da827
@@ -1,3 +1,4 @@
3da827
+INSTALL
3da827
 Makefile
3da827
 Makefile.in
3da827
 aclocal.m4
3da827
@@ -13,18 +14,14 @@ depcomp
3da827
 install-sh
3da827
 libtool
3da827
 ltmain.sh
3da827
-man/Makefile
3da827
-man/Makefile.in
3da827
 missing
3da827
-src/.deps/
3da827
-src/Makefile
3da827
-src/Makefile.in
3da827
 src/config.h
3da827
 src/stamp-h2
3da827
 stamp-h1
3da827
 # file generated during compilation
3da827
+.deps
3da827
 *.o
3da827
-src/rpcbind
3da827
-src/rpcinfo
3da827
+rpcbind
3da827
+rpcinfo
3da827
 # cscope database files
3da827
 cscope.*
3da827
diff --git a/INSTALL b/INSTALL
3da827
index 98e5d87..7d1c323 100644
3da827
--- a/INSTALL
3da827
+++ b/INSTALL
3da827
@@ -1,32 +1,25 @@
3da827
-Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
3da827
-Foundation, Inc.
3da827
+Installation Instructions
3da827
+*************************
3da827
 
3da827
-   This file is free documentation; the Free Software Foundation gives
3da827
-unlimited permission to copy, distribute and modify it.
3da827
-
3da827
-
3da827
-rpcbind Quick Installation
3da827
-==========================
3da827
-
3da827
-$ ./configure
3da827
-$ make
3da827
-# make install
3da827
-
3da827
-   The install phase will install the rpcbind and rpcinfo commands
3da827
-under /usr/bin.  If you wish they replace the basic portmap and 
3da827
-rpcinfo commands, you can run:
3da827
-
3da827
-# mv /sbin/portmap /sbin/portmap.sav
3da827
-# ln -s /usr/bin/rpcbind /sbin/portmap
3da827
-
3da827
-# mv /usr/sbin/rpcinfo /usr/sbin/rpcinfo.sav
3da827
-# ln -s /usr/bin/rpcinfo /usr/sbin/rpcinfo
3da827
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
3da827
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
3da827
 
3da827
+   Copying and distribution of this file, with or without modification,
3da827
+are permitted in any medium without royalty provided the copyright
3da827
+notice and this notice are preserved.  This file is offered as-is,
3da827
+without warranty of any kind.
3da827
 
3da827
 Basic Installation
3da827
 ==================
3da827
 
3da827
-   These are generic installation instructions.
3da827
+   Briefly, the shell commands `./configure; make; make install' should
3da827
+configure, build, and install this package.  The following
3da827
+more-detailed instructions are generic; see the `README' file for
3da827
+instructions specific to this package.  Some packages provide this
3da827
+`INSTALL' file but do not implement all of the features documented
3da827
+below.  The lack of an optional feature in a given package is not
3da827
+necessarily a bug.  More recommendations for GNU packages can be found
3da827
+in *note Makefile Conventions: (standards)Makefile Conventions.
3da827
 
3da827
    The `configure' shell script attempts to guess correct values for
3da827
 various system-dependent variables used during compilation.  It uses
3da827
@@ -39,9 +32,9 @@ debugging `configure').
3da827
 
3da827
    It can also use an optional file (typically called `config.cache'
3da827
 and enabled with `--cache-file=config.cache' or simply `-C') that saves
3da827
-the results of its tests to speed up reconfiguring.  (Caching is
3da827
+the results of its tests to speed up reconfiguring.  Caching is
3da827
 disabled by default to prevent problems with accidental use of stale
3da827
-cache files.)
3da827
+cache files.
3da827
 
3da827
    If you need to do unusual things to compile the package, please try
3da827
 to figure out how `configure' could check whether to do them, and mail
3da827
@@ -51,30 +44,37 @@ some point `config.cache' contains results you don't want to keep, you
3da827
 may remove or edit it.
3da827
 
3da827
    The file `configure.ac' (or `configure.in') is used to create
3da827
-`configure' by a program called `autoconf'.  You only need
3da827
-`configure.ac' if you want to change it or regenerate `configure' using
3da827
-a newer version of `autoconf'.
3da827
+`configure' by a program called `autoconf'.  You need `configure.ac' if
3da827
+you want to change it or regenerate `configure' using a newer version
3da827
+of `autoconf'.
3da827
 
3da827
-The simplest way to compile this package is:
3da827
+   The simplest way to compile this package is:
3da827
 
3da827
   1. `cd' to the directory containing the package's source code and type
3da827
-     `./configure' to configure the package for your system.  If you're
3da827
-     using `csh' on an old version of System V, you might need to type
3da827
-     `sh ./configure' instead to prevent `csh' from trying to execute
3da827
-     `configure' itself.
3da827
+     `./configure' to configure the package for your system.
3da827
 
3da827
-     Running `configure' takes awhile.  While running, it prints some
3da827
-     messages telling which features it is checking for.
3da827
+     Running `configure' might take a while.  While running, it prints
3da827
+     some messages telling which features it is checking for.
3da827
 
3da827
   2. Type `make' to compile the package.
3da827
 
3da827
   3. Optionally, type `make check' to run any self-tests that come with
3da827
-     the package.
3da827
+     the package, generally using the just-built uninstalled binaries.
3da827
 
3da827
   4. Type `make install' to install the programs and any data files and
3da827
-     documentation.
3da827
-
3da827
-  5. You can remove the program binaries and object files from the
3da827
+     documentation.  When installing into a prefix owned by root, it is
3da827
+     recommended that the package be configured and built as a regular
3da827
+     user, and only the `make install' phase executed with root
3da827
+     privileges.
3da827
+
3da827
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
3da827
+     this time using the binaries in their final installed location.
3da827
+     This target does not install anything.  Running this target as a
3da827
+     regular user, particularly if the prior `make install' required
3da827
+     root privileges, verifies that the installation completed
3da827
+     correctly.
3da827
+
3da827
+  6. You can remove the program binaries and object files from the
3da827
      source code directory by typing `make clean'.  To also remove the
3da827
      files that `configure' created (so you can compile the package for
3da827
      a different kind of computer), type `make distclean'.  There is
3da827
@@ -83,6 +83,16 @@ The simplest way to compile this package is:
3da827
      all sorts of other programs in order to regenerate files that came
3da827
      with the distribution.
3da827
 
3da827
+  7. Often, you can also type `make uninstall' to remove the installed
3da827
+     files again.  In practice, not all packages have tested that
3da827
+     uninstallation works correctly, even though it is required by the
3da827
+     GNU Coding Standards.
3da827
+
3da827
+  8. Some packages, particularly those that use Automake, provide `make
3da827
+     distcheck', which can by used by developers to test that all other
3da827
+     targets like `make install' and `make uninstall' work correctly.
3da827
+     This target is generally not run by end users.
3da827
+
3da827
 Compilers and Options
3da827
 =====================
3da827
 
3da827
@@ -94,7 +104,7 @@ for details on some of the pertinent environment variables.
3da827
 by setting variables in the command line or in the environment.  Here
3da827
 is an example:
3da827
 
3da827
-     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
3da827
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
3da827
 
3da827
    *Note Defining Variables::, for more details.
3da827
 
3da827
@@ -103,44 +113,89 @@ Compiling For Multiple Architectures
3da827
 
3da827
    You can compile the package for more than one kind of computer at the
3da827
 same time, by placing the object files for each architecture in their
3da827
-own directory.  To do this, you must use a version of `make' that
3da827
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
3da827
+own directory.  To do this, you can use GNU `make'.  `cd' to the
3da827
 directory where you want the object files and executables to go and run
3da827
 the `configure' script.  `configure' automatically checks for the
3da827
-source code in the directory that `configure' is in and in `..'.
3da827
+source code in the directory that `configure' is in and in `..'.  This
3da827
+is known as a "VPATH" build.
3da827
 
3da827
-   If you have to use a `make' that does not support the `VPATH'
3da827
-variable, you have to compile the package for one architecture at a
3da827
-time in the source code directory.  After you have installed the
3da827
-package for one architecture, use `make distclean' before reconfiguring
3da827
-for another architecture.
3da827
+   With a non-GNU `make', it is safer to compile the package for one
3da827
+architecture at a time in the source code directory.  After you have
3da827
+installed the package for one architecture, use `make distclean' before
3da827
+reconfiguring for another architecture.
3da827
+
3da827
+   On MacOS X 10.5 and later systems, you can create libraries and
3da827
+executables that work on multiple system types--known as "fat" or
3da827
+"universal" binaries--by specifying multiple `-arch' options to the
3da827
+compiler but only a single `-arch' option to the preprocessor.  Like
3da827
+this:
3da827
+
3da827
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
3da827
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
3da827
+                 CPP="gcc -E" CXXCPP="g++ -E"
3da827
+
3da827
+   This is not guaranteed to produce working output in all cases, you
3da827
+may have to build one architecture at a time and combine the results
3da827
+using the `lipo' tool if you have problems.
3da827
 
3da827
 Installation Names
3da827
 ==================
3da827
 
3da827
-   By default, `make install' will install the package's files in
3da827
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
3da827
-installation prefix other than `/usr/local' by giving `configure' the
3da827
-option `--prefix=PATH'.
3da827
+   By default, `make install' installs the package's commands under
3da827
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
3da827
+can specify an installation prefix other than `/usr/local' by giving
3da827
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
3da827
+absolute file name.
3da827
 
3da827
    You can specify separate installation prefixes for
3da827
 architecture-specific files and architecture-independent files.  If you
3da827
-give `configure' the option `--exec-prefix=PATH', the package will use
3da827
-PATH as the prefix for installing programs and libraries.
3da827
-Documentation and other data files will still use the regular prefix.
3da827
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
3da827
+PREFIX as the prefix for installing programs and libraries.
3da827
+Documentation and other data files still use the regular prefix.
3da827
 
3da827
    In addition, if you use an unusual directory layout you can give
3da827
-options like `--bindir=PATH' to specify different values for particular
3da827
+options like `--bindir=DIR' to specify different values for particular
3da827
 kinds of files.  Run `configure --help' for a list of the directories
3da827
-you can set and what kinds of files go in them.
3da827
+you can set and what kinds of files go in them.  In general, the
3da827
+default for these options is expressed in terms of `${prefix}', so that
3da827
+specifying just `--prefix' will affect all of the other directory
3da827
+specifications that were not explicitly provided.
3da827
+
3da827
+   The most portable way to affect installation locations is to pass the
3da827
+correct locations to `configure'; however, many packages provide one or
3da827
+both of the following shortcuts of passing variable assignments to the
3da827
+`make install' command line to change installation locations without
3da827
+having to reconfigure or recompile.
3da827
+
3da827
+   The first method involves providing an override variable for each
3da827
+affected directory.  For example, `make install
3da827
+prefix=/alternate/directory' will choose an alternate location for all
3da827
+directory configuration variables that were expressed in terms of
3da827
+`${prefix}'.  Any directories that were specified during `configure',
3da827
+but not in terms of `${prefix}', must each be overridden at install
3da827
+time for the entire installation to be relocated.  The approach of
3da827
+makefile variable overrides for each directory variable is required by
3da827
+the GNU Coding Standards, and ideally causes no recompilation.
3da827
+However, some platforms have known limitations with the semantics of
3da827
+shared libraries that end up requiring recompilation when using this
3da827
+method, particularly noticeable in packages that use GNU Libtool.
3da827
+
3da827
+   The second method involves providing the `DESTDIR' variable.  For
3da827
+example, `make install DESTDIR=/alternate/directory' will prepend
3da827
+`/alternate/directory' before all installation names.  The approach of
3da827
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
3da827
+does not work on platforms that have drive letters.  On the other hand,
3da827
+it does better at avoiding recompilation issues, and works well even
3da827
+when some directory options were not specified in terms of `${prefix}'
3da827
+at `configure' time.
3da827
+
3da827
+Optional Features
3da827
+=================
3da827
 
3da827
    If the package supports it, you can cause programs to be installed
3da827
 with an extra prefix or suffix on their names by giving `configure' the
3da827
 option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
3da827
 
3da827
-Optional Features
3da827
-=================
3da827
-
3da827
    Some packages pay attention to `--enable-FEATURE' options to
3da827
 `configure', where FEATURE indicates an optional part of the package.
3da827
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
3da827
@@ -153,6 +208,45 @@ find the X include and library files automatically, but if it doesn't,
3da827
 you can use the `configure' options `--x-includes=DIR' and
3da827
 `--x-libraries=DIR' to specify their locations.
3da827
 
3da827
+   Some packages offer the ability to configure how verbose the
3da827
+execution of `make' will be.  For these packages, running `./configure
3da827
+--enable-silent-rules' sets the default to minimal output, which can be
3da827
+overridden with `make V=1'; while running `./configure
3da827
+--disable-silent-rules' sets the default to verbose, which can be
3da827
+overridden with `make V=0'.
3da827
+
3da827
+Particular systems
3da827
+==================
3da827
+
3da827
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
3da827
+CC is not installed, it is recommended to use the following options in
3da827
+order to use an ANSI C compiler:
3da827
+
3da827
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
3da827
+
3da827
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
3da827
+
3da827
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
3da827
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
3da827
+a workaround.  If GNU CC is not installed, it is therefore recommended
3da827
+to try
3da827
+
3da827
+     ./configure CC="cc"
3da827
+
3da827
+and if that doesn't work, try
3da827
+
3da827
+     ./configure CC="cc -nodtk"
3da827
+
3da827
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
3da827
+directory contains several dysfunctional programs; working variants of
3da827
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
3da827
+in your `PATH', put it _after_ `/usr/bin'.
3da827
+
3da827
+   On Haiku, software installed for all users goes in `/boot/common',
3da827
+not `/usr/local'.  It is recommended to use the following options:
3da827
+
3da827
+     ./configure --prefix=/boot/common
3da827
+
3da827
 Specifying the System Type
3da827
 ==========================
3da827
 
3da827
@@ -168,14 +262,15 @@ type, such as `sun4', or a canonical name which has the form:
3da827
 
3da827
 where SYSTEM can have one of these forms:
3da827
 
3da827
-     OS KERNEL-OS
3da827
+     OS
3da827
+     KERNEL-OS
3da827
 
3da827
    See the file `config.sub' for the possible values of each field.  If
3da827
 `config.sub' isn't included in this package, then this package doesn't
3da827
 need to know the machine type.
3da827
 
3da827
    If you are _building_ compiler tools for cross-compiling, you should
3da827
-use the `--target=TYPE' option to select the type of system they will
3da827
+use the option `--target=TYPE' to select the type of system they will
3da827
 produce code for.
3da827
 
3da827
    If you want to _use_ a cross compiler, that generates code for a
3da827
@@ -205,9 +300,14 @@ them in the `configure' command line, using `VAR=value'.  For example:
3da827
 
3da827
      ./configure CC=/usr/local2/bin/gcc
3da827
 
3da827
-will cause the specified gcc to be used as the C compiler (unless it is
3da827
+causes the specified `gcc' to be used as the C compiler (unless it is
3da827
 overridden in the site shell script).
3da827
 
3da827
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
3da827
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
3da827
+
3da827
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
3da827
+
3da827
 `configure' Invocation
3da827
 ======================
3da827
 
3da827
@@ -216,7 +316,14 @@ operates.
3da827
 
3da827
 `--help'
3da827
 `-h'
3da827
-     Print a summary of the options to `configure', and exit.
3da827
+     Print a summary of all of the options to `configure', and exit.
3da827
+
3da827
+`--help=short'
3da827
+`--help=recursive'
3da827
+     Print a summary of the options unique to this package's
3da827
+     `configure', and exit.  The `short' variant lists options used
3da827
+     only in the top level, while the `recursive' variant lists options
3da827
+     also present in any nested packages.
3da827
 
3da827
 `--version'
3da827
 `-V'
3da827
@@ -243,6 +350,16 @@ operates.
3da827
      Look for the package's source code in directory DIR.  Usually
3da827
      `configure' can determine that directory automatically.
3da827
 
3da827
+`--prefix=DIR'
3da827
+     Use DIR as the installation prefix.  *note Installation Names::
3da827
+     for more details, including other options available for fine-tuning
3da827
+     the installation locations.
3da827
+
3da827
+`--no-create'
3da827
+`-n'
3da827
+     Run the configure checks, but stop before creating any output
3da827
+     files.
3da827
+
3da827
 `configure' also accepts some other, not widely useful, options.  Run
3da827
 `configure --help' for more details.
3da827
 
3da827
diff --git a/Makefile.am b/Makefile.am
3da827
index cd56148..d10c906 100644
3da827
--- a/Makefile.am
3da827
+++ b/Makefile.am
3da827
@@ -1,2 +1,44 @@
3da827
-SUBDIRS= src man
3da827
+AM_CPPFLAGS = \
3da827
+	-DCHECK_LOCAL \
3da827
+	-DPORTMAP \
3da827
+	-DFACILITY=LOG_MAIL \
3da827
+	-DSEVERITY=LOG_INFO \
3da827
+	-DINET6 \
3da827
+	-DRPCBIND_STATEDIR="\"$(statedir)\"" \
3da827
+	-DRPCBIND_USER="\"$(rpcuser)\"" \
3da827
+	-D_GNU_SOURCE \
3da827
+	$(TIRPC_CFLAGS)
3da827
 
3da827
+if DEBUG
3da827
+AM_CPPFLAGS +=	-DRPCBIND_DEBUG -DSVC_RUN_DEBUG -DDEBUG_RMTCALL
3da827
+AM_CPPFLAGS +=	-DND_DEBUG -DBIND_DEBUG
3da827
+endif
3da827
+
3da827
+if WARMSTART
3da827
+AM_CPPFLAGS +=	-DWARMSTART
3da827
+endif
3da827
+
3da827
+if LIBWRAP
3da827
+AM_CPPFLAGS +=	-DLIBWRAP
3da827
+endif
3da827
+
3da827
+bin_PROGRAMS = rpcbind rpcinfo
3da827
+
3da827
+rpcbind_SOURCES = \
3da827
+	src/check_bound.c \
3da827
+	src/pmap_svc.c \
3da827
+	src/rpcb_stat.c \
3da827
+	src/rpcb_svc.c \
3da827
+	src/rpcb_svc_4.c \
3da827
+	src/rpcb_svc_com.c \
3da827
+	src/rpcbind.c \
3da827
+	src/rpcbind.h \
3da827
+	src/security.c \
3da827
+	src/util.c \
3da827
+	src/warmstart.c
3da827
+rpcbind_LDADD = $(TIRPC_LIBS)
3da827
+
3da827
+rpcinfo_SOURCES =       src/rpcinfo.c
3da827
+rpcinfo_LDADD   =       $(TIRPC_LIBS)
3da827
+
3da827
+dist_man8_MANS = man/rpcbind.8 man/rpcinfo.8
3da827
diff --git a/autogen.sh b/autogen.sh
3da827
index 1613b6d..761db90 100755
3da827
--- a/autogen.sh
3da827
+++ b/autogen.sh
3da827
@@ -36,7 +36,7 @@ if test x"${1}" = x"clean"; then
3da827
 fi
3da827
 
3da827
 aclocal
3da827
-libtoolize --force --copy
3da827
-autoheader
3da827
+#libtoolize --force --copy
3da827
+#autoheader
3da827
 automake --add-missing --copy --gnu # -Wall
3da827
 autoconf # -Wall
3da827
diff --git a/configure.in b/configure.in
3da827
index de1c730..2b67720 100644
3da827
--- a/configure.in
3da827
+++ b/configure.in
3da827
@@ -1,66 +1,39 @@
3da827
- AC_INIT(rpcbind, 0.2.0)
3da827
+AC_INIT(rpcbind, 0.2.0)
3da827
  
3da827
- AM_INIT_AUTOMAKE
3da827
-# AM_MAINTAINER_MODE
3da827
+AM_INIT_AUTOMAKE
3da827
 AC_CONFIG_SRCDIR([src/rpcbind.c])
3da827
- AC_PROG_CC
3da827
- AM_CONFIG_HEADER(config.h)
3da827
- AC_HEADER_DIRENT
3da827
- AC_PREFIX_DEFAULT(/usr)
3da827
-
3da827
-AC_CONFIG_SRCDIR([src/config.h.in])
3da827
-AC_CONFIG_HEADERS([src/config.h])
3da827
-
3da827
-AC_PROG_LIBTOOL
3da827
-
3da827
-AC_ARG_ENABLE(debug,[  --enable-debug      Turns on rpcbind debugging], 
3da827
-	[case "${enableval}" in
3da827
-		yes) debug=true ;;
3da827
-		no)  debug=no ;;
3da827
-		*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
3da827
-	esac],[debug=false])
3da827
-AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
3da827
-
3da827
-AC_ARG_ENABLE(warmstarts,[  --enable-warmstarts  Enables Warm Starts], 
3da827
-	[case "${enableval}" in
3da827
-		yes) warmstarts=true ;;
3da827
-		no)  warmstarts=no ;;
3da827
-		*) AC_MSG_ERROR(bad value ${enableval} for --enable-warmstarts) ;;
3da827
-	esac],[warmstarts=false])
3da827
-AM_CONDITIONAL(WARMSTART, test x$warmstarts = xtrue)
3da827
-
3da827
-if test "$warmstarts" = "true" ; then
3da827
-	AC_ARG_WITH(statedir,
3da827
-		[  --with-statedir=/foo use state dir /foo [/tmp]],
3da827
-    	statedir=$withval,
3da827
-		statedir=/tmp)
3da827
-		AC_SUBST(statedir)
3da827
-	AC_DEFINE_UNQUOTED(RPCBIND_STATEDIR, "$statedir", [This defines the location where the state files will be kept for warm starts])
3da827
-fi
3da827
-AC_ARG_WITH(rpcuser,
3da827
-	[  --with-rpcuser=user uid to use [root]],
3da827
-	rpcuser=$withval,
3da827
-	rpcuser=root)
3da827
-	AC_SUBST(rpcuser)
3da827
-AC_DEFINE_UNQUOTED(RPCBIND_USER, "$rpcuser", [This defines the uid to run as])
3da827
+AC_PREFIX_DEFAULT(/usr)
3da827
+AC_PROG_CC
3da827
+
3da827
+AC_ARG_ENABLE([libwrap],
3da827
+  AS_HELP_STRING([--enable-libwrap], [Enables host name checking through tcpd @<:@default=no@:>@]))
3da827
+AM_CONDITIONAL(LIBWRAP, test x$enable_libwrap = xyes)
3da827
+
3da827
+AC_ARG_ENABLE([debug],
3da827
+  AS_HELP_STRING([--enable-debug], [Turns on rpcbind debugging @<:@default=no@:>@]))
3da827
+AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
3da827
+
3da827
+AC_ARG_ENABLE([warmstarts],
3da827
+  AS_HELP_STRING([--enable-warmstarts], [Enables Warm Starts @<:@default=no@:>@]))
3da827
+AM_CONDITIONAL(WARMSTART, test x$enable_warmstarts = xyes)
3da827
+
3da827
+AC_ARG_WITH([statedir],
3da827
+  AS_HELP_STRING([--with-statedir=ARG], [use ARG as state dir @<:@default=/tmp@:>@])
3da827
+  ,, [with_statedir=/tmp])
3da827
+AC_SUBST([statedir], [$with_statedir])
3da827
+
3da827
+AC_ARG_WITH([rpcuser],
3da827
+  AS_HELP_STRING([--with-rpcuser=ARG], [use ARG for RPC @<:@default=root@:>@]),
3da827
+  ,, [with_rpcuser=root])
3da827
+AC_SUBST([rpcuser], [$with_rpcuser])
3da827
+ 
3da827
+PKG_CHECK_MODULES([TIRPC], [libtirpc])
3da827
 
3da827
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h \
3da827
-                  netinet/in.h stdlib.h string.h \
3da827
-                  sys/param.h sys/socket.h \
3da827
-                  sys/time.h syslog.h \
3da827
-                  unistd.h nss.h])
3da827
+AS_IF([test x$enable_libwrap = xyes], [
3da827
+	AC_CHECK_LIB([wrap], [hosts_access], ,
3da827
+		AC_MSG_ERROR([libwrap support requested but unable to find libwrap]))
3da827
+])
3da827
 
3da827
-AC_CHECK_LIB([pthread], [pthread_create])
3da827
-AC_CHECK_LIB([tirpc], [clnt_create])
3da827
-AC_ARG_ENABLE(libwrap,[ --enable-libwrap  Enables host name checking], 
3da827
-	[case "${enableval}" in
3da827
-		yes) libwarp=true 
3da827
-			AC_CHECK_LIB([wrap],  [hosts_access]) ;;
3da827
-		no)  libwarp=no ;;
3da827
-		*) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
3da827
-	esac],[libwarp=false])
3da827
-AM_CONDITIONAL(LIBWRAP, test x$libwarp = xtrue)
3da827
+AC_SEARCH_LIBS([pthread_create], [pthread])
3da827
 
3da827
-AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
3da827
-AC_OUTPUT()
3da827
-                                                                   
3da827
+AC_OUTPUT([Makefile])
3da827
diff --git a/man/Makefile.am b/man/Makefile.am
3da827
deleted file mode 100644
3da827
index 84818e9..0000000
3da827
--- a/man/Makefile.am
3da827
+++ /dev/null
3da827
@@ -1,2 +0,0 @@
3da827
-man8_MANS   = rpcbind.8
3da827
-EXTRA_DIST  = $(man8_MANS)
3da827
diff --git a/man/rpcbind.8 b/man/rpcbind.8
3da827
index 32806d4..da32701 100644
3da827
--- a/man/rpcbind.8
3da827
+++ b/man/rpcbind.8
3da827
@@ -82,6 +82,8 @@ during operation, and will abort on certain errors if
3da827
 is also specified.
3da827
 With this option, the name-to-address translation consistency
3da827
 checks are shown in detail.
3da827
+.It Fl f
3da827
+Do not fork and become a background process.
3da827
 .It Fl h
3da827
 Specify specific IP addresses to bind to for UDP requests.
3da827
 This option
3da827
@@ -141,7 +143,6 @@ All RPC servers must be restarted if
3da827
 .Nm
3da827
 is restarted.
3da827
 .Sh SEE ALSO
3da827
-.Xr rpcbind 3 ,
3da827
 .Xr rpcinfo 8
3da827
 .Sh LINUX PORT
3da827
 .Bl Aurelien Charbon <aurelien.charbon@bull.net>
3da827
diff --git a/src/Makefile.am b/src/Makefile.am
3da827
deleted file mode 100644
3da827
index cc0a85b..0000000
3da827
--- a/src/Makefile.am
3da827
+++ /dev/null
3da827
@@ -1,34 +0,0 @@
3da827
-INCLUDES = -I$(srcdir)/tirpc -DPORTMAP -DINET6 -DVERSION="\"$(VERSION)\"" \
3da827
-                                                -D_GNU_SOURCE -Wall -pipe
3da827
-if DEBUG
3da827
-INCLUDES +=	-DRPCBIND_DEBUG -DSVC_RUN_DEBUG -DDEBUG_RMTCALL
3da827
-INCLUDES +=	-DND_DEBUG -DBIND_DEBUG
3da827
-endif
3da827
-
3da827
-if WARMSTART
3da827
-INCLUDES +=	-DWARMSTART
3da827
-endif
3da827
-
3da827
-if LIBWRAP
3da827
-INCLUDES +=	-DLIBWRAP
3da827
-endif
3da827
-
3da827
-
3da827
-bin_PROGRAMS = rpcbind rpcinfo
3da827
-
3da827
-rpcbind_SOURCES =       check_bound.c rpcbind.c \
3da827
-                        rpcb_svc_4.c rpcb_svc_com.c \
3da827
-                        util.c pmap_svc.c rpcb_stat.c \
3da827
-                        rpcb_svc.c security.c warmstart.c \
3da827
-                        rpcbind.h
3da827
-
3da827
-rpcinfo_SOURCES =       rpcinfo.c
3da827
-rpcinfo_LDFLAGS =       -lpthread -ltirpc
3da827
-rpcinfo_LDADD   =       $(LIB_TIRPC)
3da827
-
3da827
-
3da827
-rpcbind_LDFLAGS = -lpthread -ltirpc
3da827
-rpcbind_LDADD = $(LIB_TIRPC)
3da827
-AM_CPPFLAGS = -I/usr/include/tirpc -DCHECK_LOCAL -DPORTMAP \
3da827
-                       -DFACILITY=LOG_MAIL -DSEVERITY=LOG_INFO
3da827
-     
3da827
diff --git a/src/config.h.in b/src/config.h.in
3da827
deleted file mode 100644
3da827
index 67a0e39..0000000
3da827
--- a/src/config.h.in
3da827
+++ /dev/null
3da827
@@ -1,105 +0,0 @@
3da827
-/* config.h.in.  Generated from configure.in by autoheader.  */
3da827
-
3da827
-/* Define to 1 if you have the <arpa/inet.h> header file. */
3da827
-#undef HAVE_ARPA_INET_H
3da827
-
3da827
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
3da827
-   */
3da827
-#undef HAVE_DIRENT_H
3da827
-
3da827
-/* Define to 1 if you have the <fcntl.h> header file. */
3da827
-#undef HAVE_FCNTL_H
3da827
-
3da827
-/* Define to 1 if you have the <inttypes.h> header file. */
3da827
-#undef HAVE_INTTYPES_H
3da827
-
3da827
-/* Define to 1 if you have the `pthread' library (-lpthread). */
3da827
-#undef HAVE_LIBPTHREAD
3da827
-
3da827
-/* Define to 1 if you have the `tirpc' library (-ltirpc). */
3da827
-#undef HAVE_LIBTIRPC
3da827
-
3da827
-/* Define to 1 if you have the <memory.h> header file. */
3da827
-#undef HAVE_MEMORY_H
3da827
-
3da827
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
3da827
-#undef HAVE_NDIR_H
3da827
-
3da827
-/* Define to 1 if you have the <netdb.h> header file. */
3da827
-#undef HAVE_NETDB_H
3da827
-
3da827
-/* Define to 1 if you have the <netinet/in.h> header file. */
3da827
-#undef HAVE_NETINET_IN_H
3da827
-
3da827
-/* Define to 1 if you have the <stdint.h> header file. */
3da827
-#undef HAVE_STDINT_H
3da827
-
3da827
-/* Define to 1 if you have the <stdlib.h> header file. */
3da827
-#undef HAVE_STDLIB_H
3da827
-
3da827
-/* Define to 1 if you have the <strings.h> header file. */
3da827
-#undef HAVE_STRINGS_H
3da827
-
3da827
-/* Define to 1 if you have the <string.h> header file. */
3da827
-#undef HAVE_STRING_H
3da827
-
3da827
-/* Define to 1 if you have the <syslog.h> header file. */
3da827
-#undef HAVE_SYSLOG_H
3da827
-
3da827
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
3da827
-   */
3da827
-#undef HAVE_SYS_DIR_H
3da827
-
3da827
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
3da827
-   */
3da827
-#undef HAVE_SYS_NDIR_H
3da827
-
3da827
-/* Define to 1 if you have the <sys/param.h> header file. */
3da827
-#undef HAVE_SYS_PARAM_H
3da827
-
3da827
-/* Define to 1 if you have the <sys/socket.h> header file. */
3da827
-#undef HAVE_SYS_SOCKET_H
3da827
-
3da827
-/* Define to 1 if you have the <sys/stat.h> header file. */
3da827
-#undef HAVE_SYS_STAT_H
3da827
-
3da827
-/* Define to 1 if you have the <sys/time.h> header file. */
3da827
-#undef HAVE_SYS_TIME_H
3da827
-
3da827
-/* Define to 1 if you have the <sys/types.h> header file. */
3da827
-#undef HAVE_SYS_TYPES_H
3da827
-
3da827
-/* Define to 1 if you have the <unistd.h> header file. */
3da827
-#undef HAVE_UNISTD_H
3da827
-
3da827
-/* Name of package */
3da827
-#undef PACKAGE
3da827
-
3da827
-/* Define to the address where bug reports for this package should be sent. */
3da827
-#undef PACKAGE_BUGREPORT
3da827
-
3da827
-/* Define to the full name of this package. */
3da827
-#undef PACKAGE_NAME
3da827
-
3da827
-/* Define to the full name and version of this package. */
3da827
-#undef PACKAGE_STRING
3da827
-
3da827
-/* Define to the one symbol short name of this package. */
3da827
-#undef PACKAGE_TARNAME
3da827
-
3da827
-/* Define to the version of this package. */
3da827
-#undef PACKAGE_VERSION
3da827
-
3da827
-/* Define to 1 if you have the ANSI C header files. */
3da827
-#undef STDC_HEADERS
3da827
-
3da827
-/* Version number of package */
3da827
-#undef VERSION
3da827
-
3da827
-/* This defines the location where the state files will be kept for warm
3da827
-   starts */
3da827
-#undef RPCBIND_STATEDIR
3da827
-
3da827
-/* This defines the uid to run as */
3da827
-#undef RPCBIND_USER
3da827
-
3da827
diff --git a/src/pmap_svc.c b/src/pmap_svc.c
3da827
index 4736700..337e64d 100644
3da827
--- a/src/pmap_svc.c
3da827
+++ b/src/pmap_svc.c
3da827
@@ -80,7 +80,7 @@ pmap_service(struct svc_req *rqstp, SVCXPRT *xprt)
3da827
 		if (debugging)
3da827
 			fprintf(stderr, "PMAPPROC_NULL\n");
3da827
 #endif
3da827
-		check_access(xprt, rqstp->rq_proc, NULL, PMAPVERS);
3da827
+		check_access(xprt, rqstp->rq_proc, 0, PMAPVERS);
3da827
 		if ((!svc_sendreply(xprt, (xdrproc_t) xdr_void, NULL)) &&
3da827
 			debugging) {
3da827
 			if (doabort) {
3da827
@@ -201,11 +201,11 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
3da827
 		  reg.pm_prog, reg.pm_vers);
3da827
 #endif
3da827
 
3da827
-	if (!check_access(xprt, op, &reg, PMAPVERS)) {
3da827
+	if (!check_access(xprt, op, reg.pm_prog, PMAPVERS)) {
3da827
 		svcerr_weakauth(xprt);
3da827
 		return (FALSE);
3da827
 	}
3da827
-		
3da827
+
3da827
 	rpcbreg.r_prog = reg.pm_prog;
3da827
 	rpcbreg.r_vers = reg.pm_vers;
3da827
 
3da827
@@ -276,7 +276,7 @@ pmapproc_getport(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
3da827
 		return (FALSE);
3da827
 	}
3da827
 
3da827
-	if (!check_access(xprt, PMAPPROC_GETPORT, &reg, PMAPVERS)) {
3da827
+	if (!check_access(xprt, PMAPPROC_GETPORT, reg.pm_prog, PMAPVERS)) {
3da827
 		svcerr_weakauth(xprt);
3da827
 		return FALSE;
3da827
 	}
3da827
@@ -340,7 +340,7 @@ pmapproc_dump(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
3da827
 		return (FALSE);
3da827
 	}
3da827
 
3da827
-	if (!check_access(xprt, PMAPPROC_DUMP, NULL, PMAPVERS)) {
3da827
+	if (!check_access(xprt, PMAPPROC_DUMP, 0, PMAPVERS)) {
3da827
 		svcerr_weakauth(xprt);
3da827
 		return FALSE;
3da827
 	}
3da827
diff --git a/src/rpcb_svc.c b/src/rpcb_svc.c
3da827
index 0514ba5..e350f85 100644
3da827
--- a/src/rpcb_svc.c
3da827
+++ b/src/rpcb_svc.c
3da827
@@ -75,6 +75,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp)
3da827
 	char *result;
3da827
 	xdrproc_t xdr_argument, xdr_result;
3da827
 	void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
3da827
+	rpcprog_t setprog = 0;
3da827
 
3da827
 	rpcbs_procinfo(RPCBVERS_3_STAT, rqstp->rq_proc);
3da827
 
3da827
@@ -88,7 +89,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp)
3da827
 			fprintf(stderr, "RPCBPROC_NULL\n");
3da827
 #endif
3da827
 		/* This call just logs, no actual checks */
3da827
-		check_access(transp, rqstp->rq_proc, NULL, RPCBVERS);
3da827
+		check_access(transp, rqstp->rq_proc, 0, RPCBVERS);
3da827
 		(void) svc_sendreply(transp, (xdrproc_t)xdr_void, (char *)NULL);
3da827
 		return;
3da827
 
3da827
@@ -166,7 +167,13 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp)
3da827
 			(void) fprintf(stderr, "rpcbind: could not decode\n");
3da827
 		return;
3da827
 	}
3da827
-	if (!check_access(transp, rqstp->rq_proc, &argument, RPCBVERS)) {
3da827
+
3da827
+	if (rqstp->rq_proc == RPCBPROC_SET
3da827
+	 || rqstp->rq_proc == RPCBPROC_UNSET
3da827
+	 || rqstp->rq_proc == RPCBPROC_GETADDR)
3da827
+		setprog = argument.rpcbproc_set_3_arg.r_prog;
3da827
+
3da827
+	if (!check_access(transp, rqstp->rq_proc, setprog, RPCBVERS)) {
3da827
 		svcerr_weakauth(transp);
3da827
 		goto done;
3da827
 	}
3da827
diff --git a/src/rpcb_svc_4.c b/src/rpcb_svc_4.c
3da827
index 9fd5bef..313e6d1 100644
3da827
--- a/src/rpcb_svc_4.c
3da827
+++ b/src/rpcb_svc_4.c
3da827
@@ -78,6 +78,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp)
3da827
 	char *result;
3da827
 	xdrproc_t xdr_argument, xdr_result;
3da827
 	void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
3da827
+	rpcprog_t setprog = 0;
3da827
 
3da827
 	rpcbs_procinfo(RPCBVERS_4_STAT, rqstp->rq_proc);
3da827
 
3da827
@@ -90,7 +91,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp)
3da827
 		if (debugging)
3da827
 			fprintf(stderr, "RPCBPROC_NULL\n");
3da827
 #endif
3da827
-		check_access(transp, rqstp->rq_proc, NULL, RPCBVERS4);
3da827
+		check_access(transp, rqstp->rq_proc, 0, RPCBVERS4);
3da827
 		(void) svc_sendreply(transp, (xdrproc_t) xdr_void,
3da827
 					(char *)NULL);
3da827
 		return;
3da827
@@ -220,7 +221,13 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp)
3da827
 			(void) fprintf(stderr, "rpcbind: could not decode\n");
3da827
 		return;
3da827
 	}
3da827
-	if (!check_access(transp, rqstp->rq_proc, &argument, RPCBVERS4)) {
3da827
+
3da827
+	if (rqstp->rq_proc == RPCBPROC_SET
3da827
+	 || rqstp->rq_proc == RPCBPROC_UNSET
3da827
+	 || rqstp->rq_proc == RPCBPROC_GETADDR)
3da827
+		setprog = argument.rpcbproc_set_4_arg.r_prog;
3da827
+
3da827
+	if (!check_access(transp, rqstp->rq_proc, setprog, RPCBVERS4)) {
3da827
 		svcerr_weakauth(transp);
3da827
 		goto done;
3da827
 	}
3da827
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
3da827
index 291421f..f6bd6bd 100644
3da827
--- a/src/rpcb_svc_com.c
3da827
+++ b/src/rpcb_svc_com.c
3da827
@@ -1227,6 +1227,8 @@ send_svcsyserr(SVCXPRT *xprt, struct finfo *fi)
3da827
 	return;
3da827
 }
3da827
 
3da827
+extern SVCAUTH svc_auth_none;
3da827
+
3da827
 static void
3da827
 handle_reply(int fd, SVCXPRT *xprt)
3da827
 {
3da827
@@ -1293,7 +1295,10 @@ handle_reply(int fd, SVCXPRT *xprt)
3da827
 	a.rmt_localvers = fi->versnum;
3da827
 
3da827
 	xprt_set_caller(xprt, fi);
3da827
+	xprt->xp_auth = &svc_auth_none;
3da827
 	svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (char *) &a);
3da827
+	SVCAUTH_DESTROY(xprt->xp_auth);
3da827
+	xprt->xp_auth = NULL;
3da827
 done:
3da827
 	if (buffer)
3da827
 		free(buffer);
3da827
@@ -1372,10 +1377,13 @@ static char *
3da827
 getowner(SVCXPRT *transp, char *owner, size_t ownersize)
3da827
 {
3da827
 	uid_t uid;
3da827
- 
3da827
-	if (__rpc_get_local_uid(transp, &uid) < 0)
3da827
-		snprintf(owner, ownersize, "unknown");
3da827
-	else if (uid == 0)
3da827
+
3da827
+	if (__rpc_get_local_uid(transp, &uid) < 0) {
3da827
+		if (is_localroot(svc_getrpccaller(transp)))
3da827
+			snprintf(owner, ownersize, "superuser");
3da827
+		else 
3da827
+			snprintf(owner, ownersize, "unknown");
3da827
+	} else if (uid == 0)
3da827
 		snprintf(owner, ownersize, "superuser");
3da827
 	else
3da827
 		snprintf(owner, ownersize, "%d", uid);  
3da827
diff --git a/src/rpcbind.c b/src/rpcbind.c
3da827
index 525ffba..9a0504d 100644
3da827
--- a/src/rpcbind.c
3da827
+++ b/src/rpcbind.c
3da827
@@ -68,7 +68,6 @@
3da827
 #include <string.h>
3da827
 #include <errno.h>
3da827
 #include <nss.h>
3da827
-#include "config.h"
3da827
 #include "rpcbind.h"
3da827
 
3da827
 /*#define RPCBIND_DEBUG*/
3da827
@@ -77,6 +76,7 @@
3da827
 
3da827
 int debugging = 0;	/* Tell me what's going on */
3da827
 int doabort = 0;	/* When debugging, do an abort on errors */
3da827
+int dofork = 1;		/* fork? */
3da827
 
3da827
 rpcblist_ptr list_rbl;	/* A list of version 3/4 rpcbind services */
3da827
 
3da827
@@ -213,8 +213,8 @@ main(int argc, char *argv[])
3da827
 			printf("\n");
3da827
 		}
3da827
 #endif
3da827
-	} else {
3da827
-		if (daemon(0, 0)) 
3da827
+	} else if (dofork) {
3da827
+		if (daemon(0, 0))
3da827
         		err(1, "fork failed");
3da827
 	}
3da827
 
3da827
@@ -236,6 +236,10 @@ main(int argc, char *argv[])
3da827
                         syslog(LOG_ERR, "setgid to '%s' (%d) failed: %m", id, p->pw_gid);
3da827
                         exit(1);
3da827
                 }
3da827
+		if (setgroups(0, NULL) == -1) {
3da827
+			syslog(LOG_ERR, "dropping supplemental groups failed: %m");
3da827
+			exit(1);
3da827
+		}
3da827
 		if (setuid(p->pw_uid) == -1) {
3da827
 			syslog(LOG_ERR, "setuid to '%s' (%d) failed: %m", id, p->pw_uid);
3da827
 			exit(1);
3da827
@@ -276,6 +280,7 @@ init_transport(struct netconfig *nconf)
3da827
 	int addrlen = 0;
3da827
 	int nhostsbak;
3da827
 	int checkbind;
3da827
+	int on = 1;
3da827
 	struct sockaddr *sa = NULL;
3da827
 	u_int32_t host_addr[4];  /* IPv4 or IPv6 */
3da827
 	struct sockaddr_un sun;
3da827
@@ -493,6 +498,14 @@ init_transport(struct netconfig *nconf)
3da827
 		}
3da827
 		oldmask = umask(S_IXUSR|S_IXGRP|S_IXOTH);
3da827
 		__rpc_fd2sockinfo(fd, &si);
3da827
+		if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on,
3da827
+				sizeof(on)) != 0) {
3da827
+			syslog(LOG_ERR, "cannot set SO_REUSEADDR on %s",
3da827
+				nconf->nc_netid);
3da827
+			if (res != NULL)
3da827
+				freeaddrinfo(res);
3da827
+			return 1;
3da827
+		}
3da827
 		if (bind(fd, sa, addrlen) < 0) {
3da827
 			syslog(LOG_ERR, "cannot bind %s: %m", nconf->nc_netid);
3da827
 			if (res != NULL)
3da827
@@ -731,7 +744,7 @@ parseargs(int argc, char *argv[])
3da827
 {
3da827
 	int c;
3da827
 	oldstyle_local = 1;
3da827
-	while ((c = getopt(argc, argv, "dwah:ils")) != -1) {
3da827
+	while ((c = getopt(argc, argv, "adh:ilswf")) != -1) {
3da827
 		switch (c) {
3da827
 		case 'a':
3da827
 			doabort = 1;	/* when debugging, do an abort on */
3da827
@@ -758,13 +771,16 @@ parseargs(int argc, char *argv[])
3da827
 		case 's':
3da827
 			runasdaemon = 1;
3da827
 			break;
3da827
+		case 'f':
3da827
+			dofork = 0;
3da827
+			break;
3da827
 #ifdef WARMSTART
3da827
 		case 'w':
3da827
 			warmstart = 1;
3da827
 			break;
3da827
 #endif
3da827
 		default:	/* error */
3da827
-			fprintf(stderr,	"usage: rpcbind [-Idwils]\n");
3da827
+			fprintf(stderr,	"usage: rpcbind [-adhilswf]\n");
3da827
 			exit (1);
3da827
 		}
3da827
 	}
3da827
diff --git a/src/rpcbind.h b/src/rpcbind.h
3da827
index c800577..74f9591 100644
3da827
--- a/src/rpcbind.h
3da827
+++ b/src/rpcbind.h
3da827
@@ -119,7 +119,7 @@ void rpcbind_abort(void);
3da827
 void reap(int);
3da827
 void toggle_verboselog(int);
3da827
 
3da827
-int check_access(SVCXPRT *, rpcproc_t, void *, unsigned int);
3da827
+int check_access(SVCXPRT *, rpcproc_t, rpcprog_t, unsigned int);
3da827
 int check_callit(SVCXPRT *, struct r_rmtcall_args *, int);
3da827
 void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *);
3da827
 int is_loopback(struct netbuf *);
3da827
diff --git a/src/security.c b/src/security.c
3da827
index 0edeac6..d272f74 100644
3da827
--- a/src/security.c
3da827
+++ b/src/security.c
3da827
@@ -62,34 +62,21 @@ int log_severity = PORTMAP_LOG_FACILITY|PORTMAP_LOG_SEVERITY;
3da827
 extern int verboselog;
3da827
 
3da827
 int 
3da827
-check_access(SVCXPRT *xprt, rpcproc_t proc, void *args, unsigned int rpcbvers)
3da827
+check_access(SVCXPRT *xprt, rpcproc_t proc, rpcprog_t prog, unsigned int rpcbvers)
3da827
 {
3da827
 	struct netbuf *caller = svc_getrpccaller(xprt);
3da827
 	struct sockaddr *addr = (struct sockaddr *)caller->buf;
3da827
 #ifdef LIBWRAP
3da827
 	struct request_info req;
3da827
 #endif
3da827
-	rpcprog_t prog = 0;
3da827
-	rpcb *rpcbp;
3da827
-	struct pmap *pmap;
3da827
 
3da827
 	/*
3da827
 	 * The older PMAP_* equivalents have the same numbers, so
3da827
 	 * they are accounted for here as well.
3da827
 	 */
3da827
 	switch (proc) {
3da827
-	case RPCBPROC_GETADDR:
3da827
 	case RPCBPROC_SET:
3da827
 	case RPCBPROC_UNSET:
3da827
-		if (rpcbvers > PMAPVERS) {
3da827
-			rpcbp = (rpcb *)args;
3da827
-			prog = rpcbp->r_prog;
3da827
-		} else {
3da827
-			pmap = (struct pmap *)args;
3da827
-			prog = pmap->pm_prog;
3da827
-		}
3da827
-		if (proc == RPCBPROC_GETADDR)
3da827
-			break;
3da827
 		if (!insecure && !is_loopback(caller)) {
3da827
 #ifdef RPCBIND_DEBUG
3da827
 			  if (debugging)
3da827
@@ -101,6 +88,7 @@ check_access(SVCXPRT *xprt, rpcproc_t proc, void *args, unsigned int rpcbvers)
3da827
 			return 0;
3da827
 		}
3da827
 		break;
3da827
+	case RPCBPROC_GETADDR:
3da827
 	case RPCBPROC_CALLIT:
3da827
 	case RPCBPROC_INDIRECT:
3da827
 	case RPCBPROC_DUMP:
3da827
@@ -150,8 +138,7 @@ is_loopback(struct netbuf *nbuf)
3da827
 				  "Checking caller's adress (port = %d)\n",
3da827
 				  ntohs(sin->sin_port));
3da827
 #endif
3da827
-	       	return ((sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) &&
3da827
-		    (ntohs(sin->sin_port) < IPPORT_RESERVED));
3da827
+	       	return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK));
3da827
 #ifdef INET6
3da827
 	case AF_INET6:
3da827
 		if (!oldstyle_local)
3da827
@@ -163,10 +150,9 @@ is_loopback(struct netbuf *nbuf)
3da827
 				  "Checking caller's adress (port = %d)\n",
3da827
 				  ntohs(sin6->sin6_port));
3da827
 #endif
3da827
-		return ((IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) ||
3da827
+		return (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) ||
3da827
 			 (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr) &&
3da827
-			  sin6->sin6_addr.s6_addr32[3] == htonl(INADDR_LOOPBACK))) &&
3da827
-		        (ntohs(sin6->sin6_port) < IPV6PORT_RESERVED));
3da827
+			  sin6->sin6_addr.s6_addr32[3] == htonl(INADDR_LOOPBACK)));
3da827
 #endif
3da827
 	case AF_LOCAL:
3da827
 		return 1;
3da827
diff --git a/src/warmstart.c b/src/warmstart.c
3da827
index 25e5d89..d1bb971 100644
3da827
--- a/src/warmstart.c
3da827
+++ b/src/warmstart.c
3da827
@@ -46,7 +46,6 @@
3da827
 #include <unistd.h>
3da827
 #include <errno.h>
3da827
 
3da827
-#include "config.h"
3da827
 #include "rpcbind.h"
3da827
 
3da827
 #ifndef RPCBIND_STATEDIR