Compare commits

...
Sign in to create a new pull request.

5 commits

Author SHA1 Message Date
Fedora Release Engineering
697df6e1e0 Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild 2026-07-16 23:40:25 +00:00
Steve Dickson
fdd42666b9 Fix leak of nconf in main()
Signed-off-by: Steve Dickson <steved@redhat.com>
2026-07-01 11:39:21 -04:00
Scott Mayhew
4b9905a7c3 rpcbind: rename RPCBIND_ARGS to RPCBIND_OPTIONS in /etc/sysconfig/rpcbind
rpcbind.service uses RPCBIND_OPTIONS, but /etc/sysconfig/rpcbind uses
RPCBIND_ARGS, resulting in this error in the journal on startup:

rpcbind.service: Referenced but unset environment variable evaluates to an empty string: RPCBIND_OPTIONS

as well as settings being placed in /etc/sysconfig/rpcbind having no
effect.

Also clean up unused patches rpcbind-0.2.3-create-statdir.patch and
rpcbind-1.2.5-rpcinfo-bufoverflow.patch, as well as unused source file
rpcbind.init.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
2026-06-30 12:26:36 -04:00
Steve Dickson
518eec180e Updated to latest upstream release: rpcbind-1_2_9 (bz 2482426)
Signed-off-by: Steve Dickson <steved@redhat.com>
2026-06-13 13:52:57 -04:00
Steve Dickson
53d764e5f9 Updated the URL to https://sourceforge.net/projects/rpcbind
Signed-off-by: Steve Dickson <steved@redhat.com>
2026-05-15 07:02:41 -04:00
8 changed files with 54 additions and 310 deletions

4
.gitignore vendored
View file

@ -1,4 +1,4 @@
x86_64
Makefile
rpcbind-1.2.8-build/
/rpcbind-1.2.8.tar.bz2
rpcbind-1.2.9-build/
/rpcbind-1.2.9.tar.bz2

View file

