xref: /dragonfly/lib/libc/rpc/key_prot_xdr.c (revision 74ad0aa1)
1 /*
2  * Please do not edit this file.
3  * It was generated using rpcgen.
4  */
5 /* $DragonFly: src/lib/libc/rpc/key_prot_xdr.c,v 1.3 2006/03/13 14:36:46 swildner Exp $								*/
6 
7 #include <rpc/key_prot.h>
8 #include "un-namespace.h"
9 /*-
10  * Copyright (c) 2009, Sun Microsystems, Inc.
11  * All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions are met:
15  * - Redistributions of source code must retain the above copyright notice,
16  *   this list of conditions and the following disclaimer.
17  * - Redistributions in binary form must reproduce the above copyright notice,
18  *   this list of conditions and the following disclaimer in the documentation
19  *   and/or other materials provided with the distribution.
20  * - Neither the name of Sun Microsystems, Inc. nor the names of its
21  *   contributors may be used to endorse or promote products derived
22  *   from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  */
36 /* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */
37 
38 /* #pragma ident	"@(#)key_prot.x	1.7	94/04/29 SMI" */
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 bool_t
47 xdr_keystatus(XDR *xdrs, keystatus *objp)
48 {
49 
50 	if (!xdr_enum(xdrs, (enum_t *)objp))
51 		return (FALSE);
52 	return (TRUE);
53 }
54 
55 bool_t
56 xdr_keybuf(XDR *xdrs, keybuf objp)
57 {
58 
59 	if (!xdr_opaque(xdrs, objp, HEXKEYBYTES))
60 		return (FALSE);
61 	return (TRUE);
62 }
63 
64 bool_t
65 xdr_netnamestr(XDR *xdrs, netnamestr *objp)
66 {
67 
68 	if (!xdr_string(xdrs, objp, MAXNETNAMELEN))
69 		return (FALSE);
70 	return (TRUE);
71 }
72 
73 bool_t
74 xdr_cryptkeyarg(XDR *xdrs, cryptkeyarg *objp)
75 {
76 
77 	if (!xdr_netnamestr(xdrs, &objp->remotename))
78 		return (FALSE);
79 	if (!xdr_des_block(xdrs, &objp->deskey))
80 		return (FALSE);
81 	return (TRUE);
82 }
83 
84 bool_t
85 xdr_cryptkeyarg2(XDR *xdrs, cryptkeyarg2 *objp)
86 {
87 
88 	if (!xdr_netnamestr(xdrs, &objp->remotename))
89 		return (FALSE);
90 	if (!xdr_netobj(xdrs, &objp->remotekey))
91 		return (FALSE);
92 	if (!xdr_des_block(xdrs, &objp->deskey))
93 		return (FALSE);
94 	return (TRUE);
95 }
96 
97 bool_t
98 xdr_cryptkeyres(XDR *xdrs, cryptkeyres *objp)
99 {
100 
101 	if (!xdr_keystatus(xdrs, &objp->status))
102 		return (FALSE);
103 	switch (objp->status) {
104 	case KEY_SUCCESS:
105 		if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey))
106 			return (FALSE);
107 		break;
108 	default:
109 		break;
110 	}
111 	return (TRUE);
112 }
113 
114 bool_t
115 xdr_unixcred(XDR *xdrs, unixcred *objp)
116 {
117 	u_int **pgids_val;
118 
119 	if (!xdr_u_int(xdrs, &objp->uid))
120 		return (FALSE);
121 	if (!xdr_u_int(xdrs, &objp->gid))
122 		return (FALSE);
123 	pgids_val = &objp->gids.gids_val;
124 	if (!xdr_array(xdrs, (char **) pgids_val, (u_int *) &objp->gids.gids_len, MAXGIDS,
125 		sizeof (u_int), (xdrproc_t) xdr_u_int))
126 		return (FALSE);
127 	return (TRUE);
128 }
129 
130 bool_t
131 xdr_getcredres(XDR *xdrs, getcredres *objp)
132 {
133 
134 	if (!xdr_keystatus(xdrs, &objp->status))
135 		return (FALSE);
136 	switch (objp->status) {
137 	case KEY_SUCCESS:
138 		if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
139 			return (FALSE);
140 		break;
141 	default:
142 		break;
143 	}
144 	return (TRUE);
145 }
146 
147 bool_t
148 xdr_key_netstarg(XDR *xdrs, key_netstarg *objp)
149 {
150 
151 	if (!xdr_keybuf(xdrs, objp->st_priv_key))
152 		return (FALSE);
153 	if (!xdr_keybuf(xdrs, objp->st_pub_key))
154 		return (FALSE);
155 	if (!xdr_netnamestr(xdrs, &objp->st_netname))
156 		return (FALSE);
157 	return (TRUE);
158 }
159 
160 bool_t
161 xdr_key_netstres(XDR *xdrs, key_netstres *objp)
162 {
163 
164 	if (!xdr_keystatus(xdrs, &objp->status))
165 		return (FALSE);
166 	switch (objp->status) {
167 	case KEY_SUCCESS:
168 		if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
169 			return (FALSE);
170 		break;
171 	default:
172 		break;
173 	}
174 	return (TRUE);
175 }
176