Back to index

glibc  2.9
authdes_prot.c
Go to the documentation of this file.
00001 /*
00002  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
00003  * unrestricted use provided that this legend is included on all tape
00004  * media and as a part of the software program in whole or part.  Users
00005  * may copy or modify Sun RPC without charge, but are not authorized
00006  * to license or distribute it to anyone else except as part of a product or
00007  * program developed by the user.
00008  *
00009  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
00010  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
00011  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
00012  *
00013  * Sun RPC is provided with no support and without any obligation on the
00014  * part of Sun Microsystems, Inc. to assist in its use, correction,
00015  * modification or enhancement.
00016  *
00017  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
00018  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
00019  * OR ANY PART THEREOF.
00020  *
00021  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
00022  * or profits or other special, indirect and consequential damages, even if
00023  * Sun has been advised of the possibility of such damages.
00024  *
00025  * Sun Microsystems, Inc.
00026  * 2550 Garcia Avenue
00027  * Mountain View, California  94043
00028  */
00029 /*
00030  * Copyright (c) 1988 by Sun Microsystems, Inc.
00031  */
00032 /*
00033  * authdes_prot.c, XDR routines for DES authentication
00034  */
00035 
00036 #include <rpc/types.h>
00037 #include <rpc/xdr.h>
00038 #include <rpc/auth.h>
00039 #include <rpc/auth_des.h>
00040 
00041 #define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
00042 
00043 bool_t
00044 xdr_authdes_cred (XDR *xdrs, struct authdes_cred *cred)
00045 {
00046   /*
00047    * Unrolled xdr
00048    */
00049   ATTEMPT (INTUSE(xdr_enum) (xdrs, (enum_t *) & cred->adc_namekind));
00050   switch (cred->adc_namekind)
00051     {
00052     case ADN_FULLNAME:
00053       ATTEMPT (INTUSE(xdr_string) (xdrs, &cred->adc_fullname.name,
00054                                MAXNETNAMELEN));
00055       ATTEMPT (INTUSE(xdr_opaque) (xdrs, (caddr_t) & cred->adc_fullname.key,
00056                                sizeof (des_block)));
00057       ATTEMPT (INTUSE(xdr_opaque) (xdrs, (caddr_t) & cred->adc_fullname.window,
00058                                sizeof (cred->adc_fullname.window)));
00059       return (TRUE);
00060     case ADN_NICKNAME:
00061       ATTEMPT (INTUSE(xdr_opaque) (xdrs, (caddr_t) & cred->adc_nickname,
00062                                sizeof (cred->adc_nickname)));
00063       return TRUE;
00064     default:
00065       return FALSE;
00066     }
00067 }
00068 INTDEF(xdr_authdes_cred)
00069 
00070 
00071 bool_t
00072 xdr_authdes_verf (register XDR *xdrs, register struct authdes_verf *verf)
00073 {
00074   /*
00075    * Unrolled xdr
00076    */
00077   ATTEMPT (INTUSE(xdr_opaque) (xdrs, (caddr_t) & verf->adv_xtimestamp,
00078                             sizeof (des_block)));
00079   ATTEMPT (INTUSE(xdr_opaque) (xdrs, (caddr_t) & verf->adv_int_u,
00080                             sizeof (verf->adv_int_u)));
00081   return TRUE;
00082 }
00083 INTDEF(xdr_authdes_verf)