@ -1,138 +0,0 @@
commit 1805cdb116bd076dc5746beeb6dc79067a79d094
Author: NeilBrown <neilb@suse.com>
Date: Wed Nov 16 10:53:07 2016 -0500
Move default state-dir to a subdirectory of /var/run
rpcbind can save state in a file to allow restart without forgetting
about running services.
The default location is currently "/tmp" which is
not ideal for system files. It is particularly unpleasant
to put simple files there rather than creating a directory
to contain them.
On a modern Linux system it is preferable to use /run, and there it is
even more consistent with practice to use a subdirectory.
This directory needs to be create one each boot, and while there are
tools (e.g. systemd-tmpfiles) which can do that it is cleaner to keep
rpcbind self-contained and have it create the directory.
So change the default location to /var/run/rpcbind, and create that
directory. If a different user-id is used, we need to create
and chown the directory before dropping privileges. We do this
with care so avoid chowning the wrong thing by mistake.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/configure.ac b/configure.ac
index f84921e..acc6914 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,8 +22,8 @@ AC_ARG_ENABLE([warmstarts],
AM_CONDITIONAL(WARMSTART, test x$enable_warmstarts = xyes)
AC_ARG_WITH([statedir],
- AS_HELP_STRING([--with-statedir=ARG], [use ARG as state dir @<:@default=/tmp@:>@])
- ,, [with_statedir=/tmp])
+ AS_HELP_STRING([--with-statedir=ARG], [use ARG as state dir @<:@default=/var/run/rpcbind@:>@])
+ ,, [with_statedir=/var/run/rpcbind])
AC_SUBST([statedir], [$with_statedir])
AC_ARG_WITH([rpcuser],
diff --git a/src/rpcbind.c b/src/rpcbind.c
index 87ccdc2..8db8dfc 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -263,6 +263,11 @@ main(int argc, char *argv[])
syslog(LOG_ERR, "cannot get uid of '%s': %m", id);
exit(1);
}
+#ifdef WARMSTART
+ if (warmstart) {
+ mkdir_warmstart(p->pw_uid);
+ }
+#endif
if (setgid(p->pw_gid) == -1) {
syslog(LOG_ERR, "setgid to '%s' (%d) failed: %m", id, p->pw_gid);
exit(1);
diff --git a/src/rpcbind.h b/src/rpcbind.h
index 74f9591..5b1a9bb 100644
--- a/src/rpcbind.h
+++ b/src/rpcbind.h
@@ -129,6 +129,7 @@ int is_localroot(struct netbuf *);
extern void pmap_service(struct svc_req *, SVCXPRT *);
#endif
+void mkdir_warmstart(int uid);
void write_warmstart(void);
void read_warmstart(void);
diff --git a/src/warmstart.c b/src/warmstart.c
index 122a058..aafcb61 100644
--- a/src/warmstart.c
+++ b/src/warmstart.c
@@ -45,19 +45,23 @@
#include <syslog.h>
#include <unistd.h>
#include <errno.h>
+#include <fcntl.h>
#include "rpcbind.h"
-#ifndef RPCBIND_STATEDIR
-#define RPCBIND_STATEDIR "/tmp"
-#endif
-
/* These files keep the pmap_list and rpcb_list in XDR format */
#define RPCBFILE RPCBIND_STATEDIR "/rpcbind.xdr"
#ifdef PORTMAP
#define PMAPFILE RPCBIND_STATEDIR "/portmap.xdr"
#endif
+#ifndef O_DIRECTORY
+#define O_DIRECTORY 0
+#endif
+#ifndef O_NOFOLLOW
+#define O_NOFOLLOW 0
+#endif
+
static bool_t write_struct(char *, xdrproc_t, void *);
static bool_t read_struct(char *, xdrproc_t, void *);
@@ -139,8 +143,33 @@ error:
}
void
+mkdir_warmstart(int uid)
+{
+ /* Already exists? */
+ if (access(RPCBIND_STATEDIR, X_OK) == 0)
+ return;
+
+ if (mkdir(RPCBIND_STATEDIR, 0770) == 0) {
+ int fd = open(RPCBIND_STATEDIR, O_RDONLY | O_DIRECTORY | O_NOFOLLOW);
+ if (fd >= 0) {
+ if (fchown(fd, uid, -1) < 0) {
+ syslog(LOG_ERR,
+ "mkdir_warmstart: open failed '%s', errno %d (%s)",
+ RPCBIND_STATEDIR, errno, strerror(errno));
+ }
+ close(fd);
+ } else
+ syslog(LOG_ERR, "mkdir_warmstart: open failed '%s', errno %d (%s)",
+ RPCBIND_STATEDIR, errno, strerror(errno));
+ } else
+ syslog(LOG_ERR, "mkdir_warmstart: mkdir failed '%s', errno %d (%s)",
+ RPCBIND_STATEDIR, errno, strerror(errno));
+}
+
+void
write_warmstart()
{
+ (void) mkdir(RPCBIND_STATEDIR, 0770);
(void) write_struct(RPCBFILE, (xdrproc_t)xdr_rpcblist_ptr, &list_rbl);
#ifdef PORTMAP
(void) write_struct(PMAPFILE, (xdrproc_t)xdr_pmaplist_ptr, &list_pml);

View file

@ -0,0 +1,30 @@
commit d7db84aefb2e302bab281d4fba31e498528ef531
Author: Scott Mayhew <smayhew@redhat.com>
Date: Wed Jul 1 08:31:13 2026 -0400
rpcbind: fix leak of nconf in main()
Before reusing nconf in the getnetconfig() loop, we need to free the
memory that was previously allocated via getnetconfigent(). Fixes the
following leak reported by valgrind:
==9031== 1,136 (136 direct, 1,000 indirect) bytes in 1 blocks are definitely lost in loss record 63 of 67
==9031== at 0x485183E: malloc (vg_replace_malloc.c:447)
==9031== by 0x4879D1F: getnetconfigent (in /usr/lib64/libtirpc.so.3.0.0)
==9031== by 0x4004336: main (rpcbind.c:271)
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/src/rpcbind.c b/src/rpcbind.c
index 4212377..c39df97 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -282,6 +282,7 @@ main(int argc, char *argv[])
rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
init_transport(nconf);
+ freenetconfigent(nconf);
while ((nconf = getnetconfig(nc_handle))) {
if (nconf->nc_flag & NC_VISIBLE)

View file

@ -1,64 +0,0 @@
commit 0bc1c0ae7ce61a7ac8a8e9a9b2086268f011abf0
Author: Steve Dickson <steved@redhat.com>
Date: Tue Oct 9 09:19:50 2018 -0400
rpcinfo: Fix stack buffer overflow
*** buffer overflow detected ***: rpcinfo terminated
======= Backtrace: =========
/lib64/libc.so.6(+0x721af)[0x7ff24c4451af]
/lib64/libc.so.6(__fortify_fail+0x37)[0x7ff24c4ccdc7]
/lib64/libc.so.6(+0xf8050)[0x7ff24c4cb050]
rpcinfo(+0x435f)[0xef3be2635f]
rpcinfo(+0x1c62)[0xef3be23c62]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7ff24c3f36e5]
rpcinfo(+0x2739)[0xef3be24739]
======= Memory map: ========
...
The patch below fixes it.
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Thomas Blume <thomas.blume@suse.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
index 9b46864..cfdba88 100644
--- a/src/rpcinfo.c
+++ b/src/rpcinfo.c
@@ -973,6 +973,7 @@ rpcbdump (dumptype, netid, argc, argv)
(" program version(s) netid(s) service owner\n");
for (rs = rs_head; rs; rs = rs->next)
{
+ size_t netidmax = sizeof(buf) - 1;
char *p = buf;
printf ("%10ld ", rs->prog);
@@ -985,12 +986,22 @@ rpcbdump (dumptype, netid, argc, argv)
}
printf ("%-10s", buf);
buf[0] = '\0';
- for (nl = rs->nlist; nl; nl = nl->next)
- {
- strcat (buf, nl->netid);
- if (nl->next)
- strcat (buf, ",");
- }
+
+ for (nl = rs->nlist; nl; nl = nl->next)
+ {
+ strncat (buf, nl->netid, netidmax);
+ if (strlen (nl->netid) < netidmax)
+ netidmax -= strlen(nl->netid);
+ else
+ break;
+
+ if (nl->next && netidmax > 1)
+ {
+ strncat (buf, ",", netidmax);
+ netidmax --;
+ }
+ }
+
printf ("%-32s", buf);
rpc = getrpcbynumber (rs->prog);
if (rpc)

View file

@ -1,101 +0,0 @@
#! /bin/sh
#
# rpcbind Start/Stop RPCbind
#
# chkconfig: 2345 13 87
# description: The rpcbind utility is a server that converts RPC program \
# numbers into universal addresses. It must be running on the \
# host to be able to make RPC calls on a server on that machine.
#
# processname: rpcbind
# probe: true
# config: /etc/sysconfig/rpcbind
# This is an interactive program, we need the current locale
[ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh
# We can't Japanese on normal console at boot time, so force LANG=C.
if [ "$LANG" = "ja" -o "$LANG" = "ja_JP.eucJP" ]; then
if [ "$TERM" = "linux" ] ; then
LANG=C
fi
fi
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
prog="rpcbind"
[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
RETVAL=0
uid=`id | cut -d\( -f1 | cut -d= -f2`
start() {
# Check that networking is up.
[ "$NETWORKING" = "yes" ] || exit 6
[ -f /sbin/$prog ] || exit 5
# Make sure the rpcbind is not already running.
if status $prog > /dev/null ; then
exit 0
fi
# Only root can start the service
[ $uid -ne 0 ] && exit 4
echo -n $"Starting $prog: "
daemon $prog $RPCBIND_ARGS $1
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && {
rm -f /var/lock/subsys/$prog
rm -f /var/run/rpcbind*
}
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
RETVAL=$?
;;
restart | reload| force-reload)
$0 stop
$0 start
RETVAL=$?
;;
condrestart | try-restart)
if [ -f /var/lock/subsys/$prog ]; then
$0 stop
$0 start -w
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}"
RETVAL=2
;;
esac
exit $RETVAL

View file

@ -3,11 +3,11 @@
%global rpcbind_state_dir %{_rundir}/rpcbind
Name: rpcbind
Version: 1.2.8
Release: 1%{?dist}
Version: 1.2.9
Release: 3%{?dist}
Summary: Universal Addresses to RPC Program Number Mapper
License: BSD-3-Clause
URL: http://nfsv4.bullopensource.org
URL: https://sourceforge.net/projects/rpcbind
Source0: http://downloads.sourceforge.net/rpcbind/%{name}-%{version}.tar.bz2
Source1: %{name}.sysconfig
@ -23,6 +23,8 @@ Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd coreutils
Patch001: rpcbind-0.2.9-mem-leak-main.patch
Patch100: rpcbind-0.2.3-systemd-tmpfiles.patch
Patch101: rpcbind-0.2.4-systemd-rundir.patch
@ -118,6 +120,21 @@ install -m0644 -D rpcbind.sysusers.conf %{buildroot}%{_sysusersdir}/rpcbind.conf
%{_sysusersdir}/rpcbind.conf
%changelog
* Thu Jul 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
* Wed Jul 1 2026 Steve Dickson <steved@redhat.com> 1.2.9-2
- Fix leak of nconf in main()
* Tue Jun 30 2026 Scott Mayhew <smayhew@redhat.com> 1.2.9-1
- Renamed RPCBIND_ARGS to RPCBIND_OPTIONS in /etc/sysconfig/rpcbind
* Sat Jun 13 2026 Steve Dickson <steved@redhat.com> 1.2.9-0
- Updated to latest upstream release: rpcbind-1_2_9 (bz 2482426)
* Fri May 15 2026 Steve Dickson <steved@redhat.com> 1.2.8-2
- Updated the URL to https://sourceforge.net/projects/rpcbind
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.8-1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild

View file

@ -1,3 +1,3 @@
#
# Optional arguments passed to rpcbind. See rpcbind(8)
RPCBIND_ARGS=""
RPCBIND_OPTIONS=""

View file

@ -1 +1 @@
SHA512 (rpcbind-1.2.8.tar.bz2) = 66f3955a67c4d0142ec635614ceafbc9bdbea985f2edaeec903f17efaf3c2e98f6483e8e6b7f1358cf8d2c1c877b281d153a3bf1b6748b6d259ae7ad1465ee71
SHA512 (rpcbind-1.2.9.tar.bz2) = bf3998c25be915bba19e06a250e6e213ae13609858bb6c1f9bf8c9737a14ef506d20251b0c2a21a003fe1edd26936958d4e73875830ede6d7098296a673f3856