xref: /illumos-gate/usr/src/lib/libnsl/yp/yp_xdr.c (revision 1da57d551424de5a9d469760be7c4b4d4f10a755)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
2161961e0fSrobinson  */
2261961e0fSrobinson 
2361961e0fSrobinson /*
24*e8031f0aSraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
297c478bd9Sstevel@tonic-gate /*	  All Rights Reserved   */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley
337c478bd9Sstevel@tonic-gate  * under license from the Regents of the University of
347c478bd9Sstevel@tonic-gate  * California.
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * This contains ALL xdr routines used by the YP rpc interface.
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
41*e8031f0aSraf #include "mt.h"
4261961e0fSrobinson #include <unistd.h>
4361961e0fSrobinson #include <stdlib.h>
447c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
457c478bd9Sstevel@tonic-gate #include "yp_b.h"
467c478bd9Sstevel@tonic-gate #include <rpcsvc/yp_prot.h>
477c478bd9Sstevel@tonic-gate #include <rpcsvc/ypclnt.h>
487c478bd9Sstevel@tonic-gate #include <sys/types.h>
497c478bd9Sstevel@tonic-gate #include <limits.h>
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate static bool xdr_ypmaplist(XDR *, struct ypmaplist **);
527c478bd9Sstevel@tonic-gate static bool xdr_ypmaplist_wrap_string(XDR *, char *);
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate typedef struct xdr_discrim XDR_DISCRIM;
5561961e0fSrobinson extern bool xdr_ypreq_key(XDR *, struct ypreq_key *);
5661961e0fSrobinson extern bool xdr_ypreq_nokey(XDR *, struct ypreq_nokey *);
5761961e0fSrobinson extern bool xdr_ypresp_val(XDR *, struct ypresp_val *);
5861961e0fSrobinson extern bool xdr_ypresp_key_val(XDR *, struct ypresp_key_val *);
5961961e0fSrobinson extern bool xdr_ypmap_parms(XDR *, struct ypmap_parms *);
6061961e0fSrobinson extern bool xdr_ypowner_wrap_string(XDR *, char **);
6161961e0fSrobinson extern bool xdr_ypreq_newname_string(XDR *, char **);
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * Serializes/deserializes a dbm datum data structure.
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate bool
xdr_datum(XDR * xdrs,datum * pdatum)6861961e0fSrobinson xdr_datum(XDR *xdrs, datum *pdatum)
697c478bd9Sstevel@tonic-gate {
7061961e0fSrobinson 	bool res;
717c478bd9Sstevel@tonic-gate 	uint_t dsize;
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate 	/*
747c478bd9Sstevel@tonic-gate 	 * LP64 case :
757c478bd9Sstevel@tonic-gate 	 * xdr_bytes() expects a uint_t for the 3rd argument. Since
767c478bd9Sstevel@tonic-gate 	 * datum.dsize is a long, we need a new temporary to pass to
777c478bd9Sstevel@tonic-gate 	 * xdr_bytes()
787c478bd9Sstevel@tonic-gate 	 */
797c478bd9Sstevel@tonic-gate 	if (xdrs->x_op == XDR_ENCODE) {
807c478bd9Sstevel@tonic-gate 		if (pdatum->dsize > UINT_MAX)
817c478bd9Sstevel@tonic-gate 			return (FALSE);
827c478bd9Sstevel@tonic-gate 	}
837c478bd9Sstevel@tonic-gate 	dsize = (uint_t)pdatum->dsize;
8461961e0fSrobinson 	res = (bool)xdr_bytes(xdrs, (char **)&(pdatum->dptr), &dsize,
8561961e0fSrobinson 								YPMAXRECORD);
867c478bd9Sstevel@tonic-gate 	if (xdrs->x_op == XDR_DECODE) {
877c478bd9Sstevel@tonic-gate 		pdatum->dsize = dsize;
887c478bd9Sstevel@tonic-gate 	}
897c478bd9Sstevel@tonic-gate 
9061961e0fSrobinson 	return (res);
917c478bd9Sstevel@tonic-gate }
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate /*
957c478bd9Sstevel@tonic-gate  * Serializes/deserializes a domain name string.  This is a "wrapper" for
967c478bd9Sstevel@tonic-gate  * xdr_string which knows about the maximum domain name size.
977c478bd9Sstevel@tonic-gate  */
987c478bd9Sstevel@tonic-gate bool
xdr_ypdomain_wrap_string(XDR * xdrs,char ** ppstring)9961961e0fSrobinson xdr_ypdomain_wrap_string(XDR *xdrs, char **ppstring)
1007c478bd9Sstevel@tonic-gate {
10161961e0fSrobinson 	return ((bool)xdr_string(xdrs, ppstring, YPMAXDOMAIN));
1027c478bd9Sstevel@tonic-gate }
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /*
1057c478bd9Sstevel@tonic-gate  * Serializes/deserializes a map name string.  This is a "wrapper" for
1067c478bd9Sstevel@tonic-gate  * xdr_string which knows about the maximum map name size.
1077c478bd9Sstevel@tonic-gate  */
1087c478bd9Sstevel@tonic-gate bool
xdr_ypmap_wrap_string(XDR * xdrs,char ** ppstring)10961961e0fSrobinson xdr_ypmap_wrap_string(XDR *xdrs, char **ppstring)
1107c478bd9Sstevel@tonic-gate {
11161961e0fSrobinson 	return ((bool)xdr_string(xdrs, ppstring, YPMAXMAP));
1127c478bd9Sstevel@tonic-gate }
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /*
1157c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypreq_key structure.
1167c478bd9Sstevel@tonic-gate  */
1177c478bd9Sstevel@tonic-gate bool
xdr_ypreq_key(XDR * xdrs,struct ypreq_key * ps)11861961e0fSrobinson xdr_ypreq_key(XDR *xdrs, struct ypreq_key *ps)
1197c478bd9Sstevel@tonic-gate {
12061961e0fSrobinson 	return ((bool)(xdr_ypdomain_wrap_string(xdrs, &ps->domain) &&
1217c478bd9Sstevel@tonic-gate 		    xdr_ypmap_wrap_string(xdrs, &ps->map) &&
12261961e0fSrobinson 		    xdr_datum(xdrs, &ps->keydat)));
1237c478bd9Sstevel@tonic-gate }
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate /*
1267c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypreq_nokey structure.
1277c478bd9Sstevel@tonic-gate  */
1287c478bd9Sstevel@tonic-gate bool
xdr_ypreq_nokey(XDR * xdrs,struct ypreq_nokey * ps)12961961e0fSrobinson xdr_ypreq_nokey(XDR *xdrs, struct ypreq_nokey *ps)
1307c478bd9Sstevel@tonic-gate {
13161961e0fSrobinson 	return ((bool)(xdr_ypdomain_wrap_string(xdrs, &ps->domain) &&
13261961e0fSrobinson 		    xdr_ypmap_wrap_string(xdrs, &ps->map)));
1337c478bd9Sstevel@tonic-gate }
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate /*
1367c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypresp_val structure.
1377c478bd9Sstevel@tonic-gate  */
1387c478bd9Sstevel@tonic-gate bool
xdr_ypresp_val(XDR * xdrs,struct ypresp_val * ps)13961961e0fSrobinson xdr_ypresp_val(XDR *xdrs, struct ypresp_val *ps)
1407c478bd9Sstevel@tonic-gate {
14161961e0fSrobinson 	return ((bool)(xdr_u_int(xdrs, &ps->status) &&
14261961e0fSrobinson 		    xdr_datum(xdrs, &ps->valdat)));
1437c478bd9Sstevel@tonic-gate }
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate /*
1467c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypresp_key_val structure.
1477c478bd9Sstevel@tonic-gate  */
1487c478bd9Sstevel@tonic-gate bool
xdr_ypresp_key_val(XDR * xdrs,struct ypresp_key_val * ps)14961961e0fSrobinson xdr_ypresp_key_val(XDR *xdrs, struct ypresp_key_val *ps)
1507c478bd9Sstevel@tonic-gate {
15161961e0fSrobinson 	return ((bool)(xdr_u_int(xdrs, &ps->status) &&
1527c478bd9Sstevel@tonic-gate 	    xdr_datum(xdrs, &ps->valdat) &&
15361961e0fSrobinson 	    xdr_datum(xdrs, &ps->keydat)));
1547c478bd9Sstevel@tonic-gate }
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate  * Serializes/deserializes a peer server's node name
1587c478bd9Sstevel@tonic-gate  */
1597c478bd9Sstevel@tonic-gate bool
xdr_ypowner_wrap_string(XDR * xdrs,char ** ppstring)16061961e0fSrobinson xdr_ypowner_wrap_string(XDR *xdrs, char **ppstring)
1617c478bd9Sstevel@tonic-gate {
16261961e0fSrobinson 	return ((bool)xdr_string(xdrs, ppstring, YPMAXPEER));
1637c478bd9Sstevel@tonic-gate }
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate /*
1667c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypmap_parms structure.
1677c478bd9Sstevel@tonic-gate  */
1687c478bd9Sstevel@tonic-gate bool
xdr_ypmap_parms(XDR * xdrs,struct ypmap_parms * ps)16961961e0fSrobinson xdr_ypmap_parms(XDR *xdrs, struct ypmap_parms *ps)
1707c478bd9Sstevel@tonic-gate {
17161961e0fSrobinson 	return ((bool)(xdr_ypdomain_wrap_string(xdrs, &ps->domain) &&
1727c478bd9Sstevel@tonic-gate 	    xdr_ypmap_wrap_string(xdrs, &ps->map) &&
1737c478bd9Sstevel@tonic-gate 	    xdr_u_int(xdrs, &ps->ordernum) &&
17461961e0fSrobinson 	    xdr_ypowner_wrap_string(xdrs, &ps->owner)));
1757c478bd9Sstevel@tonic-gate }
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypreq_newxfr name
1797c478bd9Sstevel@tonic-gate  */
1807c478bd9Sstevel@tonic-gate bool
xdr_ypreq_newname_string(XDR * xdrs,char ** ppstring)18161961e0fSrobinson xdr_ypreq_newname_string(XDR *xdrs, char **ppstring)
1827c478bd9Sstevel@tonic-gate {
18361961e0fSrobinson 	return ((bool)xdr_string(xdrs, ppstring, 256));
1847c478bd9Sstevel@tonic-gate }
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypresp_master structure.
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate bool
xdr_ypresp_master(XDR * xdrs,struct ypresp_master * ps)19061961e0fSrobinson xdr_ypresp_master(XDR *xdrs, struct ypresp_master *ps)
1917c478bd9Sstevel@tonic-gate {
19261961e0fSrobinson 	return ((bool)(xdr_u_int(xdrs, &ps->status) &&
19361961e0fSrobinson 	    xdr_ypowner_wrap_string(xdrs, &ps->master)));
1947c478bd9Sstevel@tonic-gate }
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate /*
1977c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypresp_order structure.
1987c478bd9Sstevel@tonic-gate  */
1997c478bd9Sstevel@tonic-gate bool
xdr_ypresp_order(XDR * xdrs,struct ypresp_order * ps)20061961e0fSrobinson xdr_ypresp_order(XDR *xdrs, struct ypresp_order *ps)
2017c478bd9Sstevel@tonic-gate {
20261961e0fSrobinson 	return ((bool)(xdr_u_int(xdrs, &ps->status) &&
20361961e0fSrobinson 	    xdr_u_int(xdrs, &ps->ordernum)));
2047c478bd9Sstevel@tonic-gate }
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate /*
2077c478bd9Sstevel@tonic-gate  * This is like xdr_ypmap_wrap_string except that it serializes/deserializes
2087c478bd9Sstevel@tonic-gate  * an array, instead of a pointer, so xdr_reference can work on the structure
2097c478bd9Sstevel@tonic-gate  * containing the char array itself.
2107c478bd9Sstevel@tonic-gate  */
2117c478bd9Sstevel@tonic-gate static bool
xdr_ypmaplist_wrap_string(XDR * xdrs,char * pstring)21261961e0fSrobinson xdr_ypmaplist_wrap_string(XDR *xdrs, char *pstring)
2137c478bd9Sstevel@tonic-gate {
2147c478bd9Sstevel@tonic-gate 	char *s;
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate 	s = pstring;
21761961e0fSrobinson 	return ((bool)xdr_string(xdrs, &s, YPMAXMAP));
2187c478bd9Sstevel@tonic-gate }
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate /*
2217c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypmaplist.
2227c478bd9Sstevel@tonic-gate  */
2237c478bd9Sstevel@tonic-gate static bool
xdr_ypmaplist(XDR * xdrs,struct ypmaplist ** lst)22461961e0fSrobinson xdr_ypmaplist(XDR *xdrs, struct ypmaplist **lst)
2257c478bd9Sstevel@tonic-gate {
2267c478bd9Sstevel@tonic-gate 	bool_t more_elements;
2277c478bd9Sstevel@tonic-gate 	int freeing = (xdrs->x_op == XDR_FREE);
2287c478bd9Sstevel@tonic-gate 	struct ypmaplist **next;
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate 	for (;;) {
23161961e0fSrobinson 		more_elements = (*lst != NULL);
2327c478bd9Sstevel@tonic-gate 
23361961e0fSrobinson 		if (!xdr_bool(xdrs, &more_elements))
2347c478bd9Sstevel@tonic-gate 			return (FALSE);
2357c478bd9Sstevel@tonic-gate 
23661961e0fSrobinson 		if (!more_elements)
2377c478bd9Sstevel@tonic-gate 			return (TRUE);  /* All done */
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate 		if (freeing)
2407c478bd9Sstevel@tonic-gate 			next = &((*lst)->ypml_next);
2417c478bd9Sstevel@tonic-gate 
2427c478bd9Sstevel@tonic-gate 		if (!xdr_reference(xdrs, (caddr_t *)lst,
24361961e0fSrobinson 			(uint_t)sizeof (struct ypmaplist),
24461961e0fSrobinson 		    (xdrproc_t)xdr_ypmaplist_wrap_string))
2457c478bd9Sstevel@tonic-gate 			return (FALSE);
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate 		lst = (freeing) ? next : &((*lst)->ypml_next);
2487c478bd9Sstevel@tonic-gate 	}
2497c478bd9Sstevel@tonic-gate 	/*NOTREACHED*/
2507c478bd9Sstevel@tonic-gate }
2517c478bd9Sstevel@tonic-gate 
2527c478bd9Sstevel@tonic-gate /*
2537c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypresp_maplist.
2547c478bd9Sstevel@tonic-gate  */
2557c478bd9Sstevel@tonic-gate bool
xdr_ypresp_maplist(XDR * xdrs,struct ypresp_maplist * ps)25661961e0fSrobinson xdr_ypresp_maplist(XDR *xdrs, struct ypresp_maplist *ps)
2577c478bd9Sstevel@tonic-gate {
25861961e0fSrobinson 	return ((bool)(xdr_u_int(xdrs, &ps->status) &&
25961961e0fSrobinson 		xdr_ypmaplist(xdrs, &ps->list)));
2607c478bd9Sstevel@tonic-gate }
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate /*
2637c478bd9Sstevel@tonic-gate  * Serializes/deserializes a yppushresp_xfr structure.
2647c478bd9Sstevel@tonic-gate  */
2657c478bd9Sstevel@tonic-gate bool
xdr_yppushresp_xfr(XDR * xdrs,struct yppushresp_xfr * ps)26661961e0fSrobinson xdr_yppushresp_xfr(XDR *xdrs, struct yppushresp_xfr *ps)
2677c478bd9Sstevel@tonic-gate {
26861961e0fSrobinson 	return ((bool)(xdr_u_int(xdrs, &ps->transid) &&
26961961e0fSrobinson 	    xdr_u_int(xdrs, &ps->status)));
2707c478bd9Sstevel@tonic-gate }
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate /*
2747c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypreq_xfr structure.
2757c478bd9Sstevel@tonic-gate  */
2767c478bd9Sstevel@tonic-gate bool
xdr_ypreq_newxfr(XDR * xdrs,struct ypreq_newxfr * ps)27761961e0fSrobinson xdr_ypreq_newxfr(XDR *xdrs, struct ypreq_newxfr *ps)
2787c478bd9Sstevel@tonic-gate {
27961961e0fSrobinson 	return ((bool)(xdr_ypmap_parms(xdrs, &ps->map_parms) &&
2807c478bd9Sstevel@tonic-gate 	    xdr_u_int(xdrs, &ps->transid) &&
2817c478bd9Sstevel@tonic-gate 	    xdr_u_int(xdrs, &ps->proto) &&
28261961e0fSrobinson 	    xdr_string(xdrs, &ps->name, 256)));
2837c478bd9Sstevel@tonic-gate }
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate /*
2867c478bd9Sstevel@tonic-gate  * Serializes/deserializes a ypreq_xfr structure.
2877c478bd9Sstevel@tonic-gate  */
2887c478bd9Sstevel@tonic-gate bool
xdr_ypreq_xfr(XDR * xdrs,struct ypreq_xfr * ps)28961961e0fSrobinson xdr_ypreq_xfr(XDR *xdrs, struct ypreq_xfr *ps)
2907c478bd9Sstevel@tonic-gate {
29161961e0fSrobinson 	return ((bool)(xdr_ypmap_parms(xdrs, &ps->map_parms) &&
2927c478bd9Sstevel@tonic-gate 	    xdr_u_int(xdrs, &ps->transid) &&
2937c478bd9Sstevel@tonic-gate 	    xdr_u_int(xdrs, &ps->proto) &&
29461961e0fSrobinson 	    xdr_u_short(xdrs, &ps->port)));
2957c478bd9Sstevel@tonic-gate }
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate /*
2997c478bd9Sstevel@tonic-gate  * Serializes/deserializes a stream of struct ypresp_key_val's.  This is used
3007c478bd9Sstevel@tonic-gate  * only by the client side of the batch enumerate operation.
3017c478bd9Sstevel@tonic-gate  */
3027c478bd9Sstevel@tonic-gate bool
xdr_ypall(XDR * xdrs,struct ypall_callback * callback)30361961e0fSrobinson xdr_ypall(XDR *xdrs, struct ypall_callback *callback)
3047c478bd9Sstevel@tonic-gate {
3057c478bd9Sstevel@tonic-gate 	bool_t more;
3067c478bd9Sstevel@tonic-gate 	struct ypresp_key_val kv;
3077c478bd9Sstevel@tonic-gate 	char keybuf[YPMAXRECORD];
3087c478bd9Sstevel@tonic-gate 	char valbuf[YPMAXRECORD];
3097c478bd9Sstevel@tonic-gate 
31061961e0fSrobinson 	if (xdrs->x_op == XDR_ENCODE)
3117c478bd9Sstevel@tonic-gate 		return (FALSE);
3127c478bd9Sstevel@tonic-gate 
31361961e0fSrobinson 	if (xdrs->x_op == XDR_FREE)
3147c478bd9Sstevel@tonic-gate 		return (TRUE);
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate 	kv.keydat.dptr = keybuf;
3177c478bd9Sstevel@tonic-gate 	kv.valdat.dptr = valbuf;
3187c478bd9Sstevel@tonic-gate 	kv.keydat.dsize = YPMAXRECORD;
3197c478bd9Sstevel@tonic-gate 	kv.valdat.dsize = YPMAXRECORD;
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate 	for (;;) {
32261961e0fSrobinson 		if (!xdr_bool(xdrs, &more))
3237c478bd9Sstevel@tonic-gate 			return (FALSE);
3247c478bd9Sstevel@tonic-gate 
32561961e0fSrobinson 		if (!more)
3267c478bd9Sstevel@tonic-gate 			return (TRUE);
3277c478bd9Sstevel@tonic-gate 
32861961e0fSrobinson 		if (!xdr_ypresp_key_val(xdrs, &kv))
32961961e0fSrobinson 			return (FALSE);
33061961e0fSrobinson 		if ((*callback->foreach)(kv.status, kv.keydat.dptr,
3317c478bd9Sstevel@tonic-gate 			    kv.keydat.dsize, kv.valdat.dptr, kv.valdat.dsize,
33261961e0fSrobinson 			    callback->data))
3337c478bd9Sstevel@tonic-gate 			return (TRUE);
3347c478bd9Sstevel@tonic-gate 	}
3357c478bd9Sstevel@tonic-gate }
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate bool_t
xdr_netconfig(XDR * xdrs,struct netconfig * objp)33861961e0fSrobinson xdr_netconfig(XDR *xdrs, struct netconfig *objp)
3397c478bd9Sstevel@tonic-gate {
34061961e0fSrobinson 	if (!xdr_string(xdrs, &objp->nc_netid, ~0))
3417c478bd9Sstevel@tonic-gate 		return (FALSE);
34261961e0fSrobinson 	if (!xdr_u_int(xdrs, &objp->nc_semantics))
3437c478bd9Sstevel@tonic-gate 		return (FALSE);
34461961e0fSrobinson 	if (!xdr_u_int(xdrs, &objp->nc_flag))
3457c478bd9Sstevel@tonic-gate 		return (FALSE);
34661961e0fSrobinson 	if (!xdr_string(xdrs, &objp->nc_protofmly, ~0))
3477c478bd9Sstevel@tonic-gate 		return (FALSE);
34861961e0fSrobinson 	if (!xdr_string(xdrs, &objp->nc_proto, ~0))
3497c478bd9Sstevel@tonic-gate 		return (FALSE);
35061961e0fSrobinson 	if (!xdr_string(xdrs, &objp->nc_device, ~0))
3517c478bd9Sstevel@tonic-gate 		return (FALSE);
3527c478bd9Sstevel@tonic-gate 	if (!xdr_array(xdrs, (char **)&objp->nc_lookups,
35361961e0fSrobinson 		(uint_t *)&objp->nc_nlookups, 100, sizeof (char *),
35461961e0fSrobinson 		xdr_wrapstring))
3557c478bd9Sstevel@tonic-gate 		return (FALSE);
35661961e0fSrobinson 	return ((bool)xdr_vector(xdrs, (char *)objp->nc_unused,
35761961e0fSrobinson 		8, sizeof (uint_t), xdr_u_int));
3587c478bd9Sstevel@tonic-gate }
359