1*2140Srmesta /*
2*2140Srmesta * CDDL HEADER START
3*2140Srmesta *
4*2140Srmesta * The contents of this file are subject to the terms of the
5*2140Srmesta * Common Development and Distribution License (the "License").
6*2140Srmesta * You may not use this file except in compliance with the License.
7*2140Srmesta *
8*2140Srmesta * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*2140Srmesta * or http://www.opensolaris.org/os/licensing.
10*2140Srmesta * See the License for the specific language governing permissions
11*2140Srmesta * and limitations under the License.
12*2140Srmesta *
13*2140Srmesta * When distributing Covered Code, include this CDDL HEADER in each
14*2140Srmesta * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*2140Srmesta * If applicable, add the following below this CDDL HEADER, with the
16*2140Srmesta * fields enclosed by brackets "[]" replaced with your own identifying
17*2140Srmesta * information: Portions Copyright [yyyy] [name of copyright owner]
18*2140Srmesta *
19*2140Srmesta * CDDL HEADER END
20*2140Srmesta */
21*2140Srmesta /*
22*2140Srmesta * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23*2140Srmesta * Use is subject to license terms.
24*2140Srmesta */
25*2140Srmesta #pragma ident "%Z%%M% %I% %E% SMI"
26*2140Srmesta
27*2140Srmesta #include <stdlib.h>
28*2140Srmesta #include <nfs/auth.h>
29*2140Srmesta
30*2140Srmesta bool_t
xdr_varg(XDR * xdrs,varg_t * vap)31*2140Srmesta xdr_varg(XDR *xdrs, varg_t *vap)
32*2140Srmesta {
33*2140Srmesta if (!xdr_u_int(xdrs, &vap->vers))
34*2140Srmesta return (FALSE);
35*2140Srmesta
36*2140Srmesta switch (vap->vers) {
37*2140Srmesta case V_PROTO:
38*2140Srmesta if (!xdr_nfsauth_arg(xdrs, &vap->arg_u.arg))
39*2140Srmesta return (FALSE);
40*2140Srmesta break;
41*2140Srmesta
42*2140Srmesta /* Additional versions of the args go here */
43*2140Srmesta
44*2140Srmesta default:
45*2140Srmesta vap->vers = V_ERROR;
46*2140Srmesta return (FALSE);
47*2140Srmesta /* NOTREACHED */
48*2140Srmesta }
49*2140Srmesta return (TRUE);
50*2140Srmesta }
51*2140Srmesta
52*2140Srmesta bool_t
xdr_nfsauth_arg(XDR * xdrs,nfsauth_arg_t * argp)53*2140Srmesta xdr_nfsauth_arg(XDR *xdrs, nfsauth_arg_t *argp)
54*2140Srmesta {
55*2140Srmesta if (!xdr_u_int(xdrs, &argp->cmd))
56*2140Srmesta return (FALSE);
57*2140Srmesta if (!xdr_netobj(xdrs, &argp->areq.req_client))
58*2140Srmesta return (FALSE);
59*2140Srmesta if (!xdr_string(xdrs, &argp->areq.req_netid, ~0))
60*2140Srmesta return (FALSE);
61*2140Srmesta if (!xdr_string(xdrs, &argp->areq.req_path, A_MAXPATH))
62*2140Srmesta return (FALSE);
63*2140Srmesta if (!xdr_int(xdrs, &argp->areq.req_flavor))
64*2140Srmesta return (FALSE);
65*2140Srmesta return (TRUE);
66*2140Srmesta }
67*2140Srmesta
68*2140Srmesta bool_t
xdr_nfsauth_res(XDR * xdrs,nfsauth_res_t * argp)69*2140Srmesta xdr_nfsauth_res(XDR *xdrs, nfsauth_res_t *argp)
70*2140Srmesta {
71*2140Srmesta if (!xdr_u_int(xdrs, &argp->stat))
72*2140Srmesta return (FALSE);
73*2140Srmesta if (!xdr_int(xdrs, &argp->ares.auth_perm))
74*2140Srmesta return (FALSE);
75*2140Srmesta return (TRUE);
76*2140Srmesta }
77