diff --git a/rpcbind-0.1.4-rpcuser.patch b/rpcbind-0.1.4-rpcuser.patch new file mode 100644 index 0000000..bf48424 --- /dev/null +++ b/rpcbind-0.1.4-rpcuser.patch @@ -0,0 +1,68 @@ +--- rpcbind-0.1.4/src/rpcbind.c.orig 2004-12-02 11:37:16.000000000 -0500 ++++ rpcbind-0.1.4/src/rpcbind.c 2007-04-03 09:03:12.000000000 -0400 +@@ -68,6 +68,7 @@ + #include + #include + #include ++#include "config.h" + #include "rpcbind.h" + + /*#define RPCBIND_DEBUG*/ +@@ -79,6 +80,11 @@ + + rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */ + ++#ifdef RPCBIND_USER ++char *rpcbinduser = RPCBIND_USER; ++#else ++char *rpcbinduser = NULL; ++#endif + + /* who to suid to if -s is given */ + #define RUN_AS "daemon" +@@ -206,15 +212,16 @@ + err(1, "fork failed"); + } + +- if (runasdaemon) { ++ if (runasdaemon || rpcbinduser) { + struct passwd *p; ++ char *id = runasdaemon ? RUN_AS : rpcbinduser; + +- if((p = getpwnam(RUN_AS)) == NULL) { +- syslog(LOG_ERR, "cannot get uid of daemon: %m"); ++ if((p = getpwnam(id)) == NULL) { ++ syslog(LOG_ERR, "cannot get uid of '%s': %m", id); + exit(1); + } + if (setuid(p->pw_uid) == -1) { +- syslog(LOG_ERR, "setuid to daemon failed: %m"); ++ syslog(LOG_ERR, "setuid to '%s' failed: %m", id); + exit(1); + } + } +--- rpcbind-0.1.4/src/config.h.in.orig 2007-04-03 09:02:35.000000000 -0400 ++++ rpcbind-0.1.4/src/config.h.in 2007-04-03 09:02:49.000000000 -0400 +@@ -1,2 +1,6 @@ +-/* this define where the state files live for warm starts */ ++ ++/* This defines where the state files live for warm starts */ + #undef RPCBIND_STATEDIR ++ ++/* This defines the uid to run as */ ++#undef RPCBIND_USER +--- rpcbind-0.1.4/configure.in.orig 2007-04-03 09:02:35.000000000 -0400 ++++ rpcbind-0.1.4/configure.in 2007-04-03 09:02:49.000000000 -0400 +@@ -37,6 +37,12 @@ + 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_ARG_WITH(rpcuser, ++ [ --with-rpcuser=user uid to use [root]], ++ rpcuser=$withval, ++ rpcuser=root) ++ AC_SUBST(rpcuser) ++AC_DEFINE_UNQUOTED(RPCBIND_USER, "$rpcuser", [This defines the uid to run as]) + + AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h \ + netinet/in.h stdlib.h string.h \ diff --git a/rpcbind.init b/rpcbind.init index e67ca2a..c5bc1bd 100755 --- a/rpcbind.init +++ b/rpcbind.init @@ -61,7 +61,10 @@ stop() { killproc $prog RETVAL=$? echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog + [ $RETVAL -eq 0 ] && { + rm -f /var/lock/subsys/$prog + rm -f /var/run/rpcbind* + } return $RETVAL } diff --git a/rpcbind.spec b/rpcbind.spec index 470b38f..ff137d8 100644 --- a/rpcbind.spec +++ b/rpcbind.spec @@ -38,7 +38,7 @@ RPC calls on a server on that machine. %patch1 -p1 %patch2 -p1 %patch3 -p1 -#%patch4 -p1 +%patch4 -p1 %build %ifarch s390 s390x @@ -48,6 +48,7 @@ PIE="-fpie" %endif export PIE +RPCBUSR=rpc RPCBDIR=/var/lib/rpcbind CFLAGS="`echo $RPM_OPT_FLAGS $ARCH_OPT_FLAGS $PIE`" @@ -55,6 +56,7 @@ autoreconf -fisv %configure CFLAGS="$CFLAGS" LDFLAGS="-pie" \ --enable-warmstarts \ --with-statedir="$RPCBDIR" \ + --with-rpcuser="$RPCBUSR" \ --enable-debug make all