1e8636dfdSBill Paul #if defined(LIBC_SCCS) && !defined(lint) 2e8636dfdSBill Paul static char sccsid[] = "@(#)authdes_prot.c 2.1 88/07/29 4.0 RPCSRC; from 1.6 88/02/08 SMI"; 3e8636dfdSBill Paul #endif 4e8636dfdSBill Paul /* 5e8636dfdSBill Paul * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 6e8636dfdSBill Paul * unrestricted use provided that this legend is included on all tape 7e8636dfdSBill Paul * media and as a part of the software program in whole or part. Users 8e8636dfdSBill Paul * may copy or modify Sun RPC without charge, but are not authorized 9e8636dfdSBill Paul * to license or distribute it to anyone else except as part of a product or 10e8636dfdSBill Paul * program developed by the user. 11e8636dfdSBill Paul * 12e8636dfdSBill Paul * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 13e8636dfdSBill Paul * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 14e8636dfdSBill Paul * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 15e8636dfdSBill Paul * 16e8636dfdSBill Paul * Sun RPC is provided with no support and without any obligation on the 17e8636dfdSBill Paul * part of Sun Microsystems, Inc. to assist in its use, correction, 18e8636dfdSBill Paul * modification or enhancement. 19e8636dfdSBill Paul * 20e8636dfdSBill Paul * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 21e8636dfdSBill Paul * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 22e8636dfdSBill Paul * OR ANY PART THEREOF. 23e8636dfdSBill Paul * 24e8636dfdSBill Paul * In no event will Sun Microsystems, Inc. be liable for any lost revenue 25e8636dfdSBill Paul * or profits or other special, indirect and consequential damages, even if 26e8636dfdSBill Paul * Sun has been advised of the possibility of such damages. 27e8636dfdSBill Paul * 28e8636dfdSBill Paul * Sun Microsystems, Inc. 29e8636dfdSBill Paul * 2550 Garcia Avenue 30e8636dfdSBill Paul * Mountain View, California 94043 31e8636dfdSBill Paul */ 32e8636dfdSBill Paul /* 33e8636dfdSBill Paul * Copyright (c) 1988 by Sun Microsystems, Inc. 34e8636dfdSBill Paul */ 35e8636dfdSBill Paul 36e8636dfdSBill Paul /* 37e8636dfdSBill Paul * authdes_prot.c, XDR routines for DES authentication 38e8636dfdSBill Paul */ 39e8636dfdSBill Paul 40e8636dfdSBill Paul #include <rpc/types.h> 41e8636dfdSBill Paul #include <rpc/xdr.h> 42e8636dfdSBill Paul #include <rpc/auth.h> 43e8636dfdSBill Paul #include <rpc/auth_des.h> 44e8636dfdSBill Paul 45e8636dfdSBill Paul #define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE) 46e8636dfdSBill Paul 47e8636dfdSBill Paul bool_t 48e8636dfdSBill Paul xdr_authdes_cred(xdrs, cred) 49e8636dfdSBill Paul XDR *xdrs; 50e8636dfdSBill Paul struct authdes_cred *cred; 51e8636dfdSBill Paul { 52e8636dfdSBill Paul /* 53e8636dfdSBill Paul * Unrolled xdr 54e8636dfdSBill Paul */ 55e8636dfdSBill Paul ATTEMPT(xdr_enum(xdrs, (enum_t *)&cred->adc_namekind)); 56e8636dfdSBill Paul switch (cred->adc_namekind) { 57e8636dfdSBill Paul case ADN_FULLNAME: 58e8636dfdSBill Paul ATTEMPT(xdr_string(xdrs, &cred->adc_fullname.name, MAXNETNAMELEN)); 59e8636dfdSBill Paul ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.key, sizeof(des_block))); 60e8636dfdSBill Paul ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.window, sizeof(cred->adc_fullname.window))); 61e8636dfdSBill Paul return (TRUE); 62e8636dfdSBill Paul case ADN_NICKNAME: 63e8636dfdSBill Paul ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_nickname, sizeof(cred->adc_nickname))); 64e8636dfdSBill Paul return (TRUE); 65e8636dfdSBill Paul default: 66e8636dfdSBill Paul return (FALSE); 67e8636dfdSBill Paul } 68e8636dfdSBill Paul } 69e8636dfdSBill Paul 70e8636dfdSBill Paul 71e8636dfdSBill Paul bool_t 72e8636dfdSBill Paul xdr_authdes_verf(xdrs, verf) 73e8636dfdSBill Paul register XDR *xdrs; 74e8636dfdSBill Paul register struct authdes_verf *verf; 75e8636dfdSBill Paul { 76e8636dfdSBill Paul /* 77e8636dfdSBill Paul * Unrolled xdr 78e8636dfdSBill Paul */ 79e8636dfdSBill Paul ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_xtimestamp, sizeof(des_block))); 80e8636dfdSBill Paul ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_int_u, sizeof(verf->adv_int_u))); 81e8636dfdSBill Paul return (TRUE); 82e8636dfdSBill Paul } 83