Blame SOURCES/rpcbind-0_2_1-rc4.patch

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