summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-04-18 18:58:35 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-15 15:47:59 -0700
commitf7f0a0a7bd8ba24dd66fcb66a869b6347c00f216 (patch)
tree70168ca4ecd3c75064396996e8b2e01de8471fa5
parent4dd8c6f663027866d23988b669b7f2e2b4dee0bb (diff)
downloadpoky-f7f0a0a7bd8ba24dd66fcb66a869b6347c00f216.tar.gz
libtirpc: Backport fixes from 1.0.2rc3
These fixes are needed for it to work with gcc7 (From OE-Core rev: 387cd21a6792b3243c4fde84231d6e164e660f98) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/libtirpc/libtirpc/0001-Add-missing-rwlock_unlocks-in-xprt_register.patch62
-rw-r--r--meta/recipes-extended/libtirpc/libtirpc/libtirpc-1.0.2-rc3.patch743
-rw-r--r--meta/recipes-extended/libtirpc/libtirpc/remove-des-functionality.patch39
-rw-r--r--meta/recipes-extended/libtirpc/libtirpc_1.0.1.bb4
4 files changed, 762 insertions, 86 deletions
diff --git a/meta/recipes-extended/libtirpc/libtirpc/0001-Add-missing-rwlock_unlocks-in-xprt_register.patch b/meta/recipes-extended/libtirpc/libtirpc/0001-Add-missing-rwlock_unlocks-in-xprt_register.patch
deleted file mode 100644
index 50613ba312..0000000000
--- a/meta/recipes-extended/libtirpc/libtirpc/0001-Add-missing-rwlock_unlocks-in-xprt_register.patch
+++ /dev/null
@@ -1,62 +0,0 @@
1Subject: [PATCH] Add missing rwlock_unlocks in xprt_register
2
3It looks like in b2c9430f46c4ac848957fb8adaac176a3f6ac03f when svc_run
4switched to poll, an early return was added, but the rwlock was not
5unlocked.
6
7I observed that rpcbind built against libtirpc-1.0.1 would handle only
8one request before hanging, and tracked it down to a missing
9rwlock_unlock here.
10
11Fixes: b2c9430f46c4 ('Use poll() instead of select() in svc_run()')
12
13Upstream-Status: Backport
14
15Signed-off-by: Michael Forney <mforney@mforney.org>
16Signed-off-by: Steve Dickson <steved@redhat.com>
17Signed-off-by: Maxin B. John <maxin.john@intel.com>
18---
19 src/svc.c | 7 ++++---
20 1 file changed, 4 insertions(+), 3 deletions(-)
21
22diff --git a/src/svc.c b/src/svc.c
23index 9c41445..b59467b 100644
24--- a/src/svc.c
25+++ b/src/svc.c
26@@ -99,7 +99,7 @@ xprt_register (xprt)
27 {
28 __svc_xports = (SVCXPRT **) calloc (_rpc_dtablesize(), sizeof (SVCXPRT *));
29 if (__svc_xports == NULL)
30- return;
31+ goto unlock;
32 }
33 if (sock < _rpc_dtablesize())
34 {
35@@ -120,14 +120,14 @@ xprt_register (xprt)
36 svc_pollfd[i].fd = sock;
37 svc_pollfd[i].events = (POLLIN | POLLPRI |
38 POLLRDNORM | POLLRDBAND);
39- return;
40+ goto unlock;
41 }
42
43 new_svc_pollfd = (struct pollfd *) realloc (svc_pollfd,
44 sizeof (struct pollfd)
45 * (svc_max_pollfd + 1));
46 if (new_svc_pollfd == NULL) /* Out of memory */
47- return;
48+ goto unlock;
49 svc_pollfd = new_svc_pollfd;
50 ++svc_max_pollfd;
51
52@@ -135,6 +135,7 @@ xprt_register (xprt)
53 svc_pollfd[svc_max_pollfd - 1].events = (POLLIN | POLLPRI |
54 POLLRDNORM | POLLRDBAND);
55 }
56+unlock:
57 rwlock_unlock (&svc_fd_lock);
58 }
59
60--
612.5.3
62
diff --git a/meta/recipes-extended/libtirpc/libtirpc/libtirpc-1.0.2-rc3.patch b/meta/recipes-extended/libtirpc/libtirpc/libtirpc-1.0.2-rc3.patch
new file mode 100644
index 0000000000..113dabe13b
--- /dev/null
+++ b/meta/recipes-extended/libtirpc/libtirpc/libtirpc-1.0.2-rc3.patch
@@ -0,0 +1,743 @@
1Backport the 1.0.2 RC3 changes, this fixes issues with gcc7
2
3Upstream-Status: Backport
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7diff --git a/src/Makefile.am b/src/Makefile.am
8index e4ed8aa..fba2aa4 100644
9--- a/src/Makefile.am
10+++ b/src/Makefile.am
11@@ -24,7 +24,7 @@ libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c bindresvport.c cln
12 rpcb_st_xdr.c svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_auth_none.c \
13 svc_auth_des.c \
14 svc_generic.c svc_raw.c svc_run.c svc_simple.c svc_vc.c getpeereid.c \
15- auth_time.c auth_des.c authdes_prot.c debug.c
16+ auth_time.c auth_des.c authdes_prot.c debug.c des_crypt.c des_impl.c
17
18 ## XDR
19 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
20diff --git a/src/auth_des.c b/src/auth_des.c
21index 4d3639e..af2f61f 100644
22--- a/src/auth_des.c
23+++ b/src/auth_des.c
24@@ -46,8 +46,8 @@
25 #include <rpc/clnt.h>
26 #include <rpc/xdr.h>
27 #include <sys/socket.h>
28-#undef NIS
29-#include <rpcsvc/nis.h>
30+
31+#include "nis.h"
32
33 #if defined(LIBC_SCCS) && !defined(lint)
34 #endif
35diff --git a/src/auth_gss.c b/src/auth_gss.c
36index 9b88c38..5959893 100644
37--- a/src/auth_gss.c
38+++ b/src/auth_gss.c
39@@ -526,6 +526,14 @@ _rpc_gss_refresh(AUTH *auth, rpc_gss_options_ret_t *options_ret)
40 gr.gr_major != GSS_S_CONTINUE_NEEDED)) {
41 options_ret->major_status = gr.gr_major;
42 options_ret->minor_status = gr.gr_minor;
43+ if (call_stat != RPC_SUCCESS) {
44+ struct rpc_err err;
45+ clnt_geterr(gd->clnt, &err);
46+ LIBTIRPC_DEBUG(1, ("authgss_refresh: %s errno: %s",
47+ clnt_sperrno(call_stat), strerror(err.re_errno)));
48+ } else
49+ gss_log_status("authgss_refresh:",
50+ gr.gr_major, gr.gr_minor);
51 return FALSE;
52 }
53
54diff --git a/src/auth_time.c b/src/auth_time.c
55index 10e58eb..7f83ab4 100644
56--- a/src/auth_time.c
57+++ b/src/auth_time.c
58@@ -44,8 +44,8 @@
59 #include <rpc/rpcb_prot.h>
60 //#include <clnt_soc.h>
61 #include <sys/select.h>
62-#undef NIS
63-#include <rpcsvc/nis.h>
64+
65+#include "nis.h"
66
67
68 #ifdef TESTING
69diff --git a/src/des_impl.c b/src/des_impl.c
70index c5b7ed6..9dbccaf 100644
71--- a/src/des_impl.c
72+++ b/src/des_impl.c
73@@ -6,7 +6,8 @@
74 /* see <http://www.gnu.org/licenses/> to obtain a copy. */
75 #include <string.h>
76 #include <stdint.h>
77-#include <rpc/rpc_des.h>
78+#include <sys/types.h>
79+#include <rpc/des.h>
80
81
82 static const uint32_t des_SPtrans[8][64] =
83diff --git a/src/getpublickey.c b/src/getpublickey.c
84index 764a5f9..8cf4dc2 100644
85--- a/src/getpublickey.c
86+++ b/src/getpublickey.c
87@@ -38,8 +38,10 @@
88 #include <pwd.h>
89 #include <rpc/rpc.h>
90 #include <rpc/key_prot.h>
91+#ifdef YP
92 #include <rpcsvc/yp_prot.h>
93 #include <rpcsvc/ypclnt.h>
94+#endif
95 #include <string.h>
96 #include <stdlib.h>
97
98diff --git a/src/nis.h b/src/nis.h
99new file mode 100644
100index 0000000..588c041
101--- /dev/null
102+++ b/src/nis.h
103@@ -0,0 +1,70 @@
104+/*
105+ * Copyright (c) 2010, Oracle America, Inc.
106+ *
107+ * Redistribution and use in source and binary forms, with or without
108+ * modification, are permitted provided that the following conditions are
109+ * met:
110+ *
111+ * * Redistributions of source code must retain the above copyright
112+ * notice, this list of conditions and the following disclaimer.
113+ * * Redistributions in binary form must reproduce the above
114+ * copyright notice, this list of conditions and the following
115+ * disclaimer in the documentation and/or other materials
116+ * provided with the distribution.
117+ * * Neither the name of the "Oracle America, Inc." nor the names of its
118+ * contributors may be used to endorse or promote products derived
119+ * from this software without specific prior written permission.
120+ *
121+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
122+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
123+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
124+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
125+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
126+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
127+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
128+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
129+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
130+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
131+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
132+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
133+ */
134+
135+#ifndef _INTERNAL_NIS_H
136+#define _INTERNAL_NIS_H 1
137+
138+/* This file only contains the definition of nis_server, to be
139+ able to compile libtirpc without the need to have a glibc
140+ with sunrpc or a libnsl already installed. */
141+
142+#define NIS_PK_NONE 0
143+
144+struct nis_attr {
145+ char *zattr_ndx;
146+ struct {
147+ u_int zattr_val_len;
148+ char *zattr_val_val;
149+ } zattr_val;
150+};
151+typedef struct nis_attr nis_attr;
152+
153+typedef char *nis_name;
154+
155+struct endpoint {
156+ char *uaddr;
157+ char *family;
158+ char *proto;
159+};
160+typedef struct endpoint endpoint;
161+
162+struct nis_server {
163+ nis_name name;
164+ struct {
165+ u_int ep_len;
166+ endpoint *ep_val;
167+ } ep;
168+ uint32_t key_type;
169+ netobj pkey;
170+};
171+typedef struct nis_server nis_server;
172+
173+#endif /* ! _INTERNAL_NIS_H */
174diff --git a/src/rpc_dtablesize.c b/src/rpc_dtablesize.c
175index 13d320c..3fe503a 100644
176--- a/src/rpc_dtablesize.c
177+++ b/src/rpc_dtablesize.c
178@@ -27,22 +27,14 @@
179 */
180
181 #include <unistd.h>
182-
183 #include <sys/select.h>
184-
185-int _rpc_dtablesize(void); /* XXX */
186+#include <rpc/clnt.h>
187+#include <rpc/rpc_com.h>
188
189 /*
190 * Cache the result of getdtablesize(), so we don't have to do an
191 * expensive system call every time.
192 */
193-/*
194- * XXX In FreeBSD 2.x, you can have the maximum number of open file
195- * descriptors be greater than FD_SETSIZE (which us 256 by default).
196- *
197- * Since old programs tend to use this call to determine the first arg
198- * for _select(), having this return > FD_SETSIZE is a Bad Idea(TM)!
199- */
200 int
201 _rpc_dtablesize(void)
202 {
203diff --git a/src/rpc_soc.c b/src/rpc_soc.c
204index 1ec7b3f..ed0892a 100644
205--- a/src/rpc_soc.c
206+++ b/src/rpc_soc.c
207@@ -61,8 +61,8 @@
208 #include <string.h>
209 #include <unistd.h>
210 #include <fcntl.h>
211-#include <rpcsvc/nis.h>
212
213+#include "nis.h"
214 #include "rpc_com.h"
215
216 extern mutex_t rpcsoc_lock;
217diff --git a/src/rtime.c b/src/rtime.c
218index c34e0af..b642840 100644
219--- a/src/rtime.c
220+++ b/src/rtime.c
221@@ -46,6 +46,7 @@
222 #include <unistd.h>
223 #include <errno.h>
224 #include <sys/types.h>
225+#include <sys/poll.h>
226 #include <sys/socket.h>
227 #include <sys/time.h>
228 #include <netinet/in.h>
229@@ -67,7 +68,8 @@ rtime(addrp, timep, timeout)
230 struct timeval *timeout;
231 {
232 int s;
233- fd_set readfds;
234+ struct pollfd fd;
235+ int milliseconds;
236 int res;
237 unsigned long thetime;
238 struct sockaddr_in from;
239@@ -94,31 +96,32 @@ rtime(addrp, timep, timeout)
240 addrp->sin_port = serv->s_port;
241
242 if (type == SOCK_DGRAM) {
243- res = sendto(s, (char *)&thetime, sizeof(thetime), 0,
244+ res = sendto(s, (char *)&thetime, sizeof(thetime), 0,
245 (struct sockaddr *)addrp, sizeof(*addrp));
246 if (res < 0) {
247 do_close(s);
248- return(-1);
249+ return(-1);
250 }
251- do {
252- FD_ZERO(&readfds);
253- FD_SET(s, &readfds);
254- res = select(_rpc_dtablesize(), &readfds,
255- (fd_set *)NULL, (fd_set *)NULL, timeout);
256- } while (res < 0 && errno == EINTR);
257+
258+ milliseconds = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
259+ fd.fd = s;
260+ fd.events = POLLIN;
261+ do
262+ res = poll (&fd, 1, milliseconds);
263+ while (res < 0 && errno == EINTR);
264 if (res <= 0) {
265 if (res == 0) {
266 errno = ETIMEDOUT;
267 }
268 do_close(s);
269- return(-1);
270+ return(-1);
271 }
272 fromlen = sizeof(from);
273- res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
274+ res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
275 (struct sockaddr *)&from, &fromlen);
276 do_close(s);
277 if (res < 0) {
278- return(-1);
279+ return(-1);
280 }
281 } else {
282 if (connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) {
283diff --git a/src/svc.c b/src/svc.c
284index 9c41445..b59467b 100644
285--- a/src/svc.c
286+++ b/src/svc.c
287@@ -99,7 +99,7 @@ xprt_register (xprt)
288 {
289 __svc_xports = (SVCXPRT **) calloc (_rpc_dtablesize(), sizeof (SVCXPRT *));
290 if (__svc_xports == NULL)
291- return;
292+ goto unlock;
293 }
294 if (sock < _rpc_dtablesize())
295 {
296@@ -120,14 +120,14 @@ xprt_register (xprt)
297 svc_pollfd[i].fd = sock;
298 svc_pollfd[i].events = (POLLIN | POLLPRI |
299 POLLRDNORM | POLLRDBAND);
300- return;
301+ goto unlock;
302 }
303
304 new_svc_pollfd = (struct pollfd *) realloc (svc_pollfd,
305 sizeof (struct pollfd)
306 * (svc_max_pollfd + 1));
307 if (new_svc_pollfd == NULL) /* Out of memory */
308- return;
309+ goto unlock;
310 svc_pollfd = new_svc_pollfd;
311 ++svc_max_pollfd;
312
313@@ -135,6 +135,7 @@ xprt_register (xprt)
314 svc_pollfd[svc_max_pollfd - 1].events = (POLLIN | POLLPRI |
315 POLLRDNORM | POLLRDBAND);
316 }
317+unlock:
318 rwlock_unlock (&svc_fd_lock);
319 }
320
321diff --git a/src/svc_auth_des.c b/src/svc_auth_des.c
322index 5bc264c..2e90146 100644
323--- a/src/svc_auth_des.c
324+++ b/src/svc_auth_des.c
325@@ -86,13 +86,13 @@ static struct cache_entry *authdes_cache/* [AUTHDES_CACHESZ] */;
326 static short *authdes_lru/* [AUTHDES_CACHESZ] */;
327
328 static void cache_init(); /* initialize the cache */
329-static short cache_spot(); /* find an entry in the cache */
330-static void cache_ref(/*short sid*/); /* note that sid was ref'd */
331+static short cache_spot(des_block *key, char *name, struct timeval *timestamp); /* find an entry in the cache */
332+static void cache_ref(short sid); /* note that sid was ref'd */
333
334-static void invalidate(); /* invalidate entry in cache */
335+static void invalidate(char *cred); /* invalidate entry in cache */
336
337 /*
338- * cache statistics
339+ * cache statistics
340 */
341 static struct {
342 u_long ncachehits; /* times cache hit, and is not replay */
343diff --git a/src/svc_auth_gss.c b/src/svc_auth_gss.c
344index b6aa407..bece46a 100644
345--- a/src/svc_auth_gss.c
346+++ b/src/svc_auth_gss.c
347@@ -129,6 +129,8 @@ struct svc_rpc_gss_data {
348 ((struct svc_rpc_gss_data *)(auth)->svc_ah_private)
349
350 /* Global server credentials. */
351+static u_int _svcauth_req_time = 0;
352+static gss_OID_set_desc _svcauth_oid_set = {1, GSS_C_NULL_OID };
353 static gss_cred_id_t _svcauth_gss_creds;
354 static gss_name_t _svcauth_gss_name = GSS_C_NO_NAME;
355 static char * _svcauth_svc_name = NULL;
356@@ -167,6 +169,7 @@ svcauth_gss_import_name(char *service)
357 gss_name_t name;
358 gss_buffer_desc namebuf;
359 OM_uint32 maj_stat, min_stat;
360+ bool_t result;
361
362 gss_log_debug("in svcauth_gss_import_name()");
363
364@@ -181,22 +184,21 @@ svcauth_gss_import_name(char *service)
365 maj_stat, min_stat);
366 return (FALSE);
367 }
368- if (svcauth_gss_set_svc_name(name) != TRUE) {
369- gss_release_name(&min_stat, &name);
370- return (FALSE);
371- }
372- return (TRUE);
373+ result = svcauth_gss_set_svc_name(name);
374+ gss_release_name(&min_stat, &name);
375+ return result;
376 }
377
378 static bool_t
379-svcauth_gss_acquire_cred(u_int req_time, gss_OID_set_desc *oid_set)
380+svcauth_gss_acquire_cred(void)
381 {
382 OM_uint32 maj_stat, min_stat;
383
384 gss_log_debug("in svcauth_gss_acquire_cred()");
385
386- maj_stat = gss_acquire_cred(&min_stat, _svcauth_gss_name, req_time,
387- oid_set, GSS_C_ACCEPT,
388+ maj_stat = gss_acquire_cred(&min_stat, _svcauth_gss_name,
389+ _svcauth_req_time, &_svcauth_oid_set,
390+ GSS_C_ACCEPT,
391 &_svcauth_gss_creds, NULL, NULL);
392
393 if (maj_stat != GSS_S_COMPLETE) {
394@@ -300,6 +302,8 @@ svcauth_gss_accept_sec_context(struct svc_req *rqst,
395 NULL,
396 &gd->deleg);
397
398+ xdr_free((xdrproc_t)xdr_rpc_gss_init_args, (caddr_t)&recv_tok);
399+
400 if (gr->gr_major != GSS_S_COMPLETE &&
401 gr->gr_major != GSS_S_CONTINUE_NEEDED) {
402 gss_log_status("svcauth_gss_accept_sec_context: accept_sec_context",
403@@ -352,8 +356,11 @@ svcauth_gss_accept_sec_context(struct svc_req *rqst,
404 return (FALSE);
405
406 rqst->rq_xprt->xp_verf.oa_flavor = RPCSEC_GSS;
407- rqst->rq_xprt->xp_verf.oa_base = checksum.value;
408+ memcpy(rqst->rq_xprt->xp_verf.oa_base, checksum.value,
409+ checksum.length);
410 rqst->rq_xprt->xp_verf.oa_length = checksum.length;
411+
412+ gss_release_buffer(&min_stat, &checksum);
413 }
414 return (TRUE);
415 }
416@@ -435,10 +442,13 @@ svcauth_gss_nextverf(struct svc_req *rqst, u_int num)
417 maj_stat, min_stat);
418 return (FALSE);
419 }
420+
421 rqst->rq_xprt->xp_verf.oa_flavor = RPCSEC_GSS;
422- rqst->rq_xprt->xp_verf.oa_base = (caddr_t)checksum.value;
423+ memcpy(rqst->rq_xprt->xp_verf.oa_base, checksum.value, checksum.length);
424 rqst->rq_xprt->xp_verf.oa_length = (u_int)checksum.length;
425
426+ gss_release_buffer(&min_stat, &checksum);
427+
428 return (TRUE);
429 }
430
431@@ -568,6 +578,8 @@ _svcauth_gss(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch)
432 gss_qop_t qop;
433 struct svcauth_gss_cache_entry **ce;
434 time_t now;
435+ enum auth_stat result = AUTH_OK;
436+ OM_uint32 min_stat;
437
438 gss_log_debug("in svcauth_gss()");
439
440@@ -621,19 +633,25 @@ _svcauth_gss(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch)
441 XDR_DESTROY(&xdrs);
442
443 /* Check version. */
444- if (gc->gc_v != RPCSEC_GSS_VERSION)
445- return (AUTH_BADCRED);
446+ if (gc->gc_v != RPCSEC_GSS_VERSION) {
447+ result = AUTH_BADCRED;
448+ goto out;
449+ }
450
451 /* Check RPCSEC_GSS service. */
452 if (gc->gc_svc != RPCSEC_GSS_SVC_NONE &&
453 gc->gc_svc != RPCSEC_GSS_SVC_INTEGRITY &&
454- gc->gc_svc != RPCSEC_GSS_SVC_PRIVACY)
455- return (AUTH_BADCRED);
456+ gc->gc_svc != RPCSEC_GSS_SVC_PRIVACY) {
457+ result = AUTH_BADCRED;
458+ goto out;
459+ }
460
461 /* Check sequence number. */
462 if (gd->established) {
463- if (gc->gc_seq > MAXSEQ)
464- return (RPCSEC_GSS_CTXPROBLEM);
465+ if (gc->gc_seq > MAXSEQ) {
466+ result = RPCSEC_GSS_CTXPROBLEM;
467+ goto out;
468+ }
469
470 if ((offset = gd->seqlast - gc->gc_seq) < 0) {
471 gd->seqlast = gc->gc_seq;
472@@ -643,7 +661,8 @@ _svcauth_gss(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch)
473 }
474 else if (offset >= gd->win || (gd->seqmask & (1 << offset))) {
475 *no_dispatch = 1;
476- return (RPCSEC_GSS_CTXPROBLEM);
477+ result = RPCSEC_GSS_CTXPROBLEM;
478+ goto out;
479 }
480 gd->seq = gc->gc_seq;
481 gd->seqmask |= (1 << offset);
482@@ -654,35 +673,52 @@ _svcauth_gss(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch)
483 rqst->rq_svcname = (char *)gd->ctx;
484 }
485
486+ rqst->rq_xprt->xp_verf.oa_base = msg->rm_call.cb_verf.oa_base;
487+
488 /* Handle RPCSEC_GSS control procedure. */
489 switch (gc->gc_proc) {
490
491 case RPCSEC_GSS_INIT:
492 case RPCSEC_GSS_CONTINUE_INIT:
493- if (rqst->rq_proc != NULLPROC)
494- return (AUTH_FAILED); /* XXX ? */
495+ if (rqst->rq_proc != NULLPROC) {
496+ result = AUTH_FAILED; /* XXX ? */
497+ break;
498+ }
499
500 if (_svcauth_gss_name == GSS_C_NO_NAME) {
501- if (!svcauth_gss_import_name("nfs"))
502- return (AUTH_FAILED);
503+ if (!svcauth_gss_import_name("nfs")) {
504+ result = AUTH_FAILED;
505+ break;
506+ }
507 }
508
509- if (!svcauth_gss_acquire_cred(0, GSS_C_NULL_OID_SET))
510- return (AUTH_FAILED);
511+ if (!svcauth_gss_acquire_cred()) {
512+ result = AUTH_FAILED;
513+ break;
514+ }
515
516- if (!svcauth_gss_accept_sec_context(rqst, &gr))
517- return (AUTH_REJECTEDCRED);
518+ if (!svcauth_gss_accept_sec_context(rqst, &gr)) {
519+ result = AUTH_REJECTEDCRED;
520+ break;
521+ }
522
523- if (!svcauth_gss_nextverf(rqst, htonl(gr.gr_win)))
524- return (AUTH_FAILED);
525+ if (!svcauth_gss_nextverf(rqst, htonl(gr.gr_win))) {
526+ result = AUTH_FAILED;
527+ break;
528+ }
529
530 *no_dispatch = TRUE;
531
532 call_stat = svc_sendreply(rqst->rq_xprt,
533 (xdrproc_t)xdr_rpc_gss_init_res, (caddr_t)&gr);
534
535- if (!call_stat)
536- return (AUTH_FAILED);
537+ gss_release_buffer(&min_stat, &gr.gr_token);
538+ free(gr.gr_ctx.value);
539+
540+ if (!call_stat) {
541+ result = AUTH_FAILED;
542+ break;
543+ }
544
545 if (gr.gr_major == GSS_S_COMPLETE)
546 gd->established = TRUE;
547@@ -690,27 +726,37 @@ _svcauth_gss(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch)
548 break;
549
550 case RPCSEC_GSS_DATA:
551- if (!svcauth_gss_validate(gd, msg, &qop))
552- return (RPCSEC_GSS_CREDPROBLEM);
553+ if (!svcauth_gss_validate(gd, msg, &qop)) {
554+ result = RPCSEC_GSS_CREDPROBLEM;
555+ break;
556+ }
557
558- if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq)))
559- return (AUTH_FAILED);
560+ if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq))) {
561+ result = AUTH_FAILED;
562+ break;
563+ }
564
565 if (!gd->callback_done) {
566 gd->callback_done = TRUE;
567 gd->sec.qop = qop;
568 (void)rpc_gss_num_to_qop(gd->rcred.mechanism,
569 gd->sec.qop, &gd->rcred.qop);
570- if (!svcauth_gss_callback(rqst, gd))
571- return (AUTH_REJECTEDCRED);
572+ if (!svcauth_gss_callback(rqst, gd)) {
573+ result = AUTH_REJECTEDCRED;
574+ break;
575+ }
576 }
577
578 if (gd->locked) {
579 if (gd->rcred.service !=
580- _rpc_gss_svc_to_service(gc->gc_svc))
581- return (AUTH_FAILED);
582- if (gd->sec.qop != qop)
583- return (AUTH_BADVERF);
584+ _rpc_gss_svc_to_service(gc->gc_svc)) {
585+ result = AUTH_FAILED;
586+ break;
587+ }
588+ if (gd->sec.qop != qop) {
589+ result = AUTH_BADVERF;
590+ break;
591+ }
592 }
593
594 if (gd->sec.qop != qop) {
595@@ -724,17 +770,25 @@ _svcauth_gss(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch)
596 break;
597
598 case RPCSEC_GSS_DESTROY:
599- if (rqst->rq_proc != NULLPROC)
600- return (AUTH_FAILED); /* XXX ? */
601+ if (rqst->rq_proc != NULLPROC) {
602+ result = AUTH_FAILED; /* XXX ? */
603+ break;
604+ }
605
606- if (!svcauth_gss_validate(gd, msg, &qop))
607- return (RPCSEC_GSS_CREDPROBLEM);
608+ if (!svcauth_gss_validate(gd, msg, &qop)) {
609+ result = RPCSEC_GSS_CREDPROBLEM;
610+ break;
611+ }
612
613- if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq)))
614- return (AUTH_FAILED);
615+ if (!svcauth_gss_nextverf(rqst, htonl(gc->gc_seq))) {
616+ result = AUTH_FAILED;
617+ break;
618+ }
619
620- if (!svcauth_gss_release_cred())
621- return (AUTH_FAILED);
622+ if (!svcauth_gss_release_cred()) {
623+ result = AUTH_FAILED;
624+ break;
625+ }
626
627 SVCAUTH_DESTROY(&SVC_XP_AUTH(rqst->rq_xprt));
628 SVC_XP_AUTH(rqst->rq_xprt).svc_ah_ops = svc_auth_none.svc_ah_ops;
629@@ -743,10 +797,12 @@ _svcauth_gss(struct svc_req *rqst, struct rpc_msg *msg, bool_t *no_dispatch)
630 break;
631
632 default:
633- return (AUTH_REJECTEDCRED);
634+ result = AUTH_REJECTEDCRED;
635 break;
636 }
637- return (AUTH_OK);
638+out:
639+ xdr_free((xdrproc_t)xdr_rpc_gss_cred, (caddr_t)gc);
640+ return result;
641 }
642
643 static bool_t
644@@ -890,7 +946,6 @@ bool_t
645 rpc_gss_set_svc_name(char *principal, char *mechanism, u_int req_time,
646 u_int UNUSED(program), u_int UNUSED(version))
647 {
648- gss_OID_set_desc oid_set;
649 rpc_gss_OID oid;
650 char *save;
651
652@@ -902,14 +957,13 @@ rpc_gss_set_svc_name(char *principal, char *mechanism, u_int req_time,
653
654 if (!rpc_gss_mech_to_oid(mechanism, &oid))
655 goto out_err;
656- oid_set.count = 1;
657- oid_set.elements = (gss_OID)oid;
658
659 if (!svcauth_gss_import_name(principal))
660 goto out_err;
661- if (!svcauth_gss_acquire_cred(req_time, &oid_set))
662- goto out_err;
663
664+ _svcauth_req_time = req_time;
665+ _svcauth_oid_set.count = 1;
666+ _svcauth_oid_set.elements = (gss_OID)oid;
667 free(_svcauth_svc_name);
668 _svcauth_svc_name = save;
669 return TRUE;
670diff --git a/src/svc_vc.c b/src/svc_vc.c
671index 6ae613d..97a76a3 100644
672--- a/src/svc_vc.c
673+++ b/src/svc_vc.c
674@@ -270,14 +270,8 @@ makefd_xprt(fd, sendsize, recvsize)
675 struct cf_conn *cd;
676 const char *netid;
677 struct __rpc_sockinfo si;
678-
679- assert(fd != -1);
680
681- if (fd >= FD_SETSIZE) {
682- warnx("svc_vc: makefd_xprt: fd too high\n");
683- xprt = NULL;
684- goto done;
685- }
686+ assert(fd != -1);
687
688 xprt = mem_alloc(sizeof(SVCXPRT));
689 if (xprt == NULL) {
690@@ -338,22 +332,10 @@ rendezvous_request(xprt, msg)
691 r = (struct cf_rendezvous *)xprt->xp_p1;
692 again:
693 len = sizeof addr;
694- if ((sock = accept(xprt->xp_fd, (struct sockaddr *)(void *)&addr,
695- &len)) < 0) {
696+ sock = accept(xprt->xp_fd, (struct sockaddr *)(void *)&addr, &len);
697+ if (sock < 0) {
698 if (errno == EINTR)
699 goto again;
700-
701- if (errno == EMFILE || errno == ENFILE) {
702- /* If there are no file descriptors available, then accept will fail.
703- We want to delay here so the connection request can be dequeued;
704- otherwise we can bounce between polling and accepting, never
705- giving the request a chance to dequeue and eating an enormous
706- amount of cpu time in svc_run if we're polling on many file
707- descriptors. */
708- struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
709- nanosleep (&ts, NULL);
710- goto again;
711- }
712 return (FALSE);
713 }
714 /*
715diff --git a/tirpc/rpc/des.h b/tirpc/rpc/des.h
716index d2881ad..018aa48 100644
717--- a/tirpc/rpc/des.h
718+++ b/tirpc/rpc/des.h
719@@ -82,6 +82,6 @@ struct desparams {
720 /*
721 * Software DES.
722 */
723-extern int _des_crypt( char *, int, struct desparams * );
724+extern int _des_crypt( char *, unsigned, struct desparams * );
725
726 #endif
727diff --git a/tirpc/rpc/rpcent.h b/tirpc/rpc/rpcent.h
728index 147f909..e07503c 100644
729--- a/tirpc/rpc/rpcent.h
730+++ b/tirpc/rpc/rpcent.h
731@@ -60,10 +60,11 @@ struct rpcent {
732 extern struct rpcent *getrpcbyname(const char *);
733 extern struct rpcent *getrpcbynumber(int);
734 extern struct rpcent *getrpcent(void);
735-#endif
736
737 extern void setrpcent(int);
738 extern void endrpcent(void);
739+#endif
740+
741 #ifdef __cplusplus
742 }
743 #endif
diff --git a/meta/recipes-extended/libtirpc/libtirpc/remove-des-functionality.patch b/meta/recipes-extended/libtirpc/libtirpc/remove-des-functionality.patch
index 512e93497d..31e97744cb 100644
--- a/meta/recipes-extended/libtirpc/libtirpc/remove-des-functionality.patch
+++ b/meta/recipes-extended/libtirpc/libtirpc/remove-des-functionality.patch
@@ -6,21 +6,22 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
6Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 6Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7Signed-off-by: Maxin B. John <maxin.john@intel.com> 7Signed-off-by: Maxin B. John <maxin.john@intel.com>
8--- 8---
9diff -Naur libtirpc-1.0.1-orig/src/Makefile.am libtirpc-1.0.1/src/Makefile.am 9Index: libtirpc-1.0.1/src/Makefile.am
10--- libtirpc-1.0.1-orig/src/Makefile.am 2015-10-30 17:15:14.000000000 +0200 10===================================================================
11+++ libtirpc-1.0.1/src/Makefile.am 2015-12-21 15:56:17.094702429 +0200 11--- libtirpc-1.0.1.orig/src/Makefile.am
12@@ -22,9 +22,8 @@ 12+++ libtirpc-1.0.1/src/Makefile.am
13@@ -22,9 +22,8 @@ libtirpc_la_SOURCES = auth_none.c auth_u
13 pmap_prot.c pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c \ 14 pmap_prot.c pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c \
14 rpc_callmsg.c rpc_generic.c rpc_soc.c rpcb_clnt.c rpcb_prot.c \ 15 rpc_callmsg.c rpc_generic.c rpc_soc.c rpcb_clnt.c rpcb_prot.c \
15 rpcb_st_xdr.c svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_auth_none.c \ 16 rpcb_st_xdr.c svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_auth_none.c \
16- svc_auth_des.c \ 17- svc_auth_des.c \
17 svc_generic.c svc_raw.c svc_run.c svc_simple.c svc_vc.c getpeereid.c \ 18 svc_generic.c svc_raw.c svc_run.c svc_simple.c svc_vc.c getpeereid.c \
18- auth_time.c auth_des.c authdes_prot.c debug.c 19- auth_time.c auth_des.c authdes_prot.c debug.c des_crypt.c des_impl.c
19+ debug.c 20+ debug.c
20 21
21 ## XDR 22 ## XDR
22 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 23 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
23@@ -41,8 +40,8 @@ 24@@ -41,8 +40,8 @@ if GSS
24 libtirpc_la_CFLAGS = -DHAVE_RPCSEC_GSS $(GSSAPI_CFLAGS) 25 libtirpc_la_CFLAGS = -DHAVE_RPCSEC_GSS $(GSSAPI_CFLAGS)
25 endif 26 endif
26 27
@@ -31,18 +32,11 @@ diff -Naur libtirpc-1.0.1-orig/src/Makefile.am libtirpc-1.0.1/src/Makefile.am
31 32
32 CLEANFILES = cscope.* *~ 33 CLEANFILES = cscope.* *~
33 DISTCLEANFILES = Makefile.in 34 DISTCLEANFILES = Makefile.in
34diff -Naur libtirpc-1.0.1-orig/src/rpc_soc.c libtirpc-1.0.1/src/rpc_soc.c 35Index: libtirpc-1.0.1/src/rpc_soc.c
35--- libtirpc-1.0.1-orig/src/rpc_soc.c 2015-10-30 17:15:14.000000000 +0200 36===================================================================
36+++ libtirpc-1.0.1/src/rpc_soc.c 2015-12-21 15:56:17.095702416 +0200 37--- libtirpc-1.0.1.orig/src/rpc_soc.c
37@@ -61,7 +61,6 @@ 38+++ libtirpc-1.0.1/src/rpc_soc.c
38 #include <string.h> 39@@ -522,86 +522,6 @@ clnt_broadcast(prog, vers, proc, xargs,
39 #include <unistd.h>
40 #include <fcntl.h>
41-#include <rpcsvc/nis.h>
42
43 #include "rpc_com.h"
44
45@@ -522,86 +521,6 @@
46 } 40 }
47 41
48 /* 42 /*
@@ -129,10 +123,11 @@ diff -Naur libtirpc-1.0.1-orig/src/rpc_soc.c libtirpc-1.0.1/src/rpc_soc.c
129 * Create a client handle for a unix connection. Obsoleted by clnt_vc_create() 123 * Create a client handle for a unix connection. Obsoleted by clnt_vc_create()
130 */ 124 */
131 CLIENT * 125 CLIENT *
132diff -Naur libtirpc-1.0.1-orig/src/svc_auth.c libtirpc-1.0.1/src/svc_auth.c 126Index: libtirpc-1.0.1/src/svc_auth.c
133--- libtirpc-1.0.1-orig/src/svc_auth.c 2015-10-30 17:15:14.000000000 +0200 127===================================================================
134+++ libtirpc-1.0.1/src/svc_auth.c 2015-12-21 15:56:17.095702416 +0200 128--- libtirpc-1.0.1.orig/src/svc_auth.c
135@@ -114,9 +114,6 @@ 129+++ libtirpc-1.0.1/src/svc_auth.c
130@@ -114,9 +114,6 @@ _gss_authenticate(rqst, msg, no_dispatch
136 case AUTH_SHORT: 131 case AUTH_SHORT:
137 dummy = _svcauth_short(rqst, msg); 132 dummy = _svcauth_short(rqst, msg);
138 return (dummy); 133 return (dummy);
diff --git a/meta/recipes-extended/libtirpc/libtirpc_1.0.1.bb b/meta/recipes-extended/libtirpc/libtirpc_1.0.1.bb
index e321d479ec..8ba547506b 100644
--- a/meta/recipes-extended/libtirpc/libtirpc_1.0.1.bb
+++ b/meta/recipes-extended/libtirpc/libtirpc_1.0.1.bb
@@ -11,8 +11,8 @@ PROVIDES = "virtual/librpc"
11 11
12SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.bz2;name=libtirpc \ 12SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.bz2;name=libtirpc \
13 ${GENTOO_MIRROR}/${BPN}-glibc-nfs.tar.xz;name=glibc-nfs \ 13 ${GENTOO_MIRROR}/${BPN}-glibc-nfs.tar.xz;name=glibc-nfs \
14 file://libtirpc-1.0.2-rc3.patch \
14 file://libtirpc-0.2.1-fortify.patch \ 15 file://libtirpc-0.2.1-fortify.patch \
15 file://0001-Add-missing-rwlock_unlocks-in-xprt_register.patch \
16 " 16 "
17 17
18SRC_URI_append_libc-uclibc = " file://remove-des-functionality.patch \ 18SRC_URI_append_libc-uclibc = " file://remove-des-functionality.patch \
@@ -32,7 +32,7 @@ inherit autotools pkgconfig
32EXTRA_OECONF = "--disable-gssapi" 32EXTRA_OECONF = "--disable-gssapi"
33 33
34do_configure_prepend () { 34do_configure_prepend () {
35 cp -r ${S}/../tirpc ${S} 35 cp -r ${WORKDIR}/tirpc ${S}
36} 36}
37 37
38do_install_append() { 38do_install_append() {