Home | History | Annotate | Line # | Download | only in yp
xdryp.c revision 1.22
      1  1.22  christos /*	$NetBSD: xdryp.c,v 1.22 1999/01/31 20:46:12 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.22  christos __RCSID("$NetBSD: xdryp.c,v 1.22 1999/01/31 20:46:12 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.1   deraadt #include <sys/param.h>
     53   1.1   deraadt #include <sys/types.h>
     54   1.1   deraadt #include <sys/socket.h>
     55   1.1   deraadt #include <stdio.h>
     56   1.7       jtc #include <stdlib.h>
     57   1.7       jtc #include <string.h>
     58   1.1   deraadt #include <ctype.h>
     59   1.1   deraadt #include <rpc/rpc.h>
     60   1.1   deraadt #include <rpc/xdr.h>
     61   1.1   deraadt #include <rpcsvc/yp_prot.h>
     62   1.1   deraadt #include <rpcsvc/ypclnt.h>
     63  1.17       jtc 
     64  1.17       jtc #ifdef __weak_alias
     65  1.17       jtc __weak_alias(xdr_datum,_xdr_datum);
     66  1.17       jtc __weak_alias(xdr_domainname,_xdr_domainname);
     67  1.17       jtc __weak_alias(xdr_mapname,_xdr_mapname);
     68  1.17       jtc __weak_alias(xdr_peername,_xdr_peername);
     69  1.17       jtc __weak_alias(xdr_yp_inaddr,_xdr_yp_inaddr);
     70  1.17       jtc __weak_alias(xdr_ypall,_xdr_ypall);
     71  1.17       jtc __weak_alias(xdr_ypbind_resp,_xdr_ypbind_resp);
     72  1.17       jtc __weak_alias(xdr_ypbind_setdom,_xdr_ypbind_setdom);
     73  1.17       jtc __weak_alias(xdr_ypdomain_wrap_string,_xdr_ypdomain_wrap_string);
     74  1.17       jtc __weak_alias(xdr_ypmap_parms,_xdr_ypmap_parms);
     75  1.17       jtc __weak_alias(xdr_ypmap_wrap_string,_xdr_ypmap_wrap_string);
     76  1.17       jtc __weak_alias(xdr_ypmaplist,_xdr_ypmaplist);
     77  1.17       jtc __weak_alias(xdr_ypowner_wrap_string,_xdr_ypowner_wrap_string);
     78  1.17       jtc __weak_alias(xdr_yppushresp_xfr,_xdr_yppushresp_xfr);
     79  1.17       jtc __weak_alias(xdr_ypreq_key,_xdr_ypreq_key);
     80  1.17       jtc __weak_alias(xdr_ypreq_nokey,_xdr_ypreq_nokey);
     81  1.17       jtc __weak_alias(xdr_ypreq_xfr,_xdr_ypreq_xfr);
     82  1.17       jtc __weak_alias(xdr_ypresp_key_val,_xdr_ypresp_key_val);
     83  1.17       jtc __weak_alias(xdr_ypresp_maplist,_xdr_ypresp_maplist);
     84  1.17       jtc __weak_alias(xdr_ypresp_master,_xdr_ypresp_master);
     85  1.17       jtc __weak_alias(xdr_ypresp_order,_xdr_ypresp_order);
     86  1.17       jtc __weak_alias(xdr_ypresp_val,_xdr_ypresp_val);
     87  1.17       jtc #endif
     88   1.1   deraadt 
     89  1.12   thorpej /*
     90  1.12   thorpej  * Functions used only within this file.
     91  1.12   thorpej  */
     92  1.12   thorpej static	bool_t xdr_ypbind_binding __P((XDR *, struct ypbind_binding *));
     93  1.12   thorpej static	bool_t xdr_ypbind_resptype __P((XDR *, enum ypbind_resptype *));
     94  1.12   thorpej static	bool_t xdr_ypstat __P((XDR *, enum ypbind_resptype *));
     95  1.12   thorpej static	bool_t xdr_ypmaplist_str __P((XDR *, char *));
     96  1.12   thorpej 
     97  1.19   thorpej __warn_references(xdr_domainname,
     98  1.20   thorpej     "warning: this program uses xdr_domainname(), which is deprecated and buggy.")
     99  1.19   thorpej 
    100  1.19   thorpej bool_t
    101  1.19   thorpej xdr_domainname(xdrs, objp)
    102  1.19   thorpej 	XDR *xdrs;
    103  1.19   thorpej 	char *objp;
    104  1.19   thorpej {
    105  1.19   thorpej 	return xdr_string(xdrs, &objp, YPMAXDOMAIN);
    106  1.19   thorpej }
    107  1.19   thorpej 
    108  1.19   thorpej __warn_references(xdr_peername,
    109  1.20   thorpej     "warning: this program uses xdr_peername(), which is deprecated and buggy.")
    110  1.19   thorpej 
    111  1.19   thorpej bool_t
    112  1.19   thorpej xdr_peername(xdrs, objp)
    113  1.19   thorpej 	XDR *xdrs;
    114  1.19   thorpej 	char *objp;
    115  1.19   thorpej {
    116  1.19   thorpej 	return xdr_string(xdrs, &objp, YPMAXPEER);
    117  1.19   thorpej }
    118  1.19   thorpej 
    119  1.19   thorpej __warn_references(xdr_mapname,
    120  1.20   thorpej     "warning: this program uses xdr_mapname(), which is deprecated and buggy.")
    121  1.19   thorpej 
    122  1.19   thorpej bool_t
    123  1.19   thorpej xdr_mapname(xdrs, objp)
    124  1.19   thorpej 	XDR *xdrs;
    125  1.19   thorpej 	char *objp;
    126  1.19   thorpej {
    127  1.19   thorpej 	return xdr_string(xdrs, &objp, YPMAXMAP);
    128  1.19   thorpej }
    129  1.19   thorpej 
    130  1.12   thorpej bool_t
    131  1.12   thorpej xdr_ypdomain_wrap_string(xdrs, objp)
    132  1.12   thorpej 	XDR *xdrs;
    133  1.12   thorpej 	char **objp;
    134  1.12   thorpej {
    135  1.12   thorpej 	return xdr_string(xdrs, objp, YPMAXDOMAIN);
    136  1.12   thorpej }
    137  1.12   thorpej 
    138  1.12   thorpej bool_t
    139  1.12   thorpej xdr_ypmap_wrap_string(xdrs, objp)
    140  1.12   thorpej 	XDR *xdrs;
    141  1.12   thorpej 	char **objp;
    142  1.12   thorpej {
    143  1.12   thorpej 	return xdr_string(xdrs, objp, YPMAXMAP);
    144  1.12   thorpej }
    145  1.12   thorpej 
    146   1.1   deraadt bool_t
    147  1.12   thorpej xdr_ypowner_wrap_string(xdrs, objp)
    148  1.12   thorpej 	XDR *xdrs;
    149  1.12   thorpej 	char **objp;
    150   1.1   deraadt {
    151  1.12   thorpej 	return xdr_string(xdrs, objp, YPMAXPEER);
    152   1.1   deraadt }
    153   1.1   deraadt 
    154   1.1   deraadt bool_t
    155  1.12   thorpej xdr_datum(xdrs, objp)
    156  1.12   thorpej 	XDR *xdrs;
    157  1.12   thorpej 	datum *objp;
    158   1.1   deraadt {
    159  1.12   thorpej 	return xdr_bytes(xdrs, (char **)&objp->dptr,
    160  1.12   thorpej 	    (u_int *)&objp->dsize, YPMAXRECORD);
    161   1.1   deraadt }
    162   1.1   deraadt 
    163   1.1   deraadt bool_t
    164   1.1   deraadt xdr_ypreq_key(xdrs, objp)
    165  1.12   thorpej 	XDR *xdrs;
    166  1.12   thorpej 	struct ypreq_key *objp;
    167   1.1   deraadt {
    168  1.13  christos 	if (!xdr_ypdomain_wrap_string(xdrs, (char **)&objp->domain))
    169   1.9  christos 		return FALSE;
    170  1.12   thorpej 
    171  1.13  christos 	if (!xdr_ypmap_wrap_string(xdrs, (char **)&objp->map))
    172   1.9  christos 		return FALSE;
    173  1.12   thorpej 
    174  1.13  christos 	if (!xdr_datum(xdrs, &objp->keydat))
    175  1.13  christos 		return FALSE;
    176  1.13  christos 
    177  1.13  christos 	return TRUE;
    178   1.1   deraadt }
    179   1.1   deraadt 
    180   1.1   deraadt bool_t
    181   1.1   deraadt xdr_ypreq_nokey(xdrs, objp)
    182  1.12   thorpej 	XDR *xdrs;
    183  1.12   thorpej 	struct ypreq_nokey *objp;
    184   1.1   deraadt {
    185  1.13  christos 	if (!xdr_ypdomain_wrap_string(xdrs, (char **)&objp->domain))
    186  1.13  christos 		return FALSE;
    187  1.13  christos 
    188  1.13  christos 	if (!xdr_ypmap_wrap_string(xdrs, (char **)&objp->map))
    189   1.9  christos 		return FALSE;
    190  1.12   thorpej 
    191  1.13  christos 	return TRUE;
    192   1.1   deraadt }
    193   1.1   deraadt 
    194   1.1   deraadt bool_t
    195   1.1   deraadt xdr_yp_inaddr(xdrs, objp)
    196  1.12   thorpej 	XDR *xdrs;
    197  1.12   thorpej 	struct in_addr *objp;
    198   1.1   deraadt {
    199  1.21  christos 	return xdr_opaque(xdrs, (caddr_t)(void *)&objp->s_addr,
    200  1.21  christos 	    sizeof objp->s_addr);
    201   1.1   deraadt }
    202   1.1   deraadt 
    203  1.12   thorpej static bool_t
    204   1.1   deraadt xdr_ypbind_binding(xdrs, objp)
    205  1.12   thorpej 	XDR *xdrs;
    206  1.12   thorpej 	struct ypbind_binding *objp;
    207   1.1   deraadt {
    208  1.12   thorpej 	if (!xdr_yp_inaddr(xdrs, &objp->ypbind_binding_addr))
    209   1.9  christos 		return FALSE;
    210  1.12   thorpej 
    211  1.13  christos 	if (!xdr_opaque(xdrs, (void *)&objp->ypbind_binding_port,
    212  1.13  christos 	    sizeof objp->ypbind_binding_port))
    213  1.13  christos 		return FALSE;
    214  1.13  christos 
    215  1.13  christos 	return TRUE;
    216   1.1   deraadt }
    217   1.1   deraadt 
    218  1.12   thorpej static bool_t
    219   1.1   deraadt xdr_ypbind_resptype(xdrs, objp)
    220  1.12   thorpej 	XDR *xdrs;
    221  1.12   thorpej 	enum ypbind_resptype *objp;
    222   1.1   deraadt {
    223   1.7       jtc 	return xdr_enum(xdrs, (enum_t *)objp);
    224   1.1   deraadt }
    225   1.1   deraadt 
    226  1.12   thorpej static bool_t
    227   1.1   deraadt xdr_ypstat(xdrs, objp)
    228  1.12   thorpej 	XDR *xdrs;
    229  1.12   thorpej 	enum ypbind_resptype *objp;
    230   1.1   deraadt {
    231   1.7       jtc 	return xdr_enum(xdrs, (enum_t *)objp);
    232   1.1   deraadt }
    233   1.1   deraadt 
    234   1.1   deraadt bool_t
    235   1.1   deraadt xdr_ypbind_resp(xdrs, objp)
    236  1.12   thorpej 	XDR *xdrs;
    237  1.12   thorpej 	struct ypbind_resp *objp;
    238   1.1   deraadt {
    239  1.12   thorpej 	if (!xdr_ypbind_resptype(xdrs, &objp->ypbind_status))
    240   1.9  christos 		return FALSE;
    241   1.9  christos 
    242   1.1   deraadt 	switch (objp->ypbind_status) {
    243   1.1   deraadt 	case YPBIND_FAIL_VAL:
    244   1.9  christos 		return xdr_u_int(xdrs,
    245  1.12   thorpej 		    (u_int *)&objp->ypbind_respbody.ypbind_error);
    246  1.12   thorpej 
    247   1.1   deraadt 	case YPBIND_SUCC_VAL:
    248  1.12   thorpej 		return xdr_ypbind_binding(xdrs,
    249  1.12   thorpej 		    &objp->ypbind_respbody.ypbind_bindinfo);
    250  1.12   thorpej 
    251   1.1   deraadt 	default:
    252   1.9  christos 		return FALSE;
    253   1.1   deraadt 	}
    254   1.7       jtc 	/* NOTREACHED */
    255   1.1   deraadt }
    256   1.1   deraadt 
    257   1.1   deraadt bool_t
    258   1.1   deraadt xdr_ypresp_val(xdrs, objp)
    259  1.12   thorpej 	XDR *xdrs;
    260  1.12   thorpej 	struct ypresp_val *objp;
    261   1.1   deraadt {
    262  1.12   thorpej 	if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)&objp->status))
    263   1.9  christos 		return FALSE;
    264  1.12   thorpej 
    265  1.13  christos 	if (!xdr_datum(xdrs, &objp->valdat))
    266  1.13  christos 		return FALSE;
    267  1.13  christos 
    268  1.13  christos 	return TRUE;
    269   1.1   deraadt }
    270   1.1   deraadt 
    271   1.1   deraadt bool_t
    272   1.1   deraadt xdr_ypbind_setdom(xdrs, objp)
    273  1.12   thorpej 	XDR *xdrs;
    274  1.12   thorpej 	struct ypbind_setdom *objp;
    275   1.1   deraadt {
    276  1.12   thorpej 	char *cp = objp->ypsetdom_domain;
    277  1.12   thorpej 
    278  1.13  christos 	if (!xdr_ypdomain_wrap_string(xdrs, &cp))
    279   1.9  christos 		return FALSE;
    280  1.12   thorpej 
    281  1.12   thorpej 	if (!xdr_ypbind_binding(xdrs, &objp->ypsetdom_binding))
    282   1.9  christos 		return FALSE;
    283  1.12   thorpej 
    284  1.14   thorpej 	if (!xdr_u_int(xdrs, &objp->ypsetdom_vers))
    285  1.13  christos 		return FALSE;
    286  1.13  christos 
    287  1.13  christos 	return TRUE;
    288   1.1   deraadt }
    289   1.1   deraadt 
    290   1.1   deraadt bool_t
    291   1.1   deraadt xdr_ypresp_key_val(xdrs, objp)
    292  1.12   thorpej 	XDR *xdrs;
    293  1.12   thorpej 	struct ypresp_key_val *objp;
    294   1.1   deraadt {
    295  1.12   thorpej 	if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)&objp->status))
    296   1.9  christos 		return FALSE;
    297  1.12   thorpej 
    298  1.12   thorpej 	if (!xdr_datum(xdrs, &objp->valdat))
    299   1.9  christos 		return FALSE;
    300  1.12   thorpej 
    301  1.13  christos 	if (!xdr_datum(xdrs, &objp->keydat))
    302  1.13  christos 		return FALSE;
    303  1.13  christos 
    304  1.13  christos 	return TRUE;
    305   1.1   deraadt }
    306   1.1   deraadt 
    307   1.1   deraadt bool_t
    308  1.12   thorpej xdr_ypall(xdrs, incallback)
    309  1.12   thorpej 	XDR *xdrs;
    310  1.12   thorpej 	struct ypall_callback *incallback;
    311  1.12   thorpej {
    312  1.12   thorpej 	struct ypresp_key_val out;
    313  1.12   thorpej 	char key[YPMAXRECORD], val[YPMAXRECORD];
    314  1.12   thorpej 	bool_t more, status;
    315   1.1   deraadt 
    316  1.12   thorpej 	/*
    317  1.12   thorpej 	 * Set up key/val struct to be used during the transaction.
    318  1.12   thorpej 	 */
    319   1.7       jtc 	memset(&out, 0, sizeof out);
    320  1.12   thorpej 	out.keydat.dptr = key;
    321  1.12   thorpej 	out.keydat.dsize = sizeof(key);
    322  1.12   thorpej 	out.valdat.dptr = val;
    323  1.12   thorpej 	out.valdat.dsize = sizeof(val);
    324  1.12   thorpej 
    325  1.12   thorpej 	for (;;) {
    326  1.12   thorpej 		/* Values pending? */
    327  1.12   thorpej 		if (!xdr_bool(xdrs, &more))
    328  1.12   thorpej 			return FALSE;		/* can't tell! */
    329  1.13  christos 		if (!more)
    330  1.12   thorpej 			return TRUE;		/* no more */
    331  1.12   thorpej 
    332  1.12   thorpej 		/* Transfer key/value pair. */
    333  1.12   thorpej 		status = xdr_ypresp_key_val(xdrs, &out);
    334  1.12   thorpej 
    335  1.12   thorpej 		/*
    336  1.12   thorpej 		 * If we succeeded, call the callback function.
    337  1.12   thorpej 		 * The callback will return TRUE when it wants
    338  1.12   thorpej 		 * no more values.  If we fail, indicate the
    339  1.12   thorpej 		 * error.
    340  1.12   thorpej 		 */
    341  1.13  christos 		if (status) {
    342  1.21  christos 			/* LINTED const dropouts */
    343  1.21  christos 			if ((*incallback->foreach)((int)out.status,
    344  1.12   thorpej 			    (char *)out.keydat.dptr, out.keydat.dsize,
    345  1.12   thorpej 			    (char *)out.valdat.dptr, out.valdat.dsize,
    346  1.12   thorpej 			    incallback->data))
    347  1.12   thorpej 				return TRUE;
    348  1.12   thorpej 		} else
    349   1.1   deraadt 			return FALSE;
    350   1.1   deraadt 	}
    351   1.1   deraadt }
    352   1.1   deraadt 
    353   1.1   deraadt bool_t
    354   1.1   deraadt xdr_ypresp_master(xdrs, objp)
    355  1.12   thorpej 	XDR *xdrs;
    356  1.12   thorpej 	struct ypresp_master *objp;
    357   1.1   deraadt {
    358  1.12   thorpej 	if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)&objp->status))
    359   1.9  christos 		return FALSE;
    360  1.12   thorpej 
    361  1.13  christos 	if (!xdr_string(xdrs, &objp->master, YPMAXPEER))
    362  1.13  christos 		return FALSE;
    363  1.13  christos 
    364  1.13  christos 	return TRUE;
    365   1.1   deraadt }
    366   1.1   deraadt 
    367  1.12   thorpej static bool_t
    368   1.1   deraadt xdr_ypmaplist_str(xdrs, objp)
    369  1.12   thorpej 	XDR *xdrs;
    370  1.12   thorpej 	char *objp;
    371   1.1   deraadt {
    372   1.7       jtc 	return xdr_string(xdrs, &objp, YPMAXMAP+1);
    373   1.1   deraadt }
    374   1.1   deraadt 
    375   1.1   deraadt bool_t
    376   1.1   deraadt xdr_ypmaplist(xdrs, objp)
    377  1.12   thorpej 	XDR *xdrs;
    378  1.12   thorpej 	struct ypmaplist *objp;
    379   1.1   deraadt {
    380  1.12   thorpej 	if (!xdr_ypmaplist_str(xdrs, objp->ypml_name))
    381   1.9  christos 		return FALSE;
    382  1.12   thorpej 
    383  1.13  christos 	if (!xdr_pointer(xdrs, (caddr_t *)&objp->ypml_next,
    384  1.22  christos 	    sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist))
    385  1.13  christos 		return FALSE;
    386  1.13  christos 
    387  1.13  christos 	return TRUE;
    388   1.1   deraadt }
    389   1.1   deraadt 
    390   1.1   deraadt bool_t
    391   1.1   deraadt xdr_ypresp_maplist(xdrs, objp)
    392  1.12   thorpej 	XDR *xdrs;
    393  1.12   thorpej 	struct ypresp_maplist *objp;
    394   1.1   deraadt {
    395  1.12   thorpej 	if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)&objp->status))
    396   1.9  christos 		return FALSE;
    397  1.12   thorpej 
    398  1.13  christos 	if (!xdr_pointer(xdrs, (caddr_t *)&objp->list,
    399  1.22  christos 	    sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist))
    400  1.13  christos 		return FALSE;
    401  1.13  christos 
    402  1.13  christos 	return TRUE;
    403   1.1   deraadt }
    404   1.1   deraadt 
    405   1.1   deraadt bool_t
    406   1.1   deraadt xdr_ypresp_order(xdrs, objp)
    407  1.12   thorpej 	XDR *xdrs;
    408  1.12   thorpej 	struct ypresp_order *objp;
    409   1.1   deraadt {
    410  1.12   thorpej 	if (!xdr_ypstat(xdrs, (enum ypbind_resptype *)&objp->status))
    411   1.9  christos 		return FALSE;
    412  1.12   thorpej 
    413  1.14   thorpej 	if (!xdr_u_int(xdrs, &objp->ordernum))
    414  1.13  christos 		return FALSE;
    415  1.13  christos 
    416  1.13  christos 	return TRUE;
    417  1.12   thorpej }
    418  1.12   thorpej 
    419  1.12   thorpej bool_t
    420  1.12   thorpej xdr_ypreq_xfr(xdrs, objp)
    421  1.12   thorpej 	XDR *xdrs;
    422  1.12   thorpej 	struct ypreq_xfr *objp;
    423  1.12   thorpej {
    424  1.13  christos 	if (!xdr_ypmap_parms(xdrs, &objp->map_parms))
    425  1.12   thorpej 		return FALSE;
    426  1.12   thorpej 
    427  1.14   thorpej 	if (!xdr_u_int(xdrs, &objp->transid))
    428  1.12   thorpej 		return FALSE;
    429  1.12   thorpej 
    430  1.14   thorpej 	if (!xdr_u_int(xdrs, &objp->proto))
    431  1.12   thorpej 		return FALSE;
    432  1.12   thorpej 
    433  1.14   thorpej 	if (!xdr_u_int(xdrs, &objp->port))
    434  1.12   thorpej 		return FALSE;
    435  1.12   thorpej 
    436  1.12   thorpej 	return TRUE;
    437  1.12   thorpej }
    438  1.12   thorpej 
    439  1.12   thorpej bool_t
    440  1.12   thorpej xdr_ypmap_parms(xdrs, objp)
    441  1.12   thorpej 	XDR *xdrs;
    442  1.12   thorpej 	struct ypmap_parms *objp;
    443  1.12   thorpej {
    444  1.15     chuck 	if (!xdr_ypdomain_wrap_string(xdrs, (char **)&objp->domain))
    445  1.12   thorpej 		return FALSE;
    446  1.12   thorpej 
    447  1.15     chuck 	if (!xdr_ypmap_wrap_string(xdrs, (char **)&objp->map))
    448  1.12   thorpej 		return FALSE;
    449  1.12   thorpej 
    450  1.14   thorpej 	if (!xdr_u_int(xdrs, &objp->ordernum))
    451  1.12   thorpej 		return FALSE;
    452  1.12   thorpej 
    453  1.13  christos 	if (!xdr_ypowner_wrap_string(xdrs, &objp->owner))
    454  1.12   thorpej 		return FALSE;
    455  1.12   thorpej 
    456  1.12   thorpej 	return TRUE;
    457  1.12   thorpej }
    458  1.12   thorpej 
    459  1.12   thorpej bool_t
    460  1.12   thorpej xdr_yppushresp_xfr(xdrs, objp)
    461  1.12   thorpej 	XDR *xdrs;
    462  1.12   thorpej 	struct yppushresp_xfr *objp;
    463  1.12   thorpej {
    464  1.14   thorpej 	if (!xdr_u_int(xdrs, &objp->transid))
    465  1.12   thorpej 		return FALSE;
    466  1.12   thorpej 
    467  1.14   thorpej 	if (!xdr_enum(xdrs, (enum_t *)&objp->status))
    468  1.12   thorpej 		return FALSE;
    469  1.12   thorpej 
    470  1.12   thorpej 	return TRUE;
    471   1.1   deraadt }
    472