updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / lib32-libtirpc / libtirpc-0.2.3rc1.patch
blobd57a59e1f21bd38bde68fb261be032289bb44b68
1 diff --git a/src/Makefile.am b/src/Makefile.am
2 index 7ee8cbc..6731ff9 100644
3 --- a/src/Makefile.am
4 +++ b/src/Makefile.am
5 @@ -50,7 +50,7 @@ libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c bindresvport.c cln
6 rpc_callmsg.c rpc_generic.c rpc_soc.c rpcb_clnt.c rpcb_prot.c \
7 rpcb_st_xdr.c svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_generic.c \
8 svc_raw.c svc_run.c svc_simple.c svc_vc.c getpeereid.c \
9 - auth_time.c auth_des.c authdes_prot.c des_crypt.c
10 + auth_time.c auth_des.c authdes_prot.c
12 ## XDR
13 libtirpc_la_SOURCES += xdr.c xdr_rec.c xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c
14 diff --git a/src/auth_des.c b/src/auth_des.c
15 index 37e7667..f0c8b8c 100644
16 --- a/src/auth_des.c
17 +++ b/src/auth_des.c
18 @@ -223,6 +223,7 @@ authdes_pk_seccreate(const char *servername, netobj *pkey, u_int window,
19 goto failed;
21 ad->ad_nis_srvr = NULL; /* not needed any longer */
22 + auth_get(auth); /* Reference for caller */
23 return (auth);
25 failed:
26 @@ -472,6 +473,12 @@ authdes_destroy(AUTH *auth)
27 FREE(auth, sizeof(AUTH));
30 +static bool_t
31 +authdes_wrap(AUTH *auth, XDR *xdrs, xdrproc_t xfunc, caddr_t xwhere)
33 + return ((*xfunc)(xdrs, xwhere));
36 static struct auth_ops *
37 authdes_ops(void)
39 @@ -487,6 +494,8 @@ authdes_ops(void)
40 ops.ah_validate = authdes_validate;
41 ops.ah_refresh = authdes_refresh;
42 ops.ah_destroy = authdes_destroy;
43 + ops.ah_wrap = authdes_wrap;
44 + ops.ah_unwrap = authdes_wrap;
46 mutex_unlock(&authdes_ops_lock);
47 return (&ops);
48 diff --git a/src/auth_gss.c b/src/auth_gss.c
49 index df3017a..a992049 100644
50 --- a/src/auth_gss.c
51 +++ b/src/auth_gss.c
52 @@ -200,6 +200,8 @@ authgss_create(CLIENT *clnt, gss_name_t name, struct rpc_gss_sec *sec)
54 if (!authgss_refresh(auth))
55 auth = NULL;
56 + else
57 + auth_get(auth); /* Reference for caller */
59 clnt->cl_auth = save_auth;
61 @@ -555,9 +557,20 @@ authgss_destroy_context(AUTH *auth)
63 if (gd->gc.gc_ctx.length != 0) {
64 if (gd->established) {
65 + AUTH *save_auth = NULL;
67 + /* Make sure we use the right auth_ops */
68 + if (gd->clnt->cl_auth != auth) {
69 + save_auth = gd->clnt->cl_auth;
70 + gd->clnt->cl_auth = auth;
71 + }
73 gd->gc.gc_proc = RPCSEC_GSS_DESTROY;
74 clnt_call(gd->clnt, NULLPROC, (xdrproc_t)xdr_void, NULL,
75 (xdrproc_t)xdr_void, NULL, AUTH_TIMEOUT);
77 + if (save_auth != NULL)
78 + gd->clnt->cl_auth = save_auth;
80 gss_release_buffer(&min_stat, &gd->gc.gc_ctx);
81 /* XXX ANDROS check size of context - should be 8 */
82 diff --git a/src/auth_none.c b/src/auth_none.c
83 index a439ec6..008c589 100644
84 --- a/src/auth_none.c
85 +++ b/src/auth_none.c
86 @@ -155,6 +155,12 @@ authnone_destroy(AUTH *client)
90 +static bool_t
91 +authnone_wrap(AUTH *auth, XDR *xdrs, xdrproc_t xfunc, caddr_t xwhere)
93 + return ((*xfunc)(xdrs, xwhere));
96 static struct auth_ops *
97 authnone_ops()
99 @@ -170,6 +176,8 @@ authnone_ops()
100 ops.ah_validate = authnone_validate;
101 ops.ah_refresh = authnone_refresh;
102 ops.ah_destroy = authnone_destroy;
103 + ops.ah_wrap = authnone_wrap;
104 + ops.ah_unwrap = authnone_wrap;
106 mutex_unlock(&ops_lock);
107 return (&ops);
108 diff --git a/src/auth_unix.c b/src/auth_unix.c
109 index c2469da..4b9b13f 100644
110 --- a/src/auth_unix.c
111 +++ b/src/auth_unix.c
112 @@ -162,6 +162,7 @@ authunix_create(machname, uid, gid, len, aup_gids)
114 auth->ah_cred = au->au_origcred;
115 marshal_new_auth(auth);
116 + auth_get(auth); /* Reference for caller */
117 return (auth);
118 #ifndef _KERNEL
119 cleanup_authunix_create:
120 @@ -396,6 +397,12 @@ marshal_new_auth(auth)
121 XDR_DESTROY(xdrs);
124 +static bool_t
125 +authunix_wrap(AUTH *auth, XDR *xdrs, xdrproc_t xfunc, caddr_t xwhere)
127 + return ((*xfunc)(xdrs, xwhere));
130 static struct auth_ops *
131 authunix_ops()
133 @@ -411,6 +418,8 @@ authunix_ops()
134 ops.ah_validate = authunix_validate;
135 ops.ah_refresh = authunix_refresh;
136 ops.ah_destroy = authunix_destroy;
137 + ops.ah_wrap = authunix_wrap;
138 + ops.ah_unwrap = authunix_wrap;
140 mutex_unlock(&ops_lock);
141 return (&ops);
142 diff --git a/src/authgss_prot.c b/src/authgss_prot.c
143 index 9d7fa09..0168318 100644
144 --- a/src/authgss_prot.c
145 +++ b/src/authgss_prot.c
146 @@ -161,6 +161,7 @@ xdr_rpc_gss_wrap_data(XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr,
147 databuflen = end - start - 4;
148 XDR_SETPOS(xdrs, start + 4);
149 databuf.value = XDR_INLINE(xdrs, databuflen);
150 + databuf.length = databuflen;
152 xdr_stat = FALSE;
154 @@ -169,7 +170,6 @@ xdr_rpc_gss_wrap_data(XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr,
155 XDR_SETPOS(xdrs, start);
156 if (!xdr_u_int(xdrs, (u_int *)&databuflen))
157 return (FALSE);
158 - databuf.length = databuflen;
160 /* Checksum rpc_gss_data_t. */
161 maj_stat = gss_get_mic(&min_stat, ctx, qop,
162 diff --git a/src/clnt_dg.c b/src/clnt_dg.c
163 index 79fed5d..4a1f60a 100644
164 --- a/src/clnt_dg.c
165 +++ b/src/clnt_dg.c
166 @@ -366,7 +366,7 @@ call_again:
168 if ((! XDR_PUTINT32(xdrs, (int32_t *)&proc)) ||
169 (! AUTH_MARSHALL(cl->cl_auth, xdrs)) ||
170 - (! (*xargs)(xdrs, argsp))) {
171 + (! AUTH_WRAP(cl->cl_auth, xdrs, xargs, argsp))) {
172 cu->cu_error.re_status = RPC_CANTENCODEARGS;
173 goto out;
175 @@ -400,8 +400,8 @@ get_reply:
176 * (We assume that this is actually only executed once.)
178 reply_msg.acpted_rply.ar_verf = _null_auth;
179 - reply_msg.acpted_rply.ar_results.where = resultsp;
180 - reply_msg.acpted_rply.ar_results.proc = xresults;
181 + reply_msg.acpted_rply.ar_results.where = NULL;
182 + reply_msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
184 fd.fd = cu->cu_fd;
185 fd.events = POLLIN;
186 @@ -512,6 +512,10 @@ get_reply:
187 &reply_msg.acpted_rply.ar_verf)) {
188 cu->cu_error.re_status = RPC_AUTHERROR;
189 cu->cu_error.re_why = AUTH_INVALIDRESP;
190 + } else if (! AUTH_UNWRAP(cl->cl_auth, &reply_xdrs,
191 + xresults, resultsp)) {
192 + if (cu->cu_error.re_status == RPC_SUCCESS)
193 + cu->cu_error.re_status = RPC_CANTDECODERES;
195 if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) {
196 xdrs->x_op = XDR_FREE;
197 diff --git a/src/clnt_vc.c b/src/clnt_vc.c
198 index 359063c..097cae8 100644
199 --- a/src/clnt_vc.c
200 +++ b/src/clnt_vc.c
201 @@ -364,7 +364,7 @@ call_again:
202 if ((! XDR_PUTBYTES(xdrs, ct->ct_u.ct_mcallc, ct->ct_mpos)) ||
203 (! XDR_PUTINT32(xdrs, (int32_t *)&proc)) ||
204 (! AUTH_MARSHALL(cl->cl_auth, xdrs)) ||
205 - (! (*xdr_args)(xdrs, args_ptr))) {
206 + (! AUTH_WRAP(cl->cl_auth, xdrs, xdr_args, args_ptr))) {
207 if (ct->ct_error.re_status == RPC_SUCCESS)
208 ct->ct_error.re_status = RPC_CANTENCODEARGS;
209 (void)xdrrec_endofrecord(xdrs, TRUE);
210 @@ -420,7 +420,8 @@ call_again:
211 &reply_msg.acpted_rply.ar_verf)) {
212 ct->ct_error.re_status = RPC_AUTHERROR;
213 ct->ct_error.re_why = AUTH_INVALIDRESP;
214 - } else if (! (*xdr_results)(xdrs, results_ptr)) {
215 + } else if (! AUTH_UNWRAP(cl->cl_auth, xdrs,
216 + xdr_results, results_ptr)) {
217 if (ct->ct_error.re_status == RPC_SUCCESS)
218 ct->ct_error.re_status = RPC_CANTDECODERES;
220 diff --git a/src/svc.c b/src/svc.c
221 index b4a63d0..08cd6c9 100644
222 --- a/src/svc.c
223 +++ b/src/svc.c
224 @@ -77,9 +77,6 @@ static struct svc_callout
226 extern rwlock_t svc_lock;
227 extern rwlock_t svc_fd_lock;
228 -#ifdef HAVE_LIBGSSAPI
229 -extern struct svc_auth_ops svc_auth_gss_ops;
230 -#endif
232 static struct svc_callout *svc_find (rpcprog_t, rpcvers_t,
233 struct svc_callout **, char *);
234 @@ -717,11 +714,9 @@ svc_getreq_common (fd)
235 SVC_DESTROY (xprt);
236 break;
238 - else if ((xprt->xp_auth != NULL)
239 -#ifdef HAVE_LIBGSSAPI
240 - && (xprt->xp_auth->svc_ah_ops != &svc_auth_gss_ops)
241 -#endif
242 - ) {
243 + else if ((xprt->xp_auth != NULL) &&
244 + (xprt->xp_auth->svc_ah_private == NULL))
246 xprt->xp_auth = NULL;
249 diff --git a/src/svc_auth.c b/src/svc_auth.c
250 index c6b3a0b..e80d5f9 100644
251 --- a/src/svc_auth.c
252 +++ b/src/svc_auth.c
253 @@ -98,8 +98,8 @@ _authenticate(rqst, msg)
254 rqst->rq_xprt->xp_verf.oa_length = 0;
255 cred_flavor = rqst->rq_cred.oa_flavor;
256 switch (cred_flavor) {
257 - case AUTH_NULL:
258 - dummy = _svcauth_null(rqst, msg);
259 + case AUTH_NONE:
260 + dummy = _svcauth_none(rqst, msg);
261 return (dummy);
262 case AUTH_SYS:
263 dummy = _svcauth_unix(rqst, msg);
264 @@ -132,15 +132,6 @@ _authenticate(rqst, msg)
265 return (AUTH_REJECTEDCRED);
268 -/*ARGSUSED*/
269 -enum auth_stat
270 -_svcauth_null(rqst, msg)
271 - struct svc_req *rqst;
272 - struct rpc_msg *msg;
274 - return (AUTH_OK);
278 * Allow the rpc service to register new authentication types that it is
279 * prepared to handle. When an authentication flavor is registered,
280 diff --git a/src/svc_auth_unix.c b/src/svc_auth_unix.c
281 index ce83859..9585069 100644
282 --- a/src/svc_auth_unix.c
283 +++ b/src/svc_auth_unix.c
284 @@ -43,6 +43,8 @@
286 #include <rpc/rpc.h>
288 +extern SVCAUTH svc_auth_none;
291 * Unix longhand authenticator
293 @@ -67,6 +69,8 @@ _svcauth_unix(rqst, msg)
294 assert(rqst != NULL);
295 assert(msg != NULL);
297 + rqst->rq_xprt->xp_auth = &svc_auth_none;
299 area = (struct area *) rqst->rq_clntcred;
300 aup = &area->area_aup;
301 aup->aup_machname = area->area_machname;
302 @@ -142,5 +146,6 @@ _svcauth_short(rqst, msg)
303 struct svc_req *rqst;
304 struct rpc_msg *msg;
306 + rqst->rq_xprt->xp_auth = &svc_auth_none;
307 return (AUTH_REJECTEDCRED);
309 diff --git a/src/svc_dg.c b/src/svc_dg.c
310 index 66a56ee..5ef9df2 100644
311 --- a/src/svc_dg.c
312 +++ b/src/svc_dg.c
313 @@ -134,6 +134,7 @@ svc_dg_create(fd, sendsize, recvsize)
314 su->su_cache = NULL;
315 xprt->xp_fd = fd;
316 xprt->xp_p2 = su;
317 + xprt->xp_auth = NULL;
318 xprt->xp_verf.oa_base = su->su_verfbody;
319 svc_dg_ops(xprt);
320 xprt->xp_rtaddr.maxlen = sizeof (struct sockaddr_storage);
321 @@ -234,10 +235,27 @@ svc_dg_reply(xprt, msg)
322 bool_t stat = FALSE;
323 size_t slen;
325 + xdrproc_t xdr_results;
326 + caddr_t xdr_location;
327 + bool_t has_args;
329 + if (msg->rm_reply.rp_stat == MSG_ACCEPTED &&
330 + msg->rm_reply.rp_acpt.ar_stat == SUCCESS) {
331 + has_args = TRUE;
332 + xdr_results = msg->acpted_rply.ar_results.proc;
333 + xdr_location = msg->acpted_rply.ar_results.where;
335 + msg->acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
336 + msg->acpted_rply.ar_results.where = NULL;
337 + } else
338 + has_args = FALSE;
340 xdrs->x_op = XDR_ENCODE;
341 XDR_SETPOS(xdrs, 0);
342 msg->rm_xid = su->su_xid;
343 - if (xdr_replymsg(xdrs, msg)) {
344 + if (xdr_replymsg(xdrs, msg) &&
345 + (!has_args ||
346 + (SVCAUTH_WRAP(xprt->xp_auth, xdrs, xdr_results, xdr_location)))) {
347 struct msghdr *msg = &su->su_msghdr;
348 struct iovec iov;
350 @@ -264,7 +282,12 @@ svc_dg_getargs(xprt, xdr_args, args_ptr)
351 xdrproc_t xdr_args;
352 void *args_ptr;
354 - return (*xdr_args)(&(su_data(xprt)->su_xdrs), args_ptr);
355 + if (! SVCAUTH_UNWRAP(xprt->xp_auth, &(su_data(xprt)->su_xdrs),
356 + xdr_args, args_ptr)) {
357 + (void)svc_freeargs(xprt, xdr_args, args_ptr);
358 + return FALSE;
360 + return TRUE;
363 static bool_t
364 @@ -288,6 +311,10 @@ svc_dg_destroy(xprt)
365 xprt_unregister(xprt);
366 if (xprt->xp_fd != -1)
367 (void)close(xprt->xp_fd);
368 + if (xprt->xp_auth != NULL) {
369 + SVCAUTH_DESTROY(xprt->xp_auth);
370 + xprt->xp_auth = NULL;
372 XDR_DESTROY(&(su->su_xdrs));
373 (void) mem_free(rpc_buffer(xprt), su->su_iosz);
374 (void) mem_free(su, sizeof (*su));
375 diff --git a/src/svc_vc.c b/src/svc_vc.c
376 index aaaf2d7..74632e2 100644
377 --- a/src/svc_vc.c
378 +++ b/src/svc_vc.c
379 @@ -172,6 +172,7 @@ svc_vc_create(fd, sendsize, recvsize)
380 xprt->xp_p1 = r;
381 xprt->xp_p2 = NULL;
382 xprt->xp_p3 = NULL;
383 + xprt->xp_auth = NULL;
384 xprt->xp_verf = _null_auth;
385 svc_vc_rendezvous_ops(xprt);
386 xprt->xp_port = (u_short)-1; /* It is the rendezvouser */
387 @@ -283,6 +284,7 @@ makefd_xprt(fd, sendsize, recvsize)
388 xdrrec_create(&(cd->xdrs), sendsize, recvsize,
389 xprt, read_vc, write_vc);
390 xprt->xp_p1 = cd;
391 + xprt->xp_auth = NULL;
392 xprt->xp_verf.oa_base = cd->verf_body;
393 svc_vc_ops(xprt); /* truely deals with calls */
394 xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
395 @@ -412,6 +414,10 @@ __svc_vc_dodestroy(xprt)
396 XDR_DESTROY(&(cd->xdrs));
397 mem_free(cd, sizeof(struct cf_conn));
399 + if (xprt->xp_auth != NULL) {
400 + SVCAUTH_DESTROY(xprt->xp_auth);
401 + xprt->xp_auth = NULL;
403 if (xprt->xp_rtaddr.buf)
404 mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen);
405 if (xprt->xp_ltaddr.buf)
406 @@ -610,7 +616,11 @@ svc_vc_recv(xprt, msg)
409 xdrs->x_op = XDR_DECODE;
410 - (void)xdrrec_skiprecord(xdrs);
411 + /*
412 + * No need skip records with nonblocking connections
413 + */
414 + if (cd->nonblock == FALSE)
415 + (void)xdrrec_skiprecord(xdrs);
416 if (xdr_callmsg(xdrs, msg)) {
417 cd->x_id = msg->rm_xid;
418 return (TRUE);
419 @@ -628,8 +638,13 @@ svc_vc_getargs(xprt, xdr_args, args_ptr)
421 assert(xprt != NULL);
422 /* args_ptr may be NULL */
423 - return ((*xdr_args)(&(((struct cf_conn *)(xprt->xp_p1))->xdrs),
424 - args_ptr));
426 + if (! SVCAUTH_UNWRAP(xprt->xp_auth,
427 + &(((struct cf_conn *)(xprt->xp_p1))->xdrs),
428 + xdr_args, args_ptr)) {
429 + return FALSE;
431 + return TRUE;
434 static bool_t
435 @@ -658,15 +673,35 @@ svc_vc_reply(xprt, msg)
436 XDR *xdrs;
437 bool_t rstat;
439 + xdrproc_t xdr_results;
440 + caddr_t xdr_location;
441 + bool_t has_args;
443 assert(xprt != NULL);
444 assert(msg != NULL);
446 cd = (struct cf_conn *)(xprt->xp_p1);
447 xdrs = &(cd->xdrs);
449 + if (msg->rm_reply.rp_stat == MSG_ACCEPTED &&
450 + msg->rm_reply.rp_acpt.ar_stat == SUCCESS) {
451 + has_args = TRUE;
452 + xdr_results = msg->acpted_rply.ar_results.proc;
453 + xdr_location = msg->acpted_rply.ar_results.where;
455 + msg->acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
456 + msg->acpted_rply.ar_results.where = NULL;
457 + } else
458 + has_args = FALSE;
460 xdrs->x_op = XDR_ENCODE;
461 msg->rm_xid = cd->x_id;
462 - rstat = xdr_replymsg(xdrs, msg);
463 + rstat = FALSE;
464 + if (xdr_replymsg(xdrs, msg) &&
465 + (!has_args ||
466 + (SVCAUTH_WRAP(xprt->xp_auth, xdrs, xdr_results, xdr_location)))) {
467 + rstat = TRUE;
469 (void)xdrrec_endofrecord(xdrs, TRUE);
470 return (rstat);
472 diff --git a/src/xdr_rec.c b/src/xdr_rec.c
473 index 4e815d7..2aca623 100644
474 --- a/src/xdr_rec.c
475 +++ b/src/xdr_rec.c
476 @@ -64,7 +64,6 @@
477 #include <rpc/clnt.h>
478 #include <stddef.h>
479 #include "rpc_com.h"
480 -#include <unistd.h>
481 static bool_t xdrrec_getlong(XDR *, long *);
482 static bool_t xdrrec_putlong(XDR *, const long *);
483 static bool_t xdrrec_getbytes(XDR *, char *, u_int);
484 @@ -330,22 +329,22 @@ xdrrec_getpos(xdrs)
485 RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
486 off_t pos;
488 - pos = lseek((int)(u_long)rstrm->tcp_handle, (off_t)0, 1);
489 - if (pos != -1)
490 - switch (xdrs->x_op) {
491 + switch (xdrs->x_op) {
493 - case XDR_ENCODE:
494 - pos += rstrm->out_finger - rstrm->out_base;
495 - break;
496 + case XDR_ENCODE:
497 + pos = rstrm->out_finger - rstrm->out_base
498 + - BYTES_PER_XDR_UNIT;
499 + break;
501 - case XDR_DECODE:
502 - pos -= rstrm->in_boundry - rstrm->in_finger;
503 - break;
504 + case XDR_DECODE:
505 + pos = rstrm->in_boundry - rstrm->in_finger
506 + - BYTES_PER_XDR_UNIT;
507 + break;
509 - default:
510 - pos = (off_t) -1;
511 - break;
513 + default:
514 + pos = (off_t) -1;
515 + break;
517 return ((u_int) pos);
520 diff --git a/tirpc/rpc/auth.h b/tirpc/rpc/auth.h
521 index 734e6b9..5f66e67 100644
522 --- a/tirpc/rpc/auth.h
523 +++ b/tirpc/rpc/auth.h
524 @@ -203,8 +203,22 @@ typedef struct __auth {
526 } *ah_ops;
527 void *ah_private;
528 + int ah_refcnt;
529 } AUTH;
531 +static __inline int
532 +auth_get(AUTH *auth)
534 + return __sync_add_and_fetch(&auth->ah_refcnt, 1);
537 +static __inline int
538 +auth_put(AUTH *auth)
540 + return __sync_sub_and_fetch(&auth->ah_refcnt, 1);
546 * Authentication ops.
547 @@ -234,10 +248,23 @@ typedef struct __auth {
548 #define auth_refresh(auth, msg) \
549 ((*((auth)->ah_ops->ah_refresh))(auth, msg))
551 -#define AUTH_DESTROY(auth) \
552 - ((*((auth)->ah_ops->ah_destroy))(auth))
553 -#define auth_destroy(auth) \
554 - ((*((auth)->ah_ops->ah_destroy))(auth))
555 +#define AUTH_DESTROY(auth) \
556 + do { \
557 + int refs; \
558 + if ((refs = auth_put((auth))) == 0) \
559 + ((*((auth)->ah_ops->ah_destroy))(auth));\
560 + log_debug("%s: auth_put(), refs %d\n", \
561 + __func__, refs); \
562 + } while (0)
564 +#define auth_destroy(auth) \
565 + do { \
566 + int refs; \
567 + if ((refs = auth_put((auth))) == 0) \
568 + ((*((auth)->ah_ops->ah_destroy))(auth));\
569 + log_debug("%s: auth_put(), refs %d\n", \
570 + __func__, refs); \
571 + } while (0)
573 #define AUTH_WRAP(auth, xdrs, xfunc, xwhere) \
574 ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
575 @@ -373,7 +400,7 @@ __END_DECLS
576 __BEGIN_DECLS
577 struct svc_req;
578 struct rpc_msg;
579 -enum auth_stat _svcauth_null (struct svc_req *, struct rpc_msg *);
580 +enum auth_stat _svcauth_none (struct svc_req *, struct rpc_msg *);
581 enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *);
582 enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *);
583 __END_DECLS
584 diff --git a/tirpc/rpc/des.h b/tirpc/rpc/des.h
585 index e3d6897..d2881ad 100644
586 --- a/tirpc/rpc/des.h
587 +++ b/tirpc/rpc/des.h
588 @@ -33,6 +33,9 @@
589 * Copyright (c) 1986 by Sun Microsystems, Inc.
592 +#ifndef _RPC_DES_H_
593 +#define _RPC_DES_H_
595 #define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
596 #define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
598 @@ -80,3 +83,5 @@ struct desparams {
599 * Software DES.
601 extern int _des_crypt( char *, int, struct desparams * );
603 +#endif
604 diff --git a/tirpc/rpc/svc_auth.h b/tirpc/rpc/svc_auth.h
605 index 659e90c..14269d1 100644
606 --- a/tirpc/rpc/svc_auth.h
607 +++ b/tirpc/rpc/svc_auth.h
608 @@ -44,17 +44,23 @@
610 * Interface to server-side authentication flavors.
612 -typedef struct {
613 +typedef struct SVCAUTH {
614 struct svc_auth_ops {
615 - int (*svc_ah_wrap)(void);
616 - int (*svc_ah_unwrap)(void);
617 - int (*svc_ah_destroy)(void);
618 + int (*svc_ah_wrap)(struct SVCAUTH *, XDR *, xdrproc_t,
619 + caddr_t);
620 + int (*svc_ah_unwrap)(struct SVCAUTH *, XDR *, xdrproc_t,
621 + caddr_t);
622 + int (*svc_ah_destroy)(struct SVCAUTH *);
623 } *svc_ah_ops;
624 caddr_t svc_ah_private;
625 } SVCAUTH;
627 -#define SVCAUTH_DESTROY(cred) ((*(cred)->svc_ah_ops->svc_ah_destroy)())
628 -#define svcauth_destroy(cred) ((*(cred)->svc_ah_ops->svc_ah_destroy)())
629 +#define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \
630 + ((*((auth)->svc_ah_ops->svc_ah_wrap))(auth, xdrs, xfunc, xwhere))
631 +#define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \
632 + ((*((auth)->svc_ah_ops->svc_ah_unwrap))(auth, xdrs, xfunc, xwhere))
633 +#define SVCAUTH_DESTROY(auth) \
634 + ((*((auth)->svc_ah_ops->svc_ah_destroy))(auth))
637 * Server side authenticator