aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAric Belsito <lluixhi@gmail.com>2017-07-06 11:07:04 -0700
committerAric Belsito <lluixhi@gmail.com>2017-07-06 11:07:04 -0700
commit2ff3ccca9589b6d1f418ec45db7295549df0b3cd (patch)
tree13e5df241dc614f8b4fa84cc7e4f6addc9ed3d68
parentsys-kernel/dracut: version bump to 045-r2 (diff)
downloadmusl-2ff3ccca9589b6d1f418ec45db7295549df0b3cd.tar.gz
musl-2ff3ccca9589b6d1f418ec45db7295549df0b3cd.tar.bz2
musl-2ff3ccca9589b6d1f418ec45db7295549df0b3cd.zip
net-libs/libtirpc: version bump to 1.0.1-r2
patch needed to be refreshed because it conflicts with other patches.
-rw-r--r--net-libs/libtirpc/Manifest10
-rw-r--r--net-libs/libtirpc/files/libtirpc-1.0.1_add-des_impl-c-7f6bb9a3467a.patch29
-rw-r--r--net-libs/libtirpc/files/libtirpc-1.0.1_ifdef-out-yp-headers-742bbdff6ddf.patch30
-rw-r--r--net-libs/libtirpc/files/libtirpc-1.0.1_remove-des-deps-to-glibc-503ac2e9fa56.patch43
-rw-r--r--net-libs/libtirpc/files/libtirpc-1.0.1_remove-nis-h-dep-5f00f8c78c5d.patch137
-rw-r--r--net-libs/libtirpc/files/libtirpc-1.0.1_uclibc-dont-use-struct-rpcent.patch51
-rw-r--r--net-libs/libtirpc/files/libtirpc-1.0.1_uclibc-use-memset-not-bzero.patch21
-rw-r--r--net-libs/libtirpc/files/musl-1.0.1_r2.patch647
-rw-r--r--net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild2
-rw-r--r--net-libs/libtirpc/libtirpc-1.0.1-r2.ebuild70
10 files changed, 1038 insertions, 2 deletions
diff --git a/net-libs/libtirpc/Manifest b/net-libs/libtirpc/Manifest
index b1e5bd4b..2b955016 100644
--- a/net-libs/libtirpc/Manifest
+++ b/net-libs/libtirpc/Manifest
@@ -7,10 +7,18 @@ AUX 0007-no-des.patch 960 SHA256 12823f030b803045108df782018d04ca253d4439b0e9201
AUX git.patch 24736 SHA256 0a62de190d38660efff0ddbb73b5b6315fdc015c20cf9c235e35c0cf7eeb0e85 SHA512 4dd540470e9a25b5df0ea2c883dd647f26b71ed82e880c7efa4eed51dd98b898e18964a3ee998ceeadf39caed0a661f110f72157ec70584e33131d0a0f375a00 WHIRLPOOL 3b7fe2207ea84b56ce889778c4ef31669afe7dd340270063c1ac09accc3459e4d53bd5d084bfa090ec041fb188cd8bac6aad55d7fd60f43e485c89d53e06b14e
AUX libtirpc-0.2.5-stdarg.patch 667 SHA256 2b31b1148af9d96c9a9e6f609c0b5b03424954d6251c18d64b6119afd8afa6f7 SHA512 2197f8c2ed3b4dbfc54ee37e973a6e275d19c6dde5d066b9ce45beecdbb17c9e620d7c6f0997b7ebfeb2bd1741327028a793b34edd94d59a89c8b36ac102b025 WHIRLPOOL 90d4e88c18f0d93ab8dfef4981377c2a6df42ff90b70049d07e203e7b66a5087910fe501cf9e1b93782eb25a8b3a8680c03287ccc563b838f517e5d1524b12c5
AUX libtirpc-1.0.1-CVE-2017-8779.patch 7032 SHA256 091d3ff2b53a3ef9b20c61af19192434f652e528070fd57c706bce2988de0279 SHA512 b7c97f6f202cd57c988ff026e2805011942f470c71fdfd81a2647a0e197386db937b022f0056e6ad106bb143c36323835748965b4915a293b89efba3cd171c84 WHIRLPOOL 44f65f1fadec76e742641a3ec7c22f90f54309c3b9e6f1076b2de1dd14aaf0012c323d3c92599775b43446405253cf1375d9c4c3d5bf26d8de1224b42a552ead
+AUX libtirpc-1.0.1_add-des_impl-c-7f6bb9a3467a.patch 1207 SHA256 1e65651a135c7c10a5ffae19ff176eb479b125b252ff4222dcd6797d583d9163 SHA512 dd6c61bc885dace248bf69d9fa15d79cb8a73530c434f834a3c53ad5d3f5598b0b04786d9d708b25c53202d2421c0888e00b9c1a260abcafa776f25cef694c19 WHIRLPOOL d436222fa75dbf26346f870aedafb1326d61c883ba90a563e99e2d56b4fc3521296cfa7bb554bbca238dea37c5dde72de802a85cfd5193da330b4c8f6a6c5fd7
+AUX libtirpc-1.0.1_ifdef-out-yp-headers-742bbdff6ddf.patch 821 SHA256 96ffc42c9c7acf1b95b39f76f817caf9f2fd555de3fca593390154e1327e9777 SHA512 3733c1e88acf91f30ec647f83f6ad44d1dbe087e89996db7cd4197b7eed7924443fb4854bfb4c0e5ce0e2c7b3569e2af444a1e6a8a4139ea3c408e9838419b88 WHIRLPOOL 3a9cc31c4e2eb8dfbf1e3a44caabcc90c52d0d2c30088f2120ee549060d66923f5170b6b3129598d1c70886735b7f69e65fa7142db4c07331ece3487b3298ac2
+AUX libtirpc-1.0.1_remove-des-deps-to-glibc-503ac2e9fa56.patch 1232 SHA256 fffab75fc00ebcbb1d860d1869d9e525ede9aca68f46e40c9d94b2ee0e563d2d SHA512 24a5012481eae9d8152267287546b390edb0fe9925bc043df50a3b82057517487e8a1b94782adc9e14ac1e72ded9b1cb44dd25e09c9a5451053a26adb3a821a2 WHIRLPOOL e210f5417d74b8589c7898f319c91e5c3c6244e703fa9fbf3fb089ec63f2694f1f6acc082a30d2f3a55131e4b0d69708ac5c2785ae5b13651217d8047adba345
+AUX libtirpc-1.0.1_remove-nis-h-dep-5f00f8c78c5d.patch 4015 SHA256 c185fd419d636a0992813b3f674f9a847ba28c56a6236246f36f39d29214d6d9 SHA512 fcd76037bd78e298a261f288b51de6ff25d362c40a416e86ed2c766b3c106339e4633e92546b96b727d38d14c85566250be25b82c1093c470e8c8cb1c86faafa WHIRLPOOL b1d4d4f58f6dadad87680ef1a4f7e5b67035f9e36dff24d1609430c4de31c6bb3e169cb052f982198409a0521d7e2ee910df4e395709b05fa0a511e1580666ba
+AUX libtirpc-1.0.1_uclibc-dont-use-struct-rpcent.patch 2010 SHA256 a747da94e2a7d5dc260ddcd5d52a3a787f4dc78076e6f2d8444a42e997a00e70 SHA512 0486bd17ab67aaeba1ed536c20297f78091c2b5badb7ce41cd0cfdb0c6139e8501b827d40798b03f114e2bf03f4c98a684aa43f47cc5a1953f8245292a0f036a WHIRLPOOL bd3f9938903e4d70ce0710c608d7da85deb2f12f9a315809b5c127428869ffbce802ae5bce99aba531fb0399d5214345379478c5f7e463dcacb5dfeb33f4d8b7
+AUX libtirpc-1.0.1_uclibc-use-memset-not-bzero.patch 759 SHA256 177266c0e4658af8b5b6c1c0ff7ce7fca08410a5e1acf2c395a341e6a6de84a1 SHA512 122a1ae24fc08ede5580d31749f7e1cfc21266b628e2f82936feef856b2ea5b0da99f60291e5bdf87d87c5711891515b0c6bdc351b0bd46f97192ab215e5f25d WHIRLPOOL ebd781854a5b7d7f1fcd84e595d42c8394a5b9f7c8651c9750fe4fbdf5fd884e84ca081957f433d2aecb12bd5b5e9f9f0b81bb177fa8eae180c3d63344d4ed11
+AUX musl-1.0.1_r2.patch 19241 SHA256 bde66b09e13f2ee032254407c12b4753d9286ba49e4afc940b8224b9facd54b2 SHA512 9f36f4189f58ccb34d9261e03857b44fcd25276514e2e8c559df06a3c63c0f5a4748c4299bbd5b9e06ef78ee6306c6fe9762a17fe7bd19474e2b02b7e6e8ec3a WHIRLPOOL dd5c0f6c1fa741104597e8baabf98f750c7a510ad2f7a5fa6494e9d1ec4c325b89496c9c5af7fd345150548e05b53b0b2584b378f9fcac8276348213d70c7491
DIST libtirpc-0.2.5.tar.bz2 459094 SHA256 62f9de7c2c8686c568757730e1fef66502a0e00d6cacf33546d0267984e002db SHA512 9f8afa1acb04a2c2c558018f2528f8caaa79994a2af2abeed947f914145872ef72988b241e11925c799db0de9ec51fd9baecd2b08150240b22f91e2e55a45194 WHIRLPOOL a2b4f1c4825f2b774c2290cccd9d552bb7566ec9eb5988d3ab619d7870a907600f67e7af39fbc3e245606db8534f114c990145789c383206d3a9cf96cf043d8c
DIST libtirpc-1.0.1.tar.bz2 495125 SHA256 5156974f31be7ccbc8ab1de37c4739af6d9d42c87b1d5caf4835dda75fcbb89e SHA512 c9b449e737bc2bd3d56e31e8352f312e89a7ec2a11b73b5ac314e7d82d3b644c611e422b623912453b67b668f86a6de7bb7f18c9495dd15de8e2798ec2ff41c8 WHIRLPOOL cce6a4e69bd634b40d66594a81c23d2044b63eec16d6c96d6fcfaa7f2ca41fb9af99c8e2b964ec12be82682afa4090b218d7e14399fdfc9b32df6c2234bc3c9e
DIST libtirpc-glibc-nfs.tar.xz 8948 SHA256 2677cfedf626f3f5a8f6e507aed5bb8f79a7453b589d684dbbc086e755170d83 SHA512 90255bf0a27af16164e0710dd940778609925d473f4343093ff19d98cc4f23023788bf4edf0178eae1961afc0ba8b69b273de95b7d7e2afdb706701d8ba6f7ba WHIRLPOOL 06bcf3fd4e424a86071e5c4ddeb89aa571c862e765aae9382d9f9a55ab72cd1c623490555c1a9bd3380a2d04ecb10fb47a75a7dddf449d4368a1a01617226858
EBUILD libtirpc-0.2.5.ebuild 1899 SHA256 3623a04c9092a9a6dd668d70ac741ee55aeeab2c6d757e2c053bc78b833f3e97 SHA512 f25fe58b1d5aaa510350199d4ad7dc5d2956aaa35989a25da88215e9a9d446819b7e6ca788fef989892130cd1ee4baae68d87d6d6d7fd59596e4c6d484d53aa1 WHIRLPOOL 4da3882bee772b029e95fe3bc6c94f7e9cd30ff47cfd8e6537494e74e9423d4d8fd9e7248f1c019042812fe75d086ae4fb24f3531b146b0b8dd91ad547c7d295
-EBUILD libtirpc-1.0.1-r1.ebuild 1510 SHA256 646fc1d6c278f78d3e6bb2fc5a2a721904a988957c74d333e745dddfc1d9a1fb SHA512 3921cefb7f47e8a41d35a00a0514519401efaee39636af2ba55a3d9fe49966b3522fcdf46f4422f2cffedf96acbb90fb140c7721b554961416c47f875217a48d WHIRLPOOL c7c62d749213adb69ada4158f09d2d66b7d23088fb63c5d73fef6ae6ed83ca9ef4a7ab00e3bab8f8f2b2025d14af1e6596ae189c322c34857b02b7b90d774446
+EBUILD libtirpc-1.0.1-r1.ebuild 1501 SHA256 819b3f7246eb4af6832d7f3ac8ea4ec8ff4308d2c0d594bd2911662a329a09a3 SHA512 69ffef74821ee6f82f4a7427551d8564603f10df32faaf6e7747468e0ea92e3f6ceb8ea6407960e8f5f67d4d387a54747f0c508ac98a919b613221371ad27943 WHIRLPOOL b388716fd19206e0e7cb78797e927f9b6a70a53e6f1fc660cbf6f1d6adf0d4f307931c93dc8182bcaeb095cd0058b26089dee2a1187a3d1db3e02cac4bd7f4df
+EBUILD libtirpc-1.0.1-r2.ebuild 1887 SHA256 26fb1034f5a509486be4e2f2608630a8a448b7f4e61361bfb7d4fc0173220e60 SHA512 9b99f89e2a573fea295332a174e70c19cb633350bbf3c8076c06f7ab10fff6f3548faeaad62b225a39bda0d4a281f191be618a4289a312021ac11be3955ba9f4 WHIRLPOOL c2639ac9a48f23a629fa7fcecbd81dc2cb75a9a1e97ed8d7552261199cbf465a76ea625527eb1fcd419612b1895dcbcd3abbdb3b08d86332f6e7d69c9bccedb9
EBUILD libtirpc-1.0.1.ebuild 1438 SHA256 0f072addbde3ed907efd658759cb39cf61769760ef13f9d08cb4e24e0a12422f SHA512 b98ac6adaf451cad9e9bb5376ccf44e6386d9b2949786258c11871315a18fb8f0c03b1473e00c78f44e8b671c0825807dde98d0b643f5dcbca6ee6c1127731bd WHIRLPOOL 74b7d1382ae2fc5f90e17e43e5b99954402b856b28f209973b0a5c76ea99d4eeafcc5b06e210745f56e6ebbbc3b606af0ffcd7d522d110b28e88d8ad8bc88f25
MISC metadata.xml 335 SHA256 02e9487e791e2d6aa99e74025dd90a6c54d86c73d530c96316e93f7552e1439a SHA512 d6dd857293827907e545dc6e8631d06682d20e13442f8ce6cbd2e2a789d885c8a788f4ed1d062a8c54c4165d22eb096279d4c2f598e462a57faaf8bec1e9777b WHIRLPOOL 6a802fc6b1fdd5bc815c4d2d41de0cba5cff351cdd1fa80021c02233b3facf21674d94ec7b822c2d514e5e1c721cf3ae2b88c885afdce8a7b60d2e63da71183c
diff --git a/net-libs/libtirpc/files/libtirpc-1.0.1_add-des_impl-c-7f6bb9a3467a.patch b/net-libs/libtirpc/files/libtirpc-1.0.1_add-des_impl-c-7f6bb9a3467a.patch
new file mode 100644
index 00000000..a62f23d8
--- /dev/null
+++ b/net-libs/libtirpc/files/libtirpc-1.0.1_add-des_impl-c-7f6bb9a3467a.patch
@@ -0,0 +1,29 @@
+From: Thorsten Kukuk <kukuk@thkukuk.de>
+Date: Mon, 4 Apr 2016 13:48:04 +0000 (-0400)
+Subject: Compile des_crypt.c and des_impl.c
+X-Git-Tag: libtirpc-1-0-2-rc3~1
+X-Git-Url: http://git.linux-nfs.org/?p=steved%2Flibtirpc.git;a=commitdiff_plain;h=7f6bb9a3467a57caf43425d213a06aeb7870086b
+
+Compile des_crypt.c and des_impl.c
+
+Add des_impl.c to become independent of deprecated functions of glibc
+
+Fixes: f17b44048003 ('Revert commit c0547c56dafb')
+Signed-off-by: Thorsten Kukuk <kukuk@thkukuk.de>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+---
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index e4ed8aa..fba2aa4 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -24,7 +24,7 @@ libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c bindresvport.c cln
+ rpcb_st_xdr.c svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_auth_none.c \
+ svc_auth_des.c \
+ svc_generic.c svc_raw.c svc_run.c svc_simple.c svc_vc.c getpeereid.c \
+- auth_time.c auth_des.c authdes_prot.c debug.c
++ auth_time.c auth_des.c authdes_prot.c debug.c des_crypt.c des_impl.c
+
+ ## XDR
+ libtirpc_la_SOURCES += xdr.c xdr_rec.c xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c xdr_sizeof.c
+
diff --git a/net-libs/libtirpc/files/libtirpc-1.0.1_ifdef-out-yp-headers-742bbdff6ddf.patch b/net-libs/libtirpc/files/libtirpc-1.0.1_ifdef-out-yp-headers-742bbdff6ddf.patch
new file mode 100644
index 00000000..481ace7e
--- /dev/null
+++ b/net-libs/libtirpc/files/libtirpc-1.0.1_ifdef-out-yp-headers-742bbdff6ddf.patch
@@ -0,0 +1,30 @@
+From: Thorsten Kukuk <kukuk@thkukuk.de>
+Date: Mon, 4 Apr 2016 13:37:32 +0000 (-0400)
+Subject: getpublickey.c: ifdef out yp headers
+X-Git-Tag: libtirpc-1-0-2-rc3~3
+X-Git-Url: http://git.linux-nfs.org/?p=steved%2Flibtirpc.git;a=commitdiff_plain;h=742bbdff6ddff4dde0d610a842cd8ac0408af0a0
+
+getpublickey.c: ifdef out yp headers
+
+If we don't compile in YP support, don't include YP
+
+Signed-off-by: Thorsten Kukuk <kukuk@thkukuk.de>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+---
+
+diff --git a/src/getpublickey.c b/src/getpublickey.c
+index 764a5f9..8cf4dc2 100644
+--- a/src/getpublickey.c
++++ b/src/getpublickey.c
+@@ -38,8 +38,10 @@
+ #include <pwd.h>
+ #include <rpc/rpc.h>
+ #include <rpc/key_prot.h>
++#ifdef YP
+ #include <rpcsvc/yp_prot.h>
+ #include <rpcsvc/ypclnt.h>
++#endif
+ #include <string.h>
+ #include <stdlib.h>
+
+
diff --git a/net-libs/libtirpc/files/libtirpc-1.0.1_remove-des-deps-to-glibc-503ac2e9fa56.patch b/net-libs/libtirpc/files/libtirpc-1.0.1_remove-des-deps-to-glibc-503ac2e9fa56.patch
new file mode 100644
index 00000000..0ef15290
--- /dev/null
+++ b/net-libs/libtirpc/files/libtirpc-1.0.1_remove-des-deps-to-glibc-503ac2e9fa56.patch
@@ -0,0 +1,43 @@
+From: Thorsten Kukuk <kukuk@thkukuk.de>
+Date: Mon, 4 Apr 2016 13:51:15 +0000 (-0400)
+Subject: Remove des*.c dependencies to glibc
+X-Git-Tag: libtirpc-1-0-2-rc3
+X-Git-Url: http://git.linux-nfs.org/?p=steved%2Flibtirpc.git;a=commitdiff_plain;h=503ac2e9fa569d95e366766202a7ca840e28b28a
+
+Remove des*.c dependencies to glibc
+
+Our des_impl.c has dependencies to glibc header files
+and different arguments then our header file has.
+Bring our own code in sync.
+
+Signed-off-by: Thorsten Kukuk <kukuk@thkukuk.de>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+---
+
+diff --git a/src/des_impl.c b/src/des_impl.c
+index c5b7ed6..9dbccaf 100644
+--- a/src/des_impl.c
++++ b/src/des_impl.c
+@@ -6,7 +6,8 @@
+ /* see <http://www.gnu.org/licenses/> to obtain a copy. */
+ #include <string.h>
+ #include <stdint.h>
+-#include <rpc/rpc_des.h>
++#include <sys/types.h>
++#include <rpc/des.h>
+
+
+ static const uint32_t des_SPtrans[8][64] =
+diff --git a/tirpc/rpc/des.h b/tirpc/rpc/des.h
+index d2881ad..018aa48 100644
+--- a/tirpc/rpc/des.h
++++ b/tirpc/rpc/des.h
+@@ -82,6 +82,6 @@ struct desparams {
+ /*
+ * Software DES.
+ */
+-extern int _des_crypt( char *, int, struct desparams * );
++extern int _des_crypt( char *, unsigned, struct desparams * );
+
+ #endif
+
diff --git a/net-libs/libtirpc/files/libtirpc-1.0.1_remove-nis-h-dep-5f00f8c78c5d.patch b/net-libs/libtirpc/files/libtirpc-1.0.1_remove-nis-h-dep-5f00f8c78c5d.patch
new file mode 100644
index 00000000..a8ad182f
--- /dev/null
+++ b/net-libs/libtirpc/files/libtirpc-1.0.1_remove-nis-h-dep-5f00f8c78c5d.patch
@@ -0,0 +1,137 @@
+From: Thorsten Kukuk <kukuk@thkukuk.de>
+Date: Mon, 4 Apr 2016 13:44:19 +0000 (-0400)
+Subject: Remove dependency to nis.h
+X-Git-Tag: libtirpc-1-0-2-rc3~2
+X-Git-Url: http://git.linux-nfs.org/?p=steved%2Flibtirpc.git;a=commitdiff_plain;h=5f00f8c78c5d13437d50c0737ce77ad67fd4361d
+
+Remove dependency to nis.h
+
+libtirpc needs rpcsvc/nis.h for compiling, but does not
+provide this head file. It's only provided by glibc,
+if the sunrpc code is not marked as deprecated, and
+by libnsl. But libnsl needs libtirpc to compile...
+
+Signed-off-by: Steve Dickson <steved@redhat.com>
+---
+
+diff --git a/src/auth_des.c b/src/auth_des.c
+index 4d3639e..af2f61f 100644
+--- a/src/auth_des.c
++++ b/src/auth_des.c
+@@ -46,8 +46,8 @@
+ #include <rpc/clnt.h>
+ #include <rpc/xdr.h>
+ #include <sys/socket.h>
+-#undef NIS
+-#include <rpcsvc/nis.h>
++
++#include "nis.h"
+
+ #if defined(LIBC_SCCS) && !defined(lint)
+ #endif
+diff --git a/src/auth_time.c b/src/auth_time.c
+index 10e58eb..7f83ab4 100644
+--- a/src/auth_time.c
++++ b/src/auth_time.c
+@@ -44,8 +44,8 @@
+ #include <rpc/rpcb_prot.h>
+ //#include <clnt_soc.h>
+ #include <sys/select.h>
+-#undef NIS
+-#include <rpcsvc/nis.h>
++
++#include "nis.h"
+
+
+ #ifdef TESTING
+diff --git a/src/nis.h b/src/nis.h
+new file mode 100644
+index 0000000..588c041
+--- /dev/null
++++ b/src/nis.h
+@@ -0,0 +1,70 @@
++/*
++ * Copyright (c) 2010, Oracle America, Inc.
++ *
++ * 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 the "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.
++ */
++
++#ifndef _INTERNAL_NIS_H
++#define _INTERNAL_NIS_H 1
++
++/* This file only contains the definition of nis_server, to be
++ able to compile libtirpc without the need to have a glibc
++ with sunrpc or a libnsl already installed. */
++
++#define NIS_PK_NONE 0
++
++struct nis_attr {
++ char *zattr_ndx;
++ struct {
++ u_int zattr_val_len;
++ char *zattr_val_val;
++ } zattr_val;
++};
++typedef struct nis_attr nis_attr;
++
++typedef char *nis_name;
++
++struct endpoint {
++ char *uaddr;
++ char *family;
++ char *proto;
++};
++typedef struct endpoint endpoint;
++
++struct nis_server {
++ nis_name name;
++ struct {
++ u_int ep_len;
++ endpoint *ep_val;
++ } ep;
++ uint32_t key_type;
++ netobj pkey;
++};
++typedef struct nis_server nis_server;
++
++#endif /* ! _INTERNAL_NIS_H */
+diff --git a/src/rpc_soc.c b/src/rpc_soc.c
+index 1ec7b3f..ed0892a 100644
+--- a/src/rpc_soc.c
++++ b/src/rpc_soc.c
+@@ -61,8 +61,8 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+-#include <rpcsvc/nis.h>
+
++#include "nis.h"
+ #include "rpc_com.h"
+
+ extern mutex_t rpcsoc_lock;
+
diff --git a/net-libs/libtirpc/files/libtirpc-1.0.1_uclibc-dont-use-struct-rpcent.patch b/net-libs/libtirpc/files/libtirpc-1.0.1_uclibc-dont-use-struct-rpcent.patch
new file mode 100644
index 00000000..b2760d2b
--- /dev/null
+++ b/net-libs/libtirpc/files/libtirpc-1.0.1_uclibc-dont-use-struct-rpcent.patch
@@ -0,0 +1,51 @@
+From https://patchwork.kernel.org/patch/5499671/:
+
+ Subject: [6/9] Define struct rpcent on non GNU libc
+ From: Natanael Copa <ncopa@alpinelinux.org>
+ X-Patchwork-Id: 5499671
+ Message-Id: <1418718540-13667-7-git-send-email-ncopa@alpinelinux.org>
+ To: libtirpc-devel@lists.sourceforge.net
+ Cc: linux-nfs@vger.kernel.org, Natanael Copa <ncopa@alpinelinux.org>
+ Date: Tue, 16 Dec 2014 09:28:57 +0100
+
+ This fixes the following compile error with musl libc:
+ getrpcent.c:65:16: error: field 'rpc' has incomplete type
+ struct rpcent rpc;
+ ^
+
+ Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+ ---
+ This patch could probably be better. It assumes that only GNU libc has
+ the rpcent struct defined, but the BSDs probably has it too.
+
+ I am not sure if uClibc has it, but uClibc does define __GLIBC__ so it
+ might be broken there too.
+
+ I looked into using AC_CHECK_MEMBER but I don't think it is a good idea
+ so depend on config.h since this is a header that will be installed on
+ the system.
+
+ I also found out that struct rpcent is also defined in
+ /usr/include/gssrpc/netdb.h but I am unsure if we can depend on that
+ too since GSS is optional.
+
+ So I am a bit in doubt what the proper fix is. Meanwhile, this works
+ for musl libc.
+
+We fix the uClibc case by checking for __UCLIBC__ as well, since uClibc will
+define __GLIBC__ as well (why?) as __UCLIBC__. This should not affect the
+musl case.
+---
+
+diff -Naurp libtirpc-1.0.1.orig/tirpc/rpc/rpcent.h libtirpc-1.0.1/tirpc/rpc/rpcent.h
+--- libtirpc-1.0.1.orig/tirpc/rpc/rpcent.h 2015-10-30 15:15:14.000000000 +0000
++++ libtirpc-1.0.1/tirpc/rpc/rpcent.h 2017-07-05 04:58:27.141468000 +0000
+@@ -49,7 +49,7 @@ extern "C" {
+ #endif
+
+ /* These are defined in /usr/include/rpc/netdb.h */
+-#if !defined(__GLIBC__)
++#if !defined(__GLIBC__) || defined(__UCLIBC__)
+ struct rpcent {
+ char *r_name; /* name of server for this rpc program */
+ char **r_aliases; /* alias list */
diff --git a/net-libs/libtirpc/files/libtirpc-1.0.1_uclibc-use-memset-not-bzero.patch b/net-libs/libtirpc/files/libtirpc-1.0.1_uclibc-use-memset-not-bzero.patch
new file mode 100644
index 00000000..f7657f74
--- /dev/null
+++ b/net-libs/libtirpc/files/libtirpc-1.0.1_uclibc-use-memset-not-bzero.patch
@@ -0,0 +1,21 @@
+Inspired by a similar fix here:
+http://git.yoctoproject.org/cgit.cgi/poky/plain/meta/packages/nfs-utils/files/uclibc_bzero_fix.patch?id=39d8c0fc4a9d14b7bad1442e05c536e28b196a47
+
+Because uclibc does not have a working implementation of `__bzero'.
+---
+
+diff -Naurp libtirpc-1.0.1.orig/src/des_impl.c libtirpc-1.0.1/src/des_impl.c
+--- libtirpc-1.0.1.orig/src/des_impl.c 2017-07-05 06:16:07.441468000 +0000
++++ libtirpc-1.0.1/src/des_impl.c 2017-07-05 06:19:57.351468000 +0000
+@@ -588,7 +588,11 @@ _des_crypt (char *buf, unsigned len, str
+ }
+ tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0;
+ tbuf[0] = tbuf[1] = 0;
++#ifndef __UCLIBC__
+ __bzero (schedule, sizeof (schedule));
++#else
++ memset (schedule, 0, sizeof (schedule));
++#endif
+
+ return (1);
+ }
diff --git a/net-libs/libtirpc/files/musl-1.0.1_r2.patch b/net-libs/libtirpc/files/musl-1.0.1_r2.patch
new file mode 100644
index 00000000..cc3a47a5
--- /dev/null
+++ b/net-libs/libtirpc/files/musl-1.0.1_r2.patch
@@ -0,0 +1,647 @@
+diff -Naur libtirpc-1.0.1.orig/src/auth_gss.c libtirpc-1.0.1/src/auth_gss.c
+--- libtirpc-1.0.1.orig/src/auth_gss.c 2017-07-06 11:02:13.298086863 -0700
++++ libtirpc-1.0.1/src/auth_gss.c 2017-07-06 11:02:24.753213878 -0700
+@@ -526,6 +526,14 @@
+ gr.gr_major != GSS_S_CONTINUE_NEEDED)) {
+ options_ret->major_status = gr.gr_major;
+ options_ret->minor_status = gr.gr_minor;
++ if (call_stat != RPC_SUCCESS) {
++ struct rpc_err err;
++ clnt_geterr(gd->clnt, &err);
++ LIBTIRPC_DEBUG(1, ("authgss_refresh: %s errno: %s",
++ clnt_sperrno(call_stat), strerror(err.re_errno)));
++ } else
++ gss_log_status("authgss_refresh:",
++ gr.gr_major, gr.gr_minor);
+ return FALSE;
+ }
+
+diff -Naur libtirpc-1.0.1.orig/src/clnt_vc.c libtirpc-1.0.1/src/clnt_vc.c
+--- libtirpc-1.0.1.orig/src/clnt_vc.c 2017-07-06 11:02:13.296086841 -0700
++++ libtirpc-1.0.1/src/clnt_vc.c 2017-07-06 11:02:24.754213889 -0700
+@@ -72,6 +72,8 @@
+ #define CMGROUP_MAX 16
+ #define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
+
++#undef rpc_createerr /* make it clear it is a thread safe variable */
++
+ /*
+ * Credentials structure, used to verify the identity of a peer
+ * process that has sent us a message. This is allocated by the
+@@ -188,10 +190,11 @@
+ cl = (CLIENT *)mem_alloc(sizeof (*cl));
+ ct = (struct ct_data *)mem_alloc(sizeof (*ct));
+ if ((cl == (CLIENT *)NULL) || (ct == (struct ct_data *)NULL)) {
++ struct rpc_createerr *ce = &get_rpc_createerr();
++ ce->cf_stat = RPC_SYSTEMERROR;
++ ce->cf_error.re_errno = errno;
+ (void) syslog(LOG_ERR, clnt_vc_errstr,
+ clnt_vc_str, __no_mem_str);
+- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
+- rpc_createerr.cf_error.re_errno = errno;
+ goto err;
+ }
+ ct->ct_addr.buf = NULL;
+@@ -230,26 +233,29 @@
+ assert(vc_cv != (cond_t *) NULL);
+
+ /*
+- * XXX - fvdl connecting while holding a mutex?
++ * Do not hold mutex during connect
+ */
++ mutex_unlock(&clnt_fd_lock);
++
+ slen = sizeof ss;
+ if (getpeername(fd, (struct sockaddr *)&ss, &slen) < 0) {
+ if (errno != ENOTCONN) {
+- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
+- rpc_createerr.cf_error.re_errno = errno;
+- mutex_unlock(&clnt_fd_lock);
++ struct rpc_createerr *ce = &get_rpc_createerr();
++ ce->cf_stat = RPC_SYSTEMERROR;
++ ce->cf_error.re_errno = errno;
+ thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
+ goto err;
+ }
+ if (connect(fd, (struct sockaddr *)raddr->buf, raddr->len) < 0){
+- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
+- rpc_createerr.cf_error.re_errno = errno;
+- mutex_unlock(&clnt_fd_lock);
+- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
+- goto err;
++ if (errno != EISCONN) {
++ struct rpc_createerr *ce = &get_rpc_createerr();
++ ce->cf_stat = RPC_SYSTEMERROR;
++ ce->cf_error.re_errno = errno;
++ thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
++ goto err;
++ }
+ }
+ }
+- mutex_unlock(&clnt_fd_lock);
+ if (!__rpc_fd2sockinfo(fd, &si))
+ goto err;
+ thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
+diff -Naur libtirpc-1.0.1.orig/src/des_impl.c libtirpc-1.0.1/src/des_impl.c
+--- libtirpc-1.0.1.orig/src/des_impl.c 2017-07-06 11:02:13.300086885 -0700
++++ libtirpc-1.0.1/src/des_impl.c 2017-07-06 11:04:00.778278610 -0700
+@@ -588,7 +588,7 @@
+ }
+ tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0;
+ tbuf[0] = tbuf[1] = 0;
+-#ifndef __UCLIBC__
++#if defined(__GLIBC__) && !defined(__UCLIBC__)
+ __bzero (schedule, sizeof (schedule));
+ #else
+ memset (schedule, 0, sizeof (schedule));
+diff -Naur libtirpc-1.0.1.orig/src/getrpcport.c libtirpc-1.0.1/src/getrpcport.c
+--- libtirpc-1.0.1.orig/src/getrpcport.c 2017-07-06 11:02:13.293086807 -0700
++++ libtirpc-1.0.1/src/getrpcport.c 2017-07-06 11:02:24.754213889 -0700
+@@ -57,8 +57,8 @@
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_port = 0;
+- if (hp->h_length > sizeof(addr))
+- hp->h_length = sizeof(addr);
++ if (hp->h_length > sizeof(addr.sin_addr.s_addr))
++ hp->h_length = sizeof(addr.sin_addr.s_addr);
+ memcpy(&addr.sin_addr.s_addr, hp->h_addr, (size_t)hp->h_length);
+ /* Inconsistent interfaces need casts! :-( */
+ return (pmap_getport(&addr, (u_long)prognum, (u_long)versnum,
+diff -Naur libtirpc-1.0.1.orig/src/rpc_dtablesize.c libtirpc-1.0.1/src/rpc_dtablesize.c
+--- libtirpc-1.0.1.orig/src/rpc_dtablesize.c 2017-07-06 11:02:13.290086774 -0700
++++ libtirpc-1.0.1/src/rpc_dtablesize.c 2017-07-06 11:02:24.754213889 -0700
+@@ -27,22 +27,14 @@
+ */
+
+ #include <unistd.h>
+-
+ #include <sys/select.h>
+-
+-int _rpc_dtablesize(void); /* XXX */
++#include <rpc/clnt.h>
++#include <rpc/rpc_com.h>
+
+ /*
+ * Cache the result of getdtablesize(), so we don't have to do an
+ * expensive system call every time.
+ */
+-/*
+- * XXX In FreeBSD 2.x, you can have the maximum number of open file
+- * descriptors be greater than FD_SETSIZE (which us 256 by default).
+- *
+- * Since old programs tend to use this call to determine the first arg
+- * for _select(), having this return > FD_SETSIZE is a Bad Idea(TM)!
+- */
+ int
+ _rpc_dtablesize(void)
+ {
+diff -Naur libtirpc-1.0.1.orig/src/rtime.c libtirpc-1.0.1/src/rtime.c
+--- libtirpc-1.0.1.orig/src/rtime.c 2017-07-06 11:02:13.290086774 -0700
++++ libtirpc-1.0.1/src/rtime.c 2017-07-06 11:02:24.755213900 -0700
+@@ -46,6 +46,7 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <sys/types.h>
++#include <sys/poll.h>
+ #include <sys/socket.h>
+ #include <sys/time.h>
+ #include <netinet/in.h>
+@@ -67,7 +68,8 @@
+ struct timeval *timeout;
+ {
+ int s;
+- fd_set readfds;
++ struct pollfd fd;
++ int milliseconds;
+ int res;
+ unsigned long thetime;
+ struct sockaddr_in from;
+@@ -94,31 +96,32 @@
+ addrp->sin_port = serv->s_port;
+
+ if (type == SOCK_DGRAM) {
+- res = sendto(s, (char *)&thetime, sizeof(thetime), 0,
++ res = sendto(s, (char *)&thetime, sizeof(thetime), 0,
+ (struct sockaddr *)addrp, sizeof(*addrp));
+ if (res < 0) {
+ do_close(s);
+- return(-1);
++ return(-1);
+ }
+- do {
+- FD_ZERO(&readfds);
+- FD_SET(s, &readfds);
+- res = select(_rpc_dtablesize(), &readfds,
+- (fd_set *)NULL, (fd_set *)NULL, timeout);
+- } while (res < 0 && errno == EINTR);
++
++ milliseconds = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
++ fd.fd = s;
++ fd.events = POLLIN;
++ do
++ res = poll (&fd, 1, milliseconds);
++ while (res < 0 && errno == EINTR);
+ if (res <= 0) {
+ if (res == 0) {
+ errno = ETIMEDOUT;
+ }
+ do_close(s);
+- return(-1);
++ return(-1);
+ }
+ fromlen = sizeof(from);
+- res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
++ res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
+ (struct sockaddr *)&from, &fromlen);
+ do_close(s);
+ if (res < 0) {
+- return(-1);
++ return(-1);
+ }
+ } else {
+ if (connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) {
+diff -Naur libtirpc-1.0.1.orig/src/svc.c libtirpc-1.0.1/src/svc.c
+--- libtirpc-1.0.1.orig/src/svc.c 2017-07-06 11:02:13.290086774 -0700
++++ libtirpc-1.0.1/src/svc.c 2017-07-06 11:02:24.755213900 -0700
+@@ -99,7 +99,7 @@
+ {
+ __svc_xports = (SVCXPRT **) calloc (_rpc_dtablesize(), sizeof (SVCXPRT *));
+ if (__svc_xports == NULL)
+- return;
++ goto unlock;
+ }
+ if (sock < _rpc_dtablesize())
+ {
+@@ -120,14 +120,14 @@
+ svc_pollfd[i].fd = sock;
+ svc_pollfd[i].events = (POLLIN | POLLPRI |
+ POLLRDNORM | POLLRDBAND);
+- return;
++ goto unlock;
+ }
+
+ new_svc_pollfd = (struct pollfd *) realloc (svc_pollfd,
+ sizeof (struct pollfd)
+ * (svc_max_pollfd + 1));
+ if (new_svc_pollfd == NULL) /* Out of memory */
+- return;
++ goto unlock;
+ svc_pollfd = new_svc_pollfd;
+ ++svc_max_pollfd;
+
+@@ -135,6 +135,7 @@
+ svc_pollfd[svc_max_pollfd - 1].events = (POLLIN | POLLPRI |
+ POLLRDNORM | POLLRDBAND);
+ }
++unlock:
+ rwlock_unlock (&svc_fd_lock);
+ }
+
+diff -Naur libtirpc-1.0.1.orig/src/svc_auth_des.c libtirpc-1.0.1/src/svc_auth_des.c
+--- libtirpc-1.0.1.orig/src/svc_auth_des.c 2017-07-06 11:02:13.289086763 -0700
++++ libtirpc-1.0.1/src/svc_auth_des.c 2017-07-06 11:02:24.756213911 -0700
+@@ -86,13 +86,13 @@
+ static short *authdes_lru/* [AUTHDES_CACHESZ] */;
+
+ static void cache_init(); /* initialize the cache */
+-static short cache_spot(); /* find an entry in the cache */
+-static void cache_ref(/*short sid*/); /* note that sid was ref'd */
++static short cache_spot(des_block *key, char *name, struct timeval *timestamp); /* find an entry in the cache */
++static void cache_ref(short sid); /* note that sid was ref'd */
+
+-static void invalidate(); /* invalidate entry in cache */
++static void invalidate(char *cred); /* invalidate entry in cache */
+
+ /*
+- * cache statistics
++ * cache statistics
+ */
+ static struct {
+ u_long ncachehits; /* times cache hit, and is not replay */
+diff -Naur libtirpc-1.0.1.orig/src/svc_auth_gss.c libtirpc-1.0.1/src/svc_auth_gss.c
+--- libtirpc-1.0.1.orig/src/svc_auth_gss.c 2017-07-06 11:02:13.289086763 -0700
++++ libtirpc-1.0.1/src/svc_auth_gss.c 2017-07-06 11:02:24.756213911 -0700
+@@ -129,6 +129,8 @@
+ ((struct svc_rpc_gss_data *)(auth)->svc_ah_private)
+
+ /* Global server credentials. */
++static u_int _svcauth_req_time = 0;
++static gss_OID_set_desc _svcauth_oid_set = {1, GSS_C_NULL_OID };
+ static gss_cred_id_t _svcauth_gss_creds;
+ static gss_name_t _svcauth_gss_name = GSS_C_NO_NAME;
+ static char * _svcauth_svc_name = NULL;
+@@ -167,6 +169,7 @@
+ gss_name_t name;
+ gss_buffer_desc namebuf;
+ OM_uint32 maj_stat, min_stat;
++ bool_t result;
+
+ gss_log_debug("in svcauth_gss_import_name()");
+
+@@ -181,22 +184,21 @@
+ maj_stat, min_stat);
+ return (FALSE);
+ }
+- if (svcauth_gss_set_svc_name(name) != TRUE) {
+- gss_release_name(&min_stat, &name);
+- return (FALSE);
+- }
+- return (TRUE);
++ result = svcauth_gss_set_svc_name(name);
++ gss_release_name(&min_stat, &name);
++ return result;
+ }
+
+ static bool_t
+-svcauth_gss_acquire_cred(u_int req_time, gss_OID_set_desc *oid_set)
++svcauth_gss_acquire_cred(void)
+ {
+ OM_uint32 maj_stat, min_stat;
+
+ gss_log_debug("in svcauth_gss_acquire_cred()");
+
+- maj_stat = gss_acquire_cred(&min_stat, _svcauth_gss_name, req_time,
+- oid_set, GSS_C_ACCEPT,
++ maj_stat = gss_acquire_cred(&min_stat, _svcauth_gss_name,
++ _svcauth_req_time, &_svcauth_oid_set,
++ GSS_C_ACCEPT,
+ &_svcauth_gss_creds, NULL, NULL);
+
+ if (maj_stat != GSS_S_COMPLETE) {
+@@ -300,6 +302,8 @@
+ NULL,
+ &gd->deleg);
+
++ xdr_free((xdrproc_t)xdr_rpc_gss_init_args, (caddr_t)&recv_tok);
++
+ if (gr->gr_major != GSS_S_COMPLETE &&
+ gr->gr_major != GSS_S_CONTINUE_NEEDED) {
+ gss_log_status("svcauth_gss_accept_sec_context: accept_sec_context",
+@@ -352,8 +356,11 @@
+ return (FALSE);
+
+ rqst->rq_xprt->xp_verf.oa_flavor = RPCSEC_GSS;
+- rqst->rq_xprt->xp_verf.oa_base = checksum.value;
++ memcpy(rqst->rq_xprt->xp_verf.oa_base, checksum.value,
++ checksum.length);
+ rqst->rq_xprt->xp_verf.oa_length = checksum.length;
++
++ gss_release_buffer(&min_stat, &checksum);
+ }
+ return (TRUE);
+ }
+@@ -435,10 +442,13 @@
+ maj_stat, min_stat);
+ return (FALSE);
+ }
++
+ rqst->rq_xprt->xp_verf.oa_flavor = RPCSEC_GSS;
+- rqst->rq_xprt->xp_verf.oa_base = (caddr_t)checksum.value;
++ memcpy(rqst->rq_xprt->xp_verf.oa_base, checksum.value, checksum.length);
+ rqst->rq_xprt->xp_verf.oa_length = (u_int)checksum.length;
+
++ gss_release_buffer(&min_stat, &checksum);
++
+ return (TRUE);
+ }
+
+@@ -568,6 +578,8 @@
+ gss_qop_t qop;
+ struct svcauth_gss_cache_entry **ce;
+ time_t now;
++ enum auth_stat result = AUTH_OK;
++ OM_uint32 min_stat;
+
+ gss_log_debug("in svcauth_gss()");
+
+@@ -621,19 +633,25 @@
+ XDR_DESTROY(&xdrs);
+
+ /* Check version. */
+- if (gc->gc_v != RPCSEC_GSS_VERSION)
+- return (AUTH_BADCRED);
++ if (gc->gc_v != RPCSEC_GSS_VERSION) {
++ result = AUTH_BADCRED;
++ goto out;
++ }
+
+ /* Check RPCSEC_GSS service. */
+ if (gc->gc_svc != RPCSEC_GSS_SVC_NONE &&
+ gc->gc_svc != RPCSEC_GSS_SVC_INTEGRITY &&
+- gc->gc_svc != RPCSEC_GSS_SVC_PRIVACY)
+- return (AUTH_BADCRED);
++ gc->gc_svc != RPCSEC_GSS_SVC_PRIVACY) {
++ result = AUTH_BADCRED;
++ goto out;
++ }
+
+ /* Check sequence number. */
+ if (gd->established) {
+- if (gc->gc_seq > MAXSEQ)
+- return (RPCSEC_GSS_CTXPROBLEM);
++ if (gc->gc_seq > MAXSEQ) {
++ result = RPCSEC_GSS_CTXPROBLEM;
++ goto out;
++ }
+
+ if ((offset = gd->seqlast - gc->gc_seq) < 0) {
+ gd->seqlast = gc->gc_seq;
+@@ -643,7 +661,8 @@
+ }
+ else if (offset >= gd->win || (gd->seqmask & (1 << offset))) {
+ *no_dispatch = 1;
+- return (RPCSEC_GSS_CTXPROBLEM);
++ result = RPCSEC_GSS_CTXPROBLEM;
++ goto out;
+ }
+ gd->seq = gc->gc_seq;
+ gd->seqmask |= (1 << offset);
+@@ -654,35 +673,52 @@
+ rqst->rq_svcname = (char *)gd->ctx;
+ }
+
++ rqst->rq_xprt->xp_verf.oa_base = msg->rm_call.cb_verf.oa_base;
++
+ /* Handle RPCSEC_GSS control procedure. */
+ switch (gc->gc_proc) {
+
+ case RPCSEC_GSS_INIT:
+ case RPCSEC_GSS_CONTINUE_INIT:
+- if (rqst->rq_proc != NULLPROC)
+- return (AUTH_FAILED); /* XXX ? */
++ if (rqst->rq_proc != NULLPROC) {
++ result = AUTH_FAILED; /* XXX ? */
++ break;
++ }
+
+ if (_svcauth_gss_name == GSS_C_NO_NAME) {
+- if (!svcauth_gss_import_name("nfs"))
+- return (AUTH_FAILED);
++ if (!svcauth_gss_import_name("nfs")) {
++ result = AUTH_FAILED;
++ break;
++ }
+ }
+
+- if (!svcauth_gss_acquire_cred(0, GSS_C_NULL_OID_SET))
+- return (AUTH_FAILED);
++ if (!svcauth_gss_acquire_cred()) {
++ result = AUTH_FAILED;
++ break;
++ }
+
+- if (!svcauth_gss_accept_sec_context(rqst, &gr))
+- return (AUTH_REJECTEDCRED);
++ if (!svcauth_gss_accept_sec_context(rqst, &gr)) {
++ result = AUTH_REJECTEDCRED;
++ break;
++ }
+
+- if (!svcauth_gss_nextverf(rqst, htonl(gr.gr_win)))
+- return (AUTH_FAILED);
++ if (!svcauth_gss_nextverf(rqst, htonl(gr.gr_win))) {
++ result = AUTH_FAILED;
++ break;
++ }
+
+ *no_dispatch = TRUE;
+
+ call_stat = svc_sendreply(rqst->rq_xprt,
+ (xdrproc_t)xdr_rpc_gss_init_res, (caddr_t)&gr);
+
+- if (!call_stat)
+- return (AUTH_FAILED);
++ gss_release_buffer(&min_stat, &gr.gr_token);
++ free(gr.gr_ctx.value);
++
++ if (!call_stat) {
++ result = AUTH_FAILED;
++ break;
++ }
+
+ if (gr.gr_major == GSS_S_COMPLETE)
+ gd->established = TRUE;
+@@ -690,27 +726,37 @@
+ break;
+
+ case RPCSEC_GSS_DATA:
+- if (!svcauth_gss_validate(gd, msg, &qop))
+- return (RPCSEC_GSS_CREDPROBLEM);
++ if (!svcauth_gss_validate(gd, msg, &qop)) {
++ result = RPCSEC_GSS_CREDPROBLEM;
++ break;
++ }
+
+- if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq)))
+- return (AUTH_FAILED);
++ if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq))) {
++ result = AUTH_FAILED;
++ break;
++ }
+
+ if (!gd->callback_done) {
+ gd->callback_done = TRUE;
+ gd->sec.qop = qop;
+ (void)rpc_gss_num_to_qop(gd->rcred.mechanism,
+ gd->sec.qop, &gd->rcred.qop);
+- if (!svcauth_gss_callback(rqst, gd))
+- return (AUTH_REJECTEDCRED);
++ if (!svcauth_gss_callback(rqst, gd)) {
++ result = AUTH_REJECTEDCRED;
++ break;
++ }
+ }
+
+ if (gd->locked) {
+ if (gd->rcred.service !=
+- _rpc_gss_svc_to_service(gc->gc_svc))
+- return (AUTH_FAILED);
+- if (gd->sec.qop != qop)
+- return (AUTH_BADVERF);
++ _rpc_gss_svc_to_service(gc->gc_svc)) {
++ result = AUTH_FAILED;
++ break;
++ }
++ if (gd->sec.qop != qop) {
++ result = AUTH_BADVERF;
++ break;
++ }
+ }
+
+ if (gd->sec.qop != qop) {
+@@ -724,17 +770,25 @@
+ break;
+
+ case RPCSEC_GSS_DESTROY:
+- if (rqst->rq_proc != NULLPROC)
+- return (AUTH_FAILED); /* XXX ? */
++ if (rqst->rq_proc != NULLPROC) {
++ result = AUTH_FAILED; /* XXX ? */
++ break;
++ }
+
+- if (!svcauth_gss_validate(gd, msg, &qop))
+- return (RPCSEC_GSS_CREDPROBLEM);
++ if (!svcauth_gss_validate(gd, msg, &qop)) {
++ result = RPCSEC_GSS_CREDPROBLEM;
++ break;
++ }
+
+- if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq)))
+- return (AUTH_FAILED);
++ if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq))) {
++ result = AUTH_FAILED;
++ break;
++ }
+
+- if (!svcauth_gss_release_cred())
+- return (AUTH_FAILED);
++ if (!svcauth_gss_release_cred()) {
++ result = AUTH_FAILED;
++ break;
++ }
+
+ SVCAUTH_DESTROY(&SVC_XP_AUTH(rqst->rq_xprt));
+ SVC_XP_AUTH(rqst->rq_xprt).svc_ah_ops = svc_auth_none.svc_ah_ops;
+@@ -743,10 +797,12 @@
+ break;
+
+ default:
+- return (AUTH_REJECTEDCRED);
++ result = AUTH_REJECTEDCRED;
+ break;
+ }
+- return (AUTH_OK);
++out:
++ xdr_free((xdrproc_t)xdr_rpc_gss_cred, (caddr_t)gc);
++ return result;
+ }
+
+ static bool_t
+@@ -890,7 +946,6 @@
+ rpc_gss_set_svc_name(char *principal, char *mechanism, u_int req_time,
+ u_int UNUSED(program), u_int UNUSED(version))
+ {
+- gss_OID_set_desc oid_set;
+ rpc_gss_OID oid;
+ char *save;
+
+@@ -902,14 +957,13 @@
+
+ if (!rpc_gss_mech_to_oid(mechanism, &oid))
+ goto out_err;
+- oid_set.count = 1;
+- oid_set.elements = (gss_OID)oid;
+
+ if (!svcauth_gss_import_name(principal))
+ goto out_err;
+- if (!svcauth_gss_acquire_cred(req_time, &oid_set))
+- goto out_err;
+
++ _svcauth_req_time = req_time;
++ _svcauth_oid_set.count = 1;
++ _svcauth_oid_set.elements = (gss_OID)oid;
+ free(_svcauth_svc_name);
+ _svcauth_svc_name = save;
+ return TRUE;
+diff -Naur libtirpc-1.0.1.orig/src/svc_vc.c libtirpc-1.0.1/src/svc_vc.c
+--- libtirpc-1.0.1.orig/src/svc_vc.c 2017-07-06 11:02:13.288086752 -0700
++++ libtirpc-1.0.1/src/svc_vc.c 2017-07-06 11:02:24.757213922 -0700
+@@ -270,14 +270,8 @@
+ struct cf_conn *cd;
+ const char *netid;
+ struct __rpc_sockinfo si;
+-
+- assert(fd != -1);
+
+- if (fd >= FD_SETSIZE) {
+- warnx("svc_vc: makefd_xprt: fd too high\n");
+- xprt = NULL;
+- goto done;
+- }
++ assert(fd != -1);
+
+ xprt = mem_alloc(sizeof(SVCXPRT));
+ if (xprt == NULL) {
+@@ -338,22 +332,10 @@
+ r = (struct cf_rendezvous *)xprt->xp_p1;
+ again:
+ len = sizeof addr;
+- if ((sock = accept(xprt->xp_fd, (struct sockaddr *)(void *)&addr,
+- &len)) < 0) {
++ sock = accept(xprt->xp_fd, (struct sockaddr *)(void *)&addr, &len);
++ if (sock < 0) {
+ if (errno == EINTR)
+ goto again;
+-
+- if (errno == EMFILE || errno == ENFILE) {
+- /* If there are no file descriptors available, then accept will fail.
+- We want to delay here so the connection request can be dequeued;
+- otherwise we can bounce between polling and accepting, never
+- giving the request a chance to dequeue and eating an enormous
+- amount of cpu time in svc_run if we're polling on many file
+- descriptors. */
+- struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
+- nanosleep (&ts, NULL);
+- goto again;
+- }
+ return (FALSE);
+ }
+ /*
+diff -Naur libtirpc-1.0.1.orig/tirpc/rpc/rpcent.h libtirpc-1.0.1/tirpc/rpc/rpcent.h
+--- libtirpc-1.0.1.orig/tirpc/rpc/rpcent.h 2017-07-06 11:02:13.286086730 -0700
++++ libtirpc-1.0.1/tirpc/rpc/rpcent.h 2017-07-06 11:02:24.757213922 -0700
+@@ -60,10 +60,11 @@
+ extern struct rpcent *getrpcbyname(const char *);
+ extern struct rpcent *getrpcbynumber(int);
+ extern struct rpcent *getrpcent(void);
+-#endif
+
+ extern void setrpcent(int);
+ extern void endrpcent(void);
++#endif
++
+ #ifdef __cplusplus
+ }
+ #endif
diff --git a/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild b/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild
index 732930d7..dea23ff4 100644
--- a/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild
+++ b/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild
@@ -12,7 +12,7 @@ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2
LICENSE="GPL-2"
SLOT="0/3" # subslot matches SONAME major
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86"
IUSE="ipv6 kerberos static-libs"
RDEPEND="kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )"
diff --git a/net-libs/libtirpc/libtirpc-1.0.1-r2.ebuild b/net-libs/libtirpc/libtirpc-1.0.1-r2.ebuild
new file mode 100644
index 00000000..a90754fc
--- /dev/null
+++ b/net-libs/libtirpc/libtirpc-1.0.1-r2.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit autotools multilib-minimal toolchain-funcs eutils
+
+DESCRIPTION="Transport Independent RPC library (SunRPC replacement)"
+HOMEPAGE="http://libtirpc.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2
+ mirror://gentoo/${PN}-glibc-nfs.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0/3" # subslot matches SONAME major
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="ipv6 kerberos static-libs"
+
+RDEPEND="kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+ elibc_musl? ( sys-libs/queue )
+ app-arch/xz-utils
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
+
+PATCHES=(
+ "${FILESDIR}/${P}-CVE-2017-8779.patch"
+ "${FILESDIR}/${P}_uclibc-dont-use-struct-rpcent.patch"
+ "${FILESDIR}/${P}_ifdef-out-yp-headers-742bbdff6ddf.patch"
+ "${FILESDIR}/${P}_remove-nis-h-dep-5f00f8c78c5d.patch"
+ "${FILESDIR}/${P}_add-des_impl-c-7f6bb9a3467a.patch"
+ "${FILESDIR}/${P}_remove-des-deps-to-glibc-503ac2e9fa56.patch"
+ "${FILESDIR}/${P}_uclibc-use-memset-not-bzero.patch"
+ # musl fixes
+ "${FILESDIR}/musl-1.0.1_r2.patch"
+)
+
+src_prepare() {
+ cp -r "${WORKDIR}"/tirpc "${S}"/ || die
+ epatch "${PATCHES[@]}"
+ epatch_user
+ eautoreconf
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE=${S} \
+ econf \
+ $(use_enable ipv6) \
+ $(use_enable kerberos gssapi) \
+ $(use_enable static-libs static)
+}
+
+multilib_src_install() {
+ default
+
+ # libtirpc replaces rpc support in glibc, so we need it in /
+ gen_usr_ldscript -a tirpc
+}
+
+multilib_src_install_all() {
+ einstalldocs
+
+ insinto /etc
+ doins doc/netconfig
+
+ insinto /usr/include/tirpc
+ doins -r "${WORKDIR}"/tirpc/*
+
+ # makes sure that the linking order for nfs-utils is proper, as
+ # libtool would inject a libgssglue dependency in the list.
+ use static-libs || prune_libtool_files
+}