Accepting request 593305 from network
OBS-URL: https://build.opensuse.org/request/show/593305 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpcbind?expand=0&rev=56
This commit is contained in:
commit
4c612e23ed
@ -1,65 +1,14 @@
|
|||||||
Add systemd unit files
|
Add EnvironmentFile=-/etc/sysconfig/rpcbind to rpcbind.service
|
||||||
|
|
||||||
Signed-off-by: Thorsten Kukuk <kukuk@suse.de>
|
Index: rpcbind-0.2.4/systemd/rpcbind.service.in
|
||||||
|
===================================================================
|
||||||
--- a/Makefile.am
|
--- rpcbind-0.2.4.orig/systemd/rpcbind.service.in
|
||||||
+++ b/Makefile.am 2014/12/10 13:27:31
|
+++ rpcbind-0.2.4/systemd/rpcbind.service.in
|
||||||
@@ -45,6 +45,14 @@
|
@@ -11,6 +11,7 @@ After=rpcbind.socket
|
||||||
AM_CPPFLAGS += $(SYSTEMD_CFLAGS) -DSYSTEMD
|
[Service]
|
||||||
|
Type=notify
|
||||||
rpcbind_LDADD += $(SYSTEMD_LIBS)
|
# distro can provide a drop-in adding EnvironmentFile=-/??? if needed.
|
||||||
+
|
|
||||||
+systemd/rpcbind.service: systemd/rpcbind.service.in Makefile
|
|
||||||
+ sed -e 's,@bindir\@,$(bindir),g' \
|
|
||||||
+ < $< > $@ || rm $@
|
|
||||||
+
|
|
||||||
+systemdsystemunit_DATA = \
|
|
||||||
+ systemd/rpcbind.service \
|
|
||||||
+ systemd/rpcbind.socket
|
|
||||||
endif
|
|
||||||
|
|
||||||
rpcinfo_SOURCES = src/rpcinfo.c
|
|
||||||
--- a/systemd/.gitignore
|
|
||||||
+++ b/systemd/.gitignore 2014/12/10 13:27:31
|
|
||||||
@@ -0,0 +1 @@
|
|
||||||
+rpcbind.service
|
|
||||||
--- a/systemd/rpcbind.service.in
|
|
||||||
+++ b/systemd/rpcbind.service.in 2014/12/10 13:27:31
|
|
||||||
@@ -0,0 +1,16 @@
|
|
||||||
+[Unit]
|
|
||||||
+Description=RPC Bind
|
|
||||||
+Documentation=man:rpcbind(8)
|
|
||||||
+DefaultDependencies=no
|
|
||||||
+Requires=rpcbind.socket
|
|
||||||
+Wants=var-run.mount
|
|
||||||
+After=var-run.mount
|
|
||||||
+
|
|
||||||
+[Service]
|
|
||||||
+Type=notify
|
|
||||||
+EnvironmentFile=-/etc/sysconfig/rpcbind
|
+EnvironmentFile=-/etc/sysconfig/rpcbind
|
||||||
+ExecStart=@bindir@/rpcbind $RPCBIND_OPTIONS -w -f
|
ExecStart=@_bindir@/rpcbind $RPCBIND_OPTIONS -w -f
|
||||||
+
|
|
||||||
+[Install]
|
[Install]
|
||||||
+WantedBy=multi-user.target
|
|
||||||
+Also=rpcbind.socket
|
|
||||||
--- a/systemd/rpcbind.socket
|
|
||||||
+++ b/systemd/rpcbind.socket 2014/12/10 13:27:58
|
|
||||||
@@ -0,0 +1,18 @@
|
|
||||||
+[Unit]
|
|
||||||
+Description=RPCbind Server Activation Socket
|
|
||||||
+DefaultDependencies=no
|
|
||||||
+Wants=rpcbind.target
|
|
||||||
+Before=rpcbind.target
|
|
||||||
+
|
|
||||||
+[Socket]
|
|
||||||
+ListenStream=/run/rpcbind.sock
|
|
||||||
+
|
|
||||||
+# RPC netconfig can't handle ipv6/ipv4 dual sockets
|
|
||||||
+BindIPv6Only=ipv6-only
|
|
||||||
+ListenStream=0.0.0.0:111
|
|
||||||
+ListenDatagram=0.0.0.0:111
|
|
||||||
+ListenStream=[::]:111
|
|
||||||
+ListenDatagram=[::]:111
|
|
||||||
+
|
|
||||||
+[Install]
|
|
||||||
+WantedBy=sockets.target
|
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
From 9194122389f2a56b1cd1f935e64307e2e963c2da Mon Sep 17 00:00:00 2001
|
|
||||||
From: Steve Dickson <steved@redhat.com>
|
|
||||||
Date: Mon, 2 Nov 2015 17:05:18 -0500
|
|
||||||
Subject: [PATCH 3/4] handle_reply: Don't use the xp_auth pointer directly
|
|
||||||
|
|
||||||
In the latest libtirpc version to access the xp_auth
|
|
||||||
one must use the SVC_XP_AUTH macro. To be backwards
|
|
||||||
compatible a couple ifdefs were added to use the
|
|
||||||
macro when it exists.
|
|
||||||
|
|
||||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
||||||
---
|
|
||||||
src/rpcb_svc_com.c | 7 +++++++
|
|
||||||
1 file changed, 7 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
|
|
||||||
index 4ae93f1..22d6c84 100644
|
|
||||||
--- a/src/rpcb_svc_com.c
|
|
||||||
+++ b/src/rpcb_svc_com.c
|
|
||||||
@@ -1295,10 +1295,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);
|
|
||||||
--
|
|
||||||
1.8.5.6
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
From 3a664b1b5a310df39bd0f325b0edb1deb31c2249 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Laurent Bigonville <bigon@bigon.be>
|
|
||||||
Date: Wed, 18 Nov 2015 14:34:26 -0500
|
|
||||||
Subject: [PATCH] Delete the unix socket only if we have created it
|
|
||||||
|
|
||||||
From: Laurent Bigonville <bigon@bigon.be>
|
|
||||||
|
|
||||||
If systemd has created the unix socket on our behalf, we shouldn't try
|
|
||||||
to delete it.
|
|
||||||
|
|
||||||
https://bugzilla.redhat.com/show_bug.cgi?id=1279076
|
|
||||||
|
|
||||||
Signed-off-by: Laurent Bigonville <bigon@bigon.be
|
|
||||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
||||||
---
|
|
||||||
src/rpcbind.c | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
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 */
|
|
||||||
--
|
|
||||||
1.8.5.6
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
|||||||
From d5dace219953c45d26ae42db238052b68540649a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Olaf Kirch <okir@suse.de>
|
|
||||||
Date: Fri, 30 Oct 2015 10:18:20 -0400
|
|
||||||
Subject: [PATCH 2/4] Fix memory corruption in PMAP_CALLIT code
|
|
||||||
|
|
||||||
- A PMAP_CALLIT call comes in on IPv4 UDP
|
|
||||||
- rpcbind duplicates the caller's address to a netbuf and stores it in
|
|
||||||
FINFO[0].caller_addr. caller_addr->buf now points to a memory region A
|
|
||||||
with a size of 16 bytes
|
|
||||||
- rpcbind forwards the call to the local service, receives a reply
|
|
||||||
- when processing the reply, it does this in xprt_set_caller:
|
|
||||||
xprt->xp_rtaddr = *FINFO[0].caller_addr
|
|
||||||
It sends out the reply, and then frees the netbuf caller_addr and
|
|
||||||
caller_addr.buf.
|
|
||||||
However, it does not clear xp_rtaddr, so xp_rtaddr.buf now refers
|
|
||||||
to memory region A, which is free.
|
|
||||||
- When the next call comes in on the UDP/IPv4 socket, svc_dg_recv will
|
|
||||||
be called, which will set xp_rtaddr to the client's address.
|
|
||||||
It will reuse the buffer inside xp_rtaddr, ie it will write a
|
|
||||||
sockaddr_in to region A
|
|
||||||
|
|
||||||
Some time down the road, an incoming TCP connection is accepted,
|
|
||||||
allocating a fresh SVCXPRT. The memory region A is inside the
|
|
||||||
new SVCXPRT
|
|
||||||
|
|
||||||
- While processing the TCP call, another UDP call comes in, again
|
|
||||||
overwriting region A with the client's address
|
|
||||||
- TCP client closes connection. In svc_destroy, we now trip over
|
|
||||||
the garbage left in region A
|
|
||||||
|
|
||||||
We ran into the case where a commercial scanner was triggering
|
|
||||||
occasional rpcbind segfaults. The core file that was captured showed
|
|
||||||
a corrupted xprt->xp_netid pointer that was really a sockaddr_in.
|
|
||||||
|
|
||||||
Signed-off-by: Olaf Kirch <okir@suse.de>
|
|
||||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
||||||
---
|
|
||||||
src/rpcb_svc_com.c | 23 ++++++++++++++++++++++-
|
|
||||||
1 file changed, 22 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
|
|
||||||
index ff9ce6b..4ae93f1 100644
|
|
||||||
--- a/src/rpcb_svc_com.c
|
|
||||||
+++ b/src/rpcb_svc_com.c
|
|
||||||
@@ -1183,12 +1183,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;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
1.8.5.6
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From de47f6323d8fb20feefee21d0195cf0529151e04 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Steve Dickson <steved@redhat.com>
|
|
||||||
Date: Thu, 17 Sep 2015 15:57:35 -0400
|
|
||||||
Subject: [PATCH 1/4] security.c: removed warning
|
|
||||||
|
|
||||||
src/security.c:100:8: warning: implicit declaration of function 'xlog'
|
|
||||||
[-Wimplicit-function-declaration]
|
|
||||||
|
|
||||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
||||||
---
|
|
||||||
src/security.c | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
--
|
|
||||||
1.8.5.6
|
|
||||||
|
|
@ -1,113 +0,0 @@
|
|||||||
From e97a3d42704ac83453cc85d09ed48eb9755696a5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Thorsten Kukuk <kukuk@thkukuk.de>
|
|
||||||
Date: Fri, 19 Feb 2016 15:55:38 +0100
|
|
||||||
Subject: [PATCH 1/1] rpcbind and libtirpc are both using poll in svc_run(),
|
|
||||||
but rpcbind used the old svc_fdset interface for this. This limits the
|
|
||||||
possible connections to 1024, while both could handle much more. rpcbind is
|
|
||||||
now accessing directly the svc_pollfd data of libtirpc.
|
|
||||||
|
|
||||||
Signed-off-by: Thorsten Kukuk <kukuk@thkukuk.de>
|
|
||||||
---
|
|
||||||
src/rpcb_svc_com.c | 48 ++++++++++++++++--------------------------------
|
|
||||||
1 file changed, 16 insertions(+), 32 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
|
|
||||||
index 22d6c84..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;
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ 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(pollfds, nfds, 30 * 1000)) {
|
|
||||||
+ 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
1.8.5.6
|
|
||||||
|
|
@ -1,146 +0,0 @@
|
|||||||
From 2e78e6fb51292fea798355e5cb749dbc1de26ca6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.com>
|
|
||||||
Date: Wed, 16 Nov 2016 10:53:07 -0500
|
|
||||||
Subject: [PATCH 1/1] 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>
|
|
||||||
---
|
|
||||||
configure.ac | 4 ++--
|
|
||||||
src/rpcbind.c | 5 +++++
|
|
||||||
src/rpcbind.h | 1 +
|
|
||||||
src/warmstart.c | 37 +++++++++++++++++++++++++++++++++----
|
|
||||||
4 files changed, 41 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
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 __P((char *, xdrproc_t, void *));
|
|
||||||
static bool_t read_struct __P((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);
|
|
||||||
--
|
|
||||||
1.8.5.6
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:9897823a9d820ea011d9ea02054d5ab99469b9ca5346265fee380713c8fed27b
|
|
||||||
size 121306
|
|
3
rpcbind-0.2.4.tar.bz2
Normal file
3
rpcbind-0.2.4.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:074a9a530dc7c11e0d905aa59bcb0847c009313f02e98d3d798aa9568f414c66
|
||||||
|
size 122781
|
@ -1,3 +1,34 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Apr 3 12:06:36 UTC 2018 - dimstar@opensuse.org
|
||||||
|
|
||||||
|
- Correctly rebase 0001-systemd-unit-files.patch: Since upstream
|
||||||
|
now ships systemd service files, we must no longer create full
|
||||||
|
unit files, but only correct the existing ones (adding
|
||||||
|
EnvironmentFile statement).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Mar 26 17:11:19 CEST 2018 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Use %license instead of %doc [bsc#1082318]
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Feb 18 19:48:56 UTC 2018 - avindra@opensuse.org
|
||||||
|
|
||||||
|
- Update to 0.2.4:
|
||||||
|
+ Memory corruption fix
|
||||||
|
+ Moved the default state directory to /var/run
|
||||||
|
+ Systemd unit files were added.
|
||||||
|
- cleanup with spec-cleaner
|
||||||
|
- don't ship NEWS or ChangeLog, these are not maintained
|
||||||
|
- rebase 0001-systemd-unit-files.patch
|
||||||
|
- remove upstreamed patches
|
||||||
|
* drop 0002-handle_reply-Don-t-use-the-xp_auth-pointer-directly.patch
|
||||||
|
* drop 0003-Delete-the-unix-socket-only-if-we-have-created-it.patch
|
||||||
|
* drop 0004-Fix-memory-corruption-in-PMAP_CALLIT-code.patch
|
||||||
|
* drop 0005-security.c-removed-warning.patch
|
||||||
|
* drop 0006-don-t-use-svc_fdset.patch
|
||||||
|
* drop 0012-Move-default-state-dir-to-a-subdirectory-of-var-run.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Nov 23 13:38:46 UTC 2017 - rbrown@suse.com
|
Thu Nov 23 13:38:46 UTC 2017 - rbrown@suse.com
|
||||||
|
|
||||||
|
97
rpcbind.spec
97
rpcbind.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package rpcbind
|
# spec file for package rpcbind
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -18,24 +18,29 @@
|
|||||||
|
|
||||||
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
||||||
%if ! %{defined _fillupdir}
|
%if ! %{defined _fillupdir}
|
||||||
%define _fillupdir /var/adm/fillup-templates
|
%define _fillupdir %{_localstatedir}/adm/fillup-templates
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: rpcbind
|
Name: rpcbind
|
||||||
Version: 0.2.3
|
Version: 0.2.4
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Transport independent RPC portmapper
|
Summary: Transport independent RPC portmapper
|
||||||
|
# Git-Web: http://git.linux-nfs.org/?p=steved/rpcbind.git;a=summary
|
||||||
License: BSD-4-Clause
|
License: BSD-4-Clause
|
||||||
Group: Productivity/Networking/System
|
Group: Productivity/Networking/System
|
||||||
Url: git://git.infradead.org/users/steved/rpcbind.git
|
Url: http://rpcbind.sourceforge.net
|
||||||
Source: %{name}-%{version}.tar.bz2
|
Source: https://downloads.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2
|
||||||
Source2: sysconfig.rpcbind
|
Source2: sysconfig.rpcbind
|
||||||
Source3: rpcbind.xml
|
Source3: rpcbind.xml
|
||||||
Source4: pmap_set.c
|
Source4: pmap_set.c
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
Patch1: 0001-systemd-unit-files.patch
|
||||||
%if 0%{?suse_version} >= 1330
|
Patch8: 0008-First-part-of-init_transport-refactoring.patch
|
||||||
BuildRequires: libnsl-devel
|
Patch9: 0009-init_transport-move-the-registration-code-into-a-sep.patch
|
||||||
%endif
|
Patch10: 0010-Fix-the-behavior-when-specifying-the-h-option.patch
|
||||||
|
Patch11: 0011-Clean-up-the-way-we-handle-the-h-option-in-init_tran.patch
|
||||||
|
Patch14: 0014-When-using-systemd-redirect-syslog-calls-to-the-syst.patch
|
||||||
|
Patch30: 0030-systemd-fix-rmtcall.patch
|
||||||
|
Patch31: 0031-rpcbind-manpage.patch
|
||||||
|
Patch32: svc-freeargs.patch
|
||||||
BuildRequires: libtirpc-devel >= 1.0.1
|
BuildRequires: libtirpc-devel >= 1.0.1
|
||||||
BuildRequires: libtool
|
BuildRequires: libtool
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
@ -43,28 +48,15 @@ BuildRequires: systemd-rpm-macros
|
|||||||
BuildRequires: tcpd-devel
|
BuildRequires: tcpd-devel
|
||||||
BuildRequires: pkgconfig(libsystemd)
|
BuildRequires: pkgconfig(libsystemd)
|
||||||
PreReq: %fillup_prereq
|
PreReq: %fillup_prereq
|
||||||
Requires(pre): /usr/sbin/useradd
|
Requires(pre): %{_sbindir}/useradd
|
||||||
|
Provides: portmap
|
||||||
|
%{?systemd_requires}
|
||||||
|
%if 0%{?suse_version} >= 1330
|
||||||
|
BuildRequires: libnsl-devel
|
||||||
|
%endif
|
||||||
%if 0%{?suse_version} >= 1330
|
%if 0%{?suse_version} >= 1330
|
||||||
Requires(pre): group(nobody)
|
Requires(pre): group(nobody)
|
||||||
%endif
|
%endif
|
||||||
Patch1: 0001-systemd-unit-files.patch
|
|
||||||
Patch2: 0002-handle_reply-Don-t-use-the-xp_auth-pointer-directly.patch
|
|
||||||
Patch3: 0003-Delete-the-unix-socket-only-if-we-have-created-it.patch
|
|
||||||
Patch4: 0004-Fix-memory-corruption-in-PMAP_CALLIT-code.patch
|
|
||||||
Patch5: 0005-security.c-removed-warning.patch
|
|
||||||
Patch6: 0006-don-t-use-svc_fdset.patch
|
|
||||||
Patch8: 0008-First-part-of-init_transport-refactoring.patch
|
|
||||||
Patch9: 0009-init_transport-move-the-registration-code-into-a-sep.patch
|
|
||||||
Patch10: 0010-Fix-the-behavior-when-specifying-the-h-option.patch
|
|
||||||
Patch11: 0011-Clean-up-the-way-we-handle-the-h-option-in-init_tran.patch
|
|
||||||
Patch12: 0012-Move-default-state-dir-to-a-subdirectory-of-var-run.patch
|
|
||||||
Patch14: 0014-When-using-systemd-redirect-syslog-calls-to-the-syst.patch
|
|
||||||
Patch30: 0030-systemd-fix-rmtcall.patch
|
|
||||||
Patch31: 0031-rpcbind-manpage.patch
|
|
||||||
Patch32: svc-freeargs.patch
|
|
||||||
|
|
||||||
%{?systemd_requires}
|
|
||||||
Provides: portmap
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Rpcbind is a replacement for portmap. Whereas portmap supports only UDP
|
Rpcbind is a replacement for portmap. Whereas portmap supports only UDP
|
||||||
@ -77,16 +69,10 @@ regards to portmap.
|
|||||||
%setup -q
|
%setup -q
|
||||||
cp %{SOURCE4} .
|
cp %{SOURCE4} .
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
%patch6 -p1
|
|
||||||
#%patch8 -p1
|
#%patch8 -p1
|
||||||
#%patch9 -p1
|
#%patch9 -p1
|
||||||
#%patch10 -p1
|
#%patch10 -p1
|
||||||
#%patch11 -p1
|
#%patch11 -p1
|
||||||
%patch12 -p1
|
|
||||||
#%patch14 -p1
|
#%patch14 -p1
|
||||||
#%patch30 -p1
|
#%patch30 -p1
|
||||||
%patch31 -p1
|
%patch31 -p1
|
||||||
@ -94,41 +80,38 @@ cp %{SOURCE4} .
|
|||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -fiv
|
autoreconf -fiv
|
||||||
export CFLAGS="$RPM_OPT_FLAGS -fpie"
|
export CFLAGS="%{optflags} -fpie"
|
||||||
export LDFLAGS="-pie -Wl,-z,relro,-z,now"
|
export LDFLAGS="-pie -Wl,-z,relro,-z,now"
|
||||||
%configure \
|
%configure \
|
||||||
--bindir=/sbin \
|
--bindir=/sbin \
|
||||||
--enable-libwrap \
|
--enable-libwrap \
|
||||||
--enable-warmstarts \
|
--enable-warmstarts \
|
||||||
--disable-debug \
|
--disable-debug \
|
||||||
--with-statedir=%{_rundir}/rpcbind \
|
--with-statedir=%{_rundir}/%{name} \
|
||||||
--with-rpcuser=rpc \
|
--with-rpcuser=rpc \
|
||||||
--with-systemdsystemunitdir=%{_unitdir}
|
--with-systemdsystemunitdir=%{_unitdir}
|
||||||
|
|
||||||
%{__make} %{?jobs:-j%jobs}
|
make %{?_smp_mflags}
|
||||||
%{__cc} -I/usr/include/tirpc -pie -fpie -fwhole-program -Wl,-z,relro,-z,now %{optflags} pmap_set.c -o pmap_set -ltirpc
|
gcc -I/usr/include/tirpc -pie -fpie -fwhole-program -Wl,-z,relro,-z,now %{optflags} pmap_set.c -o pmap_set -ltirpc
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make install DESTDIR=$RPM_BUILD_ROOT
|
%make_install
|
||||||
# fillup template
|
# fillup template
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_fillupdir}
|
mkdir -p %{buildroot}%{_fillupdir}
|
||||||
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_fillupdir}/
|
install -m 644 %{SOURCE2} %{buildroot}%{_fillupdir}/
|
||||||
mkdir -p $RPM_BUILD_ROOT%_datadir/omc/svcinfo.d
|
mkdir -p %{buildroot}%{_datadir}/omc/svcinfo.d
|
||||||
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%_datadir/omc/svcinfo.d/
|
install -m 644 %{SOURCE3} %{buildroot}%{_datadir}/omc/svcinfo.d/
|
||||||
#
|
#
|
||||||
install -m 755 pmap_set $RPM_BUILD_ROOT/sbin/pmap_set2
|
install -m 755 pmap_set %{buildroot}/sbin/pmap_set2
|
||||||
# create symlink for rcrpcbind
|
# create symlink for rcrpcbind
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
|
mkdir -p %{buildroot}%{_sbindir}
|
||||||
ln -s /sbin/service $RPM_BUILD_ROOT%{_sbindir}/rcrpcbind
|
ln -s /sbin/service %{buildroot}%{_sbindir}/rc%{name}
|
||||||
|
|
||||||
%clean
|
|
||||||
rm -rf $RPM_BUILD_ROOT
|
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
%service_add_pre %{name}.service %{name}.socket
|
%service_add_pre %{name}.service %{name}.socket
|
||||||
|
|
||||||
# Add "rpc" user
|
# Add "rpc" user
|
||||||
getent passwd rpc >/dev/null || /usr/sbin/useradd -r -g nobody -d /var/lib/empty -s /sbin/nologin -c "user for rpcbind" rpc
|
getent passwd rpc >/dev/null || %{_sbindir}/useradd -r -g nobody -d %{_localstatedir}/lib/empty -s /sbin/nologin -c "user for rpcbind" rpc
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
@ -142,15 +125,15 @@ exit 0
|
|||||||
%service_del_postun %{name}.service %{name}.socket
|
%service_del_postun %{name}.service %{name}.socket
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%license COPYING
|
||||||
%doc AUTHORS ChangeLog COPYING NEWS README
|
%doc AUTHORS README
|
||||||
/sbin/pmap_set2
|
/sbin/pmap_set2
|
||||||
/sbin/rpcbind
|
/sbin/%{name}
|
||||||
/sbin/rpcinfo
|
/sbin/rpcinfo
|
||||||
%{_sbindir}/rcrpcbind
|
%{_sbindir}/rc%{name}
|
||||||
%{_mandir}/*/*
|
%{_mandir}/*/*
|
||||||
%{_fillupdir}/sysconfig.rpcbind
|
%{_fillupdir}/sysconfig.%{name}
|
||||||
%{_datadir}/omc/svcinfo.d/rpcbind.xml
|
%{_datadir}/omc/svcinfo.d/%{name}.xml
|
||||||
%{_unitdir}/%{name}.service
|
%{_unitdir}/%{name}.service
|
||||||
%{_unitdir}/%{name}.socket
|
%{_unitdir}/%{name}.socket
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user