Rebased to latest upstream release: rpcbind-1-2-6 (bz 1959128)

Signed-off-by: Steve Dickson <steved@redhat.com>
Resolves: bz1959128
This commit is contained in:
Steve Dickson 2021-06-22 14:37:36 -04:00
parent e3ad855eca
commit 2192d9560f
4 changed files with 8 additions and 258 deletions

4
.gitignore vendored
View File

@ -1,4 +1,4 @@
x86_64
Makefile
/rpcbind-1.2.5.tar.bz2
rpcbind-1.2.5/
/rpcbind-1.2.6.tar.bz2
rpcbind-1.2.6/

View File

@ -1,249 +0,0 @@
diff -up rpcbind-1.2.5/src/pmap_svc.c.orig rpcbind-1.2.5/src/pmap_svc.c
--- rpcbind-1.2.5/src/pmap_svc.c.orig 2018-08-15 10:51:19.000000000 -0400
+++ rpcbind-1.2.5/src/pmap_svc.c 2019-11-11 09:50:09.051438608 -0500
@@ -50,6 +50,7 @@ static char sccsid[] = "@(#)pmap_svc.c 1
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
+#include <string.h>
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
#include <rpc/rpcb_prot.h>
diff -up rpcbind-1.2.5/src/rpcbind.c.orig rpcbind-1.2.5/src/rpcbind.c
--- rpcbind-1.2.5/src/rpcbind.c.orig 2018-08-15 10:51:19.000000000 -0400
+++ rpcbind-1.2.5/src/rpcbind.c 2019-11-11 09:50:09.050438602 -0500
@@ -42,11 +42,10 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/errno.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/time.h>
-#include <sys/signal.h>
+#include <signal.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -340,7 +339,7 @@ init_transport(struct netconfig *nconf)
{
int fd = -1;
struct t_bind taddr;
- struct addrinfo hints, *res;
+ struct addrinfo hints, *res = NULL;
struct __rpc_sockinfo si;
SVCXPRT *my_xprt = NULL;
int status; /* bound checking ? */
@@ -817,8 +816,12 @@ got_socket:
}
#endif
+ if (res != NULL)
+ freeaddrinfo(res);
return (0);
error:
+ if (res != NULL)
+ freeaddrinfo(res);
close(fd);
return (1);
}
diff -up rpcbind-1.2.5/src/rpcb_stat.c.orig rpcbind-1.2.5/src/rpcb_stat.c
--- rpcbind-1.2.5/src/rpcb_stat.c.orig 2018-08-15 10:51:19.000000000 -0400
+++ rpcbind-1.2.5/src/rpcb_stat.c 2019-11-11 09:50:09.051438608 -0500
@@ -151,7 +151,7 @@ rpcbs_rmtcall(rpcvers_t rtype, rpcproc_t
rpcbs_rmtcalllist *rl;
struct netconfig *nconf;
- if (rtype > RPCBVERS_STAT)
+ if (rtype >= RPCBVERS_STAT)
return;
for (rl = inf[rtype].rmtinfo; rl; rl = rl->next) {
diff -up rpcbind-1.2.5/src/rpcb_svc_com.c.orig rpcbind-1.2.5/src/rpcb_svc_com.c
--- rpcbind-1.2.5/src/rpcb_svc_com.c.orig 2018-08-15 10:51:19.000000000 -0400
+++ rpcbind-1.2.5/src/rpcb_svc_com.c 2019-11-11 09:50:09.050438602 -0500
@@ -42,7 +42,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <bits/poll.h>
#include <sys/socket.h>
#include <rpc/rpc.h>
diff -up rpcbind-1.2.5/src/rpcinfo.c.orig rpcbind-1.2.5/src/rpcinfo.c
--- rpcbind-1.2.5/src/rpcinfo.c.orig 2018-08-15 10:51:19.000000000 -0400
+++ rpcbind-1.2.5/src/rpcinfo.c 2019-11-11 09:50:09.052438613 -0500
@@ -693,11 +693,11 @@ reply_proc (res, who, nconf)
}
if (!(uaddr = taddr2uaddr (nconf, who)))
{
- uaddr = UNKNOWN;
+ printf ("%s\t%s\n", UNKNOWN, hostname);
+ } else {
+ printf ("%s\t%s\n", uaddr, hostname);
+ free ((char *) uaddr);
}
- printf ("%s\t%s\n", uaddr, hostname);
- if (strcmp (uaddr, UNKNOWN))
- free ((char *) uaddr);
return (FALSE);
}
@@ -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)
diff -up rpcbind-1.2.5/src/util.c.orig rpcbind-1.2.5/src/util.c
--- rpcbind-1.2.5/src/util.c.orig 2018-08-15 10:51:19.000000000 -0400
+++ rpcbind-1.2.5/src/util.c 2019-11-11 09:50:09.051438608 -0500
@@ -45,7 +45,7 @@
#include <net/if.h>
#include <netinet/in.h>
#include <ifaddrs.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <rpc/rpc.h>
#include <errno.h>
#include <stdlib.h>
@@ -103,7 +103,7 @@ char *
addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr,
char *netid)
{
- struct ifaddrs *ifap, *ifp = NULL, *bestif;
+ struct ifaddrs *ifap, *ifp = NULL, *bestif, *exactif;
struct netbuf *serv_nbp = NULL, *hint_nbp = NULL, tbuf;
struct sockaddr *caller_sa, *hint_sa, *ifsa, *ifmasksa, *serv_sa;
struct sockaddr_storage ss;
@@ -157,7 +157,10 @@ addrmerge(struct netbuf *caller, char *s
* network portion of its address is equal to that of the client.
* If so, we have found the interface that we want to use.
*/
- bestif = NULL;
+ bestif = NULL; /* first interface UP with same network & family */
+ exactif = NULL; /* the interface requested by the client */
+ u_int8_t maskAllAddrBits[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; /* 16 bytes for IPv6 */
for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) {
ifsa = ifap->ifa_addr;
ifmasksa = ifap->ifa_netmask;
@@ -175,8 +178,16 @@ addrmerge(struct netbuf *caller, char *s
if (!bitmaskcmp(&SA2SINADDR(ifsa),
&SA2SINADDR(hint_sa), &SA2SINADDR(ifmasksa),
sizeof(struct in_addr))) {
- bestif = ifap;
- goto found;
+ if(!bestif) /* for compatibility with previous code */
+ bestif = ifap;
+ /* Is this an exact match? */
+ if (!bitmaskcmp(&SA2SINADDR(ifsa),
+ &SA2SINADDR(hint_sa), maskAllAddrBits,
+ sizeof(struct in_addr))) {
+ exactif = ifap;
+ goto found;
+ }
+ /* else go-on looking for an exact match */
}
break;
#ifdef INET6
@@ -197,8 +208,16 @@ addrmerge(struct netbuf *caller, char *s
} else if (!bitmaskcmp(&SA2SIN6ADDR(ifsa),
&SA2SIN6ADDR(hint_sa), &SA2SIN6ADDR(ifmasksa),
sizeof(struct in6_addr))) {
- bestif = ifap;
- goto found;
+ if(!bestif) /* for compatibility with previous code */
+ bestif = ifap;
+ /* Is this an exact match? */
+ if (!bitmaskcmp(&SA2SIN6ADDR(ifsa),
+ &SA2SIN6ADDR(hint_sa), maskAllAddrBits,
+ sizeof(struct in6_addr))) {
+ exactif = ifap;
+ goto found;
+ }
+ /* else go-on looking for an exact match */
}
break;
#endif
@@ -215,10 +234,13 @@ addrmerge(struct netbuf *caller, char *s
(bestif->ifa_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))))
bestif = ifap;
}
+
if (bestif == NULL)
goto freeit;
found:
+ if(exactif)
+ bestif = exactif;
/*
* Construct the new address using the the address from
* `bestif', and the port number from `serv_uaddr'.
@@ -322,9 +344,10 @@ network_init()
/*
* Now join the RPC ipv6 multicast group on all interfaces.
*/
- if (getifaddrs(&ifp) < 0)
+ if (getifaddrs(&ifp) < 0) {
+ freeaddrinfo (res);
return;
-
+ }
mreq6.ipv6mr_interface = 0;
inet_pton(AF_INET6, RPCB_MULTICAST_ADDR, &mreq6.ipv6mr_multiaddr);
@@ -352,8 +375,8 @@ network_init()
perror("setsockopt v6 multicast");
}
#endif
-
- /* close(s); */
+ freeaddrinfo (res);
+ close(s);
}
struct sockaddr *
diff -up rpcbind-1.2.5/src/warmstart.c.orig rpcbind-1.2.5/src/warmstart.c
--- rpcbind-1.2.5/src/warmstart.c.orig 2018-08-15 10:51:19.000000000 -0400
+++ rpcbind-1.2.5/src/warmstart.c 2019-11-11 09:50:09.051438608 -0500
@@ -35,6 +35,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
+#include <string.h>
#include <rpc/rpc.h>
#include <rpc/rpcb_prot.h>
#include <rpc/xdr.h>

