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