diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2016-10-05 17:35:56 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-10-10 12:04:20 +0000 |
commit | 3e2cb134319f31ba0b311f2e7ee5770f74fb1f5d (patch) | |
tree | a726aa696b56ce5d6d9f1aa4c723bc8242982ecf /main/rpcbind | |
parent | 0546356deedf5b8fd1394768d38a68c089838de6 (diff) | |
download | aports-3e2cb134319f31ba0b311f2e7ee5770f74fb1f5d.tar.bz2 aports-3e2cb134319f31ba0b311f2e7ee5770f74fb1f5d.tar.xz |
main/rpcbind: upgrade to latest git (0.2.4-rc1)
Diffstat (limited to 'main/rpcbind')
-rw-r--r-- | main/rpcbind/0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch | 223 | ||||
-rw-r--r-- | main/rpcbind/0002-uclibc-rpcsvc-defines.patch | 58 | ||||
-rw-r--r-- | main/rpcbind/APKBUILD | 55 | ||||
-rw-r--r-- | main/rpcbind/CVE-2015-7236.patch | 78 | ||||
-rw-r--r-- | main/rpcbind/git.patch | 388 | ||||
-rw-r--r-- | main/rpcbind/musl-poll.patch | 19 | ||||
-rw-r--r-- | main/rpcbind/musl-sunrpc.patch | 25 |
7 files changed, 409 insertions, 437 deletions
diff --git a/main/rpcbind/0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch b/main/rpcbind/0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch deleted file mode 100644 index 1fcd228715..0000000000 --- a/main/rpcbind/0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch +++ /dev/null @@ -1,223 +0,0 @@ -From 2a44d862233f2126581e290d568e1c8b8f2eb9f5 Mon Sep 17 00:00:00 2001 -From: Carlo Landmeter <clandmeter@gmail.com> -Date: Thu, 19 Feb 2015 15:28:45 +0000 -Subject: [PATCH] Avoid use of glibc sys/cdefs.h header - ---- - src/check_bound.c | 2 +- - src/pmap_svc.c | 10 +++++----- - src/rpcb_svc.c | 10 +++++----- - src/rpcb_svc_4.c | 14 +++++++------- - src/rpcb_svc_com.c | 46 +++++++++++++++++++++++----------------------- - src/rpcbind.c | 12 ++++++------ - src/util.c | 2 +- - src/warmstart.c | 4 ++-- - 8 files changed, 50 insertions(+), 50 deletions(-) - -diff --git a/src/check_bound.c b/src/check_bound.c -index c70b845..5d21730 100644 ---- a/src/check_bound.c -+++ b/src/check_bound.c -@@ -70,7 +70,7 @@ static struct fdlist *fdhead; /* Link list of the check fd's */ - static struct fdlist *fdtail; - static char *nullstring = ""; - --static bool_t check_bound __P((struct fdlist *, char *uaddr)); -+static bool_t check_bound (struct fdlist *, char *uaddr); - - /* - * Returns 1 if the given address is bound for the given addr & transport -diff --git a/src/pmap_svc.c b/src/pmap_svc.c -index ad28b93..9c7d409 100644 ---- a/src/pmap_svc.c -+++ b/src/pmap_svc.c -@@ -60,11 +60,11 @@ static char sccsid[] = "@(#)pmap_svc.c 1.23 89/04/05 Copyr 1984 Sun Micro"; - #include "rpcbind.h" - #include "xlog.h" - #include <rpc/svc_soc.h> /* svc_getcaller routine definition */ --static struct pmaplist *find_service_pmap __P((rpcprog_t, rpcvers_t, -- rpcprot_t)); --static bool_t pmapproc_change __P((struct svc_req *, SVCXPRT *, u_long)); --static bool_t pmapproc_getport __P((struct svc_req *, SVCXPRT *)); --static bool_t pmapproc_dump __P((struct svc_req *, SVCXPRT *)); -+static struct pmaplist *find_service_pmap (rpcprog_t, rpcvers_t, -+ rpcprot_t); -+static bool_t pmapproc_change (struct svc_req *, SVCXPRT *, u_long); -+static bool_t pmapproc_getport (struct svc_req *, SVCXPRT *); -+static bool_t pmapproc_dump (struct svc_req *, SVCXPRT *); - - /* - * Called for all the version 2 inquiries. -diff --git a/src/rpcb_svc.c b/src/rpcb_svc.c -index 92361a2..95ffb9b 100644 ---- a/src/rpcb_svc.c -+++ b/src/rpcb_svc.c -@@ -52,10 +52,10 @@ - - #include "rpcbind.h" - --static void *rpcbproc_getaddr_3_local __P((void *, struct svc_req *, SVCXPRT *, -- rpcvers_t)); --static void *rpcbproc_dump_3_local __P((void *, struct svc_req *, SVCXPRT *, -- rpcvers_t)); -+static void *rpcbproc_getaddr_3_local (void *, struct svc_req *, SVCXPRT *, -+ rpcvers_t); -+static void *rpcbproc_dump_3_local (void *, struct svc_req *, SVCXPRT *, -+ rpcvers_t); - - /* - * Called by svc_getreqset. There is a separate server handle for -@@ -74,7 +74,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp) - } argument; - char *result; - xdrproc_t xdr_argument, xdr_result; -- void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); -+ void *(*local) (void *, struct svc_req *, SVCXPRT *, rpcvers_t); - rpcprog_t setprog = 0; - - rpcbs_procinfo(RPCBVERS_3_STAT, rqstp->rq_proc); -diff --git a/src/rpcb_svc_4.c b/src/rpcb_svc_4.c -index f1a72a6..b6fc6a8 100644 ---- a/src/rpcb_svc_4.c -+++ b/src/rpcb_svc_4.c -@@ -53,13 +53,13 @@ - #include <stdlib.h> - #include "rpcbind.h" - --static void *rpcbproc_getaddr_4_local __P((void *, struct svc_req *, SVCXPRT *, -- rpcvers_t)); --static void *rpcbproc_getversaddr_4_local __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); -+static void *rpcbproc_getaddr_4_local (void *, struct svc_req *, SVCXPRT *, -+ rpcvers_t); -+static void *rpcbproc_getversaddr_4_local (void *, struct svc_req *, SVCXPRT *, rpcvers_t); - static void *rpcbproc_getaddrlist_4_local -- __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); --static void free_rpcb_entry_list __P((rpcb_entry_list_ptr *)); --static void *rpcbproc_dump_4_local __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); -+ (void *, struct svc_req *, SVCXPRT *, rpcvers_t); -+static void free_rpcb_entry_list (rpcb_entry_list_ptr *); -+static void *rpcbproc_dump_4_local (void *, struct svc_req *, SVCXPRT *, rpcvers_t); - - /* - * Called by svc_getreqset. There is a separate server handle for -@@ -77,7 +77,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp) - } argument; - char *result; - xdrproc_t xdr_argument, xdr_result; -- void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); -+ void *(*local) (void *, struct svc_req *, SVCXPRT *, rpcvers_t); - rpcprog_t setprog = 0; - - rpcbs_procinfo(RPCBVERS_4_STAT, rqstp->rq_proc); -diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c -index 9a094f5..0b556a2 100644 ---- a/src/rpcb_svc_com.c -+++ b/src/rpcb_svc_com.c -@@ -99,29 +99,29 @@ struct finfo { - static struct finfo FINFO[NFORWARD]; - - --static bool_t xdr_encap_parms __P((XDR *, struct encap_parms *)); --static bool_t xdr_rmtcall_args __P((XDR *, struct r_rmtcall_args *)); --static bool_t xdr_rmtcall_result __P((XDR *, struct r_rmtcall_args *)); --static bool_t xdr_opaque_parms __P((XDR *, struct r_rmtcall_args *)); --static int find_rmtcallfd_by_netid __P((char *)); --static SVCXPRT *find_rmtcallxprt_by_fd __P((int)); --static int forward_register __P((u_int32_t, struct netbuf *, int, char *, -- rpcproc_t, rpcvers_t, u_int32_t *)); --static struct finfo *forward_find __P((u_int32_t)); --static int free_slot_by_xid __P((u_int32_t)); --static int free_slot_by_index __P((int)); --static int netbufcmp __P((struct netbuf *, struct netbuf *)); --static struct netbuf *netbufdup __P((struct netbuf *)); --static void netbuffree __P((struct netbuf *)); --static int check_rmtcalls __P((struct pollfd *, int)); --static void xprt_set_caller __P((SVCXPRT *, struct finfo *)); --static void send_svcsyserr __P((SVCXPRT *, struct finfo *)); --static void handle_reply __P((int, SVCXPRT *)); --static void find_versions __P((rpcprog_t, char *, rpcvers_t *, rpcvers_t *)); --static rpcblist_ptr find_service __P((rpcprog_t, rpcvers_t, char *)); --static char *getowner __P((SVCXPRT *, char *, size_t)); --static int add_pmaplist __P((RPCB *)); --static int del_pmaplist __P((RPCB *)); -+static bool_t xdr_encap_parms (XDR *, struct encap_parms *); -+static bool_t xdr_rmtcall_args (XDR *, struct r_rmtcall_args *); -+static bool_t xdr_rmtcall_result (XDR *, struct r_rmtcall_args *); -+static bool_t xdr_opaque_parms (XDR *, struct r_rmtcall_args *); -+static int find_rmtcallfd_by_netid (char *); -+static SVCXPRT *find_rmtcallxprt_by_fd (int); -+static int forward_register (u_int32_t, struct netbuf *, int, char *, -+ rpcproc_t, rpcvers_t, u_int32_t *); -+static struct finfo *forward_find (u_int32_t); -+static int free_slot_by_xid (u_int32_t); -+static int free_slot_by_index (int); -+static int netbufcmp (struct netbuf *, struct netbuf *); -+static struct netbuf *netbufdup (struct netbuf *); -+static void netbuffree (struct netbuf *); -+static int check_rmtcalls (struct pollfd *, int); -+static void xprt_set_caller (SVCXPRT *, struct finfo *); -+static void send_svcsyserr (SVCXPRT *, struct finfo *); -+static void handle_reply (int, SVCXPRT *); -+static void find_versions (rpcprog_t, char *, rpcvers_t *, rpcvers_t *); -+static rpcblist_ptr find_service (rpcprog_t, rpcvers_t, char *); -+static char *getowner (SVCXPRT *, char *, size_t); -+static int add_pmaplist (RPCB *); -+static int del_pmaplist (RPCB *); - - /* - * Set a mapping of program, version, netid -diff --git a/src/rpcbind.c b/src/rpcbind.c -index 6d8bed2..63da6b2 100644 ---- a/src/rpcbind.c -+++ b/src/rpcbind.c -@@ -132,13 +132,13 @@ char *tcp_uaddr; /* Universal TCP address */ - static char servname[] = "rpcbind"; - static char superuser[] = "superuser"; - --int main __P((int, char *[])); -+int main (int, char *[]); - --static int init_transport __P((struct netconfig *)); --static void rbllist_add __P((rpcprog_t, rpcvers_t, struct netconfig *, -- struct netbuf *)); --static void terminate __P((int)); --static void parseargs __P((int, char *[])); -+static int init_transport (struct netconfig *); -+static void rbllist_add (rpcprog_t, rpcvers_t, struct netconfig *, -+ struct netbuf *); -+static void terminate (int); -+static void parseargs (int, char *[]); - - int - main(int argc, char *argv[]) -diff --git a/src/util.c b/src/util.c -index a6c835b..ff9e1f4 100644 ---- a/src/util.c -+++ b/src/util.c -@@ -70,7 +70,7 @@ static struct sockaddr_in *local_in4; - static struct sockaddr_in6 *local_in6; - #endif - --static int bitmaskcmp __P((void *, void *, void *, int)); -+static int bitmaskcmp (void *, void *, void *, int); - - /* - * For all bits set in "mask", compare the corresponding bits in -diff --git a/src/warmstart.c b/src/warmstart.c -index b6eb73e..42dd3af 100644 ---- a/src/warmstart.c -+++ b/src/warmstart.c -@@ -58,8 +58,8 @@ - #define PMAPFILE RPCBIND_STATEDIR "/portmap.xdr" - #endif - --static bool_t write_struct __P((char *, xdrproc_t, void *)); --static bool_t read_struct __P((char *, xdrproc_t, void *)); -+static bool_t write_struct (char *, xdrproc_t, void *); -+static bool_t read_struct (char *, xdrproc_t, void *); - - static bool_t - write_struct(char *filename, xdrproc_t structproc, void *list) --- -2.2.2 - diff --git a/main/rpcbind/0002-uclibc-rpcsvc-defines.patch b/main/rpcbind/0002-uclibc-rpcsvc-defines.patch deleted file mode 100644 index 2803ef6690..0000000000 --- a/main/rpcbind/0002-uclibc-rpcsvc-defines.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 077add040c2e30d3ac507362f4afe350f47be027 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Tue, 2 Feb 2010 09:47:57 +0000 -Subject: [PATCH 2/2] uclibc-rpcsvc-defines - ---- - src/security.c | 28 ++++++++++++++++++++++++++++ - 1 files changed, 28 insertions(+), 0 deletions(-) - -diff --git a/src/security.c b/src/security.c -index 0edeac6..e9fed55 100644 ---- a/src/security.c -+++ b/src/security.c -@@ -20,6 +20,32 @@ - /* - * XXX for special case checks in check_callit. - */ -+#if defined(__UCLIBC__) || !defined(__GLIBC__) -+ -+#define MOUNTPROC_MNT 1 -+#define MOUNTPROC_UMNT 3 -+ -+#define NFS_PROGRAM 100003 -+#define YPPROG 100004 -+#define MOUNTPROG 100005 -+#define YPBINDPROG 100007 -+#define YPPASSWDPROG 100009 -+#define RQUOTAPROG 100011 -+ -+#define YPPROC_NULL 0 -+#define YPPROC_DOMAIN 1 -+#define YPPROC_DOMAIN_NONACK 2 -+#define YPPROC_MATCH 3 -+#define YPPROC_FIRST 4 -+#define YPPROC_NEXT 5 -+#define YPPROC_XFR 6 -+#define YPPROC_CLEAR 7 -+#define YPPROC_ALL 8 -+ -+#define YPBINDPROC_SETDOM 2 -+ -+#else -+ - #include <rpcsvc/mount.h> - #include <rpcsvc/rquota.h> - #include <rpcsvc/nfs_prot.h> -@@ -27,6 +53,8 @@ - #include <rpcsvc/ypclnt.h> - #include <rpcsvc/yppasswd.h> - -+#endif -+ - #include "rpcbind.h" - - #ifdef LIBWRAP --- -1.6.6.1 - diff --git a/main/rpcbind/APKBUILD b/main/rpcbind/APKBUILD index b0b619f1e0..6a415e242f 100644 --- a/main/rpcbind/APKBUILD +++ b/main/rpcbind/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=rpcbind pkgver=0.2.3 -pkgrel=2 +pkgrel=3 pkgdesc="portmap replacement which supports RPC over various protocols" url="http://rpcbind.sourceforge.net" arch="all" @@ -10,28 +10,27 @@ depends= install="$pkgname.pre-install $pkgname.pre-upgrade" makedepends="libtirpc-dev autoconf automake bsd-compat-headers" subpackages="$pkgname-dbg $pkgname-doc" -source="$pkgname-$pkgver.tar.gz::http://git.infradead.org/users/steved/rpcbind.git/snapshot/95cb04e539a74dbf53e87a13c291389a3e6d4f1d.tar.gz - 0002-uclibc-rpcsvc-defines.patch - musl-poll.patch - musl-sunrpc.patch +source="http://downloads.sourceforge.net/project/rpcbind/rpcbind/$pkgver/rpcbind-$pkgver.tar.bz2 + git.patch rpcbind.initd rpcbind.confd - 0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch - CVE-2015-7236.patch" + " -_builddir="$srcdir"/rpcbind-95cb04e +builddir="$srcdir"/rpcbind-$pkgver prepare() { - cd "$_builddir" + cd "$builddir" for i in $source; do case $i in *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; esac done - autoreconf -fisv || return 1 + sh autogen.sh || return 1 } build() { - cd "$_builddir" + cd "$builddir" + unset CC + unset CFLAGS ./configure \ --build=$CBUILD \ --host=$CHOST \ @@ -43,37 +42,25 @@ build() { --enable-debug \ --with-systemdsystemunitdir='no' \ || return 1 - make || return 1 + make -j1 || return 1 } package() { - cd "$_builddir" + cd "$builddir" make DESTDIR="$pkgdir" install || return 1 install -Dm755 "$srcdir"/rpcbind.initd "$pkgdir"/etc/init.d/rpcbind install -Dm644 "$srcdir"/rpcbind.confd "$pkgdir"/etc/conf.d/rpcbind install -D -m644 COPYING "$pkgdir"/usr/share/licenses/rpcbind/COPYING } -md5sums="01eb2544467d6239c1a1de8ab19d2bcf rpcbind-0.2.3.tar.gz -bea09b7ec434264756ec7c09da59b8bf 0002-uclibc-rpcsvc-defines.patch -30bf8bbad7e28239a4fdd5f075640663 musl-poll.patch -7825226deb532d8b91380e5425304965 musl-sunrpc.patch +md5sums="c8875246b2688a1adfbd6ad43480278d rpcbind-0.2.3.tar.bz2 +04c7ba5d58d6a45671987416da4cbaa4 git.patch 4fbc48760c73976457349150779b3b8b rpcbind.initd -2517c71cdb08f133b0d50055a44c56de rpcbind.confd -cab57f0dcff8425e5a00241f6e75e64a 0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch -940f7bed3ee84d3f827a2bfd6f19c624 CVE-2015-7236.patch" -sha256sums="7d0bbc262138c5f9f2b42f53c1953bf5440379cfe3a926fc400926b44bba6d81 rpcbind-0.2.3.tar.gz -86f56219652ce4e8009b6bb28c8a970fff55fff22c244d10efbe6e097a2e66f9 0002-uclibc-rpcsvc-defines.patch -91b795f046e956ded5d16b77867a6c8199f4b221e4cab467865b16f26b8bfd32 musl-poll.patch -8852c055fa257113d3df3525a5600e6f02f4eacba29cf98a8c0c714e4551cfc9 musl-sunrpc.patch +2517c71cdb08f133b0d50055a44c56de rpcbind.confd" +sha256sums="9897823a9d820ea011d9ea02054d5ab99469b9ca5346265fee380713c8fed27b rpcbind-0.2.3.tar.bz2 +4bb0809463d4e18c81c1a1802edda1cc314e1a6890ad3a229cb0ef4723d0bf26 git.patch ed0906acfda9f038776530ef56fcbea8627837f707682ce7311e10c7259cfb15 rpcbind.initd -55bcd47a4d0f194f09e6abb13695853459f869b54ce09ef051e55efcd8ad3903 rpcbind.confd -a1af9dd7631205d35d8bae464b5eb9965ec16952fb9479d1e58dd2fbd40f3ec3 0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch -e7aafff7fe20a5d9fdb0f93a5b6824e136934f4fbb20d210f398e851cb13f419 CVE-2015-7236.patch" -sha512sums="632c1025a562adfd2487aa22f5d8f3a49b93a16beb202c7736eae7e466ca481f0b6ea4c71842bd577555ab823ba10ec8e13d78a6f1d15f57b3b23bcc5893bd61 rpcbind-0.2.3.tar.gz -205dcf072055f3ff0477b26f63be7e228244bcaeaf3670ad9f5a9a39faa9d58f89b9eb2a98d79059a749b6ff834d37c260e71a8b06507027e315b29152b2a94d 0002-uclibc-rpcsvc-defines.patch -9ff75b07622f12dd8363ad21709bd60addcb7d428aa9e181467e8da0c4ac087653934fdfb7bcec31c52b43a96a1829793cee18e68878d5cc69fa920865bdbad8 musl-poll.patch -f8782018825e176adcb323c93cdf44612914a7a71e12f2dd4afb1593c62b91709fcf62246cc4e57ae2527d117cb05eabfc8436958da524186490615bf50c0bd4 musl-sunrpc.patch +55bcd47a4d0f194f09e6abb13695853459f869b54ce09ef051e55efcd8ad3903 rpcbind.confd" +sha512sums="b91cb4e0849213d344063ccf32d16c49819906b65e4d07c4aa7d3c8842bd83acb408d07aa285da902c389f3c9716f01678012b93a11863eb174a2577cd6ba1d6 rpcbind-0.2.3.tar.bz2 +f797f5bd309a64955c0acdcab970ecef192f7849862e676ec361977abbb8f05ec36b839b94cf3abc71956e467ace2c2ebf5d190db2874f4249d5a7d0037a9751 git.patch 1cd655d86226a45fa3e927f8ac2bb580537644d2fb3684e0f4a956bf3721c95d95b8b8c1d9a2a742fb714eeba9277e0400a7493bf1bf676466d70adb2b35a88e rpcbind.initd -0641087162ebc8fb10c5cb329105261d77cad073daed3f9a6c92574177298cd8a19a87b62dde14161cc554b5e68680cfd870b5334f3cfd8d6074ec8a43f4dfe3 rpcbind.confd -a2e2d2539b5943c93a9d44f11679ff5b7ca958b49040015a50e6a6bb865663031993e2888453b3c4ee0bef74f1eecc39a1b785ffcb1b596b156d24741154c2b5 0001-Avoid-use-of-glibc-sys-cdefs.h-header.patch -c91628b6e5758a02790651d914f35c10d19807955721d910a4d391cde0071efee169cfddd788855677bc1d509fba3a1bc5e40601d327a5f7f8487ad8f06b197a CVE-2015-7236.patch" +0641087162ebc8fb10c5cb329105261d77cad073daed3f9a6c92574177298cd8a19a87b62dde14161cc554b5e68680cfd870b5334f3cfd8d6074ec8a43f4dfe3 rpcbind.confd" diff --git a/main/rpcbind/CVE-2015-7236.patch b/main/rpcbind/CVE-2015-7236.patch deleted file mode 100644 index 29c3e1a6d0..0000000000 --- a/main/rpcbind/CVE-2015-7236.patch +++ /dev/null @@ -1,78 +0,0 @@ -commit 06f7ebb1dade2f0dbf872ea2bedf17cff4734bdd -Author: Olaf Kirch <okir () suse de> -Date: Thu Aug 6 16:27:20 2015 +0200 - - 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> - ---- - src/rpcb_svc_com.c | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - ---- a/src/rpcb_svc_com.c -+++ b/src/rpcb_svc_com.c -@@ -1204,12 +1204,33 @@ check_rmtcalls(struct pollfd *pfds, int - 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; - } diff --git a/main/rpcbind/git.patch b/main/rpcbind/git.patch new file mode 100644 index 0000000000..4c08bd60e8 --- /dev/null +++ b/main/rpcbind/git.patch @@ -0,0 +1,388 @@ +diff --git a/src/check_bound.c b/src/check_bound.c +index c70b845..92bfd36 100644 +--- a/src/check_bound.c ++++ b/src/check_bound.c +@@ -70,7 +70,7 @@ static struct fdlist *fdhead; /* Link list of the check fd's */ + static struct fdlist *fdtail; + static char *nullstring = ""; + +-static bool_t check_bound __P((struct fdlist *, char *uaddr)); ++static bool_t check_bound(struct fdlist *, char *uaddr); + + /* + * Returns 1 if the given address is bound for the given addr & transport +diff --git a/src/pmap_svc.c b/src/pmap_svc.c +index ad28b93..4c744fe 100644 +--- a/src/pmap_svc.c ++++ b/src/pmap_svc.c +@@ -60,11 +60,11 @@ static char sccsid[] = "@(#)pmap_svc.c 1.23 89/04/05 Copyr 1984 Sun Micro"; + #include "rpcbind.h" + #include "xlog.h" + #include <rpc/svc_soc.h> /* svc_getcaller routine definition */ +-static struct pmaplist *find_service_pmap __P((rpcprog_t, rpcvers_t, +- rpcprot_t)); +-static bool_t pmapproc_change __P((struct svc_req *, SVCXPRT *, u_long)); +-static bool_t pmapproc_getport __P((struct svc_req *, SVCXPRT *)); +-static bool_t pmapproc_dump __P((struct svc_req *, SVCXPRT *)); ++static struct pmaplist *find_service_pmap(rpcprog_t, rpcvers_t, ++ rpcprot_t); ++static bool_t pmapproc_change(struct svc_req *, SVCXPRT *, u_long); ++static bool_t pmapproc_getport(struct svc_req *, SVCXPRT *); ++static bool_t pmapproc_dump(struct svc_req *, SVCXPRT *); + + /* + * Called for all the version 2 inquiries. +diff --git a/src/rpcb_svc.c b/src/rpcb_svc.c +index bd92201..709e3fb 100644 +--- a/src/rpcb_svc.c ++++ b/src/rpcb_svc.c +@@ -53,10 +53,10 @@ + #include "rpcbind.h" + #include "xlog.h" + +-static void *rpcbproc_getaddr_3_local __P((void *, struct svc_req *, SVCXPRT *, +- rpcvers_t)); +-static void *rpcbproc_dump_3_local __P((void *, struct svc_req *, SVCXPRT *, +- rpcvers_t)); ++static void *rpcbproc_getaddr_3_local(void *, struct svc_req *, SVCXPRT *, ++ rpcvers_t); ++static void *rpcbproc_dump_3_local(void *, struct svc_req *, SVCXPRT *, ++ rpcvers_t); + + /* + * Called by svc_getreqset. There is a separate server handle for +@@ -75,7 +75,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp) + } argument; + char *result; + xdrproc_t xdr_argument, xdr_result; +- void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); ++ void *(*local)(void *, struct svc_req *, SVCXPRT *, rpcvers_t); + rpcprog_t setprog = 0; + + rpcbs_procinfo(RPCBVERS_3_STAT, rqstp->rq_proc); +diff --git a/src/rpcb_svc_4.c b/src/rpcb_svc_4.c +index b673452..5094879 100644 +--- a/src/rpcb_svc_4.c ++++ b/src/rpcb_svc_4.c +@@ -54,13 +54,11 @@ + #include "rpcbind.h" + #include "xlog.h" + +-static void *rpcbproc_getaddr_4_local __P((void *, struct svc_req *, SVCXPRT *, +- rpcvers_t)); +-static void *rpcbproc_getversaddr_4_local __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); +-static void *rpcbproc_getaddrlist_4_local +- __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); +-static void free_rpcb_entry_list __P((rpcb_entry_list_ptr *)); +-static void *rpcbproc_dump_4_local __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); ++static void *rpcbproc_getaddr_4_local(void *, struct svc_req *, SVCXPRT *, rpcvers_t); ++static void *rpcbproc_getversaddr_4_local(void *, struct svc_req *, SVCXPRT *, rpcvers_t); ++static void *rpcbproc_getaddrlist_4_local(void *, struct svc_req *, SVCXPRT *, rpcvers_t); ++static void free_rpcb_entry_list(rpcb_entry_list_ptr *); ++static void *rpcbproc_dump_4_local(void *, struct svc_req *, SVCXPRT *, rpcvers_t); + + /* + * Called by svc_getreqset. There is a separate server handle for +@@ -78,7 +76,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp) + } argument; + char *result; + xdrproc_t xdr_argument, xdr_result; +- void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t)); ++ void *(*local)(void *, struct svc_req *, SVCXPRT *, rpcvers_t); + rpcprog_t setprog = 0; + + rpcbs_procinfo(RPCBVERS_4_STAT, rqstp->rq_proc); +diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c +index ff9ce6b..5862c26 100644 +--- a/src/rpcb_svc_com.c ++++ b/src/rpcb_svc_com.c +@@ -100,29 +100,29 @@ struct finfo { + static struct finfo FINFO[NFORWARD]; + + +-static bool_t xdr_encap_parms __P((XDR *, struct encap_parms *)); +-static bool_t xdr_rmtcall_args __P((XDR *, struct r_rmtcall_args *)); +-static bool_t xdr_rmtcall_result __P((XDR *, struct r_rmtcall_args *)); +-static bool_t xdr_opaque_parms __P((XDR *, struct r_rmtcall_args *)); +-static int find_rmtcallfd_by_netid __P((char *)); +-static SVCXPRT *find_rmtcallxprt_by_fd __P((int)); +-static int forward_register __P((u_int32_t, struct netbuf *, int, char *, +- rpcproc_t, rpcvers_t, u_int32_t *)); +-static struct finfo *forward_find __P((u_int32_t)); +-static int free_slot_by_xid __P((u_int32_t)); +-static int free_slot_by_index __P((int)); +-static int netbufcmp __P((struct netbuf *, struct netbuf *)); +-static struct netbuf *netbufdup __P((struct netbuf *)); +-static void netbuffree __P((struct netbuf *)); +-static int check_rmtcalls __P((struct pollfd *, int)); +-static void xprt_set_caller __P((SVCXPRT *, struct finfo *)); +-static void send_svcsyserr __P((SVCXPRT *, struct finfo *)); +-static void handle_reply __P((int, SVCXPRT *)); +-static void find_versions __P((rpcprog_t, char *, rpcvers_t *, rpcvers_t *)); +-static rpcblist_ptr find_service __P((rpcprog_t, rpcvers_t, char *)); +-static char *getowner __P((SVCXPRT *, char *, size_t)); +-static int add_pmaplist __P((RPCB *)); +-static int del_pmaplist __P((RPCB *)); ++static bool_t xdr_encap_parms(XDR *, struct encap_parms *); ++static bool_t xdr_rmtcall_args(XDR *, struct r_rmtcall_args *); ++static bool_t xdr_rmtcall_result(XDR *, struct r_rmtcall_args *); ++static bool_t xdr_opaque_parms(XDR *, struct r_rmtcall_args *); ++static int find_rmtcallfd_by_netid(char *); ++static SVCXPRT *find_rmtcallxprt_by_fd(int); ++static int forward_register(u_int32_t, struct netbuf *, int, char *, ++ rpcproc_t, rpcvers_t, u_int32_t *); ++static struct finfo *forward_find(u_int32_t); ++static int free_slot_by_xid(u_int32_t); ++static int free_slot_by_index(int); ++static int netbufcmp(struct netbuf *, struct netbuf *); ++static struct netbuf *netbufdup(struct netbuf *); ++static void netbuffree(struct netbuf *); ++static int check_rmtcalls(struct pollfd *, int); ++static void xprt_set_caller(SVCXPRT *, struct finfo *); ++static void send_svcsyserr(SVCXPRT *, struct finfo *); ++static void handle_reply(int, SVCXPRT *); ++static void find_versions(rpcprog_t, char *, rpcvers_t *, rpcvers_t *); ++static rpcblist_ptr find_service(rpcprog_t, rpcvers_t, char *); ++static char *getowner(SVCXPRT *, char *, size_t); ++static int add_pmaplist(RPCB *); ++static int del_pmaplist(RPCB *); + + /* + * Set a mapping of program, version, netid +@@ -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..87ccdc2 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 */ + +@@ -135,13 +136,13 @@ char *tcp_uaddr; /* Universal TCP address */ + static char servname[] = "rpcbind"; + static char superuser[] = "superuser"; + +-int main __P((int, char *[])); ++int main(int, char *[]); + +-static int init_transport __P((struct netconfig *)); +-static void rbllist_add __P((rpcprog_t, rpcvers_t, struct netconfig *, +- struct netbuf *)); +-static void terminate __P((int)); +-static void parseargs __P((int, char *[])); ++static int init_transport(struct netconfig *); ++static void rbllist_add(rpcprog_t, rpcvers_t, struct netconfig *, ++ struct netbuf *); ++static void terminate(int); ++static void parseargs(int, char *[]); + + int + main(int argc, char *argv[]) +@@ -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. + */ +diff --git a/src/util.c b/src/util.c +index a6c835b..74b0284 100644 +--- a/src/util.c ++++ b/src/util.c +@@ -70,7 +70,7 @@ static struct sockaddr_in *local_in4; + static struct sockaddr_in6 *local_in6; + #endif + +-static int bitmaskcmp __P((void *, void *, void *, int)); ++static int bitmaskcmp(void *, void *, void *, int); + + /* + * For all bits set in "mask", compare the corresponding bits in +diff --git a/src/warmstart.c b/src/warmstart.c +index b6eb73e..122a058 100644 +--- a/src/warmstart.c ++++ b/src/warmstart.c +@@ -58,8 +58,8 @@ + #define PMAPFILE RPCBIND_STATEDIR "/portmap.xdr" + #endif + +-static bool_t write_struct __P((char *, xdrproc_t, void *)); +-static bool_t read_struct __P((char *, xdrproc_t, void *)); ++static bool_t write_struct(char *, xdrproc_t, void *); ++static bool_t read_struct(char *, xdrproc_t, void *); + + static bool_t + write_struct(char *filename, xdrproc_t structproc, void *list) diff --git a/main/rpcbind/musl-poll.patch b/main/rpcbind/musl-poll.patch deleted file mode 100644 index 9996d78426..0000000000 --- a/main/rpcbind/musl-poll.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- rpcbind-0.2.1.orig/src/rpcb_svc_com.c -+++ rpcbind-0.2.1/src/rpcb_svc_com.c -@@ -42,8 +42,6 @@ - #include <sys/types.h> - #include <sys/stat.h> - #include <sys/param.h> --#include <sys/poll.h> --#include <bits/poll.h> - #include <sys/socket.h> - #include <rpc/rpc.h> - #include <rpc/rpcb_prot.h> -@@ -54,6 +52,7 @@ - #include <unistd.h> - #include <stdio.h> - #include <time.h> -+#include <poll.h> - #ifdef PORTMAP - #include <netinet/in.h> - #include <rpc/pmap_prot.h> diff --git a/main/rpcbind/musl-sunrpc.patch b/main/rpcbind/musl-sunrpc.patch deleted file mode 100644 index d8a2e27e24..0000000000 --- a/main/rpcbind/musl-sunrpc.patch +++ /dev/null @@ -1,25 +0,0 @@ -The musl implementation of getaddrinfo and getservbyname does not -aliases. As a workaround we use "sunprc" instead of "portmapper" - -diff --git a/src/rpcbind.c b/src/rpcbind.c -index 83dbe93..9404df7 100644 ---- a/src/rpcbind.c -+++ b/src/rpcbind.c -@@ -416,7 +416,7 @@ init_transport(struct netconfig *nconf) - if ((aicode = getaddrinfo(hosts[nhostsbak], - servname, &hints, &res)) != 0) { - if ((aicode = getaddrinfo(hosts[nhostsbak], -- "portmapper", &hints, &res)) != 0) { -+ "sunrpc", &hints, &res)) != 0) { - syslog(LOG_ERR, - "cannot get local address for %s: %s", - nconf->nc_netid, gai_strerror(aicode)); -@@ -489,7 +489,7 @@ init_transport(struct netconfig *nconf) - if ((strcmp(nconf->nc_netid, "local") != 0) && - (strcmp(nconf->nc_netid, "unix") != 0)) { - if ((aicode = getaddrinfo(NULL, servname, &hints, &res))!= 0) { -- if ((aicode = getaddrinfo(NULL, "portmapper", &hints, &res))!= 0) { -+ if ((aicode = getaddrinfo(NULL, "sunrpc", &hints, &res))!= 0) { - printf("cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); - syslog(LOG_ERR, - "cannot get local address for %s: %s", |