BSD 4_3_Net_2 release
[unix-history] / usr / src / lib / librpc / secure_rpc / rpc / key_prot.c
CommitLineData
af359dea
C
1#if defined(LIBC_SCCS) && !defined(lint)
2static char sccsid[] = "@(#)key_prot.c 2.1 88/08/07 4.0 RPCSRC; from 1.4 88/02/08 SMI";
3#endif
4
5/*
6 * Copyright (c) 1988 by Sun Microsystems, Inc.
7 */
8/*
9 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
10 * unrestricted use provided that this legend is included on all tape
11 * media and as a part of the software program in whole or part. Users
12 * may copy or modify Sun RPC without charge, but are not authorized
13 * to license or distribute it to anyone else except as part of a product or
14 * program developed by the user.
15 *
16 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
17 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
19 *
20 * Sun RPC is provided with no support and without any obligation on the
21 * part of Sun Microsystems, Inc. to assist in its use, correction,
22 * modification or enhancement.
23 *
24 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
25 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
26 * OR ANY PART THEREOF.
27 *
28 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
29 * or profits or other special, indirect and consequential damages, even if
30 * Sun has been advised of the possibility of such damages.
31 *
32 * Sun Microsystems, Inc.
33 * 2550 Garcia Avenue
34 * Mountain View, California 94043
35 */
36#include <rpc/rpc.h>
37#include <rpc/key_prot.h>
38
39
40/*
41 * Compiled from key_prot.x using rpcgen.
42 * DO NOT EDIT THIS FILE!
43 * This is NOT source code!
44 */
45
46
47bool_t
48xdr_keystatus(xdrs, objp)
49 XDR *xdrs;
50 keystatus *objp;
51{
52 if (!xdr_enum(xdrs, (enum_t *)objp)) {
53 return (FALSE);
54 }
55 return (TRUE);
56}
57
58
59
60
61bool_t
62xdr_keybuf(xdrs, objp)
63 XDR *xdrs;
64 keybuf objp;
65{
66 if (!xdr_opaque(xdrs, objp, HEXKEYBYTES)) {
67 return (FALSE);
68 }
69 return (TRUE);
70}
71
72
73
74
75bool_t
76xdr_netnamestr(xdrs, objp)
77 XDR *xdrs;
78 netnamestr *objp;
79{
80 if (!xdr_string(xdrs, objp, MAXNETNAMELEN)) {
81 return (FALSE);
82 }
83 return (TRUE);
84}
85
86
87
88
89bool_t
90xdr_cryptkeyarg(xdrs, objp)
91 XDR *xdrs;
92 cryptkeyarg *objp;
93{
94 if (!xdr_netnamestr(xdrs, &objp->remotename)) {
95 return (FALSE);
96 }
97 if (!xdr_des_block(xdrs, &objp->deskey)) {
98 return (FALSE);
99 }
100 return (TRUE);
101}
102
103
104
105
106bool_t
107xdr_cryptkeyres(xdrs, objp)
108 XDR *xdrs;
109 cryptkeyres *objp;
110{
111 if (!xdr_keystatus(xdrs, &objp->status)) {
112 return (FALSE);
113 }
114 switch (objp->status) {
115 case KEY_SUCCESS:
116 if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey)) {
117 return (FALSE);
118 }
119 break;
120 }
121 return (TRUE);
122}
123
124
125
126
127bool_t
128xdr_unixcred(xdrs, objp)
129 XDR *xdrs;
130 unixcred *objp;
131{
132 if (!xdr_int(xdrs, &objp->uid)) {
133 return (FALSE);
134 }
135 if (!xdr_int(xdrs, &objp->gid)) {
136 return (FALSE);
137 }
138 if (!xdr_array(xdrs, (char **)&objp->gids.gids_val, (u_int *)&objp->gids.gids_len, MAXGIDS, sizeof(int), xdr_int)) {
139 return (FALSE);
140 }
141 return (TRUE);
142}
143
144
145
146
147bool_t
148xdr_getcredres(xdrs, objp)
149 XDR *xdrs;
150 getcredres *objp;
151{
152 if (!xdr_keystatus(xdrs, &objp->status)) {
153 return (FALSE);
154 }
155 switch (objp->status) {
156 case KEY_SUCCESS:
157 if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred)) {
158 return (FALSE);
159 }
160 break;
161 }
162 return (TRUE);
163}
164
165