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