Compare commits
16 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f73721873 | ||
|
|
a5bff644dc | ||
|
|
34ccc27d72 | ||
|
|
dec446a113 | ||
|
|
d9b5fa47f8 | ||
|
|
d871d5c868 | ||
|
|
0df1187eb1 | ||
|
|
38c5c9fae6 | ||
|
|
f458dbe14b | ||
|
|
3c0595715b | ||
|
|
feb680b399 | ||
|
|
f39388a912 | ||
|
|
518296afa5 | ||
|
|
4641820d1e | ||
|
|
f2ad40f136 | ||
|
|
f88fd230fc |
14 changed files with 906 additions and 244 deletions
13
.gitignore
vendored
13
.gitignore
vendored
|
|
@ -1,9 +1,4 @@
|
|||
rpcbind-0.2.0.tar.bz2
|
||||
*.rpm
|
||||
/rpcbind-0.2.1.tar.bz2
|
||||
rpcbind-0.2.0
|
||||
rpcbind-0.2.1
|
||||
/rpcbind-0.2.2.tar.bz2
|
||||
rpcbind-0.2.2
|
||||
/rpcbind-0.2.3.tar.bz2
|
||||
rpcbind-0.2.3
|
||||
rpcbind-0.2.4
|
||||
/rpcbind-0.2.4.tar.bz2
|
||||
x86_64
|
||||
Makefile
|
||||
|
|
|
|||
138
rpcbind-0.2.3-create-statdir.patch
Normal file
138
rpcbind-0.2.3-create-statdir.patch
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
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);
|
||||
12
rpcbind-0.2.3-systemd-envfile.patch
Normal file
12
rpcbind-0.2.3-systemd-envfile.patch
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
diff -up rpcbind-0.2.3/systemd/rpcbind.service.in.orig rpcbind-0.2.3/systemd/rpcbind.service.in
|
||||
--- rpcbind-0.2.3/systemd/rpcbind.service.in.orig 2016-11-07 14:45:17.440658739 -0500
|
||||
+++ rpcbind-0.2.3/systemd/rpcbind.service.in 2016-11-07 14:46:50.968844715 -0500
|
||||
@@ -10,7 +10,7 @@ After=rpcbind.socket
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
-# distro can provide a drop-in adding EnvironmentFile=-/??? if needed.
|
||||
+EnvironmentFile=/etc/sysconfig/rpcbind
|
||||
ExecStart=@_bindir@/rpcbind $RPCBIND_OPTIONS -w -f
|
||||
|
||||
[Install]
|
||||
57
rpcbind-0.2.3-systemd-tmpfiles.patch
Normal file
57
rpcbind-0.2.3-systemd-tmpfiles.patch
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
commit b47e0f12cfa005bb120e018257410663efbd7254
|
||||
Author: Steve Dickson <steved@redhat.com>
|
||||
Date: Tue Nov 15 13:32:40 2016 -0500
|
||||
|
||||
Use systemd-tmpfiles to create the warmstart directory
|
||||
|
||||
When systemd is available have it create the /run/rpcbind
|
||||
warmstart directory. Note, the new rpcbind.conf file
|
||||
expects 'rpc' user and group since that those will be
|
||||
the id/gid that will own the directory.
|
||||
|
||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 43c2710..d7ca426 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -54,6 +54,9 @@ rpcbind_LDADD += $(SYSTEMD_LIBS)
|
||||
systemdsystemunit_DATA = \
|
||||
systemd/rpcbind.service \
|
||||
systemd/rpcbind.socket
|
||||
+
|
||||
+systemdtmpfiles_DATA = \
|
||||
+ systemd/rpcbind.conf
|
||||
endif
|
||||
|
||||
rpcinfo_SOURCES = src/rpcinfo.c
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index acc6914..81adafc 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -52,6 +52,17 @@ AC_ARG_WITH([systemdsystemunitdir],
|
||||
fi
|
||||
AM_CONDITIONAL(SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
|
||||
|
||||
+AC_ARG_WITH([systemdtmpfilesdir],
|
||||
+ AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], [Directory for systemd tmp files]),
|
||||
+ [], [with_systemdtmpfilesdir=$($PKG_CONFIG --variable=tmpfilesdir systemd)])
|
||||
+ if test "x$with_systemdtmpfilesdir" != xno; then
|
||||
+ AC_SUBST([systemdtmpfilesdir], [$with_systemdtmpfilesdir])
|
||||
+ PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [],
|
||||
+ [PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon], [],
|
||||
+ AC_MSG_ERROR([libsystemd support requested but found]))])
|
||||
+ fi
|
||||
+AM_CONDITIONAL(SYSTEMD, [test -n "$with_systemdtmpfilesdir" -a "x$with_systemdtmpfilesdir" != xno ])
|
||||
+
|
||||
AS_IF([test x$enable_libwrap = xyes], [
|
||||
AC_CHECK_LIB([wrap], [hosts_access], ,
|
||||
AC_MSG_ERROR([libwrap support requested but unable to find libwrap]))
|
||||
diff --git a/systemd/rpcbind.conf b/systemd/rpcbind.conf
|
||||
new file mode 100644
|
||||
index 0000000..2f8af45
|
||||
--- /dev/null
|
||||
+++ b/systemd/rpcbind.conf
|
||||
@@ -0,0 +1,2 @@
|
||||
+#Type Path Mode UID GID Age Argument
|
||||
+D /run/rpcbind 0700 rpc rpc - -
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
|
||||
index ff9ce6b..148fe42 100644
|
||||
--- a/src/rpcb_svc_com.c
|
||||
+++ b/src/rpcb_svc_com.c
|
||||
@@ -536,10 +536,6 @@ create_rmtcall_fd(struct netconfig *nconf)
|
||||
rmttail->next = rmt;
|
||||
rmttail = rmt;
|
||||
}
|
||||
- /* XXX not threadsafe */
|
||||
- if (fd > svc_maxfd)
|
||||
- svc_maxfd = fd;
|
||||
- FD_SET(fd, &svc_fdset);
|
||||
return (fd);
|
||||
}
|
||||
|
||||
@@ -1056,9 +1052,6 @@ free_slot_by_index(int index)
|
||||
fi = &FINFO[index];
|
||||
if (fi->flag & FINFO_ACTIVE) {
|
||||
netbuffree(fi->caller_addr);
|
||||
- /* XXX may be too big, but can't access xprt array here */
|
||||
- if (fi->forward_fd >= svc_maxfd)
|
||||
- svc_maxfd--;
|
||||
free(fi->uaddr);
|
||||
fi->flag &= ~FINFO_ACTIVE;
|
||||
rpcb_rmtcalls--;
|
||||
@@ -1097,35 +1090,28 @@ netbuffree(struct netbuf *ap)
|
||||
}
|
||||
|
||||
|
||||
-#define MASKVAL (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)
|
||||
-extern bool_t __svc_clean_idle(fd_set *, int, bool_t);
|
||||
-
|
||||
void
|
||||
my_svc_run()
|
||||
{
|
||||
- size_t nfds;
|
||||
- struct pollfd pollfds[FD_SETSIZE];
|
||||
int poll_ret, check_ret;
|
||||
int n;
|
||||
-#ifdef SVC_RUN_DEBUG
|
||||
- int i;
|
||||
-#endif
|
||||
- register struct pollfd *p;
|
||||
- fd_set cleanfds;
|
||||
|
||||
for (;;) {
|
||||
- p = pollfds;
|
||||
- for (n = 0; n <= svc_maxfd; n++) {
|
||||
- if (FD_ISSET(n, &svc_fdset)) {
|
||||
- p->fd = n;
|
||||
- p->events = MASKVAL;
|
||||
- p++;
|
||||
- }
|
||||
- }
|
||||
- nfds = p - pollfds;
|
||||
- poll_ret = 0;
|
||||
+ struct pollfd my_pollfd[svc_max_pollfd];
|
||||
+ int i;
|
||||
+
|
||||
+ if (svc_max_pollfd == 0 && svc_pollfd == NULL)
|
||||
+ return;
|
||||
|
||||
- switch (poll_ret = poll(pollfds, nfds, 30 * 1000)) {
|
||||
+
|
||||
+ for (i = 0; i < svc_max_pollfd; ++i)
|
||||
+ {
|
||||
+ my_pollfd[i].fd = svc_pollfd[i].fd;
|
||||
+ my_pollfd[i].events = svc_pollfd[i].events;
|
||||
+ my_pollfd[i].revents = 0;
|
||||
+ }
|
||||
+
|
||||
+ switch (poll_ret = poll(my_pollfd, svc_max_pollfd, 30 * 1000)) {
|
||||
case -1:
|
||||
/*
|
||||
* We ignore all errors, continuing with the assumption
|
||||
@@ -1133,8 +1119,6 @@ my_svc_run()
|
||||
* other outside event) and not caused by poll().
|
||||
*/
|
||||
case 0:
|
||||
- cleanfds = svc_fdset;
|
||||
- __svc_clean_idle(&cleanfds, 30, FALSE);
|
||||
continue;
|
||||
default:
|
||||
/*
|
||||
@@ -1144,10 +1128,10 @@ my_svc_run()
|
||||
* don't call svc_getreq_poll. Otherwise, there
|
||||
* must be another so we must call svc_getreq_poll.
|
||||
*/
|
||||
- if ((check_ret = check_rmtcalls(pollfds, nfds)) ==
|
||||
+ if ((check_ret = check_rmtcalls(my_pollfd, svc_max_pollfd)) ==
|
||||
poll_ret)
|
||||
continue;
|
||||
- svc_getreq_poll(pollfds, poll_ret-check_ret);
|
||||
+ svc_getreq_poll(my_pollfd, poll_ret-check_ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1183,12 +1167,33 @@ check_rmtcalls(struct pollfd *pfds, int nfds)
|
||||
return (ncallbacks_found);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * This is really a helper function defined in libtirpc,
|
||||
+ * but unfortunately, it hasn't been exported yet.
|
||||
+ */
|
||||
+static struct netbuf *
|
||||
+__rpc_set_netbuf(struct netbuf *nb, const void *ptr, size_t len)
|
||||
+{
|
||||
+ if (nb->len != len) {
|
||||
+ if (nb->len)
|
||||
+ mem_free(nb->buf, nb->len);
|
||||
+ nb->buf = mem_alloc(len);
|
||||
+ if (nb->buf == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ nb->maxlen = nb->len = len;
|
||||
+ }
|
||||
+ memcpy(nb->buf, ptr, len);
|
||||
+ return nb;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
xprt_set_caller(SVCXPRT *xprt, struct finfo *fi)
|
||||
{
|
||||
+ const struct netbuf *caller = fi->caller_addr;
|
||||
u_int32_t *xidp;
|
||||
|
||||
- *(svc_getrpccaller(xprt)) = *(fi->caller_addr);
|
||||
+ __rpc_set_netbuf(svc_getrpccaller(xprt), caller->buf, caller->len);
|
||||
xidp = __rpcb_get_dg_xidp(xprt);
|
||||
*xidp = fi->caller_xid;
|
||||
}
|
||||
@@ -1274,10 +1279,17 @@ handle_reply(int fd, SVCXPRT *xprt)
|
||||
a.rmt_localvers = fi->versnum;
|
||||
|
||||
xprt_set_caller(xprt, fi);
|
||||
+#if defined(SVC_XP_AUTH)
|
||||
+ SVC_XP_AUTH(xprt) = svc_auth_none;
|
||||
+#else
|
||||
xprt->xp_auth = &svc_auth_none;
|
||||
+#endif
|
||||
svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (char *) &a);
|
||||
+#if !defined(SVC_XP_AUTH)
|
||||
SVCAUTH_DESTROY(xprt->xp_auth);
|
||||
xprt->xp_auth = NULL;
|
||||
+#endif
|
||||
+
|
||||
done:
|
||||
if (buffer)
|
||||
free(buffer);
|
||||
diff --git a/src/rpcbind.c b/src/rpcbind.c
|
||||
index 045daa1..c4265cd 100644
|
||||
--- a/src/rpcbind.c
|
||||
+++ b/src/rpcbind.c
|
||||
@@ -87,6 +87,7 @@ static inline void __nss_configure_lookup(const char *db, const char *s) {}
|
||||
int debugging = 0; /* Tell me what's going on */
|
||||
int doabort = 0; /* When debugging, do an abort on errors */
|
||||
int dofork = 1; /* fork? */
|
||||
+int createdsocket = 0; /* Did I create the socket or systemd did it for me? */
|
||||
|
||||
rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */
|
||||
|
||||
@@ -445,6 +446,7 @@ init_transport(struct netconfig *nconf)
|
||||
memset(&sun, 0, sizeof sun);
|
||||
sun.sun_family = AF_LOCAL;
|
||||
unlink(_PATH_RPCBINDSOCK);
|
||||
+ createdsocket = 1; /* We are now in the process of creating the unix socket */
|
||||
strcpy(sun.sun_path, _PATH_RPCBINDSOCK);
|
||||
addrlen = SUN_LEN(&sun);
|
||||
sa = (struct sockaddr *)&sun;
|
||||
@@ -846,7 +848,8 @@ static void
|
||||
terminate(int dummy /*__unused*/)
|
||||
{
|
||||
close(rpcbindlockfd);
|
||||
- unlink(_PATH_RPCBINDSOCK);
|
||||
+ if(createdsocket)
|
||||
+ unlink(_PATH_RPCBINDSOCK);
|
||||
unlink(RPCBINDDLOCK);
|
||||
#ifdef WARMSTART
|
||||
write_warmstart(); /* Dump yourself */
|
||||
diff --git a/src/security.c b/src/security.c
|
||||
index 0c9453f..c54ce26 100644
|
||||
--- a/src/security.c
|
||||
+++ b/src/security.c
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <syslog.h>
|
||||
#include <netdb.h>
|
||||
|
||||
+#include "xlog.h"
|
||||
+
|
||||
/*
|
||||
* XXX for special case checks in check_callit.
|
||||
*/
|
||||
61
rpcbind-0.2.4-runstatdir.patch
Normal file
61
rpcbind-0.2.4-runstatdir.patch
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
diff -up rpcbind-0.2.4/configure.ac.orig rpcbind-0.2.4/configure.ac
|
||||
--- rpcbind-0.2.4/configure.ac.orig 2017-01-03 13:51:48.426758826 -0500
|
||||
+++ rpcbind-0.2.4/configure.ac 2017-01-16 11:19:12.888958858 -0500
|
||||
@@ -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=/var/run/rpcbind@:>@])
|
||||
- ,, [with_statedir=/var/run/rpcbind])
|
||||
+ AS_HELP_STRING([--with-statedir=ARG], [use ARG as state dir @<:@default=/run/rpcbind@:>@])
|
||||
+ ,, [with_statedir=/run/rpcbind])
|
||||
AC_SUBST([statedir], [$with_statedir])
|
||||
|
||||
AC_ARG_WITH([rpcuser],
|
||||
diff -up rpcbind-0.2.4/configure.orig rpcbind-0.2.4/configure
|
||||
--- rpcbind-0.2.4/configure.orig 2017-01-03 13:51:50.222749413 -0500
|
||||
+++ rpcbind-0.2.4/configure 2017-01-16 11:20:29.650978018 -0500
|
||||
@@ -1389,7 +1389,7 @@ Optional Features:
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
||||
- --with-statedir=ARG use ARG as state dir [default=/var/run/rpcbind]
|
||||
+ --with-statedir=ARG use ARG as state dir [default=/run/rpcbind]
|
||||
|
||||
--with-rpcuser=ARG use ARG for RPC [default=root]
|
||||
|
||||
@@ -3887,7 +3887,7 @@ fi
|
||||
if test "${with_statedir+set}" = set; then :
|
||||
withval=$with_statedir;
|
||||
else
|
||||
- with_statedir=/var/run/rpcbind
|
||||
+ with_statedir=/run/rpcbind
|
||||
fi
|
||||
|
||||
statedir=$with_statedir
|
||||
diff -up rpcbind-0.2.4/man/rpcbind-fr.8.orig rpcbind-0.2.4/man/rpcbind-fr.8
|
||||
--- rpcbind-0.2.4/man/rpcbind-fr.8.orig 2016-11-28 15:47:28.000000000 -0500
|
||||
+++ rpcbind-0.2.4/man/rpcbind-fr.8 2017-01-16 11:19:12.888958858 -0500
|
||||
@@ -138,8 +138,8 @@ est redémarré.
|
||||
.Xr rpcbind 3 ,
|
||||
.Xr rpcinfo 8
|
||||
.Sh FILES
|
||||
-.Bl -tag -width /var/run/rpcbind.sock -compact
|
||||
-.It Pa /var/run/rpcbind.sock
|
||||
+.Bl -tag -width /run/rpcbind.sock -compact
|
||||
+.It Pa /run/rpcbind.sock
|
||||
.Sh TRADUCTION
|
||||
Aurelien CHARBON (Sept 2003)
|
||||
.El
|
||||
diff -up rpcbind-0.2.4/src/rpcbind.c.orig rpcbind-0.2.4/src/rpcbind.c
|
||||
--- rpcbind-0.2.4/src/rpcbind.c.orig 2016-11-28 15:47:28.000000000 -0500
|
||||
+++ rpcbind-0.2.4/src/rpcbind.c 2017-01-16 11:20:16.499974736 -0500
|
||||
@@ -106,7 +106,7 @@ char *nss_modules = "files";
|
||||
/* who to suid to if -s is given */
|
||||
#define RUN_AS "daemon"
|
||||
|
||||
-#define RPCBINDDLOCK "/var/run/rpcbind.lock"
|
||||
+#define RPCBINDDLOCK RPCBIND_STATEDIR "/rpcbind.lock"
|
||||
|
||||
int runasdaemon = 0;
|
||||
int insecure = 0;
|
||||
35
rpcbind-0.2.4-systemd-rundir.patch
Normal file
35
rpcbind-0.2.4-systemd-rundir.patch
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
diff -up rpcbind-0.2.4/src/rpcbind.c.orig rpcbind-0.2.4/src/rpcbind.c
|
||||
--- rpcbind-0.2.4/src/rpcbind.c.orig 2017-03-21 10:12:35.005190509 -0400
|
||||
+++ rpcbind-0.2.4/src/rpcbind.c 2017-03-21 10:36:45.510507649 -0400
|
||||
@@ -144,6 +144,8 @@ static void rbllist_add(rpcprog_t, rpcve
|
||||
static void terminate(int);
|
||||
static void parseargs(int, char *[]);
|
||||
|
||||
+char *systemdtmp = "/usr/bin/systemd-tmpfiles --create rpcbind.conf";
|
||||
+
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -151,13 +153,21 @@ main(int argc, char *argv[])
|
||||
void *nc_handle; /* Net config handle */
|
||||
struct rlimit rl;
|
||||
int maxrec = RPC_MAXDATASIZE;
|
||||
+ int once = 1;
|
||||
|
||||
parseargs(argc, argv);
|
||||
|
||||
+tryagain:
|
||||
/* Check that another rpcbind isn't already running. */
|
||||
if ((rpcbindlockfd = (open(RPCBINDDLOCK,
|
||||
- O_RDONLY|O_CREAT, 0444))) == -1)
|
||||
+ O_RDONLY|O_CREAT, 0444))) == -1) {
|
||||
+ if (once) {
|
||||
+ once = system(systemdtmp); /* set once to avoid a warning */
|
||||
+ once = 0;
|
||||
+ goto tryagain;
|
||||
+ }
|
||||
err(1, "%s", RPCBINDDLOCK);
|
||||
+ }
|
||||
|
||||
if(flock(rpcbindlockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
|
||||
errx(1, "another rpcbind is already running. Aborting");
|
||||
14
rpcbind-0.2.4-systemd-service.patch
Normal file
14
rpcbind-0.2.4-systemd-service.patch
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
diff -up rpcbind-0.2.4/systemd/rpcbind.service.in.orig rpcbind-0.2.4/systemd/rpcbind.service.in
|
||||
--- rpcbind-0.2.4/systemd/rpcbind.service.in.orig 2017-01-28 11:47:59.505282030 -0500
|
||||
+++ rpcbind-0.2.4/systemd/rpcbind.service.in 2017-01-28 13:13:43.763324301 -0500
|
||||
@@ -6,8 +6,8 @@ RequiresMountsFor=@statedir@
|
||||
|
||||
# Make sure we use the IP addresses listed for
|
||||
# rpcbind.socket, no matter how this unit is started.
|
||||
-Wants=rpcbind.socket
|
||||
-After=rpcbind.socket
|
||||
+Wants=rpcbind.socket systemd-tmpfiles-setup.service
|
||||
+After=rpcbind.socket systemd-tmpfiles-setup.service
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
185
rpcbind-0.2.5-rc1.patch
Normal file
185
rpcbind-0.2.5-rc1.patch
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
diff --git a/src/pmap_svc.c b/src/pmap_svc.c
|
||||
index 4c744fe..e926cdc 100644
|
||||
--- a/src/pmap_svc.c
|
||||
+++ b/src/pmap_svc.c
|
||||
@@ -175,6 +175,7 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
|
||||
long ans;
|
||||
uid_t uid;
|
||||
char uidbuf[32];
|
||||
+ int rc = TRUE;
|
||||
|
||||
/*
|
||||
* Can't use getpwnam here. We might end up calling ourselves
|
||||
@@ -194,7 +195,8 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
|
||||
|
||||
if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
|
||||
svcerr_decode(xprt);
|
||||
- return (FALSE);
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
#ifdef RPCBIND_DEBUG
|
||||
if (debugging)
|
||||
@@ -205,7 +207,8 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
|
||||
|
||||
if (!check_access(xprt, op, reg.pm_prog, PMAPVERS)) {
|
||||
svcerr_weakauth(xprt);
|
||||
- return (FALSE);
|
||||
+ rc = (FALSE);
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
rpcbreg.r_prog = reg.pm_prog;
|
||||
@@ -258,7 +261,16 @@ done_change:
|
||||
rpcbs_set(RPCBVERS_2_STAT, ans);
|
||||
else
|
||||
rpcbs_unset(RPCBVERS_2_STAT, ans);
|
||||
- return (TRUE);
|
||||
+done:
|
||||
+ if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
|
||||
+ if (debugging) {
|
||||
+ (void) xlog(LOG_DEBUG, "unable to free arguments\n");
|
||||
+ if (doabort) {
|
||||
+ rpcbind_abort();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return (rc);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
@@ -272,15 +284,18 @@ pmapproc_getport(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
|
||||
#ifdef RPCBIND_DEBUG
|
||||
char *uaddr;
|
||||
#endif
|
||||
+ int rc = TRUE;
|
||||
|
||||
if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
|
||||
svcerr_decode(xprt);
|
||||
- return (FALSE);
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (!check_access(xprt, PMAPPROC_GETPORT, reg.pm_prog, PMAPVERS)) {
|
||||
svcerr_weakauth(xprt);
|
||||
- return FALSE;
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
#ifdef RPCBIND_DEBUG
|
||||
@@ -330,21 +345,34 @@ pmapproc_getport(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
|
||||
pmap_ipprot2netid(reg.pm_prot) ?: "<unknown>",
|
||||
port ? udptrans : "");
|
||||
|
||||
- return (TRUE);
|
||||
+done:
|
||||
+ if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
|
||||
+ if (debugging) {
|
||||
+ (void) xlog(LOG_DEBUG, "unable to free arguments\n");
|
||||
+ if (doabort) {
|
||||
+ rpcbind_abort();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return (rc);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static bool_t
|
||||
pmapproc_dump(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
|
||||
{
|
||||
+ int rc = TRUE;
|
||||
+
|
||||
if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL)) {
|
||||
svcerr_decode(xprt);
|
||||
- return (FALSE);
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (!check_access(xprt, PMAPPROC_DUMP, 0, PMAPVERS)) {
|
||||
svcerr_weakauth(xprt);
|
||||
- return FALSE;
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist_ptr,
|
||||
@@ -354,7 +382,17 @@ pmapproc_dump(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
|
||||
rpcbind_abort();
|
||||
}
|
||||
}
|
||||
- return (TRUE);
|
||||
+
|
||||
+done:
|
||||
+ if (!svc_freeargs(xprt, (xdrproc_t) xdr_void, (char *)NULL)) {
|
||||
+ if (debugging) {
|
||||
+ (void) xlog(LOG_DEBUG, "unable to free arguments\n");
|
||||
+ if (doabort) {
|
||||
+ rpcbind_abort();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return (rc);
|
||||
}
|
||||
|
||||
int pmap_netid2ipprot(const char *netid)
|
||||
diff --git a/src/rpcb_svc.c b/src/rpcb_svc.c
|
||||
index 709e3fb..091f530 100644
|
||||
--- a/src/rpcb_svc.c
|
||||
+++ b/src/rpcb_svc.c
|
||||
@@ -166,7 +166,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp)
|
||||
svcerr_decode(transp);
|
||||
if (debugging)
|
||||
(void) xlog(LOG_DEBUG, "rpcbind: could not decode");
|
||||
- return;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (rqstp->rq_proc == RPCBPROC_SET
|
||||
diff --git a/src/rpcb_svc_4.c b/src/rpcb_svc_4.c
|
||||
index 5094879..eebbbbe 100644
|
||||
--- a/src/rpcb_svc_4.c
|
||||
+++ b/src/rpcb_svc_4.c
|
||||
@@ -218,7 +218,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp)
|
||||
svcerr_decode(transp);
|
||||
if (debugging)
|
||||
(void) xlog(LOG_DEBUG, "rpcbind: could not decode\n");
|
||||
- return;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (rqstp->rq_proc == RPCBPROC_SET
|
||||
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
|
||||
index 5862c26..cb63afd 100644
|
||||
--- a/src/rpcb_svc_com.c
|
||||
+++ b/src/rpcb_svc_com.c
|
||||
@@ -927,6 +927,14 @@ error:
|
||||
if (call_msg.rm_xid != 0)
|
||||
(void) free_slot_by_xid(call_msg.rm_xid);
|
||||
out:
|
||||
+ if (!svc_freeargs(transp, (xdrproc_t) xdr_rmtcall_args, (char *) &a)) {
|
||||
+ if (debugging) {
|
||||
+ (void) xlog(LOG_DEBUG, "unable to free arguments\n");
|
||||
+ if (doabort) {
|
||||
+ rpcbind_abort();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
if (local_uaddr)
|
||||
free(local_uaddr);
|
||||
if (buf_alloc)
|
||||
diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in
|
||||
index e7e86da..03a9e0b 100644
|
||||
--- a/systemd/rpcbind.service.in
|
||||
+++ b/systemd/rpcbind.service.in
|
||||
@@ -2,6 +2,7 @@
|
||||
Description=RPC Bind
|
||||
Documentation=man:rpcbind(8)
|
||||
DefaultDependencies=no
|
||||
+RequiresMountsFor=@statedir@
|
||||
|
||||
# Make sure we use the IP addresses listed for
|
||||
# rpcbind.socket, no matter how this unit is started.
|
||||
310
rpcbind-0.2.5-rc2.patch
Normal file
310
rpcbind-0.2.5-rc2.patch
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
diff --git a/src/pmap_svc.c b/src/pmap_svc.c
|
||||
index 4c744fe..a53dd5f 100644
|
||||
--- a/src/pmap_svc.c
|
||||
+++ b/src/pmap_svc.c
|
||||
@@ -175,6 +175,7 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
|
||||
long ans;
|
||||
uid_t uid;
|
||||
char uidbuf[32];
|
||||
+ int rc = TRUE;
|
||||
|
||||
/*
|
||||
* Can't use getpwnam here. We might end up calling ourselves
|
||||
@@ -194,7 +195,8 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
|
||||
|
||||
if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
|
||||
svcerr_decode(xprt);
|
||||
- return (FALSE);
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
#ifdef RPCBIND_DEBUG
|
||||
if (debugging)
|
||||
@@ -205,7 +207,8 @@ pmapproc_change(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt, unsigned long
|
||||
|
||||
if (!check_access(xprt, op, reg.pm_prog, PMAPVERS)) {
|
||||
svcerr_weakauth(xprt);
|
||||
- return (FALSE);
|
||||
+ rc = (FALSE);
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
rpcbreg.r_prog = reg.pm_prog;
|
||||
@@ -258,7 +261,18 @@ done_change:
|
||||
rpcbs_set(RPCBVERS_2_STAT, ans);
|
||||
else
|
||||
rpcbs_unset(RPCBVERS_2_STAT, ans);
|
||||
- return (TRUE);
|
||||
+done:
|
||||
+ if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
|
||||
+#ifdef RPCBIND_DEBUG
|
||||
+ if (debugging) {
|
||||
+ (void) xlog(LOG_DEBUG, "unable to free arguments\n");
|
||||
+ if (doabort) {
|
||||
+ rpcbind_abort();
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+ }
|
||||
+ return (rc);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
@@ -272,15 +286,18 @@ pmapproc_getport(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
|
||||
#ifdef RPCBIND_DEBUG
|
||||
char *uaddr;
|
||||
#endif
|
||||
+ int rc = TRUE;
|
||||
|
||||
if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
|
||||
svcerr_decode(xprt);
|
||||
- return (FALSE);
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (!check_access(xprt, PMAPPROC_GETPORT, reg.pm_prog, PMAPVERS)) {
|
||||
svcerr_weakauth(xprt);
|
||||
- return FALSE;
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
#ifdef RPCBIND_DEBUG
|
||||
@@ -330,21 +347,36 @@ pmapproc_getport(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
|
||||
pmap_ipprot2netid(reg.pm_prot) ?: "<unknown>",
|
||||
port ? udptrans : "");
|
||||
|
||||
- return (TRUE);
|
||||
+done:
|
||||
+ if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) {
|
||||
+#ifdef RPCBIND_DEBUG
|
||||
+ if (debugging) {
|
||||
+ (void) xlog(LOG_DEBUG, "unable to free arguments\n");
|
||||
+ if (doabort) {
|
||||
+ rpcbind_abort();
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+ }
|
||||
+ return (rc);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static bool_t
|
||||
pmapproc_dump(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
|
||||
{
|
||||
+ int rc = TRUE;
|
||||
+
|
||||
if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL)) {
|
||||
svcerr_decode(xprt);
|
||||
- return (FALSE);
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (!check_access(xprt, PMAPPROC_DUMP, 0, PMAPVERS)) {
|
||||
svcerr_weakauth(xprt);
|
||||
- return FALSE;
|
||||
+ rc = FALSE;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist_ptr,
|
||||
@@ -354,7 +386,19 @@ pmapproc_dump(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
|
||||
rpcbind_abort();
|
||||
}
|
||||
}
|
||||
- return (TRUE);
|
||||
+
|
||||
+done:
|
||||
+ if (!svc_freeargs(xprt, (xdrproc_t) xdr_void, (char *)NULL)) {
|
||||
+#ifdef RPCBIND_DEBUG
|
||||
+ if (debugging) {
|
||||
+ (void) xlog(LOG_DEBUG, "unable to free arguments\n");
|
||||
+ if (doabort) {
|
||||
+ rpcbind_abort();
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+ }
|
||||
+ return (rc);
|
||||
}
|
||||
|
||||
int pmap_netid2ipprot(const char *netid)
|
||||
diff --git a/src/rpcb_svc.c b/src/rpcb_svc.c
|
||||
index 709e3fb..091f530 100644
|
||||
--- a/src/rpcb_svc.c
|
||||
+++ b/src/rpcb_svc.c
|
||||
@@ -166,7 +166,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp)
|
||||
svcerr_decode(transp);
|
||||
if (debugging)
|
||||
(void) xlog(LOG_DEBUG, "rpcbind: could not decode");
|
||||
- return;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (rqstp->rq_proc == RPCBPROC_SET
|
||||
diff --git a/src/rpcb_svc_4.c b/src/rpcb_svc_4.c
|
||||
index 5094879..eebbbbe 100644
|
||||
--- a/src/rpcb_svc_4.c
|
||||
+++ b/src/rpcb_svc_4.c
|
||||
@@ -218,7 +218,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp)
|
||||
svcerr_decode(transp);
|
||||
if (debugging)
|
||||
(void) xlog(LOG_DEBUG, "rpcbind: could not decode\n");
|
||||
- return;
|
||||
+ goto done;
|
||||
}
|
||||
|
||||
if (rqstp->rq_proc == RPCBPROC_SET
|
||||
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
|
||||
index 5862c26..d36b090 100644
|
||||
--- a/src/rpcb_svc_com.c
|
||||
+++ b/src/rpcb_svc_com.c
|
||||
@@ -612,9 +612,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
||||
struct netconfig *nconf;
|
||||
struct netbuf *caller;
|
||||
struct r_rmtcall_args a;
|
||||
- char *buf_alloc = NULL, *outbufp;
|
||||
- char *outbuf_alloc = NULL;
|
||||
- char buf[RPC_BUF_MAX], outbuf[RPC_BUF_MAX];
|
||||
+ char outbuf[RPC_BUF_MAX];
|
||||
struct netbuf *na = (struct netbuf *) NULL;
|
||||
struct rpc_msg call_msg;
|
||||
int outlen;
|
||||
@@ -635,36 +633,10 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
||||
}
|
||||
if (si.si_socktype != SOCK_DGRAM)
|
||||
return; /* Only datagram type accepted */
|
||||
- sendsz = __rpc_get_t_size(si.si_af, si.si_proto, UDPMSGSIZE);
|
||||
- if (sendsz == 0) { /* data transfer not supported */
|
||||
- if (reply_type == RPCBPROC_INDIRECT)
|
||||
- svcerr_systemerr(transp);
|
||||
- return;
|
||||
- }
|
||||
- /*
|
||||
- * Should be multiple of 4 for XDR.
|
||||
- */
|
||||
- sendsz = ((sendsz + 3) / 4) * 4;
|
||||
- if (sendsz > RPC_BUF_MAX) {
|
||||
-#ifdef notyet
|
||||
- buf_alloc = alloca(sendsz); /* not in IDR2? */
|
||||
-#else
|
||||
- buf_alloc = malloc(sendsz);
|
||||
-#endif /* notyet */
|
||||
- if (buf_alloc == NULL) {
|
||||
- if (debugging)
|
||||
- xlog(LOG_DEBUG,
|
||||
- "rpcbproc_callit_com: No Memory!\n");
|
||||
- if (reply_type == RPCBPROC_INDIRECT)
|
||||
- svcerr_systemerr(transp);
|
||||
- return;
|
||||
- }
|
||||
- a.rmt_args.args = buf_alloc;
|
||||
- } else {
|
||||
- a.rmt_args.args = buf;
|
||||
- }
|
||||
+ sendsz = UDPMSGSIZE;
|
||||
|
||||
call_msg.rm_xid = 0; /* For error checking purposes */
|
||||
+ memset(&a, 0, sizeof(a)); /* Zero out the input buffer */
|
||||
if (!svc_getargs(transp, (xdrproc_t) xdr_rmtcall_args, (char *) &a)) {
|
||||
if (reply_type == RPCBPROC_INDIRECT)
|
||||
svcerr_decode(transp);
|
||||
@@ -700,11 +672,11 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
||||
|
||||
rpcbs_rmtcall(versnum - 2, reply_type, a.rmt_prog, a.rmt_vers,
|
||||
a.rmt_proc, transp->xp_netid, rbl);
|
||||
-
|
||||
if (rbl == (rpcblist_ptr)NULL) {
|
||||
#ifdef RPCBIND_DEBUG
|
||||
if (debugging)
|
||||
- xlog(LOG_DEBUG, "not found\n");
|
||||
+ xlog(LOG_DEBUG, "prog %lu vers %lu: not found\n",
|
||||
+ a.rmt_prog, a.rmt_vers);
|
||||
#endif
|
||||
if (reply_type == RPCBPROC_INDIRECT)
|
||||
svcerr_noprog(transp);
|
||||
@@ -818,24 +790,10 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
||||
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
|
||||
call_msg.rm_call.cb_prog = a.rmt_prog;
|
||||
call_msg.rm_call.cb_vers = a.rmt_vers;
|
||||
- if (sendsz > RPC_BUF_MAX) {
|
||||
-#ifdef notyet
|
||||
- outbuf_alloc = alloca(sendsz); /* not in IDR2? */
|
||||
-#else
|
||||
- outbuf_alloc = malloc(sendsz);
|
||||
-#endif /* notyet */
|
||||
- if (outbuf_alloc == NULL) {
|
||||
- if (reply_type == RPCBPROC_INDIRECT)
|
||||
- svcerr_systemerr(transp);
|
||||
- if (debugging)
|
||||
- xlog(LOG_DEBUG,
|
||||
- "rpcbproc_callit_com: No memory!\n");
|
||||
- goto error;
|
||||
- }
|
||||
- xdrmem_create(&outxdr, outbuf_alloc, sendsz, XDR_ENCODE);
|
||||
- } else {
|
||||
- xdrmem_create(&outxdr, outbuf, sendsz, XDR_ENCODE);
|
||||
- }
|
||||
+
|
||||
+ memset(outbuf, '\0', sendsz); /* Zero out the output buffer */
|
||||
+ xdrmem_create(&outxdr, outbuf, sendsz, XDR_ENCODE);
|
||||
+
|
||||
if (!xdr_callhdr(&outxdr, &call_msg)) {
|
||||
if (reply_type == RPCBPROC_INDIRECT)
|
||||
svcerr_systemerr(transp);
|
||||
@@ -900,10 +858,6 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
||||
goto error;
|
||||
}
|
||||
outlen = (int) XDR_GETPOS(&outxdr);
|
||||
- if (outbuf_alloc)
|
||||
- outbufp = outbuf_alloc;
|
||||
- else
|
||||
- outbufp = outbuf;
|
||||
|
||||
na = uaddr2taddr(nconf, local_uaddr);
|
||||
if (!na) {
|
||||
@@ -912,7 +866,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (sendto(fd, outbufp, outlen, 0, (struct sockaddr *)na->buf, na->len)
|
||||
+ if (sendto(fd, outbuf, outlen, 0, (struct sockaddr *)na->buf, na->len)
|
||||
!= outlen) {
|
||||
if (debugging)
|
||||
xlog(LOG_DEBUG,
|
||||
@@ -927,12 +881,16 @@ error:
|
||||
if (call_msg.rm_xid != 0)
|
||||
(void) free_slot_by_xid(call_msg.rm_xid);
|
||||
out:
|
||||
+ if (!svc_freeargs(transp, (xdrproc_t) xdr_rmtcall_args, (char *) &a)) {
|
||||
+ if (debugging) {
|
||||
+ (void) xlog(LOG_DEBUG, "unable to free arguments\n");
|
||||
+ if (doabort) {
|
||||
+ rpcbind_abort();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
if (local_uaddr)
|
||||
free(local_uaddr);
|
||||
- if (buf_alloc)
|
||||
- free(buf_alloc);
|
||||
- if (outbuf_alloc)
|
||||
- free(outbuf_alloc);
|
||||
if (na) {
|
||||
free(na->buf);
|
||||
free(na);
|
||||
diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in
|
||||
index e7e86da..03a9e0b 100644
|
||||
--- a/systemd/rpcbind.service.in
|
||||
+++ b/systemd/rpcbind.service.in
|
||||
@@ -2,6 +2,7 @@
|
||||
Description=RPC Bind
|
||||
Documentation=man:rpcbind(8)
|
||||
DefaultDependencies=no
|
||||
+RequiresMountsFor=@statedir@
|
||||
|
||||
# Make sure we use the IP addresses listed for
|
||||
# rpcbind.socket, no matter how this unit is started.
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
[Unit]
|
||||
Description=RPC bind service
|
||||
Requires=rpcbind.socket
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
EnvironmentFile=/etc/sysconfig/rpcbind
|
||||
ExecStart=/sbin/rpcbind -w ${RPCBIND_ARGS}
|
||||
|
||||
[Install]
|
||||
Also=rpcbind.socket
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[Unit]
|
||||
Description=RPCbind Server Activation Socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=/var/run/rpcbind.sock
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
111
rpcbind.spec
111
rpcbind.spec
|
|
@ -1,6 +1,10 @@
|
|||
# These are macros to be usable outside of the build section
|
||||
%global rpcbind_user_group rpc
|
||||
%global rpcbind_state_dir %{_rundir}/rpcbind
|
||||
|
||||
Name: rpcbind
|
||||
Version: 0.2.3
|
||||
Release: 10.rc1%{?dist}
|
||||
Version: 0.2.4
|
||||
Release: 7.rc2%{?dist}
|
||||
Summary: Universal Addresses to RPC Program Number Mapper
|
||||
Group: System Environment/Daemons
|
||||
License: BSD
|
||||
|
|
@ -8,9 +12,7 @@ URL: http://nfsv4.bullopensource.org
|
|||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
|
||||
Source0: http://downloads.sourceforge.net/rpcbind/%{name}-%{version}.tar.bz2
|
||||
Source1: rpcbind.service
|
||||
Source2: rpcbind.socket
|
||||
Source3: rpcbind.sysconfig
|
||||
Source1: %{name}.sysconfig
|
||||
|
||||
Requires: glibc-common setup
|
||||
Conflicts: man-pages < 2.43-12
|
||||
|
|
@ -21,7 +23,13 @@ Requires(post): chkconfig systemd
|
|||
Requires(preun): systemd
|
||||
Requires(postun): systemd coreutils
|
||||
|
||||
Patch001: rpcbind-0.2.4-rc1.patch
|
||||
Patch001: rpcbind-0.2.5-rc2.patch
|
||||
|
||||
Patch100: rpcbind-0.2.3-systemd-envfile.patch
|
||||
Patch101: rpcbind-0.2.3-systemd-tmpfiles.patch
|
||||
Patch102: rpcbind-0.2.4-runstatdir.patch
|
||||
Patch103: rpcbind-0.2.4-systemd-service.patch
|
||||
Patch104: rpcbind-0.2.4-systemd-rundir.patch
|
||||
|
||||
Provides: portmap = %{version}-%{release}
|
||||
Obsoletes: portmap <= 4.0-65.3
|
||||
|
|
@ -34,8 +42,14 @@ RPC calls on a server on that machine.
|
|||
%prep
|
||||
%setup -q
|
||||
|
||||
# 1401561 - rpcbind-0.2.3-12.rc2.fc24 fails to start at boot
|
||||
%patch001 -p1
|
||||
|
||||
%patch100 -p1
|
||||
%patch101 -p1
|
||||
%patch102 -p1
|
||||
%patch103 -p1
|
||||
%patch104 -p1
|
||||
%build
|
||||
%ifarch s390 s390x
|
||||
PIE="-fPIE"
|
||||
|
|
@ -44,15 +58,13 @@ PIE="-fpie"
|
|||
%endif
|
||||
export PIE
|
||||
|
||||
RPCBUSR=rpc
|
||||
RPCBDIR=/tmp
|
||||
CFLAGS="`echo $RPM_OPT_FLAGS $ARCH_OPT_FLAGS $PIE`"
|
||||
|
||||
autoreconf -fisv
|
||||
%configure CFLAGS="$CFLAGS" LDFLAGS="-pie" \
|
||||
--enable-warmstarts \
|
||||
--with-statedir="$RPCBDIR" \
|
||||
--with-rpcuser="$RPCBUSR" \
|
||||
--with-statedir="%rpcbind_state_dir" \
|
||||
--with-rpcuser="%rpcbind_user_group" \
|
||||
--with-nss-modules="files altfiles" \
|
||||
--enable-libwrap \
|
||||
--enable-debug
|
||||
|
|
@ -61,16 +73,21 @@ make all
|
|||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}{/sbin,/usr/sbin,/etc/sysconfig}
|
||||
mkdir -p %{buildroot}{%{_sbindir},%{_bindir},/etc/sysconfig}
|
||||
mkdir -p %{buildroot}%{_unitdir}
|
||||
mkdir -p %{buildroot}%{_tmpfilesdir}
|
||||
mkdir -p %{buildroot}%{_mandir}/man8
|
||||
mkdir -p %{buildroot}%{rpcbind_state_dir}
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
mv -f ${RPM_BUILD_ROOT}%{_bindir}/rpcbind ${RPM_BUILD_ROOT}/sbin
|
||||
mv -f ${RPM_BUILD_ROOT}%{_bindir}/rpcinfo ${RPM_BUILD_ROOT}%{_sbindir}
|
||||
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
|
||||
install -m644 %{SOURCE2} %{buildroot}%{_unitdir}
|
||||
install -m644 %{SOURCE3} %{buildroot}/etc/sysconfig/rpcbind
|
||||
install -m644 %{SOURCE1} %{buildroot}/etc/sysconfig/rpcbind
|
||||
|
||||
# The binaries now live in /usr/bin, moving from /usr/sbin
|
||||
# For compatibility create a couple symlinks.
|
||||
cd ${RPM_BUILD_ROOT}%{_sbindir}
|
||||
ln -sf ../bin/rpcbind
|
||||
ln -sf ../bin/rpcinfo
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
|
@ -90,7 +107,7 @@ if ! getent passwd rpc >/dev/null ; then
|
|||
fi
|
||||
|
||||
%post
|
||||
/bin/systemctl enable rpcbind.socket >/dev/null 2>&1 || :
|
||||
%systemd_post rpcbind.service rpcbind.socket
|
||||
|
||||
%preun
|
||||
%systemd_preun rpcbind.service rpcbind.socket
|
||||
|
|
@ -105,20 +122,70 @@ fi
|
|||
/bin/systemctl try-restart rpcbind.service >/dev/null 2>&1 || :
|
||||
|
||||
%triggerin -- rpcbind > 0.2.2-2.0
|
||||
/bin/systemctl enable rpcbind.socket >/dev/null 2>&1 || :
|
||||
/bin/systemctl restart rpcbind.socket >/dev/null 2>&1 || :
|
||||
if systemctl -q is-enabled rpcbind.socket
|
||||
then
|
||||
/bin/systemctl reenable rpcbind.socket >/dev/null 2>&1 || :
|
||||
/bin/systemctl restart rpcbind.socket >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%config(noreplace) /etc/sysconfig/rpcbind
|
||||
%doc AUTHORS ChangeLog README
|
||||
/sbin/rpcbind
|
||||
%{_bindir}/rpcbind
|
||||
%{_bindir}/rpcinfo
|
||||
%{_sbindir}/rpcbind
|
||||
%{_sbindir}/rpcinfo
|
||||
%{_mandir}/man8/*
|
||||
%{_unitdir}/rpcbind.service
|
||||
%{_unitdir}/rpcbind.socket
|
||||
%{_unitdir}/%{name}.service
|
||||
%{_unitdir}/%{name}.socket
|
||||
%{_tmpfilesdir}/%{name}.conf
|
||||
%attr(0700, %{rpcbind_user_group}, %{rpcbind_user_group}) %dir %{rpcbind_state_dir}
|
||||
|
||||
%changelog
|
||||
* Wed Sep 06 2017 Nils Philippsen <nils@redhat.com> - 0.2.4-7.rc2
|
||||
- create and formally own the state directory so it is available from the time
|
||||
of first installation until reboot
|
||||
|
||||
* Mon May 15 2017 Steve Dickson <steved@redhat.com> - 0.2.4-6.rc2
|
||||
- Updated to latest upstream RC release: rpcbind-0_2_5-rc2 (bz 1450765)
|
||||
|
||||
- Fixed typo in memory leaks patch (bz 1448128)
|
||||
|
||||
* Thu May 11 2017 Steve Dickson <steved@redhat.com> - 0.2.4-5.rc1
|
||||
- Fixed memory leaks (bz 1448128)
|
||||
|
||||
* Tue Mar 21 2017 Steve Dickson <steved@redhat.com> - 0.2.4-5
|
||||
- Try creating statdir once when opening lock file fails (bz 1401561)
|
||||
|
||||
* Sat Jan 28 2017 Steve Dickson <steved@redhat.com> - 0.2.4-4
|
||||
- Corrected boot dependency in systemd files (bz 1401561)
|
||||
|
||||
* Mon Jan 23 2017 Steve Dickson <steved@redhat.com> - 0.2.4-3
|
||||
- Create a systemd dependency for tmpfiles-setup.service (bz 1401561)
|
||||
|
||||
* Mon Jan 16 2017 Steve Dickson <steved@redhat.com> - 0.2.4-2
|
||||
- Document /run/rpcbind is the state directory (bz 1401561)
|
||||
|
||||
* Tue Jan 3 2017 Steve Dickson <steved@redhat.com> - 0.2.4-1
|
||||
- Fix boot dependency in systemd service file (bz 1401561)
|
||||
|
||||
* Wed Nov 30 2016 Steve Dickson <steved@redhat.com> - 0.2.4-0
|
||||
- Update to the latest upstream release: 0.2.4
|
||||
|
||||
* Sat Nov 19 2016 Steve Dickson <steved@redhat.com> - 0.2.3-13.rc2
|
||||
- Create the statedir under /run/rpcbind by systemd-tmpfiles.
|
||||
|
||||
* Sat Nov 12 2016 Steve Dickson <steved@redhat.com> - 0.2.3-12.rc2
|
||||
- Stop enable rpcbind.socket with every update (bz 1393721)
|
||||
|
||||
* Mon Nov 7 2016 Steve Dickson <steved@redhat.com> - 0.2.3-11.rc2
|
||||
- Updated to the latest RC release rpcbind-0_2_4-rc1
|
||||
|
||||
* Mon Aug 1 2016 Steve Dickson <steved@redhat.com> - 0.2.3-11.rc1
|
||||
- Removing the braces from the ${RPCBIND_ARGS} in rpcbind.service (bz 1362201)
|
||||
- Stop enable rpcbind.socket with every update (bz 1324666)
|
||||
|
||||
* Mon Apr 4 2016 Steve Dickson <steved@redhat.com> - 0.2.3-10.rc1
|
||||
- Restart rpcbind.socket on restarts (bz 1306824)
|
||||
- Soft static allocate rpc uid/gid (bz 1301288)
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
c8875246b2688a1adfbd6ad43480278d rpcbind-0.2.3.tar.bz2
|
||||
cf10cd41ed8228fc54c316191c1f07fe rpcbind-0.2.4.tar.bz2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue