summaryrefslogtreecommitdiffstats
path: root/gnu/usr.sbin
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1995-01-31 08:58:57 +0000
committerwpaul <wpaul@FreeBSD.org>1995-01-31 08:58:57 +0000
commitc46e35fcb4e90029a89425459e0c331cfcd0050b (patch)
treee63a1249a704b0b1feb88c7f46bef672120b67cb /gnu/usr.sbin
parent17c13efe1c78b3e29e968760f0063f62e2d581e1 (diff)
downloadFreeBSD-src-c46e35fcb4e90029a89425459e0c331cfcd0050b.zip
FreeBSD-src-c46e35fcb4e90029a89425459e0c331cfcd0050b.tar.gz
Obtained from: The NYS project
This is a hacked-up port of the ypserv-0.11 server from the NYS project written by Peter Eriksson. The original package included some map creating and dumping tools and was based on GDBM. This version has been modified in the following ways: - GDBM replaced with DB and many weird hacks made to the read_database() function because of this. - implimented the ypxfr service (using ypxfr from the yps-0.21 package, aso from the NYS project) - added code to check the TCP port from which NIS requests originate: the server will refuse to serve the master.passwd.{byname|byuid} maps if the request doesn't come from a privileged port. Normally, only the superuser can issue such a request. Requests for the passwd.{bynam|byuid} maps aren't affected. There will be a small change made to getpwent.c in libc to complement this. - added code to do DNS lookups via actual resolver queries instead of relying on gethostbyname() and friends. The author noted in the original documentation that a loop condition could arise where the server would query itself for hostsname lookups. Using direct DNS lookups prevents this from happening. - added code to properly fork() the server into the background unless invoked with the -debug flag. - Added combined syslog/perror function. - fixed a few bugs (which were probably introduced by all the other changes) - Created a bmake Makefile. Note that this package can be linked against the tcp_wrapper package to provide address-based authentication, but this isn't done by default since the tcp_wrapper package isn't part of FreeBSD.
Diffstat (limited to 'gnu/usr.sbin')
-rw-r--r--gnu/usr.sbin/ypserv/Makefile14
-rw-r--r--gnu/usr.sbin/ypserv/dnslookup.c111
-rw-r--r--gnu/usr.sbin/ypserv/server.c1327
-rw-r--r--gnu/usr.sbin/ypserv/system.h67
-rw-r--r--gnu/usr.sbin/ypserv/yp.h611
-rw-r--r--gnu/usr.sbin/ypserv/yp_svc.c393
-rw-r--r--gnu/usr.sbin/ypserv/yp_xdr.c415
7 files changed, 2938 insertions, 0 deletions
diff --git a/gnu/usr.sbin/ypserv/Makefile b/gnu/usr.sbin/ypserv/Makefile
new file mode 100644
index 0000000..8310fee
--- /dev/null
+++ b/gnu/usr.sbin/ypserv/Makefile
@@ -0,0 +1,14 @@
+# From: @(#)Makefile 8.3 (Berkeley) 4/2/94
+
+PROG= ypserv
+SRCS= dnslookup.c yp_svc.c yp_xdr.c server.c
+
+CFLAGS+=-Wall -DTCP_WRAPPER=0 -DTCPW_FACILITY=LOG_AUTH
+CFLAGS+=-DINSTDIR='"/usr/libexec"'
+
+BINOWN= bin
+BINMODE=555
+
+MAN8=
+
+.include <bsd.prog.mk>
diff --git a/gnu/usr.sbin/ypserv/dnslookup.c b/gnu/usr.sbin/ypserv/dnslookup.c
new file mode 100644
index 0000000..395e08c
--- /dev/null
+++ b/gnu/usr.sbin/ypserv/dnslookup.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 1995 Bill Paul (wpaul@ctr.columbia.edu)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Bill Paul.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+/*
+** Do standard and reverse DNS lookups using the resolver library.
+** Take care of all the dirty work here so the main program only has to
+** pass us a pointer to an array of characters.
+**
+** We have to use direct resolver calls here otherwise the YP server
+** could end up looping by calling itself over and over again until
+** it disappeared up its own belly button.
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+extern struct hostent *_gethostbydnsname();
+extern struct hostent *_gethostbydnsaddr();
+
+char *parse(hp)
+struct hostent *hp;
+{
+char *result;
+int len,i;
+struct in_addr addr;
+
+ len = 16 + strlen(hp->h_name);
+ for (i = 0; hp->h_aliases[i]; i++)
+ len += strlen(hp->h_aliases[i]) + 1;
+
+ result = (char *)malloc(len + 1);
+ bzero(result, len+1);
+
+ bcopy(hp->h_addr, &addr, sizeof(struct in_addr));
+ strcat(result, (char *)inet_ntoa(addr));
+ strcat(result, " ");
+ strcat(result, hp->h_name);
+
+ for (i = 0; hp->h_aliases[i]; i++)
+ {
+ strcat(result, " ");
+ strcat(result, hp->h_aliases[i]);
+ }
+
+ return (result);
+}
+
+char *dnsname(address)
+char *address;
+{
+struct hostent *hp;
+
+ if (strchr(address, '@'))
+ return (NULL);
+ if ((hp = (struct hostent *)_gethostbydnsname(address)) == NULL)
+ return (NULL);
+
+ return(parse(hp));
+}
+
+char *dnsaddr(address)
+char *address;
+{
+struct hostent *hp;
+struct in_addr addr;
+
+ if (strchr(address, '@'))
+ return (NULL);
+ if (!inet_aton(address, &addr))
+ return (NULL);
+ if ((hp = (struct hostent *)_gethostbydnsaddr(&addr,
+ sizeof(unsigned long), AF_INET)) == NULL)
+ return (NULL);
+
+ return(parse(hp));
+}
diff --git a/gnu/usr.sbin/ypserv/server.c b/gnu/usr.sbin/ypserv/server.c
new file mode 100644
index 0000000..1ed70bc
--- /dev/null
+++ b/gnu/usr.sbin/ypserv/server.c
@@ -0,0 +1,1327 @@
+/*
+** server.c YP server routines.
+**
+** Copyright (c) 1993 Signum Support AB, Sweden
+**
+** This file is part of the NYS YP Server.
+**
+** The NYS YP Server is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of the
+** License, or (at your option) any later version.
+**
+** The NYS YP Server is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+**
+** You should have received a copy of the GNU General Public
+** License along with the NYS YP Server; see the file COPYING. If
+** not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+** Cambridge, MA 02139, USA.
+**
+** Author: Peter Eriksson <pen@signum.se>
+** Ported to FreeBSD and hacked all to pieces
+** by Bill Paul <wpaul@ctr.columbia.edu>
+**
+** $Id$
+**
+*/
+
+#include "system.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <string.h>
+#include <limits.h>
+#include <db.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <rpc/rpc.h>
+#include "yp.h"
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <syslog.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#if __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#define PERM_SECURE (S_IRUSR|S_IWUSR)
+HASHINFO openinfo = {
+ 4096, /* bsize */
+ 32, /* ffactor */
+ 256, /* nelem */
+ 2048 * 1024, /* cachesize */
+ NULL, /* hash */
+ 0, /* lorder */
+};
+
+#if TCP_WRAPPER
+#include "log_tcp.h"
+int allow_severity=LOG_INFO;
+int deny_severity=LOG_WARNING;
+#endif
+
+void verr __P((const char *, _BSD_VA_LIST_));
+void Perror __P((const char *, ...));
+
+extern char *dnsname();
+extern char *dnsaddr();
+extern char *_gethostbydnsaddr();
+
+extern char *progname;
+extern int errno;
+
+int debug_flag = 0;
+int dns_flag = 0;
+
+
+void verr(fmt, ap)
+ const char *fmt;
+ _BSD_VA_LIST_ ap;
+
+{
+ if (debug_flag)
+ vfprintf(stderr, fmt, ap);
+ else
+ vsyslog(LOG_AUTH, fmt, ap);
+}
+
+void
+#ifdef __STDC__
+Perror(const char *fmt, ...)
+#else
+Perror(fmt, va_list)
+ const char *fmt;
+ va_dcl
+#endif
+{
+ va_list ap;
+#ifdef __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
+ verr(fmt,ap);
+ va_end(ap);
+}
+
+
+/*
+** Return 1 if request comes from an authorized host
+**
+** XXX This function should implement the "securenets" functionality
+*/
+static int is_valid_host(struct sockaddr_in *sin)
+{
+#if TCP_WRAPPER
+ extern int hosts_ctl(char *, char *, char *, char *);
+ int status;
+ static long oldaddr=0; /* so we dont log multiple times */
+ static int oldstatus=-1;
+ char *h=NULL;
+
+#ifdef TRYRESOLVE
+ struct hostent *hp;
+
+ hp = _gethostbydnsaddr((char *) &sin->sin_addr.s_addr,
+ sizeof (sin->sin_addr.s_addr), AF_INET);
+
+ h = (hp && hp->h_name) ? hp->h_name : NULL;
+#endif
+
+ status = hosts_ctl(progname,
+ h?h:FROM_UNKNOWN,
+ inet_ntoa(sin->sin_addr),
+ "");
+
+ if (sin->sin_addr.s_addr != oldaddr || status != oldstatus ) {
+ syslog(status?allow_severity:deny_severity,
+ "%sconnect from %s\n",status?"":"refused ",
+ h?h:inet_ntoa(sin->sin_addr));
+ oldaddr=sin->sin_addr.s_addr;
+ oldstatus=status;
+ }
+ return status;
+#else
+ return 1;
+#endif
+}
+
+
+void *ypproc_null_2_svc(void *dummy,
+ struct svc_req *rqstp)
+{
+ static int foo;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+ if (!is_valid_host(rqhost))
+ return NULL;
+
+ if (debug_flag)
+ Perror("ypproc_null() [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ return (void *) &foo;
+}
+
+
+/*
+** Return 1 if the name is a valid domain name served by us, else 0.
+*/
+static int is_valid_domain(const char *domain)
+{
+ struct stat sbuf;
+
+
+ if (domain == NULL ||
+ strcmp(domain, "binding") == 0 ||
+ strcmp(domain, "..") == 0 ||
+ strcmp(domain, ".") == 0 ||
+ strchr(domain, '/'))
+ return 0;
+
+ if (stat(domain, &sbuf) < 0 || !S_ISDIR(sbuf.st_mode))
+ return 0;
+
+ return 1;
+}
+
+
+
+bool_t *ypproc_domain_2_svc(domainname *name,
+ struct svc_req *rqstp)
+{
+ static bool_t result;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ Perror("ypproc_domain(\"%s\") [From: %s:%d]\n",
+ *name,
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ if (is_valid_domain(*name))
+ result = TRUE;
+ else
+ result = FALSE;
+
+ if (debug_flag)
+ Perror("\t-> %s.\n",
+ (result == TRUE ? "Ok" : "Not served by us"));
+
+ return &result;
+}
+
+
+bool_t *ypproc_domain_nonack_2_svc(domainname *name,
+ struct svc_req *rqstp)
+{
+ static bool_t result;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ Perror("ypproc_domain_nonack(\"%s\") [From: %s:%d]\n",
+ *name,
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ if (!is_valid_domain(*name))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid domain)\n");
+
+ /* Bail out and don't return any RPC value */
+ return NULL;
+ }
+
+ if (debug_flag)
+ Perror("\t-> OK.\n");
+
+ result = TRUE;
+ return &result;
+}
+
+
+/*
+** Open a DB database
+*/
+static DB *open_database(const char *domain,
+ const char *map)
+{
+ DB *dbp;
+ char buf[1025];
+
+
+ if (map[0] == '.' || strchr(map, '/'))
+ return 0;
+
+ strcpy(buf, domain);
+ strcat(buf, "/");
+ strcat(buf, map);
+
+ dbp = dbopen(buf,O_RDONLY|O_EXCL, PERM_SECURE, DB_HASH, &openinfo);
+
+ if (debug_flag > 1 && dbp == NULL)
+ Perror("dbopen(): ",strerror(errno));
+
+ return dbp;
+}
+
+
+#define F_ALL 0x01
+#define F_NEXT 0x02
+
+/*
+** Get a record from a DB database.
+** This looks ugly because it emulates the behavior of the original
+** GDBM-based routines. Blech.
+*/
+int read_database(DB *dbp,
+ const DBT *ikey,
+ DBT *okey,
+ DBT *dval,
+ int flags)
+{
+ int first_flag = 0;
+ DBT nkey, ckey, dummyval;
+
+
+ if (ikey == NULL || ikey->data == NULL)
+ {
+ (dbp->seq)(dbp,&ckey,&dummyval,R_FIRST);
+ first_flag = 1;
+ }
+ else
+ {
+ if ((flags & F_NEXT))
+ {
+ /*
+ ** This crap would be unnecessary if R_CURSOR actually worked.
+ */
+ (dbp->seq)(dbp,&ckey,&dummyval,R_FIRST);
+ while(strncmp((char *)ikey->data,ckey.data,(int)ikey->size) ||
+ ikey->size != ckey.size)
+ (dbp->seq)(dbp,&ckey,&dummyval,R_NEXT);
+ if ((dbp->seq)(dbp,&ckey,&dummyval,R_NEXT))
+ ckey.data = NULL;
+ free(dummyval.data);
+ }
+ else
+ ckey = *ikey;
+ }
+
+ if (ckey.data == NULL)
+ {
+ return (flags & F_NEXT) ? YP_NOMORE : YP_NOKEY;
+ }
+
+ while (1)
+ {
+ if ((dbp->get)(dbp,&ckey,dval,0))
+ {
+ /* Free key, unless it comes from the caller! */
+ if (ikey == NULL || ckey.data != ikey->data)
+ free(ckey.data);
+
+ if (ikey && ikey->data != NULL)
+ {
+ return YP_NOKEY;
+ }
+ else
+ if (first_flag)
+ return YP_BADDB;
+ else
+ return YP_FALSE;
+ }
+
+ if ((flags & F_ALL) || strncmp(ckey.data, "YP_", 3) != 0)
+ {
+ if (okey)
+ *okey = ckey;
+ else if (ikey == NULL || ikey->data != ckey.data)
+ free(ckey.data);
+
+ return YP_TRUE;
+ }
+
+ /* Free old value */
+ free(dval->data);
+
+ if ((dbp->seq)(dbp,&nkey,&dummyval,R_NEXT))
+ nkey.data = NULL;
+ free(dummyval.data);
+
+ /* Free old key, unless it comes from the caller! */
+ if (ikey == NULL || ckey.data != ikey->data)
+ free(ckey.data);
+
+ if (ckey.data == NULL || nkey.data == NULL)
+ return YP_NOMORE;
+
+ ckey = nkey;
+ }
+}
+
+
+/*
+** Get the DateTimeModified value for a certain map database
+*/
+static unsigned long get_dtm(const char *domain,
+ const char *map)
+{
+ struct stat sbuf;
+ char buf[1025];
+
+
+ strcpy(buf, domain);
+ strcat(buf, "/");
+ strcat(buf, map);
+
+ if (stat(buf, &sbuf) < 0)
+ return 0;
+ else
+ return (unsigned long) sbuf.st_mtime;
+}
+
+
+/*
+** YP function "MATCH" implementation
+*/
+ypresp_val *ypproc_match_2_svc(ypreq_key *key,
+ struct svc_req *rqstp)
+{
+ static ypresp_val result;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ {
+ Perror("ypproc_match(): [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ Perror("\t\tdomainname = \"%s\"\n",
+ key->domain);
+ Perror("\t\tmapname = \"%s\"\n",
+ key->map);
+ Perror("\t\tkeydat = \"%.*s\"\n",
+ (int) key->key.keydat_len,
+ key->key.keydat_val);
+ }
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ /*
+ ** If this request deals with master.passwd.* and it didn't
+ ** originate on a privileged port (< 1024), return a YP_YPERR.
+ ** This is our half-assed way of preventing non-root users
+ ** on NIS clients from getting at the real password map. Bah.
+ */
+
+ if (strstr(key->map, "master.passwd") != NULL &&
+ ntohs(rqhost->sin_port) > 1023)
+ {
+ result.stat = YP_YPERR;
+ return &result;
+ }
+
+ result.val.valdat_len = 0;
+ if (result.val.valdat_val)
+ {
+ free(result.val.valdat_val);
+ result.val.valdat_val = NULL;
+ }
+
+ if (key->domain[0] == '\0' || key->map[0] == '\0')
+ result.stat = YP_BADARGS;
+ else if (!is_valid_domain(key->domain))
+ result.stat = YP_NODOM;
+ else
+ {
+ DBT rdat, qdat;
+
+ DB *dbp = open_database(key->domain, key->map);
+ if (dbp == NULL)
+ result.stat = YP_NOMAP;
+ else
+ {
+ qdat.size = key->key.keydat_len;
+ qdat.data = key->key.keydat_val;
+
+ result.stat = read_database(dbp, &qdat, NULL, &rdat, F_ALL);
+
+ if (result.stat == YP_TRUE)
+ {
+ result.val.valdat_len = rdat.size;
+ result.val.valdat_val = rdat.data;
+ }
+
+ (void)(dbp->close)(dbp);
+ }
+ }
+
+ if (debug_flag)
+ {
+ if (result.stat == YP_TRUE)
+ Perror("\t-> Value = \"%.*s\"\n",
+ (int) result.val.valdat_len,
+ result.val.valdat_val);
+ else
+ Perror("\t-> Error #%d\n", result.stat);
+ }
+
+
+ /*
+ ** Do the jive thing if we didn't find the host in the YP map
+ ** and we have enabled the magic DNS lookup stuff.
+ **
+ ** XXX Perhaps this should be done in a sub-process for performance
+ ** reasons. Later.
+ */
+ if (result.stat != YP_TRUE && dns_flag)
+ {
+ char *cp = NULL;
+
+ key->key.keydat_val[key->key.keydat_len] = '\0';
+
+ if (debug_flag)
+ Perror("Doing DNS lookup of %s\n", key->key.keydat_val);
+
+ if (strcmp(key->map, "hosts.byname") == 0)
+ cp = dnsname(key->key.keydat_val);
+ else if (strcmp(key->map, "hosts.byaddr") == 0)
+ cp = dnsaddr(key->key.keydat_val);
+
+ if (cp)
+ {
+
+ if (debug_flag)
+ Perror("\t-> OK (%s)\n", cp);
+
+ result.val.valdat_len = strlen(cp);
+ result.val.valdat_val = cp;
+ result.stat = YP_TRUE;
+ }
+ else
+ {
+ if (debug_flag)
+ {
+ Perror("\t-> Not Found\n");
+ Perror("DNS lookup: %s",strerror(errno));
+ }
+
+ result.stat = YP_NOKEY;
+ }
+ }
+
+ return &result;
+}
+
+
+
+ypresp_key_val *ypproc_first_2_svc(ypreq_nokey *key,
+ struct svc_req *rqstp)
+{
+ static ypresp_key_val result;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ {
+ Perror("ypproc_first(): [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ Perror("\tdomainname = \"%s\"\n", key->domain);
+ Perror("\tmapname = \"%s\"\n", key->map);
+#if 0
+ Perror("\tkeydat = \"%.*s\"\n",
+ (int) key->key.keydat_len,
+ key->key.keydat_val);
+#endif
+ }
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ /*
+ ** If this request deals with master.passwd.* and it didn't
+ ** originate on a privileged port (< 1024), return a YP_YPERR.
+ ** This is our half-assed way of preventing non-root users
+ ** on NIS clients from getting at the real password map. Bah.
+ */
+
+ if (strstr(key->map, "master.passwd") != NULL &&
+ ntohs(rqhost->sin_port) > 1023)
+ {
+ result.stat = YP_YPERR;
+ return &result;
+ }
+
+ result.key.keydat_len = 0;
+ if (result.key.keydat_val)
+ {
+ free(result.key.keydat_val);
+ result.key.keydat_val = NULL;
+ }
+
+ result.val.valdat_len = 0;
+ if (result.val.valdat_val)
+ {
+ free(result.val.valdat_val);
+ result.val.valdat_val = NULL;
+ }
+
+ if (key->map[0] == '\0' || key->domain[0] == '\0')
+ result.stat = YP_BADARGS;
+ else if (!is_valid_domain(key->domain))
+ result.stat = YP_NODOM;
+ else
+ {
+ DBT dkey, dval;
+
+ DB *dbp = open_database(key->domain, key->map);
+ if (dbp == NULL)
+ result.stat = YP_NOMAP;
+ else
+ {
+ result.stat = read_database(dbp, NULL, &dkey, &dval, 0);
+
+ if (result.stat == YP_TRUE)
+ {
+ result.key.keydat_len = dkey.size;
+ result.key.keydat_val = dkey.data;
+
+ result.val.valdat_len = dval.size;
+ result.val.valdat_val = dval.data;
+ }
+
+ (void)(dbp->close)(dbp);
+ }
+ }
+
+ if (debug_flag)
+ {
+ if (result.stat == YP_TRUE)
+ Perror("\t-> Key = \"%.*s\", Value = \"%.*s\"\n",
+ (int) result.key.keydat_len,
+ result.key.keydat_val,
+ (int) result.val.valdat_len,
+ result.val.valdat_val);
+
+ else
+ Perror("\t-> Error #%d\n", result.stat);
+ }
+
+ return &result;
+}
+
+
+ypresp_key_val *ypproc_next_2_svc(ypreq_key *key,
+ struct svc_req *rqstp)
+{
+ static ypresp_key_val result;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ {
+ Perror("ypproc_next(): [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ Perror("\tdomainname = \"%s\"\n", key->domain);
+ Perror("\tmapname = \"%s\"\n", key->map);
+ Perror("\tkeydat = \"%.*s\"\n",
+ (int) key->key.keydat_len,
+ key->key.keydat_val);
+ }
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ /*
+ ** If this request deals with master.passwd.* and it didn't
+ ** originate on a privileged port (< 1024), return a YP_YPERR.
+ ** This is our half-assed way of preventing non-root users
+ ** on NIS clients from getting at the real password map. Bah.
+ */
+
+ if (strstr(key->map, "master.passwd") != NULL &&
+ ntohs(rqhost->sin_port) > 1023)
+ {
+ result.stat = YP_YPERR;
+ return &result;
+ }
+
+ result.key.keydat_len = 0;
+ if (result.key.keydat_val)
+ {
+ free(result.key.keydat_val);
+ result.key.keydat_val = NULL;
+ }
+
+ result.val.valdat_len = 0;
+ if (result.val.valdat_val)
+ {
+ free(result.val.valdat_val);
+ result.val.valdat_val = NULL;
+ }
+
+ if (key->map[0] == '\0' || key->domain[0] == '\0')
+ result.stat = YP_BADARGS;
+ else if (!is_valid_domain(key->domain))
+ result.stat = YP_NODOM;
+ else
+ {
+ DBT dkey, dval, okey;
+
+
+ DB *dbp = open_database(key->domain, key->map);
+ if (dbp == NULL)
+ result.stat = YP_NOMAP;
+ else
+ {
+ dkey.size = key->key.keydat_len;
+ dkey.data = key->key.keydat_val;
+
+ result.stat = read_database(dbp, &dkey, &okey, &dval, F_NEXT);
+
+ if (result.stat == YP_TRUE)
+ {
+ result.key.keydat_len = okey.size;
+ result.key.keydat_val = okey.data;
+
+ result.val.valdat_len = dval.size;
+ result.val.valdat_val = dval.data;
+ }
+ (void)(dbp->close)(dbp);
+ }
+ }
+
+ if (debug_flag)
+ {
+ if (result.stat == YP_TRUE)
+ Perror("\t-> Key = \"%.*s\", Value = \"%.*s\"\n",
+ (int) result.key.keydat_len,
+ result.key.keydat_val,
+ (int) result.val.valdat_len,
+ result.val.valdat_val);
+ else
+ Perror("\t-> Error #%d\n", result.stat);
+ }
+
+ return &result;
+}
+
+
+
+static void print_ypmap_parms(const struct ypmap_parms *pp)
+{
+ Perror("\t\tdomain = \"%s\"\n", pp->domain);
+ Perror("\t\tmap = \"%s\"\n", pp->map);
+ Perror("\t\tordernum = %u\n", pp->ordernum);
+ Perror("\t\tpeer = \"%s\"\n", pp->peer);
+}
+
+
+/*
+** Stole the ypxfr implementation from the yps package.
+*/
+ypresp_xfr *ypproc_xfr_2_svc(ypreq_xfr *xfr,
+ struct svc_req *rqstp)
+{
+ static ypresp_xfr result;
+ struct sockaddr_in *rqhost;
+ char ypxfr_command[MAXPATHLEN];
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ {
+ Perror("ypproc_xfr_2_svc(): [From: %s:%d]\n\tmap_parms:\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ print_ypmap_parms(&xfr->map_parms);
+ Perror("\t\ttransid = %u\n", xfr->transid);
+ Perror("\t\tprog = %u\n", xfr->prog);
+ Perror("\t\tport = %u\n", xfr->port);
+ }
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ /*
+ ** If this request originates on a non-privileged port (< 1024),
+ ** refuse it. We really only need to guard the master.passwd.*
+ ** maps, but what the hell.
+ ** This is our half-assed way of preventing non-root users
+ ** on NIS clients from getting at the real password map. Bah.
+ */
+
+ if (ntohs(rqhost->sin_port) > 1023)
+ {
+ result.xfrstat = YPXFR_REFUSED;
+ return &result;
+ }
+
+ switch(fork())
+ {
+ case 0:
+ {
+ char g[11], t[11], p[11];
+
+ sprintf (ypxfr_command, "%s/ypxfr", INSTDIR);
+ sprintf (t, "%u", xfr->transid);
+ sprintf (g, "%u", xfr->prog);
+ sprintf (p, "%u", xfr->port);
+ execl(ypxfr_command, "ypxfr", "-d", xfr->map_parms.domain, "-h",
+ xfr->map_parms.peer, "-f", "-C", t, g,
+ inet_ntoa(rqhost->sin_addr), p, xfr->map_parms.map, NULL);
+ Perror("ypxfr execl(): %s",strerror(errno));
+ exit(0);
+ }
+ case -1:
+ Perror("fork(): %s",strerror(errno));
+ result.xfrstat = YPXFR_XFRERR;
+ default:
+ {
+ int st;
+
+ wait4(-1, &st, WNOHANG, NULL);
+ result.xfrstat = YPXFR_SUCC;
+ break;
+ }
+ }
+
+ result.transid = xfr->transid;
+ return &result;
+}
+
+
+void *ypproc_clear_2_svc(void *dummy,
+ struct svc_req *rqstp)
+{
+ static int foo;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ Perror("ypproc_clear_2_svc() [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ return (void *) &foo;
+}
+
+
+static int ypall_close(void *data)
+{
+ DB *locptr;
+
+ if (debug_flag && data == NULL)
+ {
+ Perror("ypall_close() called with NULL pointer.\n");
+ return 0;
+ }
+
+ locptr = (DB *)data;
+ (void)(locptr->close)(locptr);
+ return 0;
+}
+
+
+static int ypall_encode(ypresp_key_val *val,
+ void *data)
+{
+ DBT dkey, dval, okey;
+
+ dkey.data = val->key.keydat_val;
+ dkey.size = val->key.keydat_len;
+
+ val->stat = read_database((DB *) data, &dkey, &okey, &dval, F_NEXT);
+
+ if (val->stat == YP_TRUE)
+ {
+ val->key.keydat_val = okey.data;
+ val->key.keydat_len = okey.size;
+
+ val->val.valdat_val = dval.data;
+ val->val.valdat_len = dval.size;
+ }
+
+
+ return val->stat;
+}
+
+
+ypresp_all *ypproc_all_2_svc(ypreq_nokey *nokey,
+ struct svc_req *rqstp)
+{
+ static ypresp_all result;
+ extern __xdr_ypall_cb_t __xdr_ypall_cb;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ {
+ Perror("ypproc_all_2_svc(): [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ Perror("\t\tdomain = \"%s\"\n", nokey->domain);
+ Perror("\t\tmap = \"%s\"\n", nokey->map);
+ }
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ __xdr_ypall_cb.u.encode = NULL;
+ __xdr_ypall_cb.u.close = NULL;
+ __xdr_ypall_cb.data = NULL;
+
+ result.more = TRUE;
+
+ /*
+ ** If this request deals with master.passwd.* and it didn't
+ ** originate on a privileged port (< 1024), return a YP_YPERR.
+ ** This is our half-assed way of preventing non-root users
+ ** on NIS clients from getting at the real password map. Bah.
+ */
+
+ if (strstr(nokey->map, "master.passwd") != NULL &&
+ ntohs(rqhost->sin_port) > 1023)
+ {
+ result.ypresp_all_u.val.stat = YP_YPERR;
+ return &result;
+ }
+
+ if (nokey->map[0] == '\0' || nokey->domain[0] == '\0')
+ result.ypresp_all_u.val.stat = YP_BADARGS;
+ else if (!is_valid_domain(nokey->domain))
+ result.ypresp_all_u.val.stat = YP_NODOM;
+ else
+ {
+ DBT dkey, dval;
+
+ DB *dbp = open_database(nokey->domain, nokey->map);
+ if (dbp == NULL)
+ result.ypresp_all_u.val.stat = YP_NOMAP;
+ else
+ {
+ result.ypresp_all_u.val.stat = read_database(dbp,
+ NULL,
+ &dkey,
+ &dval,
+ 0);
+
+ if (result.ypresp_all_u.val.stat == YP_TRUE)
+ {
+ result.ypresp_all_u.val.key.keydat_len = dkey.size;
+ result.ypresp_all_u.val.key.keydat_val = dkey.data;
+
+ result.ypresp_all_u.val.val.valdat_len = dval.size;
+ result.ypresp_all_u.val.val.valdat_val = dval.data;
+
+ __xdr_ypall_cb.u.encode = ypall_encode;
+ __xdr_ypall_cb.u.close = ypall_close;
+ __xdr_ypall_cb.data = (void *) dbp;
+
+ return &result;
+ }
+
+ (void)(dbp->close)(dbp);
+ }
+ }
+
+ return &result;
+}
+
+
+ypresp_master *ypproc_master_2_svc(ypreq_nokey *nokey,
+ struct svc_req *rqstp)
+{
+ static ypresp_master result;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ {
+ Perror("ypproc_master_2_svc(): [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ Perror("\t\tdomain = \"%s\"\n", nokey->domain);
+ Perror("\t\tmap = \"%s\"\n", nokey->map);
+ }
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ /*
+ ** If this request deals with master.passwd.* and it didn't
+ ** originate on a privileged port (< 1024), return a YP_YPERR.
+ ** This is our half-assed way of preventing non-root users
+ ** on NIS clients from getting at the real password map. Bah.
+ */
+
+ if (strstr(nokey->map, "master.passwd") != NULL &&
+ ntohs(rqhost->sin_port) > 1023)
+ {
+ result.stat = YP_YPERR;
+ return &result;
+ }
+
+ if (result.peer)
+ {
+ free(result.peer);
+ result.peer = NULL;
+ }
+
+ if (nokey->domain[0] == '\0')
+ result.stat = YP_BADARGS;
+ else if (!is_valid_domain(nokey->domain))
+ result.stat = YP_NODOM;
+ else
+ {
+ DB *dbp = open_database(nokey->domain, nokey->map);
+ if (dbp == NULL)
+ result.stat = YP_NOMAP;
+ else
+ {
+ DBT key, val;
+
+ key.size = sizeof("YP_MASTER_NAME")-1;
+ key.data = "YP_MASTER_NAME";
+
+ if ((dbp->get)(dbp,&key,&val,0))
+ val.data = NULL;
+
+ if (val.data == NULL)
+ {
+ /* No YP_MASTER_NAME record in map? Assume we are Master */
+ static char hostbuf[1025];
+
+ gethostname((char *)&hostbuf, sizeof(hostbuf)-1);
+ Perror("Hostname: [%s]",hostbuf);
+ result.peer = strdup(hostbuf);
+ }
+ else
+ {
+ *(((char *)val.data)+val.size) = '\0';
+ result.peer = val.data;
+ }
+
+ result.stat = YP_TRUE;
+ (void)(dbp->close)(dbp);
+ }
+ }
+
+ if (result.peer == NULL)
+ result.peer = strdup("");
+
+ if (debug_flag)
+ Perror("\t-> Peer = \"%s\"\n", result.peer);
+
+ return &result;
+}
+
+
+ypresp_order *ypproc_order_2_svc(ypreq_nokey *nokey,
+ struct svc_req *rqstp)
+{
+ static ypresp_order result;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ {
+ Perror("ypproc_order_2_svc(): [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ Perror("\t\tdomain = \"%s\"\n", nokey->domain);
+ Perror("\t\tmap = \"%s\"\n", nokey->map);
+ }
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ /*
+ ** If this request deals with master.passwd.* and it didn't
+ ** originate on a privileged port (< 1024), return a YP_YPERR.
+ ** This is our half-assed way of preventing non-root users
+ ** on NIS clients from getting at the real password map. Bah.
+ */
+
+ if (strstr(nokey->map, "master.passwd") != NULL &&
+ ntohs(rqhost->sin_port) > 1023)
+ {
+ result.stat = YP_YPERR;
+ return &result;
+ }
+
+ result.ordernum = 0;
+
+ if (nokey->domain[0] == '\0')
+ result.stat = YP_BADARGS;
+ else if (!is_valid_domain(nokey->domain))
+ result.stat = YP_NODOM;
+ else
+ {
+ DB *dbp = open_database(nokey->domain, nokey->map);
+ if (dbp == NULL)
+ result.stat = YP_NOMAP;
+ else
+ {
+ DBT key, val;
+
+ key.size = sizeof("YP_LAST_MODIFIED")-1;
+ key.data = "YP_LAST_MODIFIED";
+
+ (dbp->get)(dbp,&key,&val,0);
+ if (val.data == NULL)
+ {
+ /* No YP_LAST_MODIFIED record in map? Use DTM timestamp.. */
+ result.ordernum = get_dtm(nokey->domain, nokey->map);
+ }
+ else
+ {
+ result.ordernum = atoi(val.data);
+ free(val.data);
+ }
+
+ result.stat = YP_TRUE;
+ (void)(dbp->close)(dbp);
+ }
+ }
+
+ if (debug_flag)
+ Perror("-> Order # %d\n", result.ordernum);
+
+ return &result;
+}
+
+
+static void free_maplist(ypmaplist *mlp)
+{
+ ypmaplist *next;
+
+ while (mlp != NULL)
+ {
+ next = mlp->next;
+ free(mlp->map);
+ free(mlp);
+ mlp = next;
+ }
+}
+
+static int add_maplist(ypmaplist **mlhp,
+ char *map)
+{
+ ypmaplist *mlp;
+
+ if (!strncmp(map, ".", strlen(map)) || !strncmp(map, "..", strlen(map)))
+ return 0;
+
+ mlp = malloc(sizeof(*mlp));
+ if (mlp == NULL)
+ return -1;
+
+ mlp->map = strdup(map);
+ if (mlp->map == NULL)
+ {
+ free(mlp);
+ return -1;
+ }
+
+ mlp->next = *mlhp;
+ *mlhp = mlp;
+
+ return 0;
+}
+
+
+ypresp_maplist *ypproc_maplist_2_svc(domainname *name,
+ struct svc_req *rqstp)
+{
+ static ypresp_maplist result;
+ struct sockaddr_in *rqhost;
+
+
+ rqhost = svc_getcaller(rqstp->rq_xprt);
+
+ if (debug_flag)
+ {
+ Perror("ypproc_maplist_2_svc(): [From: %s:%d]\n",
+ inet_ntoa(rqhost->sin_addr),
+ ntohs(rqhost->sin_port));
+
+ Perror("\t\tdomain = \"%s\"\n", *name);
+ }
+
+ if (!is_valid_host(rqhost))
+ {
+ if (debug_flag)
+ Perror("\t-> Ignored (not a valid source host)\n");
+
+ return NULL;
+ }
+
+ if (result.maps)
+ free_maplist(result.maps);
+
+ result.maps = NULL;
+
+ if ((*name)[0] == '\0')
+ result.stat = YP_BADARGS;
+ else if (!is_valid_domain(*name))
+ result.stat = YP_NODOM;
+ else
+ {
+ DIR *dp;
+ char dirname[MAXPATHLEN];
+
+ sprintf(dirname,"./%s",*name);
+ dp = opendir(dirname);
+ if (dp == NULL)
+ {
+ if (debug_flag)
+ {
+ Perror("%s: opendir: %s", progname,strerror(errno));
+ }
+
+ result.stat = YP_BADDB;
+ }
+ else
+ {
+ struct dirent *dep;
+
+ while ((dep = readdir(dp)) != NULL)
+ if (add_maplist(&result.maps, dep->d_name) < 0)
+ {
+ result.stat = YP_YPERR;
+ break;
+ }
+ closedir(dp);
+ result.stat = YP_TRUE;
+ }
+ }
+
+ if (debug_flag)
+ {
+ if (result.stat == YP_TRUE)
+ {
+ ypmaplist *p;
+
+ p = result.maps;
+ Perror("-> ");
+ while (p->next)
+ {
+ Perror("%s,", p->map);
+ p = p->next;
+ }
+ putc('\n', stderr);
+ }
+ else
+ Perror("\t-> Error #%d\n", result.stat);
+ }
+
+ return &result;
+}
diff --git a/gnu/usr.sbin/ypserv/system.h b/gnu/usr.sbin/ypserv/system.h
new file mode 100644
index 0000000..838430a
--- /dev/null
+++ b/gnu/usr.sbin/ypserv/system.h
@@ -0,0 +1,67 @@
+/*
+ * $Id$
+ */
+
+#if (defined(__sun__) || defined(sun)) && !defined(__svr4__)
+
+/* Stupid SunOS 4 doesn't have prototypes in the header files */
+
+/* Some includes just to make the compiler be quiet */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+extern int fprintf(FILE *fp, const char *format, ...);
+extern int _flsbuf(unsigned char c, FILE *fp);
+extern int puts(const char *str);
+extern int printf(const char *format, ...);
+
+extern int chdir(const char *path);
+extern int gethostname(char *buf, int bufsize);
+extern int atoi(const char *str);
+extern int perror(const char *str);
+
+extern int socket (int af, int type, int protocol);
+extern int bind (int s, struct sockaddr *name, int namelen);
+extern int chdir (const char *path);
+
+#endif
+
+
+#if (defined(__sun__) || defined(sun)) && defined(__svr4__)
+
+extern char *strdup(const char *str);
+
+#define NEED_GETHOSTNAME
+#define NEED_SVCSOC_H
+
+#endif
+
+
+#if defined(hpux) || defined(__hpux__)
+
+/* HP is really... Ah well. */
+
+#define _INCLUDE_HPUX_SOURCE
+#define _INCLUDE_XOPEN_SOURCE
+#define _INCLUDE_POSIX_SOURCE
+#define _INCLUDE_AES_SOURCE
+
+extern void svcerr_systemerr();
+#endif
+
+
+#if defined(linux) || defined(__linux__)
+
+/* Need this because some header files doesn't check for __linux__ */
+#if !defined(linux)
+#define linux linux
+#endif
+
+/* Needed for non-ANSI prototypes */
+#define _SVID_SOURCE
+
+/* Needed for gethostname() */
+#define _BSD_SOURCE
+
+#endif
diff --git a/gnu/usr.sbin/ypserv/yp.h b/gnu/usr.sbin/ypserv/yp.h
new file mode 100644
index 0000000..fde95cd
--- /dev/null
+++ b/gnu/usr.sbin/ypserv/yp.h
@@ -0,0 +1,611 @@
+/*
+ * And thus spoke RPCGEN:
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ *
+ * And thus replied Lpd@NannyMUD:
+ * Who cares? :-) /Peter Eriksson <pen@signum.se>
+ *
+ *
+ * Modification history:
+ * 940716 pen@signum.se Change "ypreq_key" to "ypreq_nokey" for FIRST.
+ *
+ * $Id$
+ */
+
+#ifndef _YP_H_RPCGEN
+#define _YP_H_RPCGEN
+
+#include <rpc/rpc.h>
+#ifdef NEED_SVCSOC_H
+#include <rpc/svc_soc.h>
+#endif
+
+#define YPMAXRECORD 1024
+#define YPMAXDOMAIN 64
+#define YPMAXMAP 64
+#define YPMAXPEER 64
+
+enum ypstat {
+ YP_TRUE = 1,
+ YP_NOMORE = 2,
+ YP_FALSE = 0,
+ YP_NOMAP = -1,
+ YP_NODOM = -2,
+ YP_NOKEY = -3,
+ YP_BADOP = -4,
+ YP_BADDB = -5,
+ YP_YPERR = -6,
+ YP_BADARGS = -7,
+ YP_VERS = -8
+};
+typedef enum ypstat ypstat;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypstat(XDR *, ypstat*);
+#elif __STDC__
+extern bool_t __xdr_ypstat(XDR *, ypstat*);
+#else /* Old Style C */
+bool_t __xdr_ypstat();
+#endif /* Old Style C */
+
+
+enum ypxfrstat {
+ YPXFR_SUCC = 1,
+ YPXFR_AGE = 2,
+ YPXFR_NOMAP = -1,
+ YPXFR_NODOM = -2,
+ YPXFR_RSRC = -3,
+ YPXFR_RPC = -4,
+ YPXFR_MADDR = -5,
+ YPXFR_YPERR = -6,
+ YPXFR_BADARGS = -7,
+ YPXFR_DBM = -8,
+ YPXFR_FILE = -9,
+ YPXFR_SKEW = -10,
+ YPXFR_CLEAR = -11,
+ YPXFR_FORCE = -12,
+ YPXFR_XFRERR = -13,
+ YPXFR_REFUSED = -14
+};
+typedef enum ypxfrstat ypxfrstat;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypxfrstat(XDR *, ypxfrstat*);
+#elif __STDC__
+extern bool_t __xdr_ypxfrstat(XDR *, ypxfrstat*);
+#else /* Old Style C */
+bool_t __xdr_ypxfrstat();
+#endif /* Old Style C */
+
+
+typedef char *domainname;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_domainname(XDR *, domainname*);
+#elif __STDC__
+extern bool_t __xdr_domainname(XDR *, domainname*);
+#else /* Old Style C */
+bool_t __xdr_domainname();
+#endif /* Old Style C */
+
+
+typedef char *mapname;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_mapname(XDR *, mapname*);
+#elif __STDC__
+extern bool_t __xdr_mapname(XDR *, mapname*);
+#else /* Old Style C */
+bool_t __xdr_mapname();
+#endif /* Old Style C */
+
+
+typedef char *peername;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_peername(XDR *, peername*);
+#elif __STDC__
+extern bool_t __xdr_peername(XDR *, peername*);
+#else /* Old Style C */
+bool_t __xdr_peername();
+#endif /* Old Style C */
+
+
+typedef struct {
+ u_int keydat_len;
+ char *keydat_val;
+} keydat;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_keydat(XDR *, keydat*);
+#elif __STDC__
+extern bool_t __xdr_keydat(XDR *, keydat*);
+#else /* Old Style C */
+bool_t __xdr_keydat();
+#endif /* Old Style C */
+
+
+typedef struct {
+ u_int valdat_len;
+ char *valdat_val;
+} valdat;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_valdat(XDR *, valdat*);
+#elif __STDC__
+extern bool_t __xdr_valdat(XDR *, valdat*);
+#else /* Old Style C */
+bool_t __xdr_valdat();
+#endif /* Old Style C */
+
+
+struct ypmap_parms {
+ domainname domain;
+ mapname map;
+ u_int ordernum;
+ peername peer;
+};
+typedef struct ypmap_parms ypmap_parms;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypmap_parms(XDR *, ypmap_parms*);
+#elif __STDC__
+extern bool_t __xdr_ypmap_parms(XDR *, ypmap_parms*);
+#else /* Old Style C */
+bool_t __xdr_ypmap_parms();
+#endif /* Old Style C */
+
+
+struct ypreq_key {
+ domainname domain;
+ mapname map;
+ keydat key;
+};
+typedef struct ypreq_key ypreq_key;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypreq_key(XDR *, ypreq_key*);
+#elif __STDC__
+extern bool_t __xdr_ypreq_key(XDR *, ypreq_key*);
+#else /* Old Style C */
+bool_t __xdr_ypreq_key();
+#endif /* Old Style C */
+
+
+struct ypreq_nokey {
+ domainname domain;
+ mapname map;
+};
+typedef struct ypreq_nokey ypreq_nokey;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypreq_nokey(XDR *, ypreq_nokey*);
+#elif __STDC__
+extern bool_t __xdr_ypreq_nokey(XDR *, ypreq_nokey*);
+#else /* Old Style C */
+bool_t __xdr_ypreq_nokey();
+#endif /* Old Style C */
+
+
+struct ypreq_xfr {
+ ypmap_parms map_parms;
+ u_int transid;
+ u_int prog;
+ u_int port;
+};
+typedef struct ypreq_xfr ypreq_xfr;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypreq_xfr(XDR *, ypreq_xfr*);
+#elif __STDC__
+extern bool_t __xdr_ypreq_xfr(XDR *, ypreq_xfr*);
+#else /* Old Style C */
+bool_t __xdr_ypreq_xfr();
+#endif /* Old Style C */
+
+
+struct ypresp_val {
+ ypstat stat;
+ valdat val;
+};
+typedef struct ypresp_val ypresp_val;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypresp_val(XDR *, ypresp_val*);
+#elif __STDC__
+extern bool_t __xdr_ypresp_val(XDR *, ypresp_val*);
+#else /* Old Style C */
+bool_t __xdr_ypresp_val();
+#endif /* Old Style C */
+
+
+struct ypresp_key_val {
+ ypstat stat;
+ keydat key;
+ valdat val;
+};
+typedef struct ypresp_key_val ypresp_key_val;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypresp_key_val(XDR *, ypresp_key_val*);
+#elif __STDC__
+extern bool_t __xdr_ypresp_key_val(XDR *, ypresp_key_val*);
+#else /* Old Style C */
+bool_t __xdr_ypresp_key_val();
+#endif /* Old Style C */
+
+
+struct ypresp_master {
+ ypstat stat;
+ peername peer;
+};
+typedef struct ypresp_master ypresp_master;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypresp_master(XDR *, ypresp_master*);
+#elif __STDC__
+extern bool_t __xdr_ypresp_master(XDR *, ypresp_master*);
+#else /* Old Style C */
+bool_t __xdr_ypresp_master();
+#endif /* Old Style C */
+
+
+struct ypresp_order {
+ ypstat stat;
+ u_int ordernum;
+};
+typedef struct ypresp_order ypresp_order;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypresp_order(XDR *, ypresp_order*);
+#elif __STDC__
+extern bool_t __xdr_ypresp_order(XDR *, ypresp_order*);
+#else /* Old Style C */
+bool_t __xdr_ypresp_order();
+#endif /* Old Style C */
+
+
+typedef struct
+{
+ struct
+ {
+ int (*encode)(ypresp_key_val *val, void *data);
+ int (*close)(void *data);
+ } u;
+ void *data;
+} __xdr_ypall_cb_t;
+
+
+struct ypresp_all {
+ bool_t more;
+ union {
+ ypresp_key_val val;
+ } ypresp_all_u;
+};
+typedef struct ypresp_all ypresp_all;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypresp_all(XDR *, ypresp_all*);
+#elif __STDC__
+extern bool_t __xdr_ypresp_all(XDR *, ypresp_all*);
+#else /* Old Style C */
+bool_t __xdr_ypresp_all();
+#endif /* Old Style C */
+
+
+struct ypresp_xfr {
+ u_int transid;
+ ypxfrstat xfrstat;
+};
+typedef struct ypresp_xfr ypresp_xfr;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypresp_xfr(XDR *, ypresp_xfr*);
+#elif __STDC__
+extern bool_t __xdr_ypresp_xfr(XDR *, ypresp_xfr*);
+#else /* Old Style C */
+bool_t __xdr_ypresp_xfr();
+#endif /* Old Style C */
+
+
+struct ypmaplist {
+ mapname map;
+ struct ypmaplist *next;
+};
+typedef struct ypmaplist ypmaplist;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypmaplist(XDR *, ypmaplist*);
+#elif __STDC__
+extern bool_t __xdr_ypmaplist(XDR *, ypmaplist*);
+#else /* Old Style C */
+bool_t __xdr_ypmaplist();
+#endif /* Old Style C */
+
+
+struct ypresp_maplist {
+ ypstat stat;
+ ypmaplist *maps;
+};
+typedef struct ypresp_maplist ypresp_maplist;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypresp_maplist(XDR *, ypresp_maplist*);
+#elif __STDC__
+extern bool_t __xdr_ypresp_maplist(XDR *, ypresp_maplist*);
+#else /* Old Style C */
+bool_t __xdr_ypresp_maplist();
+#endif /* Old Style C */
+
+
+enum yppush_status {
+ YPPUSH_SUCC = 1,
+ YPPUSH_AGE = 2,
+ YPPUSH_NOMAP = -1,
+ YPPUSH_NODOM = -2,
+ YPPUSH_RSRC = -3,
+ YPPUSH_RPC = -4,
+ YPPUSH_MADDR = -5,
+ YPPUSH_YPERR = -6,
+ YPPUSH_BADARGS = -7,
+ YPPUSH_DBM = -8,
+ YPPUSH_FILE = -9,
+ YPPUSH_SKEW = -10,
+ YPPUSH_CLEAR = -11,
+ YPPUSH_FORCE = -12,
+ YPPUSH_XFRERR = -13,
+ YPPUSH_REFUSED = -14
+};
+typedef enum yppush_status yppush_status;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_yppush_status(XDR *, yppush_status*);
+#elif __STDC__
+extern bool_t __xdr_yppush_status(XDR *, yppush_status*);
+#else /* Old Style C */
+bool_t __xdr_yppush_status();
+#endif /* Old Style C */
+
+
+struct yppushresp_xfr {
+ u_int transid;
+ yppush_status status;
+};
+typedef struct yppushresp_xfr yppushresp_xfr;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_yppushresp_xfr(XDR *, yppushresp_xfr*);
+#elif __STDC__
+extern bool_t __xdr_yppushresp_xfr(XDR *, yppushresp_xfr*);
+#else /* Old Style C */
+bool_t __xdr_yppushresp_xfr();
+#endif /* Old Style C */
+
+
+enum ypbind_resptype {
+ YPBIND_SUCC_VAL = 1,
+ YPBIND_FAIL_VAL = 2
+};
+typedef enum ypbind_resptype ypbind_resptype;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypbind_resptype(XDR *, ypbind_resptype*);
+#elif __STDC__
+extern bool_t __xdr_ypbind_resptype(XDR *, ypbind_resptype*);
+#else /* Old Style C */
+bool_t __xdr_ypbind_resptype();
+#endif /* Old Style C */
+
+
+struct ypbind_binding {
+ char ypbind_binding_addr[4];
+ char ypbind_binding_port[2];
+};
+typedef struct ypbind_binding ypbind_binding;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypbind_binding(XDR *, ypbind_binding*);
+#elif __STDC__
+extern bool_t __xdr_ypbind_binding(XDR *, ypbind_binding*);
+#else /* Old Style C */
+bool_t __xdr_ypbind_binding();
+#endif /* Old Style C */
+
+
+struct ypbind_resp {
+ ypbind_resptype ypbind_status;
+ union {
+ u_int ypbind_error;
+ ypbind_binding ypbind_bindinfo;
+ } ypbind_resp_u;
+};
+typedef struct ypbind_resp ypbind_resp;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypbind_resp(XDR *, ypbind_resp*);
+#elif __STDC__
+extern bool_t __xdr_ypbind_resp(XDR *, ypbind_resp*);
+#else /* Old Style C */
+bool_t __xdr_ypbind_resp();
+#endif /* Old Style C */
+
+#define YPBIND_ERR_ERR 1
+#define YPBIND_ERR_NOSERV 2
+#define YPBIND_ERR_RESC 3
+
+struct ypbind_setdom {
+ domainname ypsetdom_domain;
+ ypbind_binding ypsetdom_binding;
+ u_int ypsetdom_vers;
+};
+typedef struct ypbind_setdom ypbind_setdom;
+#ifdef __cplusplus
+extern "C" bool_t __xdr_ypbind_setdom(XDR *, ypbind_setdom*);
+#elif __STDC__
+extern bool_t __xdr_ypbind_setdom(XDR *, ypbind_setdom*);
+#else /* Old Style C */
+bool_t __xdr_ypbind_setdom();
+#endif /* Old Style C */
+
+
+#define YPPROG ((u_long)100004)
+#define YPVERS ((u_long)2)
+
+#ifdef __cplusplus
+#define YPPROC_NULL ((u_long)0)
+extern "C" void * ypproc_null_2(void *, CLIENT *);
+extern "C" void * ypproc_null_2_svc(void *, struct svc_req *);
+#define YPPROC_DOMAIN ((u_long)1)
+extern "C" bool_t * ypproc_domain_2(domainname *, CLIENT *);
+extern "C" bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *);
+#define YPPROC_DOMAIN_NONACK ((u_long)2)
+extern "C" bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *);
+extern "C" bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *);
+#define YPPROC_MATCH ((u_long)3)
+extern "C" ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *);
+extern "C" ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *);
+#define YPPROC_FIRST ((u_long)4)
+extern "C" ypresp_key_val * ypproc_first_2(ypreq_nokey *, CLIENT *);
+extern "C" ypresp_key_val * ypproc_first_2_svc(ypreq_nokey *, struct svc_req *);
+#define YPPROC_NEXT ((u_long)5)
+extern "C" ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *);
+extern "C" ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *);
+#define YPPROC_XFR ((u_long)6)
+extern "C" ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *);
+extern "C" ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *);
+#define YPPROC_CLEAR ((u_long)7)
+extern "C" void * ypproc_clear_2(void *, CLIENT *);
+extern "C" void * ypproc_clear_2_svc(void *, struct svc_req *);
+#define YPPROC_ALL ((u_long)8)
+extern "C" ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *);
+extern "C" ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *);
+#define YPPROC_MASTER ((u_long)9)
+extern "C" ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *);
+extern "C" ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *);
+#define YPPROC_ORDER ((u_long)10)
+extern "C" ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *);
+extern "C" ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *);
+#define YPPROC_MAPLIST ((u_long)11)
+extern "C" ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *);
+extern "C" ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *);
+
+#elif __STDC__
+#define YPPROC_NULL ((u_long)0)
+extern void * ypproc_null_2(void *, CLIENT *);
+extern void * ypproc_null_2_svc(void *, struct svc_req *);
+#define YPPROC_DOMAIN ((u_long)1)
+extern bool_t * ypproc_domain_2(domainname *, CLIENT *);
+extern bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *);
+#define YPPROC_DOMAIN_NONACK ((u_long)2)
+extern bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *);
+extern bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *);
+#define YPPROC_MATCH ((u_long)3)
+extern ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *);
+extern ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *);
+#define YPPROC_FIRST ((u_long)4)
+extern ypresp_key_val * ypproc_first_2(ypreq_nokey *, CLIENT *);
+extern ypresp_key_val * ypproc_first_2_svc(ypreq_nokey *, struct svc_req *);
+#define YPPROC_NEXT ((u_long)5)
+extern ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *);
+extern ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *);
+#define YPPROC_XFR ((u_long)6)
+extern ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *);
+extern ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *);
+#define YPPROC_CLEAR ((u_long)7)
+extern void * ypproc_clear_2(void *, CLIENT *);
+extern void * ypproc_clear_2_svc(void *, struct svc_req *);
+#define YPPROC_ALL ((u_long)8)
+extern ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *);
+extern ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *);
+#define YPPROC_MASTER ((u_long)9)
+extern ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *);
+extern ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *);
+#define YPPROC_ORDER ((u_long)10)
+extern ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *);
+extern ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *);
+#define YPPROC_MAPLIST ((u_long)11)
+extern ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *);
+extern ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *);
+
+#else /* Old Style C */
+#define YPPROC_NULL ((u_long)0)
+extern void * ypproc_null_2();
+extern void * ypproc_null_2_svc();
+#define YPPROC_DOMAIN ((u_long)1)
+extern bool_t * ypproc_domain_2();
+extern bool_t * ypproc_domain_2_svc();
+#define YPPROC_DOMAIN_NONACK ((u_long)2)
+extern bool_t * ypproc_domain_nonack_2();
+extern bool_t * ypproc_domain_nonack_2_svc();
+#define YPPROC_MATCH ((u_long)3)
+extern ypresp_val * ypproc_match_2();
+extern ypresp_val * ypproc_match_2_svc();
+#define YPPROC_FIRST ((u_long)4)
+extern ypresp_key_val * ypproc_first_2();
+extern ypresp_key_val * ypproc_first_2_svc();
+#define YPPROC_NEXT ((u_long)5)
+extern ypresp_key_val * ypproc_next_2();
+extern ypresp_key_val * ypproc_next_2_svc();
+#define YPPROC_XFR ((u_long)6)
+extern ypresp_xfr * ypproc_xfr_2();
+extern ypresp_xfr * ypproc_xfr_2_svc();
+#define YPPROC_CLEAR ((u_long)7)
+extern void * ypproc_clear_2();
+extern void * ypproc_clear_2_svc();
+#define YPPROC_ALL ((u_long)8)
+extern ypresp_all * ypproc_all_2();
+extern ypresp_all * ypproc_all_2_svc();
+#define YPPROC_MASTER ((u_long)9)
+extern ypresp_master * ypproc_master_2();
+extern ypresp_master * ypproc_master_2_svc();
+#define YPPROC_ORDER ((u_long)10)
+extern ypresp_order * ypproc_order_2();
+extern ypresp_order * ypproc_order_2_svc();
+#define YPPROC_MAPLIST ((u_long)11)
+extern ypresp_maplist * ypproc_maplist_2();
+extern ypresp_maplist * ypproc_maplist_2_svc();
+#endif /* Old Style C */
+
+#define YPPUSH_XFRRESPPROG ((u_long)0x40000000)
+#define YPPUSH_XFRRESPVERS ((u_long)1)
+
+#ifdef __cplusplus
+#define YPPUSHPROC_NULL ((u_long)0)
+extern "C" void * yppushproc_null_1(void *, CLIENT *);
+extern "C" void * yppushproc_null_1_svc(void *, struct svc_req *);
+#define YPPUSHPROC_XFRRESP ((u_long)1)
+extern "C" yppushresp_xfr * yppushproc_xfrresp_1(void *, CLIENT *);
+extern "C" yppushresp_xfr * yppushproc_xfrresp_1_svc(void *, struct svc_req *);
+
+#elif __STDC__
+#define YPPUSHPROC_NULL ((u_long)0)
+extern void * yppushproc_null_1(void *, CLIENT *);
+extern void * yppushproc_null_1_svc(void *, struct svc_req *);
+#define YPPUSHPROC_XFRRESP ((u_long)1)
+extern yppushresp_xfr * yppushproc_xfrresp_1(void *, CLIENT *);
+extern yppushresp_xfr * yppushproc_xfrresp_1_svc(void *, struct svc_req *);
+
+#else /* Old Style C */
+#define YPPUSHPROC_NULL ((u_long)0)
+extern void * yppushproc_null_1();
+extern void * yppushproc_null_1_svc();
+#define YPPUSHPROC_XFRRESP ((u_long)1)
+extern yppushresp_xfr * yppushproc_xfrresp_1();
+extern yppushresp_xfr * yppushproc_xfrresp_1_svc();
+#endif /* Old Style C */
+
+#define YPBINDPROG ((u_long)100007)
+#define YPBINDVERS ((u_long)2)
+
+#ifdef __cplusplus
+#define YPBINDPROC_NULL ((u_long)0)
+extern "C" void * ypbindproc_null_2(void *, CLIENT *);
+extern "C" void * ypbindproc_null_2_svc(void *, struct svc_req *);
+#define YPBINDPROC_DOMAIN ((u_long)1)
+extern "C" ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *);
+extern "C" ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *);
+#define YPBINDPROC_SETDOM ((u_long)2)
+extern "C" void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *);
+extern "C" void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *);
+
+#elif __STDC__
+#define YPBINDPROC_NULL ((u_long)0)
+extern void * ypbindproc_null_2(void *, CLIENT *);
+extern void * ypbindproc_null_2_svc(void *, struct svc_req *);
+#define YPBINDPROC_DOMAIN ((u_long)1)
+extern ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *);
+extern ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *);
+#define YPBINDPROC_SETDOM ((u_long)2)
+extern void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *);
+extern void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *);
+
+#else /* Old Style C */
+#define YPBINDPROC_NULL ((u_long)0)
+extern void * ypbindproc_null_2();
+extern void * ypbindproc_null_2_svc();
+#define YPBINDPROC_DOMAIN ((u_long)1)
+extern ypbind_resp * ypbindproc_domain_2();
+extern ypbind_resp * ypbindproc_domain_2_svc();
+#define YPBINDPROC_SETDOM ((u_long)2)
+extern void * ypbindproc_setdom_2();
+extern void * ypbindproc_setdom_2_svc();
+#endif /* Old Style C */
+
+#endif /* !_YP_H_RPCGEN */
diff --git a/gnu/usr.sbin/ypserv/yp_svc.c b/gnu/usr.sbin/ypserv/yp_svc.c
new file mode 100644
index 0000000..fc525cd
--- /dev/null
+++ b/gnu/usr.sbin/ypserv/yp_svc.c
@@ -0,0 +1,393 @@
+/*
+ * And thus spoke RPCGEN:
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ *
+ * And thus replied Lpd@NannyMUD:
+ * Who cares? :-) /Peter Eriksson <pen@signum.se>
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+#include "yp.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <syslog.h>
+#include <errno.h>
+#include <paths.h>
+
+extern int errno;
+extern void Perror();
+
+#ifdef __STDC__
+#define SIG_PF void(*)(int)
+#endif
+
+static void
+ypprog_2(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ domainname ypproc_domain_2_arg;
+ domainname ypproc_domain_nonack_2_arg;
+ ypreq_key ypproc_match_2_arg;
+ ypreq_key ypproc_first_2_arg;
+ ypreq_key ypproc_next_2_arg;
+ ypreq_xfr ypproc_xfr_2_arg;
+ ypreq_nokey ypproc_all_2_arg;
+ ypreq_nokey ypproc_master_2_arg;
+ ypreq_nokey ypproc_order_2_arg;
+ domainname ypproc_maplist_2_arg;
+ } argument;
+ char *result;
+ xdrproc_t __xdr_argument, __xdr_result;
+ char *(*local)(char *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case YPPROC_NULL:
+ __xdr_argument = (xdrproc_t) xdr_void;
+ __xdr_result = (xdrproc_t) xdr_void;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_null_2_svc;
+ break;
+
+ case YPPROC_DOMAIN:
+ __xdr_argument = (xdrproc_t) __xdr_domainname;
+ __xdr_result = (xdrproc_t) xdr_bool;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_domain_2_svc;
+ break;
+
+ case YPPROC_DOMAIN_NONACK:
+ __xdr_argument = (xdrproc_t) __xdr_domainname;
+ __xdr_result = (xdrproc_t) xdr_bool;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_domain_nonack_2_svc;
+ break;
+
+ case YPPROC_MATCH:
+ __xdr_argument = (xdrproc_t) __xdr_ypreq_key;
+ __xdr_result = (xdrproc_t) __xdr_ypresp_val;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_match_2_svc;
+ break;
+
+ case YPPROC_FIRST:
+#if 0 /* Bug in Sun's yp.x RPC prototype file */
+ __xdr_argument = (xdrproc_t) __xdr_ypreq_key;
+#else
+ __xdr_argument = (xdrproc_t) __xdr_ypreq_nokey;
+#endif
+ __xdr_result = (xdrproc_t) __xdr_ypresp_key_val;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_first_2_svc;
+ break;
+
+ case YPPROC_NEXT:
+ __xdr_argument = (xdrproc_t) __xdr_ypreq_key;
+ __xdr_result = (xdrproc_t) __xdr_ypresp_key_val;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_next_2_svc;
+ break;
+
+ case YPPROC_XFR:
+ __xdr_argument = (xdrproc_t) __xdr_ypreq_xfr;
+ __xdr_result = (xdrproc_t) __xdr_ypresp_xfr;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_xfr_2_svc;
+ break;
+
+ case YPPROC_CLEAR:
+ __xdr_argument = (xdrproc_t) xdr_void;
+ __xdr_result = (xdrproc_t) xdr_void;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_clear_2_svc;
+ break;
+
+ case YPPROC_ALL:
+ __xdr_argument = (xdrproc_t) __xdr_ypreq_nokey;
+ __xdr_result = (xdrproc_t) __xdr_ypresp_all;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_all_2_svc;
+ break;
+
+ case YPPROC_MASTER:
+ __xdr_argument = (xdrproc_t) __xdr_ypreq_nokey;
+ __xdr_result = (xdrproc_t) __xdr_ypresp_master;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_master_2_svc;
+ break;
+
+ case YPPROC_ORDER:
+ __xdr_argument = (xdrproc_t) __xdr_ypreq_nokey;
+ __xdr_result = (xdrproc_t) __xdr_ypresp_order;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_order_2_svc;
+ break;
+
+ case YPPROC_MAPLIST:
+ __xdr_argument = (xdrproc_t) __xdr_domainname;
+ __xdr_result = (xdrproc_t) __xdr_ypresp_maplist;
+ local = (char *(*)(char *, struct svc_req *)) ypproc_maplist_2_svc;
+ break;
+
+ default:
+ svcerr_noproc(transp);
+ return;
+ }
+ (void) memset((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs(transp, __xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode(transp);
+ return;
+ }
+ result = (*local)((char *)&argument, rqstp);
+ if (result != NULL && !svc_sendreply(transp, __xdr_result, result)) {
+ svcerr_systemerr(transp);
+ }
+ if (!svc_freeargs(transp, __xdr_argument, (caddr_t) &argument)) {
+ fprintf(stderr, "unable to free arguments");
+ exit(1);
+ }
+ return;
+}
+
+#if 0
+static void
+yppush_xfrrespprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ char *result;
+ xdrproc_t __xdr_argument, __xdr_result;
+ char *(*local)(char *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case YPPUSHPROC_NULL:
+ __xdr_argument = (xdrproc_t) xdr_void;
+ __xdr_result = (xdrproc_t) xdr_void;
+ local = (char *(*)(char *, struct svc_req *)) yppushproc_null_1_svc;
+ break;
+
+ case YPPUSHPROC_XFRRESP:
+ __xdr_argument = (xdrproc_t) xdr_void;
+ __xdr_result = (xdrproc_t) __xdr_yppushresp_xfr;
+ local = (char *(*)(char *, struct svc_req *)) yppushproc_xfrresp_1_svc;
+ break;
+
+ default:
+ svcerr_noproc(transp);
+ return;
+ }
+ (void) memset((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs(transp, __xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode(transp);
+ return;
+ }
+ result = (*local)((char *)&argument, rqstp);
+ if (result != NULL && !svc_sendreply(transp, __xdr_result, result)) {
+ svcerr_systemerr(transp);
+ }
+ if (!svc_freeargs(transp, __xdr_argument, (caddr_t) &argument)) {
+ fprintf(stderr, "unable to free arguments");
+ exit(1);
+ }
+ return;
+}
+
+static void
+ypbindprog_2(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ domainname ypbindproc_domain_2_arg;
+ ypbind_setdom ypbindproc_setdom_2_arg;
+ } argument;
+ char *result;
+ xdrproc_t __xdr_argument, __xdr_result;
+ char *(*local)(char *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case YPBINDPROC_NULL:
+ __xdr_argument = (xdrproc_t) xdr_void;
+ __xdr_result = (xdrproc_t) xdr_void;
+ local = (char *(*)(char *, struct svc_req *)) ypbindproc_null_2_svc;
+ break;
+
+ case YPBINDPROC_DOMAIN:
+ __xdr_argument = (xdrproc_t) __xdr_domainname;
+ __xdr_result = (xdrproc_t) __xdr_ypbind_resp;
+ local = (char *(*)(char *, struct svc_req *)) ypbindproc_domain_2_svc;
+ break;
+
+ case YPBINDPROC_SETDOM:
+ __xdr_argument = (xdrproc_t) __xdr_ypbind_setdom;
+ __xdr_result = (xdrproc_t) xdr_void;
+ local = (char *(*)(char *, struct svc_req *)) ypbindproc_setdom_2_svc;
+ break;
+
+ default:
+ svcerr_noproc(transp);
+ return;
+ }
+ (void) memset((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs(transp, __xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode(transp);
+ return;
+ }
+ result = (*local)((char *)&argument, rqstp);
+ if (result != NULL && !svc_sendreply(transp, __xdr_result, result)) {
+ svcerr_systemerr(transp);
+ }
+ if (!svc_freeargs(transp, __xdr_argument, (caddr_t) &argument)) {
+ fprintf(stderr, "unable to free arguments");
+ exit(1);
+ }
+ return;
+}
+#endif
+
+extern int debug_flag;
+extern int dns_flag;
+
+#ifndef _PATH_YP
+#define _PATH_YP "/var/yp"
+#endif
+char *path_ypdb = _PATH_YP;
+
+char *progname;
+
+
+int main(int argc, char **argv)
+{
+ register SVCXPRT *transp;
+ int i;
+ int my_port = -1;
+ int my_socket;
+ struct sockaddr_in socket_address;
+ int result;
+
+
+ progname = strrchr (argv[0], '/');
+ if (progname == (char *) NULL)
+ progname = argv[0];
+ else
+ progname++;
+
+ openlog(progname, LOG_PID, TCPW_FACILITY);
+
+ for (i = 1; i < argc && argv[i][0] == '-'; i++)
+ {
+ if (strcmp(argv[i], "-debug") == 0 || strcmp(argv[i], "-d") == 0)
+ debug_flag = 1;
+ else if (strcmp(argv[i], "-dns") == 0 || strcmp(argv[i], "-b") == 0)
+ dns_flag = 1;
+ else if ((argv[i][1] == 'p') && (argv[i][2] >= '0') && (argv[i][2] <= '9'))
+ my_port = atoi(argv[i] + 2);
+ else
+ {
+ fprintf(stderr, "%s: Unknown command line switch: %s\n",
+ progname,
+ argv[i]);
+ exit(1);
+ }
+ }
+
+ if (!debug_flag)
+ if(daemon(0,0))
+ {
+ perror("daemon()");
+ exit (1);
+ }
+
+ if (debug_flag)
+ Perror("[Welcome to the NYS YP Server, version 0.11]\n");
+
+ if (i < argc)
+ {
+ path_ypdb = argv[i];
+ if (debug_flag)
+ Perror("Using database directory: %s\n", path_ypdb);
+ }
+
+ /* Change current directory to database location */
+ if (chdir(path_ypdb) < 0)
+ {
+ Perror("%s: chdir: %", argv[0], strerror(errno));
+ exit(1);
+ }
+
+ (void) pmap_unset(YPPROG, YPVERS);
+
+ if (my_port >= 0)
+ {
+ my_socket = socket (AF_INET, SOCK_DGRAM, 0);
+ if (my_socket < 0)
+ {
+ Perror("%s: can not create UDP: %s",
+ progname, strerror(errno));
+ exit (1);
+ }
+
+ socket_address.sin_family = AF_INET;
+ socket_address.sin_addr.s_addr = htonl (INADDR_ANY);
+ socket_address.sin_port = htons (my_port);
+
+ result = bind (my_socket, (struct sockaddr *) &socket_address,
+ sizeof (socket_address));
+ if (result < 0)
+ {
+ Perror("%s: can not create UDP: %s",
+ progname, strerror(errno));
+ exit (1);
+ }
+ }
+ else
+ my_socket = RPC_ANYSOCK;
+
+ transp = svcudp_create(my_socket);
+ if (transp == NULL) {
+ Perror("cannot create udp service.");
+ exit(1);
+ }
+ if (!svc_register(transp, YPPROG, YPVERS, ypprog_2, IPPROTO_UDP)) {
+ Perror("unable to register (YPPROG, YPVERS, udp).");
+ exit(1);
+ }
+
+ if (my_port >= 0)
+ {
+ my_socket = socket (AF_INET, SOCK_STREAM, 0);
+ if (my_socket < 0)
+ {
+ Perror("%s: can not create TCP: %s",
+ progname, strerror(errno));
+ exit (1);
+ }
+
+ socket_address.sin_family = AF_INET;
+ socket_address.sin_addr.s_addr = htonl (INADDR_ANY);
+ socket_address.sin_port = htons (my_port);
+
+ result = bind (my_socket, (struct sockaddr *) &socket_address,
+ sizeof (socket_address));
+ if (result < 0)
+ {
+ Perror("%s: can not create TCP: %s",
+ progname, strerror(errno));
+ exit (1);
+ }
+ }
+ else
+ my_socket = RPC_ANYSOCK;
+
+ transp = svctcp_create(my_socket, 0, 0);
+ if (transp == NULL) {
+ Perror("%s: cannot create tcp service\n", progname);
+ exit(1);
+ }
+ if (!svc_register(transp, YPPROG, YPVERS, ypprog_2, IPPROTO_TCP)) {
+ Perror("%s: unable to register (YPPROG, YPVERS, tcp)\n", progname);
+ exit(1);
+ }
+
+ svc_run();
+ Perror("svc_run returned");
+ exit(1);
+ /* NOTREACHED */
+}
diff --git a/gnu/usr.sbin/ypserv/yp_xdr.c b/gnu/usr.sbin/ypserv/yp_xdr.c
new file mode 100644
index 0000000..bb70473
--- /dev/null
+++ b/gnu/usr.sbin/ypserv/yp_xdr.c
@@ -0,0 +1,415 @@
+/*
+ * And thus spoke RPCGEN:
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ *
+ * And thus replied Lpd@NannyMUD:
+ * Who cares? :-) /Peter Eriksson <pen@signum.se>
+ *
+ *
+ * Modification history:
+ * 940616 pen@signum.se Major cleanups.
+ * 940713 pen@signum.se Added SunOS 4 prototypes.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+
+
+#include "yp.h"
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+__xdr_ypall_cb_t __xdr_ypall_cb;
+
+bool_t
+__xdr_ypstat(XDR *xdrs, ypstat *objp)
+{
+ if (!xdr_enum(xdrs, (enum_t *)objp))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
+{
+ if (!xdr_enum(xdrs, (enum_t *)objp))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_domainname(XDR *xdrs, domainname *objp)
+{
+ if (!xdr_string(xdrs, objp, YPMAXDOMAIN))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_mapname(XDR *xdrs, mapname *objp)
+{
+ if (!xdr_string(xdrs, objp, YPMAXMAP))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_peername(XDR *xdrs, peername *objp)
+{
+ if (!xdr_string(xdrs, objp, YPMAXPEER))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_keydat(XDR *xdrs, keydat *objp)
+{
+ if (!xdr_bytes(xdrs, (char **)&objp->keydat_val,
+ (u_int *)&objp->keydat_len, YPMAXRECORD))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_valdat(XDR *xdrs, valdat *objp)
+{
+ if (!xdr_bytes(xdrs, (char **)&objp->valdat_val,
+ (u_int *)&objp->valdat_len, YPMAXRECORD))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
+{
+ if (!__xdr_domainname(xdrs, &objp->domain))
+ return FALSE;
+
+ if (!__xdr_mapname(xdrs, &objp->map))
+ return FALSE;
+
+ if (!xdr_u_int(xdrs, &objp->ordernum))
+ return FALSE;
+
+ if (!__xdr_peername(xdrs, &objp->peer))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypreq_key(XDR *xdrs, ypreq_key *objp)
+{
+ if (!__xdr_domainname(xdrs, &objp->domain))
+ return FALSE;
+
+ if (!__xdr_mapname(xdrs, &objp->map))
+ return FALSE;
+
+ if (!__xdr_keydat(xdrs, &objp->key))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypreq_nokey(XDR *xdrs, ypreq_nokey *objp)
+{
+ if (!__xdr_domainname(xdrs, &objp->domain))
+ return FALSE;
+
+ if (!__xdr_mapname(xdrs, &objp->map))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
+{
+ if (!__xdr_ypmap_parms(xdrs, &objp->map_parms))
+ return FALSE;
+
+ if (!xdr_u_int(xdrs, &objp->transid))
+ return FALSE;
+
+ if (!xdr_u_int(xdrs, &objp->prog))
+ return FALSE;
+
+ if (!xdr_u_int(xdrs, &objp->port))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypresp_val(XDR *xdrs, ypresp_val *objp)
+{
+ if (!__xdr_ypstat(xdrs, &objp->stat))
+ return FALSE;
+
+ if (!__xdr_valdat(xdrs, &objp->val))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypresp_key_val(XDR *xdrs, ypresp_key_val *objp)
+{
+ if (!__xdr_ypstat(xdrs, &objp->stat))
+ return FALSE;
+
+#if 0 /* The Sun-supplied yp.x RPC input file have these in the wrong order */
+ if (!__xdr_keydat(xdrs, &objp->key))
+ return FALSE;
+
+ if (!__xdr_valdat(xdrs, &objp->val))
+ return FALSE;
+#else
+ if (!__xdr_valdat(xdrs, &objp->val))
+ return FALSE;
+
+ if (!__xdr_keydat(xdrs, &objp->key))
+ return FALSE;
+#endif
+ return TRUE;
+}
+
+bool_t
+__xdr_ypresp_master(XDR *xdrs, ypresp_master *objp)
+{
+ if (!__xdr_ypstat(xdrs, &objp->stat))
+ return FALSE;
+
+ if (!__xdr_peername(xdrs, &objp->peer))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypresp_order(XDR *xdrs, ypresp_order *objp)
+{
+ if (!__xdr_ypstat(xdrs, &objp->stat))
+ return FALSE;
+
+ if (!xdr_u_int(xdrs, &objp->ordernum))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypresp_all(XDR *xdrs, ypresp_all *objp)
+{
+ if (xdrs->x_op == XDR_ENCODE)
+ {
+ while (1)
+ {
+ if (!xdr_bool(xdrs, &objp->more))
+ {
+ if (__xdr_ypall_cb.u.close != NULL)
+ (*(__xdr_ypall_cb.u.close))(__xdr_ypall_cb.data);
+
+ __xdr_ypall_cb.data = NULL;
+
+ return FALSE;
+ }
+
+ if (!__xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val))
+ {
+ if (__xdr_ypall_cb.u.close != NULL)
+ (*(__xdr_ypall_cb.u.close))(__xdr_ypall_cb.data);
+
+ __xdr_ypall_cb.data = NULL;
+
+ return FALSE;
+ }
+
+ if (objp->ypresp_all_u.val.stat != YP_TRUE)
+ {
+ objp->more = FALSE;
+
+ if (__xdr_ypall_cb.u.close != NULL)
+ (*(__xdr_ypall_cb.u.close))(__xdr_ypall_cb.data);
+
+ __xdr_ypall_cb.data = NULL;
+
+ if (!xdr_bool(xdrs, &objp->more))
+ return FALSE;
+
+ return TRUE;
+ }
+
+ if ((*__xdr_ypall_cb.u.encode)(&objp->ypresp_all_u.val,
+ __xdr_ypall_cb.data) == YP_NOKEY)
+ objp->more = FALSE;
+ }
+ }
+
+#ifdef NOTYET /* This code isn't needed in the server */
+ else if (xdrs->x_op == XDR_DECODE)
+ {
+ int more = 0;
+
+
+ while (1)
+ {
+ if (!xdr_bool(xdrs, &objp->more))
+ return FALSE;
+
+ switch (objp->more)
+ {
+ case TRUE:
+ if (!__xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val))
+ return FALSE;
+
+ if (more == 0)
+ more = (*__xdr_ypall_callback->foreach.decoder)
+ (&objp->ypresp_all_u.val, __xdr_ypall_callback->data);
+ break;
+
+ case FALSE:
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ }
+ return FALSE;
+ }
+#endif
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
+{
+ if (!xdr_u_int(xdrs, &objp->transid))
+ return FALSE;
+
+ if (!__xdr_ypxfrstat(xdrs, &objp->xfrstat))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypmaplist(XDR *xdrs, ypmaplist *objp)
+{
+ if (!__xdr_mapname(xdrs, &objp->map))
+ return FALSE;
+
+ if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof(ypmaplist),
+ (xdrproc_t)__xdr_ypmaplist))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypresp_maplist(XDR *xdrs, ypresp_maplist *objp)
+{
+ if (!__xdr_ypstat(xdrs, &objp->stat))
+ return FALSE;
+
+ if (!xdr_pointer(xdrs, (char **)&objp->maps, sizeof(ypmaplist),
+ (xdrproc_t)__xdr_ypmaplist))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_yppush_status(XDR *xdrs, yppush_status *objp)
+{
+ if (!xdr_enum(xdrs, (enum_t *)objp))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
+{
+ if (!xdr_u_int(xdrs, &objp->transid))
+ return FALSE;
+
+ if (!__xdr_yppush_status(xdrs, &objp->status))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp)
+{
+ if (!xdr_enum(xdrs, (enum_t *)objp))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypbind_binding(XDR *xdrs, ypbind_binding *objp)
+{
+ if (!xdr_opaque(xdrs, objp->ypbind_binding_addr, 4))
+ return FALSE;
+
+ if (!xdr_opaque(xdrs, objp->ypbind_binding_port, 2))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+__xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp)
+{
+ if (!__xdr_ypbind_resptype(xdrs, &objp->ypbind_status))
+ return FALSE;
+
+ switch (objp->ypbind_status)
+ {
+ case YPBIND_FAIL_VAL:
+ if (!xdr_u_int(xdrs, &objp->ypbind_resp_u.ypbind_error))
+ return FALSE;
+ break;
+
+ case YPBIND_SUCC_VAL:
+ if (!__xdr_ypbind_binding(xdrs, &objp->ypbind_resp_u.ypbind_bindinfo))
+ return FALSE;
+ break;
+
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+bool_t
+__xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp)
+{
+ if (!__xdr_domainname(xdrs, &objp->ypsetdom_domain))
+ return FALSE;
+
+ if (!__xdr_ypbind_binding(xdrs, &objp->ypsetdom_binding))
+ return FALSE;
+
+ if (!xdr_u_int(xdrs, &objp->ypsetdom_vers))
+ return FALSE;
+
+ return TRUE;
+}
OpenPOWER on IntegriCloud