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 /* 26 * Copyright 2014 Nexenta Systems, Inc. All rights reserved. 27 */ 28 29 #include <nfs/auth.h> 30 31 bool_t 32 xdr_varg(XDR *xdrs, varg_t *vap) 33 { 34 if (!xdr_u_int(xdrs, &vap->vers)) 35 return (FALSE); 36 37 switch (vap->vers) { 38 case V_PROTO: 39 if (!xdr_nfsauth_arg(xdrs, &vap->arg_u.arg)) 40 return (FALSE); 41 break; 42 43 /* Additional versions of the args go here */ 44 45 default: 46 vap->vers = V_ERROR; 47 return (FALSE); 48 /* NOTREACHED */ 49 } 50 return (TRUE); 51 } 52 53 bool_t 54 xdr_nfsauth_arg(XDR *xdrs, nfsauth_arg_t *argp) 55 { 56 if (!xdr_u_int(xdrs, &argp->cmd)) 57 return (FALSE); 58 if (!xdr_netobj(xdrs, &argp->areq.req_client)) 59 return (FALSE); 60 if (!xdr_string(xdrs, &argp->areq.req_netid, ~0)) 61 return (FALSE); 62 if (!xdr_string(xdrs, &argp->areq.req_path, A_MAXPATH)) 63 return (FALSE); 64 if (!xdr_int(xdrs, &argp->areq.req_flavor)) 65 return (FALSE); 66 if (!xdr_u_int(xdrs, &argp->areq.req_clnt_uid)) 67 return (FALSE); 68 if (!xdr_u_int(xdrs, &argp->areq.req_clnt_gid)) 69 return (FALSE); 70 return (TRUE); 71 } 72 73 bool_t 74 xdr_nfsauth_res(XDR *xdrs, nfsauth_res_t *argp) 75 { 76 if (!xdr_u_int(xdrs, &argp->stat)) 77 return (FALSE); 78 if (!xdr_int(xdrs, &argp->ares.auth_perm)) 79 return (FALSE); 80 if (!xdr_u_int(xdrs, &argp->ares.auth_srv_uid)) 81 return (FALSE); 82 if (!xdr_u_int(xdrs, &argp->ares.auth_srv_gid)) 83 return (FALSE); 84 return (TRUE); 85 } 86