From faf8c031c89c3ccc37e5fd36c6385e687c73d915 Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Mon, 30 Jul 2018 09:52:16 -0400 Subject: [PATCH] Clean up old patches Signed-off-by: Steve Dickson --- libtirpc-1.0.3-alloca.patch | 51 ---- libtirpc-1.0.3-clntcreate.patch | 64 ----- libtirpc-1.0.3-rc1.patch | 112 -------- libtirpc-1.0.3-rc2.patch | 492 -------------------------------- libtirpc-1.0.4-rc1.patch | 98 ------- 5 files changed, 817 deletions(-) delete mode 100644 libtirpc-1.0.3-alloca.patch delete mode 100644 libtirpc-1.0.3-clntcreate.patch delete mode 100644 libtirpc-1.0.3-rc1.patch delete mode 100644 libtirpc-1.0.3-rc2.patch delete mode 100644 libtirpc-1.0.4-rc1.patch diff --git a/libtirpc-1.0.3-alloca.patch b/libtirpc-1.0.3-alloca.patch deleted file mode 100644 index eff3c2a..0000000 --- a/libtirpc-1.0.3-alloca.patch +++ /dev/null @@ -1,51 +0,0 @@ -commit 7a42aa8af6779286aabb11a666f25f37ece98eb8 -Author: Steve Dickson -Date: Tue Mar 6 13:05:17 2018 -0500 - - clnt_dg_call: Change the memory allocation - - Commit 2936f109590e add free()s on memory that - was allocated from the stack (via alloca()). - That type memory is automatically freed so - those added free()s was causing a double frees. - - It was suggested allocating memory from the - stack can be a bit troublesome. So this patch - changes the memory allocation from the stack - to the heap which also eliminates the double frees. - - Fixes: 2936f109590e ("clnt_dg_call: Fix a buffer overflow (CVE-2016-4429)") - BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1552163 - - Reviewed-by: Chuck Lever - Signed-off-by: Steve Dickson - -diff --git a/src/clnt_dg.c b/src/clnt_dg.c -index 884a2db..04a2aba 100644 ---- a/src/clnt_dg.c -+++ b/src/clnt_dg.c -@@ -430,7 +430,7 @@ get_reply: - struct sockaddr_in err_addr; - struct sockaddr_in *sin = (struct sockaddr_in *)&cu->cu_raddr; - struct iovec iov; -- char *cbuf = (char *) alloca (outlen + 256); -+ char *cbuf = (char *) mem_alloc((outlen + 256)); - int ret; - - if (cbuf == NULL) -@@ -462,13 +462,13 @@ get_reply: - cmsg = CMSG_NXTHDR (&msg, cmsg)) - if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) - { -- free(cbuf); -+ mem_free(cbuf, (outlen + 256)); - e = (struct sock_extended_err *) CMSG_DATA(cmsg); - cu->cu_error.re_errno = e->ee_errno; - release_fd_lock(cu->cu_fd, mask); - return (cu->cu_error.re_status = RPC_CANTRECV); - } -- free(cbuf); -+ mem_free(cbuf, (outlen + 256)); - } - #endif - diff --git a/libtirpc-1.0.3-clntcreate.patch b/libtirpc-1.0.3-clntcreate.patch deleted file mode 100644 index 13079de..0000000 --- a/libtirpc-1.0.3-clntcreate.patch +++ /dev/null @@ -1,64 +0,0 @@ -commit 2802259184ada839793152ed0a0f130065f82dfd -Author: Steve Dickson -Date: Thu Apr 12 10:24:02 2018 -0400 - - clnt_create: Restore using reserve ports for client connections - - Commit 46e04a73 changed clnt_create(3) not to - use reserve ports when binding a connection to - a server. - - For certain legacy apps, like some of the NIS commands, - the client has to used reserve port to be able - to communicate with the server. - - So the use of reserve ports in clnt_create(3) - has been restored. - - Signed-off-by: Steve Dickson - -diff --git a/src/clnt_generic.c b/src/clnt_generic.c -index e5a314f..3f3dabf 100644 ---- a/src/clnt_generic.c -+++ b/src/clnt_generic.c -@@ -47,7 +47,6 @@ - - extern bool_t __rpc_is_local_host(const char *); - int __rpc_raise_fd(int); --extern int __binddynport(int fd); - - #ifndef NETIDLEN - #define NETIDLEN 32 -@@ -341,8 +340,7 @@ clnt_tli_create(int fd, const struct netconfig *nconf, - servtype = nconf->nc_semantics; - if (!__rpc_fd2sockinfo(fd, &si)) - goto err; -- if (__binddynport(fd) == -1) -- goto err; -+ bindresvport(fd, NULL); - } else { - if (!__rpc_fd2sockinfo(fd, &si)) - goto err; -diff --git a/src/rpc_soc.c b/src/rpc_soc.c -index af6c482..5a6eeb7 100644 ---- a/src/rpc_soc.c -+++ b/src/rpc_soc.c -@@ -67,8 +67,6 @@ - - extern mutex_t rpcsoc_lock; - --extern int __binddynport(int fd); -- - static CLIENT *clnt_com_create(struct sockaddr_in *, rpcprog_t, rpcvers_t, - int *, u_int, u_int, char *, int); - static SVCXPRT *svc_com_create(int, u_int, u_int, char *); -@@ -147,8 +145,7 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp, flags) - bindaddr.maxlen = bindaddr.len = sizeof (struct sockaddr_in); - bindaddr.buf = raddr; - -- if (__binddynport(fd) == -1) -- goto err; -+ bindresvport(fd, NULL); - cl = clnt_tli_create(fd, nconf, &bindaddr, prog, vers, - sendsz, recvsz); - if (cl) { diff --git a/libtirpc-1.0.3-rc1.patch b/libtirpc-1.0.3-rc1.patch deleted file mode 100644 index e474029..0000000 --- a/libtirpc-1.0.3-rc1.patch +++ /dev/null @@ -1,112 +0,0 @@ -diff --git a/src/auth_time.c b/src/auth_time.c -index 7f83ab4..69400bc 100644 ---- a/src/auth_time.c -+++ b/src/auth_time.c -@@ -317,7 +317,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) - sprintf(ipuaddr, "%d.%d.%d.%d.0.111", a1, a2, a3, a4); - useua = &ipuaddr[0]; - -- bzero((char *)&sin, sizeof(sin)); -+ memset(&sin, 0, sizeof(sin)); - if (uaddr_to_sockaddr(useua, &sin)) { - msg("unable to translate uaddr to sockaddr."); - if (needfree) -diff --git a/src/des_impl.c b/src/des_impl.c -index 9dbccaf..15bec2a 100644 ---- a/src/des_impl.c -+++ b/src/des_impl.c -@@ -588,7 +588,7 @@ _des_crypt (char *buf, unsigned len, struct desparams *desp) - } - tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; - tbuf[0] = tbuf[1] = 0; -- __bzero (schedule, sizeof (schedule)); -+ memset (schedule, 0, sizeof (schedule)); - - return (1); - } -diff --git a/src/libtirpc.map b/src/libtirpc.map -index f385de5..21d6065 100644 ---- a/src/libtirpc.map -+++ b/src/libtirpc.map -@@ -298,7 +298,7 @@ TIRPC_0.3.2 { - key_gendes; - key_get_conv; - key_setsecret; -- key_secret_is_set; -+ key_secretkey_is_set; - key_setnet; - netname2host; - netname2user; -diff --git a/src/svc_auth_des.c b/src/svc_auth_des.c -index 2e90146..19a7c60 100644 ---- a/src/svc_auth_des.c -+++ b/src/svc_auth_des.c -@@ -356,7 +356,7 @@ cache_init() - - authdes_cache = (struct cache_entry *) - mem_alloc(sizeof(struct cache_entry) * AUTHDES_CACHESZ); -- bzero((char *)authdes_cache, -+ memset(authdes_cache, 0, - sizeof(struct cache_entry) * AUTHDES_CACHESZ); - - authdes_lru = (short *)mem_alloc(sizeof(short) * AUTHDES_CACHESZ); -diff --git a/src/xdr_sizeof.c b/src/xdr_sizeof.c -index d23fbd1..79d6707 100644 ---- a/src/xdr_sizeof.c -+++ b/src/xdr_sizeof.c -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - #include "un-namespace.h" - - /* ARGSUSED */ -diff --git a/tirpc/rpc/pmap_clnt.h b/tirpc/rpc/pmap_clnt.h -index 6abd583..cf1ab61 100644 ---- a/tirpc/rpc/pmap_clnt.h -+++ b/tirpc/rpc/pmap_clnt.h -@@ -64,6 +64,10 @@ - #ifndef _RPC_PMAP_CLNT_H_ - #define _RPC_PMAP_CLNT_H_ - -+#include -+#include -+#include -+ - #ifdef __cplusplus - extern "C" { - #endif -diff --git a/tirpc/rpc/types.h b/tirpc/rpc/types.h -index 52c30a2..f069efa 100644 ---- a/tirpc/rpc/types.h -+++ b/tirpc/rpc/types.h -@@ -65,6 +65,28 @@ typedef int32_t rpc_inline_t; - #define mem_alloc(bsize) calloc(1, bsize) - #define mem_free(ptr, bsize) free(ptr) - -+ -+#if defined __APPLE_CC__ || defined __FreeBSD__ -+# define __u_char_defined -+# define __daddr_t_defined -+#endif -+ -+#ifndef __u_char_defined -+typedef __u_char u_char; -+typedef __u_short u_short; -+typedef __u_int u_int; -+typedef __u_long u_long; -+typedef __quad_t quad_t; -+typedef __u_quad_t u_quad_t; -+typedef __fsid_t fsid_t; -+# define __u_char_defined -+#endif -+#ifndef __daddr_t_defined -+typedef __daddr_t daddr_t; -+typedef __caddr_t caddr_t; -+# define __daddr_t_defined -+#endif -+ - #include - #include - #include diff --git a/libtirpc-1.0.3-rc2.patch b/libtirpc-1.0.3-rc2.patch deleted file mode 100644 index e38fd65..0000000 --- a/libtirpc-1.0.3-rc2.patch +++ /dev/null @@ -1,492 +0,0 @@ -diff --git a/src/Makefile.am b/src/Makefile.am -index fba2aa4..932414d 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -15,8 +15,9 @@ lib_LTLIBRARIES = libtirpc.la - libtirpc_la_LDFLAGS = @LDFLAG_NOUNDEFINED@ -no-undefined -lpthread - libtirpc_la_LDFLAGS += -version-info @LT_VERSION_INFO@ - --libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c bindresvport.c clnt_bcast.c \ -- clnt_dg.c clnt_generic.c clnt_perror.c clnt_raw.c clnt_simple.c \ -+libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c \ -+ binddynport.c bindresvport.c \ -+ clnt_bcast.c clnt_dg.c clnt_generic.c clnt_perror.c clnt_raw.c clnt_simple.c \ - clnt_vc.c rpc_dtablesize.c getnetconfig.c getnetpath.c getrpcent.c \ - getrpcport.c mt_misc.c pmap_clnt.c pmap_getmaps.c pmap_getport.c \ - pmap_prot.c pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c \ -diff --git a/src/auth_time.c b/src/auth_time.c -index 7f83ab4..69400bc 100644 ---- a/src/auth_time.c -+++ b/src/auth_time.c -@@ -317,7 +317,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) - sprintf(ipuaddr, "%d.%d.%d.%d.0.111", a1, a2, a3, a4); - useua = &ipuaddr[0]; - -- bzero((char *)&sin, sizeof(sin)); -+ memset(&sin, 0, sizeof(sin)); - if (uaddr_to_sockaddr(useua, &sin)) { - msg("unable to translate uaddr to sockaddr."); - if (needfree) -diff --git a/src/binddynport.c b/src/binddynport.c -new file mode 100644 -index 0000000..062629a ---- /dev/null -+++ b/src/binddynport.c -@@ -0,0 +1,139 @@ -+/* -+ * Copyright (c) 2018, Oracle America, Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * - Redistributions of source code must retain the above copyright notice, -+ * this list of conditions and the following disclaimer. -+ * - Redistributions in binary form must reproduce the above copyright notice, -+ * this list of conditions and the following disclaimer in the documentation -+ * and/or other materials provided with the distribution. -+ * - Neither the name of "Oracle America, Inc." nor the names of its -+ * contributors may be used to endorse or promote products derived -+ * from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include "reentrant.h" -+#include "rpc_com.h" -+ -+extern pthread_mutex_t port_lock; -+ -+/* -+ * Dynamic port range as defined in RFC 6335 Section 6. -+ * This range avoids all IANA-assigned service port -+ * numbers. -+ */ -+enum { -+ LOWPORT = 49152, -+ ENDPORT = 65534, -+ NPORTS = ENDPORT - LOWPORT + 1, -+}; -+ -+/* -+ * Bind a socket to a dynamically-assigned IP port. -+ * -+ * @fd is an open but unbound socket. -+ * -+ * On each call, a port number is chosen at random from -+ * within the dynamic/private port range, even if the -+ * caller has CAP_NET_ADMIN_BIND. -+ * -+ * Returns 0 on success, -1 on failure. errno may be -+ * set to a non-determinant value. -+ * -+ * This function is re-entrant. -+ */ -+int __binddynport(int fd) -+{ -+ struct sockaddr_storage ss; -+#ifdef INET6 -+ struct sockaddr_in6 *sin6; -+#endif -+ struct sockaddr_in *sin; -+ static unsigned int seed; -+ in_port_t port, *portp; -+ struct sockaddr *sap; -+ socklen_t salen; -+ int i, res; -+ -+ if (__rpc_sockisbound(fd)) -+ return 0; -+ -+ res = -1; -+ sap = (struct sockaddr *)(void *)&ss; -+ salen = sizeof(ss); -+ memset(sap, 0, salen); -+ -+ mutex_lock(&port_lock); -+ -+ if (getsockname(fd, sap, &salen) == -1) -+ goto out; -+ -+ switch (ss.ss_family) { -+ case AF_INET: -+ sin = (struct sockaddr_in *)(void *)&ss; -+ portp = &sin->sin_port; -+ salen = sizeof(struct sockaddr_in); -+ break; -+#ifdef INET6 -+ case AF_INET6: -+ sin6 = (struct sockaddr_in6 *)(void *)&ss; -+ portp = &sin6->sin6_port; -+ salen = sizeof(struct sockaddr_in6); -+ break; -+#endif -+ default: -+ goto out; -+ } -+ -+ if (!seed) { -+ struct timeval tv; -+ -+ gettimeofday(&tv, NULL); -+ seed = tv.tv_usec * getpid(); -+ } -+ port = (rand_r(&seed) % NPORTS) + LOWPORT; -+ for (i = 0; i < NPORTS; ++i) { -+ *portp = htons(port++); -+ res = bind(fd, sap, salen); -+ if (res >= 0) { -+ res = 0; -+ break; -+ } -+ if (errno != EADDRINUSE) -+ break; -+ if (port > ENDPORT) -+ port = LOWPORT; -+ } -+ -+out: -+ mutex_unlock(&port_lock); -+ return res; -+} -diff --git a/src/clnt_dg.c b/src/clnt_dg.c -index 248138b..884a2db 100644 ---- a/src/clnt_dg.c -+++ b/src/clnt_dg.c -@@ -433,6 +433,11 @@ get_reply: - char *cbuf = (char *) alloca (outlen + 256); - int ret; - -+ if (cbuf == NULL) -+ { -+ cu->cu_error.re_errno = errno; -+ return (cu->cu_error.re_status = RPC_CANTRECV); -+ } - iov.iov_base = cbuf + 256; - iov.iov_len = outlen; - msg.msg_name = (void *) &err_addr; -@@ -457,11 +462,13 @@ get_reply: - cmsg = CMSG_NXTHDR (&msg, cmsg)) - if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) - { -+ free(cbuf); - e = (struct sock_extended_err *) CMSG_DATA(cmsg); - cu->cu_error.re_errno = e->ee_errno; - release_fd_lock(cu->cu_fd, mask); - return (cu->cu_error.re_status = RPC_CANTRECV); - } -+ free(cbuf); - } - #endif - -diff --git a/src/clnt_generic.c b/src/clnt_generic.c -index 3f3dabf..e5a314f 100644 ---- a/src/clnt_generic.c -+++ b/src/clnt_generic.c -@@ -47,6 +47,7 @@ - - extern bool_t __rpc_is_local_host(const char *); - int __rpc_raise_fd(int); -+extern int __binddynport(int fd); - - #ifndef NETIDLEN - #define NETIDLEN 32 -@@ -340,7 +341,8 @@ clnt_tli_create(int fd, const struct netconfig *nconf, - servtype = nconf->nc_semantics; - if (!__rpc_fd2sockinfo(fd, &si)) - goto err; -- bindresvport(fd, NULL); -+ if (__binddynport(fd) == -1) -+ goto err; - } else { - if (!__rpc_fd2sockinfo(fd, &si)) - goto err; -diff --git a/src/debug.c b/src/debug.c -index b40ff37..332831c 100644 ---- a/src/debug.c -+++ b/src/debug.c -@@ -3,20 +3,28 @@ - * - * Copyright (C) 2014 Red Hat, Steve Dickson - * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * as published by the Free Software Foundation; either version 2 -- * of the License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02110-1301, USA. -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * - Redistributions of source code must retain the above copyright notice, -+ * this list of conditions and the following disclaimer. -+ * - Redistributions in binary form must reproduce the above copyright notice, -+ * this list of conditions and the following disclaimer in the documentation -+ * and/or other materials provided with the distribution. -+ * - Neither the name of Sun Microsystems, Inc. nor the names of its -+ * contributors may be used to endorse or promote products derived -+ * from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. - */ - #include - #include -diff --git a/src/debug.h b/src/debug.h -index c971ac3..0c98ba4 100644 ---- a/src/debug.h -+++ b/src/debug.h -@@ -3,20 +3,28 @@ - * - * Copyright (C) 2014 Red Hat, Steve Dickson - * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * as published by the Free Software Foundation; either version 2 -- * of the License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02110-1301, USA. -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * - Redistributions of source code must retain the above copyright notice, -+ * this list of conditions and the following disclaimer. -+ * - Redistributions in binary form must reproduce the above copyright notice, -+ * this list of conditions and the following disclaimer in the documentation -+ * and/or other materials provided with the distribution. -+ * - Neither the name of Sun Microsystems, Inc. nor the names of its -+ * contributors may be used to endorse or promote products derived -+ * from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. - */ - - #ifndef _DEBUG_H -diff --git a/src/des_impl.c b/src/des_impl.c -index 9dbccaf..15bec2a 100644 ---- a/src/des_impl.c -+++ b/src/des_impl.c -@@ -588,7 +588,7 @@ _des_crypt (char *buf, unsigned len, struct desparams *desp) - } - tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; - tbuf[0] = tbuf[1] = 0; -- __bzero (schedule, sizeof (schedule)); -+ memset (schedule, 0, sizeof (schedule)); - - return (1); - } -diff --git a/src/libtirpc.map b/src/libtirpc.map -index f385de5..21d6065 100644 ---- a/src/libtirpc.map -+++ b/src/libtirpc.map -@@ -298,7 +298,7 @@ TIRPC_0.3.2 { - key_gendes; - key_get_conv; - key_setsecret; -- key_secret_is_set; -+ key_secretkey_is_set; - key_setnet; - netname2host; - netname2user; -diff --git a/src/rpc_soc.c b/src/rpc_soc.c -index ed0892a..af6c482 100644 ---- a/src/rpc_soc.c -+++ b/src/rpc_soc.c -@@ -67,6 +67,8 @@ - - extern mutex_t rpcsoc_lock; - -+extern int __binddynport(int fd); -+ - static CLIENT *clnt_com_create(struct sockaddr_in *, rpcprog_t, rpcvers_t, - int *, u_int, u_int, char *, int); - static SVCXPRT *svc_com_create(int, u_int, u_int, char *); -@@ -145,7 +147,8 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp, flags) - bindaddr.maxlen = bindaddr.len = sizeof (struct sockaddr_in); - bindaddr.buf = raddr; - -- bindresvport(fd, NULL); -+ if (__binddynport(fd) == -1) -+ goto err; - cl = clnt_tli_create(fd, nconf, &bindaddr, prog, vers, - sendsz, recvsz); - if (cl) { -@@ -313,7 +316,6 @@ svc_com_create(fd, sendsize, recvsize, netid) - SVCXPRT *svc; - int madefd = FALSE; - int port; -- struct sockaddr_in sin; - - if ((nconf = __rpc_getconfip(netid)) == NULL) { - (void) syslog(LOG_ERR, "Could not get %s transport", netid); -@@ -330,10 +332,6 @@ svc_com_create(fd, sendsize, recvsize, netid) - madefd = TRUE; - } - -- memset(&sin, 0, sizeof sin); -- sin.sin_family = AF_INET; -- bindresvport(fd, &sin); -- listen(fd, SOMAXCONN); - svc = svc_tli_create(fd, nconf, NULL, sendsize, recvsize); - (void) freenetconfigent(nconf); - if (svc == NULL) { -diff --git a/src/svc_auth_des.c b/src/svc_auth_des.c -index 2e90146..19a7c60 100644 ---- a/src/svc_auth_des.c -+++ b/src/svc_auth_des.c -@@ -356,7 +356,7 @@ cache_init() - - authdes_cache = (struct cache_entry *) - mem_alloc(sizeof(struct cache_entry) * AUTHDES_CACHESZ); -- bzero((char *)authdes_cache, -+ memset(authdes_cache, 0, - sizeof(struct cache_entry) * AUTHDES_CACHESZ); - - authdes_lru = (short *)mem_alloc(sizeof(short) * AUTHDES_CACHESZ); -diff --git a/src/svc_generic.c b/src/svc_generic.c -index 7aae796..52a56c2 100644 ---- a/src/svc_generic.c -+++ b/src/svc_generic.c -@@ -53,6 +53,7 @@ - #include - - extern int __svc_vc_setflag(SVCXPRT *, int); -+extern int __binddynport(int fd); - - /* - * The highest level interface for server creation. -@@ -220,15 +221,10 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz) - */ - if (madefd || !__rpc_sockisbound(fd)) { - if (bindaddr == NULL) { -- if (bindresvport(fd, NULL) < 0) { -- memset(&ss, 0, sizeof ss); -- ss.ss_family = si.si_af; -- if (bind(fd, (struct sockaddr *)(void *)&ss, -- (socklen_t)si.si_alen) < 0) { -- warnx( -+ if (__binddynport(fd) == -1) { -+ warnx( - "svc_tli_create: could not bind to anonymous port"); -- goto freedata; -- } -+ goto freedata; - } - listen(fd, SOMAXCONN); - } else { -diff --git a/src/xdr_sizeof.c b/src/xdr_sizeof.c -index d23fbd1..79d6707 100644 ---- a/src/xdr_sizeof.c -+++ b/src/xdr_sizeof.c -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - #include "un-namespace.h" - - /* ARGSUSED */ -diff --git a/tirpc/rpc/pmap_clnt.h b/tirpc/rpc/pmap_clnt.h -index 6abd583..cf1ab61 100644 ---- a/tirpc/rpc/pmap_clnt.h -+++ b/tirpc/rpc/pmap_clnt.h -@@ -64,6 +64,10 @@ - #ifndef _RPC_PMAP_CLNT_H_ - #define _RPC_PMAP_CLNT_H_ - -+#include -+#include -+#include -+ - #ifdef __cplusplus - extern "C" { - #endif -diff --git a/tirpc/rpc/types.h b/tirpc/rpc/types.h -index 52c30a2..f069efa 100644 ---- a/tirpc/rpc/types.h -+++ b/tirpc/rpc/types.h -@@ -65,6 +65,28 @@ typedef int32_t rpc_inline_t; - #define mem_alloc(bsize) calloc(1, bsize) - #define mem_free(ptr, bsize) free(ptr) - -+ -+#if defined __APPLE_CC__ || defined __FreeBSD__ -+# define __u_char_defined -+# define __daddr_t_defined -+#endif -+ -+#ifndef __u_char_defined -+typedef __u_char u_char; -+typedef __u_short u_short; -+typedef __u_int u_int; -+typedef __u_long u_long; -+typedef __quad_t quad_t; -+typedef __u_quad_t u_quad_t; -+typedef __fsid_t fsid_t; -+# define __u_char_defined -+#endif -+#ifndef __daddr_t_defined -+typedef __daddr_t daddr_t; -+typedef __caddr_t caddr_t; -+# define __daddr_t_defined -+#endif -+ - #include - #include - #include diff --git a/libtirpc-1.0.4-rc1.patch b/libtirpc-1.0.4-rc1.patch deleted file mode 100644 index 342e199..0000000 --- a/libtirpc-1.0.4-rc1.patch +++ /dev/null @@ -1,98 +0,0 @@ -diff --git a/src/clnt_generic.c b/src/clnt_generic.c -index e5a314f..3f3dabf 100644 ---- a/src/clnt_generic.c -+++ b/src/clnt_generic.c -@@ -47,7 +47,6 @@ - - extern bool_t __rpc_is_local_host(const char *); - int __rpc_raise_fd(int); --extern int __binddynport(int fd); - - #ifndef NETIDLEN - #define NETIDLEN 32 -@@ -341,8 +340,7 @@ clnt_tli_create(int fd, const struct netconfig *nconf, - servtype = nconf->nc_semantics; - if (!__rpc_fd2sockinfo(fd, &si)) - goto err; -- if (__binddynport(fd) == -1) -- goto err; -+ bindresvport(fd, NULL); - } else { - if (!__rpc_fd2sockinfo(fd, &si)) - goto err; -diff --git a/src/rpc_soc.c b/src/rpc_soc.c -index af6c482..5a6eeb7 100644 ---- a/src/rpc_soc.c -+++ b/src/rpc_soc.c -@@ -67,8 +67,6 @@ - - extern mutex_t rpcsoc_lock; - --extern int __binddynport(int fd); -- - static CLIENT *clnt_com_create(struct sockaddr_in *, rpcprog_t, rpcvers_t, - int *, u_int, u_int, char *, int); - static SVCXPRT *svc_com_create(int, u_int, u_int, char *); -@@ -147,8 +145,7 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp, flags) - bindaddr.maxlen = bindaddr.len = sizeof (struct sockaddr_in); - bindaddr.buf = raddr; - -- if (__binddynport(fd) == -1) -- goto err; -+ bindresvport(fd, NULL); - cl = clnt_tli_create(fd, nconf, &bindaddr, prog, vers, - sendsz, recvsz); - if (cl) { -diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c -index a94fc73..4b44364 100644 ---- a/src/rpcb_clnt.c -+++ b/src/rpcb_clnt.c -@@ -752,7 +752,7 @@ __try_protocol_version_2(program, version, nconf, host, tp) - - client = getpmaphandle(nconf, host, &parms.r_addr); - if (client == NULL) -- return (NULL); -+ goto error; - - /* - * Set retry timeout. -@@ -771,11 +771,11 @@ __try_protocol_version_2(program, version, nconf, host, tp) - if (clnt_st != RPC_SUCCESS) { - rpc_createerr.cf_stat = RPC_PMAPFAILURE; - clnt_geterr(client, &rpc_createerr.cf_error); -- return (NULL); -+ goto error; - } else if (port == 0) { - pmapaddress = NULL; - rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED; -- return (NULL); -+ goto error; - } - port = htons(port); - CLNT_CONTROL(client, CLGET_SVC_ADDR, (char *)&remote); -@@ -789,14 +789,24 @@ __try_protocol_version_2(program, version, nconf, host, tp) - free(pmapaddress); - pmapaddress = NULL; - } -- return (NULL); -+ goto error; - } - memcpy(pmapaddress->buf, remote.buf, remote.len); - memcpy(&((char *)pmapaddress->buf)[sizeof (short)], - (char *)(void *)&port, sizeof (short)); - pmapaddress->len = pmapaddress->maxlen = remote.len; - -+ CLNT_DESTROY(client); - return pmapaddress; -+ -+error: -+ if (client) { -+ CLNT_DESTROY(client); -+ client = NULL; -+ -+ } -+ return (NULL); -+ - } - #endif -