Back to index

glibc  2.9
key_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 #if 0
00030 #pragma ident "@(#)key_prot.x      1.7    94/04/29 SMI"
00031 #endif
00032 
00033 /* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */
00034 
00035 #include "rpc/key_prot.h"
00036 
00037 bool_t
00038 xdr_keystatus (XDR * xdrs, keystatus * objp)
00039 {
00040   if (!INTUSE(xdr_enum) (xdrs, (enum_t *) objp))
00041     return FALSE;
00042 
00043   return TRUE;
00044 }
00045 INTDEF(xdr_keystatus)
00046 
00047 bool_t
00048 xdr_keybuf (XDR * xdrs, keybuf objp)
00049 {
00050   if (!INTUSE(xdr_opaque) (xdrs, objp, HEXKEYBYTES))
00051     return FALSE;
00052 
00053   return TRUE;
00054 }
00055 INTDEF(xdr_keybuf)
00056 
00057 bool_t
00058 xdr_netnamestr (XDR * xdrs, netnamestr * objp)
00059 {
00060   if (!INTUSE(xdr_string) (xdrs, objp, MAXNETNAMELEN))
00061     return FALSE;
00062 
00063   return TRUE;
00064 }
00065 INTDEF(xdr_netnamestr)
00066 
00067 bool_t
00068 xdr_cryptkeyarg (XDR * xdrs, cryptkeyarg * objp)
00069 {
00070   if (!INTUSE(xdr_netnamestr) (xdrs, &objp->remotename))
00071     return FALSE;
00072 
00073   if (!INTUSE(xdr_des_block) (xdrs, &objp->deskey))
00074     return FALSE;
00075 
00076   return TRUE;
00077 }
00078 INTDEF(xdr_cryptkeyarg)
00079 
00080 bool_t
00081 xdr_cryptkeyarg2 (XDR * xdrs, cryptkeyarg2 * objp)
00082 {
00083   if (!INTUSE(xdr_netnamestr) (xdrs, &objp->remotename))
00084     return FALSE;
00085   if (!INTUSE(xdr_netobj) (xdrs, &objp->remotekey))
00086     return FALSE;
00087   if (!INTUSE(xdr_des_block) (xdrs, &objp->deskey))
00088     return FALSE;
00089   return TRUE;
00090 }
00091 INTDEF(xdr_cryptkeyarg2)
00092 
00093 bool_t
00094 xdr_cryptkeyres (XDR * xdrs, cryptkeyres * objp)
00095 {
00096   if (!INTUSE(xdr_keystatus) (xdrs, &objp->status))
00097     return FALSE;
00098   switch (objp->status)
00099     {
00100     case KEY_SUCCESS:
00101       if (!INTUSE(xdr_des_block) (xdrs, &objp->cryptkeyres_u.deskey))
00102        return FALSE;
00103       break;
00104     default:
00105       break;
00106     }
00107   return TRUE;
00108 }
00109 INTDEF(xdr_cryptkeyres)
00110 
00111 bool_t
00112 xdr_unixcred (XDR * xdrs, unixcred * objp)
00113 {
00114   if (!INTUSE(xdr_u_int) (xdrs, &objp->uid))
00115     return FALSE;
00116   if (!INTUSE(xdr_u_int) (xdrs, &objp->gid))
00117     return FALSE;
00118   if (!INTUSE(xdr_array) (xdrs, (void *) &objp->gids.gids_val,
00119                        (u_int *) & objp->gids.gids_len, MAXGIDS,
00120                        sizeof (u_int), (xdrproc_t) INTUSE(xdr_u_int)))
00121     return FALSE;
00122   return TRUE;
00123 }
00124 INTDEF(xdr_unixcred)
00125 
00126 bool_t
00127 xdr_getcredres (XDR * xdrs, getcredres * objp)
00128 {
00129   if (!INTUSE(xdr_keystatus) (xdrs, &objp->status))
00130     return FALSE;
00131   switch (objp->status)
00132     {
00133     case KEY_SUCCESS:
00134       if (!INTUSE(xdr_unixcred) (xdrs, &objp->getcredres_u.cred))
00135        return FALSE;
00136       break;
00137     default:
00138       break;
00139     }
00140   return TRUE;
00141 }
00142 
00143 bool_t
00144 xdr_key_netstarg (XDR * xdrs, key_netstarg * objp)
00145 {
00146   if (!INTUSE(xdr_keybuf) (xdrs, objp->st_priv_key))
00147     return FALSE;
00148   if (!INTUSE(xdr_keybuf) (xdrs, objp->st_pub_key))
00149     return FALSE;
00150   if (!INTUSE(xdr_netnamestr) (xdrs, &objp->st_netname))
00151     return FALSE;
00152   return TRUE;
00153 }
00154 INTDEF(xdr_key_netstarg)
00155 
00156 bool_t
00157 xdr_key_netstres (XDR * xdrs, key_netstres * objp)
00158 {
00159   if (!INTUSE(xdr_keystatus) (xdrs, &objp->status))
00160     return FALSE;
00161   switch (objp->status)
00162     {
00163     case KEY_SUCCESS:
00164       if (!INTUSE(xdr_key_netstarg) (xdrs, &objp->key_netstres_u.knet))
00165        return FALSE;
00166       break;
00167     default:
00168       break;
00169     }
00170   return TRUE;
00171 }
00172 INTDEF(xdr_key_netstres)