(__gen_tempname): Change attempts_min into a macro. Use preprocessor
[glibc/history.git] / sunrpc / key_prot.c
blob56a541469767c5de2eb37a7e952a5cfd90915f8b
1 /*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13 * Sun RPC is provided with no support and without any obligation on the
14 * part of Sun Microsystems, Inc. to assist in its use, correction,
15 * modification or enhancement.
17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 * OR ANY PART THEREOF.
21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 * or profits or other special, indirect and consequential damages, even if
23 * Sun has been advised of the possibility of such damages.
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California 94043
29 #if 0
30 #pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI"
31 #endif
33 /* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */
35 #include "rpc/key_prot.h"
37 bool_t
38 xdr_keystatus (XDR * xdrs, keystatus * objp)
40 if (!INTUSE(xdr_enum) (xdrs, (enum_t *) objp))
41 return FALSE;
43 return TRUE;
45 INTDEF(xdr_keystatus)
47 bool_t
48 xdr_keybuf (XDR * xdrs, keybuf objp)
50 if (!INTUSE(xdr_opaque) (xdrs, objp, HEXKEYBYTES))
51 return FALSE;
53 return TRUE;
55 INTDEF(xdr_keybuf)
57 bool_t
58 xdr_netnamestr (XDR * xdrs, netnamestr * objp)
60 if (!INTUSE(xdr_string) (xdrs, objp, MAXNETNAMELEN))
61 return FALSE;
63 return TRUE;
65 INTDEF(xdr_netnamestr)
67 bool_t
68 xdr_cryptkeyarg (XDR * xdrs, cryptkeyarg * objp)
70 if (!INTUSE(xdr_netnamestr) (xdrs, &objp->remotename))
71 return FALSE;
73 if (!INTUSE(xdr_des_block) (xdrs, &objp->deskey))
74 return FALSE;
76 return TRUE;
78 INTDEF(xdr_cryptkeyarg)
80 bool_t
81 xdr_cryptkeyarg2 (XDR * xdrs, cryptkeyarg2 * objp)
83 if (!INTUSE(xdr_netnamestr) (xdrs, &objp->remotename))
84 return FALSE;
85 if (!INTUSE(xdr_netobj) (xdrs, &objp->remotekey))
86 return FALSE;
87 if (!INTUSE(xdr_des_block) (xdrs, &objp->deskey))
88 return FALSE;
89 return TRUE;
91 INTDEF(xdr_cryptkeyarg2)
93 bool_t
94 xdr_cryptkeyres (XDR * xdrs, cryptkeyres * objp)
96 if (!INTUSE(xdr_keystatus) (xdrs, &objp->status))
97 return FALSE;
98 switch (objp->status)
100 case KEY_SUCCESS:
101 if (!INTUSE(xdr_des_block) (xdrs, &objp->cryptkeyres_u.deskey))
102 return FALSE;
103 break;
104 default:
105 break;
107 return TRUE;
109 INTDEF(xdr_cryptkeyres)
111 bool_t
112 xdr_unixcred (XDR * xdrs, unixcred * objp)
114 if (!INTUSE(xdr_u_int) (xdrs, &objp->uid))
115 return FALSE;
116 if (!INTUSE(xdr_u_int) (xdrs, &objp->gid))
117 return FALSE;
118 if (!INTUSE(xdr_array) (xdrs, (char **) &objp->gids.gids_val,
119 (u_int *) & objp->gids.gids_len, MAXGIDS,
120 sizeof (u_int), (xdrproc_t) INTUSE(xdr_u_int)))
121 return FALSE;
122 return TRUE;
124 INTDEF(xdr_unixcred)
126 bool_t
127 xdr_getcredres (XDR * xdrs, getcredres * objp)
129 if (!INTUSE(xdr_keystatus) (xdrs, &objp->status))
130 return FALSE;
131 switch (objp->status)
133 case KEY_SUCCESS:
134 if (!INTUSE(xdr_unixcred) (xdrs, &objp->getcredres_u.cred))
135 return FALSE;
136 break;
137 default:
138 break;
140 return TRUE;
143 bool_t
144 xdr_key_netstarg (XDR * xdrs, key_netstarg * objp)
146 if (!INTUSE(xdr_keybuf) (xdrs, objp->st_priv_key))
147 return FALSE;
148 if (!INTUSE(xdr_keybuf) (xdrs, objp->st_pub_key))
149 return FALSE;
150 if (!INTUSE(xdr_netnamestr) (xdrs, &objp->st_netname))
151 return FALSE;
152 return TRUE;
154 INTDEF(xdr_key_netstarg)
156 bool_t
157 xdr_key_netstres (XDR * xdrs, key_netstres * objp)
159 if (!INTUSE(xdr_keystatus) (xdrs, &objp->status))
160 return FALSE;
161 switch (objp->status)
163 case KEY_SUCCESS:
164 if (!INTUSE(xdr_key_netstarg) (xdrs, &objp->key_netstres_u.knet))
165 return FALSE;
166 break;
167 default:
168 break;
170 return TRUE;
172 INTDEF(xdr_key_netstres)