Blob Blame Raw
--- rpcbind-0.1.4/man/rpcbind.8.orig	2004-10-25 08:07:44.000000000 -0400
+++ rpcbind-0.1.4/man/rpcbind.8	2007-04-03 08:31:57.000000000 -0400
@@ -131,6 +131,14 @@
 clients from using
 .Nm
 to connect to services from a privileged port.
+.It Fl w
+Cause
+.Nm
+to do a "warm start" by read a state file when
+.Nm
+starts up. The state file is created when
+.Nm
+terminates.
 .El
 .Sh NOTES
 All RPC servers must be restarted if
--- rpcbind-0.1.4/src/warmstart.c.orig	2004-10-25 08:07:42.000000000 -0400
+++ rpcbind-0.1.4/src/warmstart.c	2007-04-03 08:32:21.000000000 -0400
@@ -46,17 +46,21 @@
 #include <syslog.h>
 #include <unistd.h>
 
+#include "config.h"
 #include "rpcbind.h"
 
 /*
  * XXX this code is unsafe and is not used. It should be made safe.
  */
 
+#ifndef RPCBIND_STATEDIR
+#define RPCBIND_STATEDIR "/tmp"
+#endif
 
 /* These files keep the pmap_list and rpcb_list in XDR format */
-#define	RPCBFILE	"/tmp/rpcbind.file"
+#define	RPCBFILE	RPCBIND_STATEDIR "/rpcbind.file"
 #ifdef PORTMAP
-#define	PMAPFILE	"/tmp/portmap.file"
+#define	PMAPFILE	RPCBIND_STATEDIR "/portmap.file"
 #endif
 
 static bool_t write_struct __P((char *, xdrproc_t, void *));
--- /dev/null	2007-04-02 10:04:26.771658626 -0400
+++ rpcbind-0.1.4/src/config.h.in	2007-04-03 08:31:57.000000000 -0400
@@ -0,0 +1,2 @@
+/* this define where the state files live for warm starts */
+#undef RPCBIND_STATEDIR
--- rpcbind-0.1.4/src/Makefile.am.orig	2007-04-03 08:31:44.000000000 -0400
+++ rpcbind-0.1.4/src/Makefile.am	2007-04-03 08:31:57.000000000 -0400
@@ -1,5 +1,14 @@
 INCLUDES = -I$(srcdir)/tirpc -DPORTMAP -DINET6 -DVERSION="\"$(VERSION)\"" \
                                                 -D_GNU_SOURCE -Wall -pipe
+if DEBUG
+INCLUDES +=	-DRPCBIND_DEBUG -DSVC_RUN_DEBUG -DDEBUG_RMTCALL
+INCLUDES +=	-DND_DEBUG -DBIND_DEBUG
+endif
+
+if WARMSTART
+INCLUDES +=	-DWARMSTART
+endif
+
 
 bin_PROGRAMS = rpcbind rpcinfo
 
@@ -18,10 +27,6 @@
 rpcbind_LDADD = $(LIB_TIRPC)
 AM_CPPFLAGS = -I/usr/include/tirpc -DCHECK_LOCAL -DPORTMAP \
                        -DFACILITY=LOG_MAIL -DSEVERITY=LOG_INFO
-if DEBUG
-INCLUDES +=	-DRPCBIND_DEBUG -DSVC_RUN_DEBUG -DDEBUG_RMTCALL
-INCLUDES +=	-DND_DEBUG -DBIND_DEBUG
-endif
 
 $(rpcbind_OBJECTS) :    security.o util.o check_bound.o pmap_svc.o \
                         rpcb_svc.o rpcb_svc_com.o rpcb_svc_4.o \
--- rpcbind-0.1.4/configure.in.orig	2007-04-03 08:31:44.000000000 -0400
+++ rpcbind-0.1.4/configure.in	2007-04-03 08:31:57.000000000 -0400
@@ -9,7 +9,10 @@
  ##AC_PROG_RANLIB
  AC_HEADER_DIRENT
  AC_PREFIX_DEFAULT(/usr)
-                    
+
+AC_CONFIG_SRCDIR([src/config.h.in])
+AC_CONFIG_HEADERS([src/config.h])
+
 AC_ARG_ENABLE(debug,[  --enable-debug      Turns on rpcbind debugging], 
 	[case "${enableval}" in
 		yes) debug=true ;;
@@ -18,6 +21,23 @@
 	esac],[debug=false])
 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
 
+AC_ARG_ENABLE(warmstarts,[  --enable-warmstarts  Enables Warm Starts], 
+	[case "${enableval}" in
+		yes) warmstarts=true ;;
+		no)  warmstarts=no ;;
+		*) AC_MSG_ERROR(bad value ${enableval} for --enable-warmstarts) ;;
+	esac],[warmstarts=false])
+AM_CONDITIONAL(WARMSTART, test x$warmstarts = xtrue)
+
+if test "$warmstarts" = "true" ; then
+	AC_ARG_WITH(statedir,
+		[  --with-statedir=/foo use state dir /foo [/tmp]],
+    	statedir=$withval,
+		statedir=/tmp)
+		AC_SUBST(statedir)
+	AC_DEFINE_UNQUOTED(RPCBIND_STATEDIR, "$statedir", [This defines the location where the state files will be kept for warm starts])
+fi
+
 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h \
                   netinet/in.h stdlib.h string.h \
                   sys/param.h sys/socket.h \