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