xref: /freebsd/lib/libc/rpc/key_prot_xdr.c (revision 2008043f386721d58158e37e0d7e50df8095942d)
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 /*
42  * Compiled from key_prot.x using rpcgen.
43  * DO NOT EDIT THIS FILE!
44  * This is NOT source code!
45  */
46 
47 bool_t
48 xdr_keystatus(register XDR *xdrs, keystatus *objp)
49 {
50 
51 	if (!xdr_enum(xdrs, (enum_t *)objp))
52 		return (FALSE);
53 	return (TRUE);
54 }
55 
56 bool_t
57 xdr_keybuf(register XDR *xdrs, keybuf objp)
58 {
59 
60 	if (!xdr_opaque(xdrs, objp, HEXKEYBYTES))
61 		return (FALSE);
62 	return (TRUE);
63 }
64 
65 bool_t
66 xdr_netnamestr(register XDR *xdrs, netnamestr *objp)
67 {
68 
69 	if (!xdr_string(xdrs, objp, MAXNETNAMELEN))
70 		return (FALSE);
71 	return (TRUE);
72 }
73 
74 bool_t
75 xdr_cryptkeyarg(register XDR *xdrs, cryptkeyarg *objp)
76 {
77 
78 	if (!xdr_netnamestr(xdrs, &objp->remotename))
79 		return (FALSE);
80 	if (!xdr_des_block(xdrs, &objp->deskey))
81 		return (FALSE);
82 	return (TRUE);
83 }
84 
85 bool_t
86 xdr_cryptkeyarg2(register XDR *xdrs, cryptkeyarg2 *objp)
87 {
88 
89 	if (!xdr_netnamestr(xdrs, &objp->remotename))
90 		return (FALSE);
91 	if (!xdr_netobj(xdrs, &objp->remotekey))
92 		return (FALSE);
93 	if (!xdr_des_block(xdrs, &objp->deskey))
94 		return (FALSE);
95 	return (TRUE);
96 }
97 
98 bool_t
99 xdr_cryptkeyres(register XDR *xdrs, cryptkeyres *objp)
100 {
101 
102 	if (!xdr_keystatus(xdrs, &objp->status))
103 		return (FALSE);
104 	switch (objp->status) {
105 	case KEY_SUCCESS:
106 		if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey))
107 			return (FALSE);
108 		break;
109 	default:
110 		break;
111 	}
112 	return (TRUE);
113 }
114 
115 bool_t
116 xdr_unixcred(register XDR *xdrs, unixcred *objp)
117 {
118 	u_int **pgids_val;
119 
120 	if (!xdr_u_int(xdrs, &objp->uid))
121 		return (FALSE);
122 	if (!xdr_u_int(xdrs, &objp->gid))
123 		return (FALSE);
124 	pgids_val = &objp->gids.gids_val;
125 	if (!xdr_array(xdrs, (char **) pgids_val, (u_int *) &objp->gids.gids_len, MAXGIDS,
126 		sizeof (u_int), (xdrproc_t) xdr_u_int))
127 		return (FALSE);
128 	return (TRUE);
129 }
130 
131 bool_t
132 xdr_getcredres(register XDR *xdrs, getcredres *objp)
133 {
134 
135 	if (!xdr_keystatus(xdrs, &objp->status))
136 		return (FALSE);
137 	switch (objp->status) {
138 	case KEY_SUCCESS:
139 		if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
140 			return (FALSE);
141 		break;
142 	default:
143 		break;
144 	}
145 	return (TRUE);
146 }
147 
148 bool_t
149 xdr_key_netstarg(register XDR *xdrs, key_netstarg *objp)
150 {
151 
152 	if (!xdr_keybuf(xdrs, objp->st_priv_key))
153 		return (FALSE);
154 	if (!xdr_keybuf(xdrs, objp->st_pub_key))
155 		return (FALSE);
156 	if (!xdr_netnamestr(xdrs, &objp->st_netname))
157 		return (FALSE);
158 	return (TRUE);
159 }
160 
161 bool_t
162 xdr_key_netstres(register XDR *xdrs, key_netstres *objp)
163 {
164 
165 	if (!xdr_keystatus(xdrs, &objp->status))
166 		return (FALSE);
167 	switch (objp->status) {
168 	case KEY_SUCCESS:
169 		if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
170 			return (FALSE);
171 		break;
172 	default:
173 		break;
174 	}
175 	return (TRUE);
176 }
177