From 766e98de25237332e7ee43f35af7cb232ccf034b Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Nov 11 2019 15:15:04 +0000 Subject: Updated to latest upstream RC release: rpcbind-1_2_5-rc1 (bz 1431574) Signed-off-by: Steve Dickson --- diff --git a/rpcbind-0.2.5-rc1.patch b/rpcbind-0.2.5-rc1.patch deleted file mode 100644 index 6dbfff3..0000000 --- a/rpcbind-0.2.5-rc1.patch +++ /dev/null @@ -1,185 +0,0 @@ -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) ?: "", - 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. diff --git a/rpcbind-0.2.5-rc2.patch b/rpcbind-0.2.5-rc2.patch deleted file mode 100644 index bf89442..0000000 --- a/rpcbind-0.2.5-rc2.patch +++ /dev/null @@ -1,310 +0,0 @@ -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) ?: "", - 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. diff --git a/rpcbind-1.2.5-rc1.patch b/rpcbind-1.2.5-rc1.patch new file mode 100644 index 0000000..6d09254 --- /dev/null +++ b/rpcbind-1.2.5-rc1.patch @@ -0,0 +1,249 @@ +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 + #include + #include ++#include + #include + #include + #include +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 + #include +-#include + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -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 + #include + #include +-#include ++#include + #include + #include + #include +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 + #include + #include +-#include ++#include + #include + #include + #include +@@ -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 + #include + #include ++#include + #include + #include + #include diff --git a/rpcbind.spec b/rpcbind.spec index adae6ec..855f802 100644 --- a/rpcbind.spec +++ b/rpcbind.spec @@ -4,7 +4,7 @@ Name: rpcbind Version: 1.2.5 -Release: 4%{?dist} +Release: 4.rc1%{?dist} Summary: Universal Addresses to RPC Program Number Mapper License: BSD URL: http://nfsv4.bullopensource.org @@ -21,7 +21,7 @@ Requires(post): systemd Requires(preun): systemd Requires(postun): systemd coreutils -Patch001: rpcbind-1.2.5-rpcinfo-bufoverflow.patch +Patch001: rpcbind-1.2.5-rc1.patch Patch100: rpcbind-0.2.3-systemd-envfile.patch Patch101: rpcbind-0.2.3-systemd-tmpfiles.patch @@ -122,7 +122,9 @@ fi %attr(0700, %{rpcbind_user_group}, %{rpcbind_user_group}) %dir %{rpcbind_state_dir} %changelog -* Thu Sep 19 2019 Steve Dickson - 1.2.5-4 +* Mon Nov 11 2019 Steve Dickson - 1.2.5-4.rc1 +- Updated to latest upstream RC release: rpcbind-1_2_5-rc1 (bz 1431574) + - Enable remote calls which are used by NIS and other packages (bz 1630672) * Sat Feb 02 2019 Fedora Release Engineering - 1.2.5-3