View File

@ -3,8 +3,8 @@
%global rpcbind_state_dir %{_rundir}/rpcbind
Name: rpcbind
Version: 1.2.5
Release: 6.rc1%{?dist}
Version: 1.2.6
Release: 0%{?dist}
Summary: Universal Addresses to RPC Program Number Mapper
License: BSD
URL: http://nfsv4.bullopensource.org
@ -22,8 +22,6 @@ Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd coreutils
Patch001: rpcbind-1.2.5-rc1.patch
Patch100: rpcbind-0.2.3-systemd-envfile.patch
Patch101: rpcbind-0.2.3-systemd-tmpfiles.patch
Patch102: rpcbind-0.2.4-runstatdir.patch
@ -40,8 +38,6 @@ RPC calls on a server on that machine.
%prep
%setup -q
# 1637562 - rpcinfo: Fix stack buffer overflow
%patch001 -p1
%patch100 -p1
%patch101 -p1
@ -122,6 +118,9 @@ fi
%attr(0700, %{rpcbind_user_group}, %{rpcbind_user_group}) %dir %{rpcbind_state_dir}
%changelog
* Tue Jun 22 2021 Steve Dickson <steved@redhat.com> - 1.2.6-0
- Rebased to latest upstream release: rpcbind-1-2-6 (bz 1959128)
* Mon Jun 7 2021 Steve Dickson <steved@redhat.com> - 1.2.5-6.rc1
- Disable remote calls (bz 1923041)

View File

@ -1 +1 @@
SHA512 (rpcbind-1.2.5.tar.bz2) = e884c4757950ccead0f9a07f50625a63e6f18f9bfae9fcfffa3e5fa4b7a66c3a99d9fa303061848fe8211509d5456f24ff26e4579af6e161a35522268f3ef3e4
SHA512 (rpcbind-1.2.6.tar.bz2) = fb89c61be4c533fe2e6057749d97079a2d1c9fac0d35d6be1a159a0edbf86092b3fc121f19fa920e75aac5ecdd3f59f5978e6401d5cad16cd438c977736206a7