xdryp.c revision 1.26 1 1.26 christos /* $NetBSD: xdryp.c,v 1.26 2003/05/29 18:15:25 christos Exp $ */
2 1.8 cgd
3 1.3 deraadt /*
4 1.12 thorpej * Copyright (c) 1996 Jason R. Thorpe <thorpej (at) NetBSD.ORG>.
5 1.12 thorpej * All rights reserved.
6 1.12 thorpej *
7 1.6 deraadt * Copyright (c) 1992, 1993 Theo de Raadt <deraadt (at) fsa.ca>
8 1.3 deraadt * All rights reserved.
9 1.3 deraadt *
10 1.3 deraadt * Redistribution and use in source and binary forms, with or without
11 1.3 deraadt * modification, are permitted provided that the following conditions
12 1.3 deraadt * are met:
13 1.3 deraadt * 1. Redistributions of source code must retain the above copyright
14 1.3 deraadt * notice, this list of conditions and the following disclaimer.
15 1.3 deraadt * 2. Redistributions in binary form must reproduce the above copyright
16 1.3 deraadt * notice, this list of conditions and the following disclaimer in the
17 1.3 deraadt * documentation and/or other materials provided with the distribution.
18 1.6 deraadt * 3. All advertising materials mentioning features or use of this software
19 1.6 deraadt * must display the following acknowledgement:
20 1.6 deraadt * This product includes software developed by Theo de Raadt.
21 1.12 thorpej * This product includes software developed for the NetBSD Project
22 1.12 thorpej * by Jason R. Thorpe.
23 1.6 deraadt * 4. The name of the author may not be used to endorse or promote products
24 1.6 deraadt * derived from this software without specific prior written permission.
25 1.3 deraadt *
26 1.3 deraadt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
27 1.3 deraadt * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28 1.3 deraadt * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.3 deraadt * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
30 1.3 deraadt * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.3 deraadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.3 deraadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.3 deraadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.3 deraadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.3 deraadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.3 deraadt * SUCH DAMAGE.
37 1.3 deraadt */
38 1.3 deraadt
39 1.16 christos #include <sys/cdefs.h>
40 1.10 jtc #if defined(LIBC_SCCS) && !defined(lint)
41 1.26 christos __RCSID("$NetBSD: xdryp.c,v 1.26 2003/05/29 18:15:25 christos Exp $");
42 1.3 deraadt #endif
43 1.3 deraadt
44 1.12 thorpej /*
45 1.12 thorpej * XDR routines used by the YP protocol. Note that these routines do
46 1.12 thorpej * not strictly conform to the RPC definition in yp.x. This file
47 1.12 thorpej * replicates the functions exported by the Sun YP API; reality is
48 1.12 thorpej * often inaccurate.
49 1.12 thorpej */
50 1.12 thorpej
51 1.17 jtc #include "namespace.h"
52 1.23 lukem
53 1.1 deraadt #include <sys/param.h>
54 1.1 deraadt #include <sys/socket.h>
55 1.23 lukem
56 1.23 lukem #include <assert.h>
57 1.23 lukem #include <ctype.h>
58 1.1 deraadt #include <stdio.h>
59 1.7 jtc #include <stdlib.h>
60 1.7 jtc #include <string.h>
61 1.23 lukem
62 1.1 deraadt #include <rpc/rpc.h>
63 1.1 deraadt #include <rpc/xdr.h>
64 1.1 deraadt #include <rpcsvc/yp_prot.h>
65 1.1 deraadt #include <rpcsvc/ypclnt.h>
66 1.17 jtc
67 1.17 jtc #ifdef __weak_alias
68 1.25 mycroft __weak_alias(xdr_datum,_xdr_datum)
69 1.25 mycroft __weak_alias(xdr_domainname,_xdr_domainname)
70 1.25 mycroft __weak_alias(xdr_mapname,_xdr_mapname)
71 1.25 mycroft __weak_alias(xdr_peername,_xdr_peername)
72 1.25 mycroft __weak_alias(xdr_yp_inaddr,_xdr_yp_inaddr)
73 1.25 mycroft __weak_alias(xdr_ypall,_xdr_ypall)
74 1.25 mycroft __weak_alias(xdr_ypbind_resp,_xdr_ypbind_resp)
75 1.25 mycroft __weak_alias(xdr_ypbind_setdom,_xdr_ypbind_setdom)
76 1.25 mycroft __weak_alias(xdr_ypdomain_wrap_string,_xdr_ypdomain_wrap_string)
77 1.25 mycroft __weak_alias(xdr_ypmap_parms,_xdr_ypmap_parms)
78 1.25 mycroft __weak_alias(xdr_ypmap_wrap_string,_xdr_ypmap_wrap_string)
79 1.25 mycroft __weak_alias(xdr_ypmaplist,_xdr_ypmaplist)
80 1.25 mycroft __weak_alias(xdr_ypowner_wrap_string,_xdr_ypowner_wrap_string)
81 1.25 mycroft __weak_alias(xdr_yppushresp_xfr,_xdr_yppushresp_xfr)
82 1.25 mycroft __weak_alias(xdr_ypreq_key,_xdr_ypreq_key)
83 1.25 mycroft __weak_alias(xdr_ypreq_nokey,_xdr_ypreq_nokey)
84 1.25 mycroft __weak_alias(xdr_ypreq_xfr,_xdr_ypreq_xfr)
85 1.25 mycroft __weak_alias(xdr_ypresp_key_val,_xdr_ypresp_key_val)
86 1.25 mycroft __weak_alias(xdr_ypresp_maplist,_xdr_ypresp_maplist)
87 1.25 mycroft __weak_alias(xdr_ypresp_master,_xdr_ypresp_master)
88 1.25 mycroft __weak_alias(xdr_ypresp_order,_xdr_ypresp_order)
89 1.25 mycroft __weak_alias(xdr_ypresp_val,_xdr_ypresp_val)
90 1.17 jtc #endif
91 1.1 deraadt
92 1.12 thorpej /*
93 1.12 thorpej * Functions used only within this file.
94 1.12 thorpej */
95 1.12 thorpej static bool_t xdr_ypbind_binding __P((XDR *, struct ypbind_binding *));
96 1.12 thorpej static bool_t xdr_ypbind_resptype __P((XDR *, enum ypbind_resptype *));
97 1.12 thorpej static bool_t xdr_ypstat __P((XDR *, enum ypbind_resptype *));
98 1.12 thorpej static bool_t xdr_ypmaplist_str __P((XDR *, char *));
99 1.12 thorpej
100 1.19 thorpej __warn_references(xdr_domainname,
101 1.20 thorpej "warning: this program uses xdr_domainname(), which is deprecated and buggy.")
102 1.19 thorpej
103 1.19 thorpej bool_t
104 1.19 thorpej xdr_domainname(xdrs, objp)
105 1.19 thorpej XDR *xdrs;
106 1.19 thorpej char *objp;
107 1.19 thorpej {
108 1.23 lukem
109 1.23 lukem _DIAGASSERT(xdrs != NULL);
110 1.23 lukem _DIAGASSERT(objp != NULL);
111 1.23 lukem
112 1.19 thorpej return xdr_string(xdrs, &objp, YPMAXDOMAIN);
113 1.19 thorpej }
114 1.19 thorpej
115 1.19 thorpej __warn_references(xdr_peername,
116 1.20 thorpej "warning: this program uses xdr_peername(), which is deprecated and buggy.")
117 1.19 thorpej
118 1.19 thorpej bool_t
119 1.19 thorpej xdr_peername(xdrs, objp)
120 1.19 thorpej XDR *xdrs;
121 1.19 thorpej char *objp;
122 1.19 thorpej {
123 1.23 lukem
124 1.23 lukem _DIAGASSERT(xdrs != NULL);
125 1.23 lukem _DIAGASSERT(objp != NULL);
126 1.23 lukem
127 1.19 thorpej return xdr_string(xdrs, &objp, YPMAXPEER);
128 1.19 thorpej }
129 1.19 thorpej
130 1.19 thorpej __warn_references(xdr_mapname,
131 1.20 thorpej "warning: this program uses xdr_mapname(), which is deprecated and buggy.")
132 1.19 thorpej
133 1.19 thorpej bool_t
134 1.19 thorpej xdr_mapname(xdrs, objp)
135 1.19 thorpej XDR *xdrs;
136 1.19 thorpej char *objp;
137 1.19 thorpej {
138 1.23 lukem
139 1.23 lukem _DIAGASSERT(xdrs != NULL);
140 1.23 lukem _DIAGASSERT(objp != NULL);
141 1.23 lukem
142 1.19 thorpej return xdr_string(xdrs, &objp, YPMAXMAP);
143 1.19 thorpej }
144 1.19 thorpej
145 1.12 thorpej bool_t
146 1.12 thorpej xdr_ypdomain_wrap_string(xdrs, objp)
147 1.12 thorpej XDR *xdrs;
148 1.12 thorpej char **objp;
149 1.12 thorpej {
150 1.23 lukem
151 1.23 lukem _DIAGASSERT(xdrs != NULL);
152 1.23 lukem _DIAGASSERT(objp != NULL);
153 1.23 lukem
154 1.12 thorpej return xdr_string(xdrs, objp, YPMAXDOMAIN);
155 1.12 thorpej }
156 1.12 thorpej
157 1.12 thorpej bool_t
158 1.12 thorpej xdr_ypmap_wrap_string(xdrs, objp)
159 1.12 thorpej XDR *xdrs;
160 1.12 thorpej char **objp;
161 1.12 thorpej {
162 1.23 lukem
163 1.23 lukem _DIAGASSERT(xdrs != NULL);
164 1.23 lukem _DIAGASSERT(objp != NULL);
165 1.23 lukem
166 1.12 thorpej return xdr_string(xdrs, objp, YPMAXMAP);
167 1.12 thorpej }
168 1.12 thorpej
169 1.1 deraadt bool_t
170 1.12 thorpej xdr_ypowner_wrap_string(xdrs, objp)
171 1.12 thorpej XDR *xdrs;
172 1.12 thorpej char **objp;
173 1.1 deraadt {
174 1.23 lukem
175 1.23 lukem _DIAGASSERT(xdrs != NULL);
176 1.23 lukem _DIAGASSERT(objp != NULL);
177 1.23 lukem
178 1.12 thorpej return xdr_string(xdrs, objp, YPMAXPEER);
179 1.1 deraadt }
180 1.1 deraadt
181 1.1 deraadt bool_t
182 1.12 thorpej xdr_datum(xdrs, objp)
183 1.12 thorpej XDR *xdrs;
184 1.12 thorpej datum *objp;
185 1.1 deraadt {
186 1.23 lukem
187 1.23 lukem _DIAGASSERT(xdrs != NULL);
188 1.23 lukem _DIAGASSERT(objp != NULL);
189 1.23 lukem
190 1.12 thorpej return xdr_bytes(xdrs, (char **)&objp->dptr,
191 1.12 thorpej (u_int *)&objp->dsize, YPMAXRECORD);
192 1.1 deraadt }
193 1.1 deraadt
194 1.1 deraadt bool_t
195 1.1 deraadt xdr_ypreq_key(xdrs, objp)
196 1.12 thorpej XDR *xdrs;
197 1.12 thorpej struct ypreq_key *objp;
198 1.1 deraadt {
199 1.23 lukem
200 1.23 lukem _DIAGASSERT(xdrs != NULL);
201 1.23 lukem _DIAGASSERT(objp != NULL);
202 1.23 lukem
203 1.13 christos if (!xdr_ypdomain_wrap_string(xdrs, (char **)&objp->domain))
204 1.9 christos return FALSE;
205 1.12 thorpej
206 1.13 christos if (!xdr_ypmap_wrap_string(xdrs, (char **)&objp->map))
207 1.9 christos return FALSE;
208 1.12 thorpej
209 1.13 christos if (!xdr_datum(xdrs, &objp->keydat))
210 1.13 christos return FALSE;
211 1.13 christos
212 1.13 christos return TRUE;
213 1.1 deraadt }
214 1.1 deraadt
215 1.1 deraadt bool_t
216 1.1 deraadt xdr_ypreq_nokey(xdrs, objp)
217 1.12 thorpej XDR *xdrs;
218 1.12 thorpej struct ypreq_nokey *objp;
219 1.1 deraadt {
220 1.23 lukem
221 1.23 lukem _DIAGASSERT(xdrs != NULL);
222 1.23 lukem _DIAGASSERT(objp != NULL);
223 1.23 lukem
224 1.13 christos if (!xdr_ypdomain_wrap_string(xdrs, (char **)&objp->domain))
225 1.13 christos return FALSE;
226 1.13 christos
227 1.13 christos if (!xdr_ypmap_wrap_string(xdrs, (char **)&objp->map))
228 1.9 christos return FALSE;
229 1.12 thorpej
230 1.13 christos return TRUE;
231 1.1 deraadt }
232 1.1 deraadt
233 1.1 deraadt bool_t
234 1.1 deraadt xdr_yp_inaddr(xdrs, objp)
235 1.12 thorpej XDR *xdrs;
236 1.12 thorpej struct in_addr *objp;
237 1.1 deraadt {
238 1.23 lukem
239 1.23 lukem _DIAGASSERT(xdrs != NULL);
240 1.23 lukem _DIAGASSERT(objp != NULL);
241 1.23 lukem
242 1.21 christos return xdr_opaque(xdrs, (caddr_t)(void *)&objp->s_addr,
243 1.21 christos sizeof objp->s_addr);
244 1.1 deraadt }
245 1.1 deraadt
246 1.12 thorpej static bool_t
247 1.1 deraadt xdr_ypbind_binding(xdrs, objp)
248 1.12 thorpej XDR *xdrs;
249 1.12 thorpej struct ypbind_binding *objp;
250 1.1 deraadt {
251 1.23 lukem
252 1.23 lukem _DIAGASSERT(xdrs != NULL);
253 1.23 lukem _DIAGASSERT(objp != NULL);
254 1.23 lukem
255 1.12 thorpej if (!xdr_yp_inaddr(xdrs, &objp->ypbind_binding_addr))
256 1.9 christos return FALSE;
257 1.12 thorpej
258 1.13 christos if (!xdr_opaque(xdrs, (void *)&objp->ypbind_binding_port,
259 1.13 christos sizeof objp->ypbind_binding_port))
260 1.13 christos return FALSE;
261 1.13 christos
262 1.13 christos return TRUE;
263 1.1 deraadt }
264 1.1 deraadt
265 1.12 thorpej static bool_t
266 1.1 deraadt xdr_ypbind_resptype(xdrs, objp)
267 1.12 thorpej XDR *xdrs;
268 1.12 thorpej enum ypbind_resptype *objp;
269 1.1 deraadt {
270 1.23 lukem
271 1.23 lukem _DIAGASSERT(xdrs != NULL);
272 1.23 lukem _DIAGASSERT(objp != NULL);
273 1.23 lukem
274 1.26 christos return xdr_enum(xdrs, (enum_t *)(void *)objp);
275 1.1 deraadt }
276 1.1 deraadt
277 1.12 thorpej static bool_t
278 1.1 deraadt xdr_ypstat(xdrs, objp)
279 1.12 thorpej XDR *xdrs;
280 1.12 thorpej enum ypbind_resptype *objp;
281 1.1 deraadt {
282 1.23 lukem
283 1.23 lukem _DIAGASSERT(xdrs != NULL);
284 1.23 lukem _DIAGASSERT(objp != NULL);
285 1.23 lukem
286 1.26 christos return xdr_enum(xdrs, (enum_t *)(void *)objp);
287 1.1 deraadt }
288 1.1 deraadt
289 1.1 deraadt bool_t
290 1.1 deraadt xdr_ypbind_resp(xdrs, objp)
291 1.12 thorpej XDR *xdrs;
292 1.12 thorpej struct ypbind_resp *objp;
293 1.1 deraadt {
294 1.23 lukem
295 1.23 lukem _DIAGASSERT(xdrs != NULL);
296 1.23 lukem _DIAGASSERT(objp != NULL);
297 1.23 lukem
298 1.12 thorpej if (!xdr_ypbind_resptype(xdrs, &objp->ypbind_status))
299 1.9 christos return FALSE;
300 1.9 christos
301 1.1 deraadt switch (objp->ypbind_status) {
302 1.1 deraadt case YPBIND_FAIL_VAL:
303 1.9 christos return xdr_u_int(xdrs,
304 1.12 thorpej (u_int *)&objp->ypbind_respbody.ypbind_error);
305 1.12 thorpej
306 1.1 deraadt case YPBIND_SUCC_VAL:
307 1.12 thorpej return xdr_ypbind_binding(xdrs,
308 1.12 thorpej &objp->ypbind_respbody.ypbind_bindinfo);
309 1.12 thorpej
310 1.1 deraadt default:
311 1.9 christos return FALSE;
312 1.1 deraadt }
313 1.7 jtc /* NOTREACHED */
314 1.1 deraadt }
315 1.1 deraadt
316 1.1 deraadt bool_t
317 1.1 deraadt xdr_ypresp_val(xdrs, objp)
318 1.12 thorpej XDR *xdrs;
319 1.12 thorpej struct ypresp_val *objp;
320 1.1 deraadt {
321 1.23 lukem
322 1.23 lukem _DIAGASSERT(xdrs != NULL);
323 1.23 lukem _DIAGASSERT(objp != NULL);
324 1.23 lukem
325 1.26 christos if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)(void *)&objp->status))
326 1.9 christos return FALSE;
327 1.12 thorpej
328 1.13 christos if (!xdr_datum(xdrs, &objp->valdat))
329 1.13 christos return FALSE;
330 1.13 christos
331 1.13 christos return TRUE;
332 1.1 deraadt }
333 1.1 deraadt
334 1.1 deraadt bool_t
335 1.1 deraadt xdr_ypbind_setdom(xdrs, objp)
336 1.12 thorpej XDR *xdrs;
337 1.12 thorpej struct ypbind_setdom *objp;
338 1.1 deraadt {
339 1.23 lukem char *cp;
340 1.23 lukem
341 1.23 lukem _DIAGASSERT(xdrs != NULL);
342 1.23 lukem _DIAGASSERT(objp != NULL);
343 1.23 lukem
344 1.23 lukem cp = objp->ypsetdom_domain;
345 1.12 thorpej
346 1.13 christos if (!xdr_ypdomain_wrap_string(xdrs, &cp))
347 1.9 christos return FALSE;
348 1.12 thorpej
349 1.12 thorpej if (!xdr_ypbind_binding(xdrs, &objp->ypsetdom_binding))
350 1.9 christos return FALSE;
351 1.12 thorpej
352 1.14 thorpej if (!xdr_u_int(xdrs, &objp->ypsetdom_vers))
353 1.13 christos return FALSE;
354 1.13 christos
355 1.13 christos return TRUE;
356 1.1 deraadt }
357 1.1 deraadt
358 1.1 deraadt bool_t
359 1.1 deraadt xdr_ypresp_key_val(xdrs, objp)
360 1.12 thorpej XDR *xdrs;
361 1.12 thorpej struct ypresp_key_val *objp;
362 1.1 deraadt {
363 1.23 lukem
364 1.23 lukem _DIAGASSERT(xdrs != NULL);
365 1.23 lukem _DIAGASSERT(objp != NULL);
366 1.23 lukem
367 1.26 christos if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)(void *)&objp->status))
368 1.9 christos return FALSE;
369 1.12 thorpej
370 1.12 thorpej if (!xdr_datum(xdrs, &objp->valdat))
371 1.9 christos return FALSE;
372 1.12 thorpej
373 1.13 christos if (!xdr_datum(xdrs, &objp->keydat))
374 1.13 christos return FALSE;
375 1.13 christos
376 1.13 christos return TRUE;
377 1.1 deraadt }
378 1.1 deraadt
379 1.1 deraadt bool_t
380 1.12 thorpej xdr_ypall(xdrs, incallback)
381 1.12 thorpej XDR *xdrs;
382 1.12 thorpej struct ypall_callback *incallback;
383 1.12 thorpej {
384 1.12 thorpej struct ypresp_key_val out;
385 1.12 thorpej char key[YPMAXRECORD], val[YPMAXRECORD];
386 1.12 thorpej bool_t more, status;
387 1.1 deraadt
388 1.23 lukem _DIAGASSERT(xdrs != NULL);
389 1.23 lukem _DIAGASSERT(incallback != NULL);
390 1.23 lukem
391 1.12 thorpej /*
392 1.12 thorpej * Set up key/val struct to be used during the transaction.
393 1.12 thorpej */
394 1.7 jtc memset(&out, 0, sizeof out);
395 1.12 thorpej out.keydat.dptr = key;
396 1.12 thorpej out.keydat.dsize = sizeof(key);
397 1.12 thorpej out.valdat.dptr = val;
398 1.12 thorpej out.valdat.dsize = sizeof(val);
399 1.12 thorpej
400 1.12 thorpej for (;;) {
401 1.12 thorpej /* Values pending? */
402 1.12 thorpej if (!xdr_bool(xdrs, &more))
403 1.12 thorpej return FALSE; /* can't tell! */
404 1.13 christos if (!more)
405 1.12 thorpej return TRUE; /* no more */
406 1.12 thorpej
407 1.12 thorpej /* Transfer key/value pair. */
408 1.12 thorpej status = xdr_ypresp_key_val(xdrs, &out);
409 1.12 thorpej
410 1.12 thorpej /*
411 1.12 thorpej * If we succeeded, call the callback function.
412 1.12 thorpej * The callback will return TRUE when it wants
413 1.12 thorpej * no more values. If we fail, indicate the
414 1.12 thorpej * error.
415 1.12 thorpej */
416 1.13 christos if (status) {
417 1.21 christos /* LINTED const dropouts */
418 1.21 christos if ((*incallback->foreach)((int)out.status,
419 1.12 thorpej (char *)out.keydat.dptr, out.keydat.dsize,
420 1.12 thorpej (char *)out.valdat.dptr, out.valdat.dsize,
421 1.12 thorpej incallback->data))
422 1.12 thorpej return TRUE;
423 1.12 thorpej } else
424 1.1 deraadt return FALSE;
425 1.1 deraadt }
426 1.1 deraadt }
427 1.1 deraadt
428 1.1 deraadt bool_t
429 1.1 deraadt xdr_ypresp_master(xdrs, objp)
430 1.12 thorpej XDR *xdrs;
431 1.12 thorpej struct ypresp_master *objp;
432 1.1 deraadt {
433 1.23 lukem
434 1.23 lukem _DIAGASSERT(xdrs != NULL);
435 1.23 lukem _DIAGASSERT(objp != NULL);
436 1.23 lukem
437 1.26 christos if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)(void *)&objp->status))
438 1.9 christos return FALSE;
439 1.12 thorpej
440 1.13 christos if (!xdr_string(xdrs, &objp->master, YPMAXPEER))
441 1.13 christos return FALSE;
442 1.13 christos
443 1.13 christos return TRUE;
444 1.1 deraadt }
445 1.1 deraadt
446 1.12 thorpej static bool_t
447 1.1 deraadt xdr_ypmaplist_str(xdrs, objp)
448 1.12 thorpej XDR *xdrs;
449 1.12 thorpej char *objp;
450 1.1 deraadt {
451 1.23 lukem
452 1.23 lukem _DIAGASSERT(xdrs != NULL);
453 1.23 lukem _DIAGASSERT(objp != NULL);
454 1.23 lukem
455 1.7 jtc return xdr_string(xdrs, &objp, YPMAXMAP+1);
456 1.1 deraadt }
457 1.1 deraadt
458 1.1 deraadt bool_t
459 1.1 deraadt xdr_ypmaplist(xdrs, objp)
460 1.12 thorpej XDR *xdrs;
461 1.12 thorpej struct ypmaplist *objp;
462 1.1 deraadt {
463 1.23 lukem
464 1.23 lukem _DIAGASSERT(xdrs != NULL);
465 1.23 lukem _DIAGASSERT(objp != NULL);
466 1.23 lukem
467 1.12 thorpej if (!xdr_ypmaplist_str(xdrs, objp->ypml_name))
468 1.9 christos return FALSE;
469 1.12 thorpej
470 1.13 christos if (!xdr_pointer(xdrs, (caddr_t *)&objp->ypml_next,
471 1.22 christos sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist))
472 1.13 christos return FALSE;
473 1.13 christos
474 1.13 christos return TRUE;
475 1.1 deraadt }
476 1.1 deraadt
477 1.1 deraadt bool_t
478 1.1 deraadt xdr_ypresp_maplist(xdrs, objp)
479 1.12 thorpej XDR *xdrs;
480 1.12 thorpej struct ypresp_maplist *objp;
481 1.1 deraadt {
482 1.23 lukem
483 1.23 lukem _DIAGASSERT(xdrs != NULL);
484 1.23 lukem _DIAGASSERT(objp != NULL);
485 1.23 lukem
486 1.26 christos if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)(void *)&objp->status))
487 1.9 christos return FALSE;
488 1.12 thorpej
489 1.13 christos if (!xdr_pointer(xdrs, (caddr_t *)&objp->list,
490 1.22 christos sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist))
491 1.13 christos return FALSE;
492 1.13 christos
493 1.13 christos return TRUE;
494 1.1 deraadt }
495 1.1 deraadt
496 1.1 deraadt bool_t
497 1.1 deraadt xdr_ypresp_order(xdrs, objp)
498 1.12 thorpej XDR *xdrs;
499 1.12 thorpej struct ypresp_order *objp;
500 1.1 deraadt {
501 1.23 lukem
502 1.23 lukem _DIAGASSERT(xdrs != NULL);
503 1.23 lukem _DIAGASSERT(objp != NULL);
504 1.23 lukem
505 1.26 christos if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)(void *)&objp->status))
506 1.9 christos return FALSE;
507 1.12 thorpej
508 1.14 thorpej if (!xdr_u_int(xdrs, &objp->ordernum))
509 1.13 christos return FALSE;
510 1.13 christos
511 1.13 christos return TRUE;
512 1.12 thorpej }
513 1.12 thorpej
514 1.12 thorpej bool_t
515 1.12 thorpej xdr_ypreq_xfr(xdrs, objp)
516 1.12 thorpej XDR *xdrs;
517 1.12 thorpej struct ypreq_xfr *objp;
518 1.12 thorpej {
519 1.23 lukem
520 1.23 lukem _DIAGASSERT(xdrs != NULL);
521 1.23 lukem _DIAGASSERT(objp != NULL);
522 1.23 lukem
523 1.13 christos if (!xdr_ypmap_parms(xdrs, &objp->map_parms))
524 1.12 thorpej return FALSE;
525 1.12 thorpej
526 1.14 thorpej if (!xdr_u_int(xdrs, &objp->transid))
527 1.12 thorpej return FALSE;
528 1.12 thorpej
529 1.14 thorpej if (!xdr_u_int(xdrs, &objp->proto))
530 1.12 thorpej return FALSE;
531 1.12 thorpej
532 1.14 thorpej if (!xdr_u_int(xdrs, &objp->port))
533 1.12 thorpej return FALSE;
534 1.12 thorpej
535 1.12 thorpej return TRUE;
536 1.12 thorpej }
537 1.12 thorpej
538 1.12 thorpej bool_t
539 1.12 thorpej xdr_ypmap_parms(xdrs, objp)
540 1.12 thorpej XDR *xdrs;
541 1.12 thorpej struct ypmap_parms *objp;
542 1.12 thorpej {
543 1.23 lukem
544 1.23 lukem _DIAGASSERT(xdrs != NULL);
545 1.23 lukem _DIAGASSERT(objp != NULL);
546 1.23 lukem
547 1.15 chuck if (!xdr_ypdomain_wrap_string(xdrs, (char **)&objp->domain))
548 1.12 thorpej return FALSE;
549 1.12 thorpej
550 1.15 chuck if (!xdr_ypmap_wrap_string(xdrs, (char **)&objp->map))
551 1.12 thorpej return FALSE;
552 1.12 thorpej
553 1.14 thorpej if (!xdr_u_int(xdrs, &objp->ordernum))
554 1.12 thorpej return FALSE;
555 1.12 thorpej
556 1.13 christos if (!xdr_ypowner_wrap_string(xdrs, &objp->owner))
557 1.12 thorpej return FALSE;
558 1.12 thorpej
559 1.12 thorpej return TRUE;
560 1.12 thorpej }
561 1.12 thorpej
562 1.12 thorpej bool_t
563 1.12 thorpej xdr_yppushresp_xfr(xdrs, objp)
564 1.12 thorpej XDR *xdrs;
565 1.12 thorpej struct yppushresp_xfr *objp;
566 1.12 thorpej {
567 1.23 lukem
568 1.23 lukem _DIAGASSERT(xdrs != NULL);
569 1.23 lukem _DIAGASSERT(objp != NULL);
570 1.23 lukem
571 1.14 thorpej if (!xdr_u_int(xdrs, &objp->transid))
572 1.12 thorpej return FALSE;
573 1.12 thorpej
574 1.14 thorpej if (!xdr_enum(xdrs, (enum_t *)&objp->status))
575 1.12 thorpej return FALSE;
576 1.12 thorpej
577 1.12 thorpej return TRUE;
578 1.1 deraadt }
579