diff options
Diffstat (limited to 'gnu/usr.sbin/ypserv')
-rw-r--r-- | gnu/usr.sbin/ypserv/Makefile | 20 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/Makefile.yp | 394 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/dnslookup.c | 112 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/mknetid | 36 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/server.c | 1384 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/svc_run.c | 85 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/system.h | 67 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/yp.h | 611 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/yp_svc.c | 430 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/yp_xdr.c | 415 | ||||
-rw-r--r-- | gnu/usr.sbin/ypserv/ypserv.8 | 293 |
11 files changed, 0 insertions, 3847 deletions
diff --git a/gnu/usr.sbin/ypserv/Makefile b/gnu/usr.sbin/ypserv/Makefile deleted file mode 100644 index edc8ac0605cc..000000000000 --- a/gnu/usr.sbin/ypserv/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# $Id: Makefile,v 1.7 1995/07/12 16:28:10 wpaul Exp $ -# From: @(#)Makefile 8.3 (Berkeley) 4/2/94 - -PROG= ypserv -SRCS= dnslookup.c svc_run.c yp_svc.c yp_xdr.c server.c - -CFLAGS+=-Wall -DTCP_WRAPPER=0 -DTCPW_FACILITY=LOG_AUTH -CFLAGS+=-DMAX_CHILDREN=20 -DINSTDIR='"/usr/libexec"' - -MAN8= ypserv.8 - -afterinstall: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.CURDIR}/Makefile.yp \ - ${DESTDIR}/var/yp/Makefile - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${.CURDIR}/mknetid \ - ${DESTDIR}/usr/libexec/mknetid - -.include <bsd.prog.mk> diff --git a/gnu/usr.sbin/ypserv/Makefile.yp b/gnu/usr.sbin/ypserv/Makefile.yp deleted file mode 100644 index b69707083136..000000000000 --- a/gnu/usr.sbin/ypserv/Makefile.yp +++ /dev/null @@ -1,394 +0,0 @@ -# -# Makefile for the NIS databases -# -# $Id: Makefile.yp,v 1.12 1995/10/26 18:00:35 wpaul Exp $ -# -# This Makefile should only be run on the NIS master server of a domain. -# All updated maps will be pushed to all NIS slave servers listed in the -# /var/yp/ypservers file. Please make sure that the hostnames of all -# NIS servers in your domain are listed in /var/yp/ypservers. -# -# This Makefile can be modified to support more NIS maps if desired. -# - -# If this machine is an NIS master, comment out this next line so -# that changes to the NIS maps can be propagated to the slave servers. -# (By default we assume that we are only serving a small domain with -# only one server.) -# -NOPUSH = "True" - -# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients -# (i.e. clients who expect the password field in the passwd maps to be -# valid) then uncomment this line. This will cause $YPDIR/passwd to -# be generated with valid password fields. This is insecure: FreeBSD -# normally only serves the master.passwd maps (which have real encrypted -# passwords in them) to the superuser on other FreeBSD machines, but -# non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, -# etc...) will only work properly in 'unsecure' mode. -# -#UNSECURE = "True" - -# These are commands which this Makefile needs to properly rebuild the -# NIS databases. Don't change these unless you have a good reason. Also -# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary -# and it'll break everything in sight. -# -AWK = /usr/bin/awk -RM = @/bin/rm -f -RCAT = /bin/cat -CAT = @$(RCAT) - -DBLOAD = /usr/sbin/yp_mkdb -m `hostname` -MKNETID = /usr/libexec/mknetid -YPPUSH = /usr/bin/yppush -DOMAIN = `/bin/domainname` -REVNETGROUP = /usr/libexec/revnetgroup - -YPSRCDIR = /etc -YPDIR = /var/yp -YPMAPDIR = $(YPDIR)/$(DOMAIN) - -# These are the files from which the NIS databases are built. You may edit -# these to taste in the event that you wish to keep your NIS source files -# seperate from your NIS server's actual configuration files. Note that the -# NIS passwd and master.passwd files are stored in /var/yp: the server's -# real password database is not used by default. However, you may use -# the real /etc/passwd and /etc/master.passwd files by: -# -# -# - invoking yppasswdd without the -m option (yppasswdd will use -# /etc/master.passwd if no alternate master.passwd file is specified -# and do a 'pwd_mkdb' as needed). -# - Specifying the location of the master.passwd file using the -# MASTER_PASSWD variable, i.e.: -# -# # make MASTER_PASSWD=/path/to/some/other/master.passwd -# -# - (optionally): editing this Makefile to change the default location. -# -# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw -# passwd file will be generated from the master.passwd file automagically. -# -ETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) -BOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) -HOSTS = $(YPSRCDIR)/hosts -NETWORKS = $(YPSRCDIR)/networks -PROTOCOLS = $(YPSRCDIR)/protocols -RPC = $(YPSRCDIR)/rpc -SERVICES = $(YPSRCDIR)/services -GROUP = $(YPSRCDIR)/group -NETGROUP = $(YPSRCDIR)/netgroup -PASSWD = $(YPDIR)/passwd -.if !defined(MASTER_PASSWD) -MASTER = $(YPDIR)/master.passwd -.else -MASTER = $(MASTER_PASSWD) -.endif -YPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain -PUBLICKEY = $(YPSRCDIR)/publickey - -target: - @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ - cd $(DOMAIN) ; echo "NIS Map update started on `date`" ; \ - make -f ../Makefile all; echo "NIS Map update completed." - -# If you don't want some of these maps built, feel free to comment -# them out from this list. -# Note that we don't build the ethers or boorparams maps by default -# since /etc/ethers and /etc/bootparams are not likely to be present -# on all systems. -# - -all: master.passwd passwd hosts group networks protocols \ - rpc services servers netid # publickey netgroup ethers bootparam - -ethers: ethers.byname ethers.byaddr -bootparam: bootparams -hosts: hosts.byname hosts.byaddr -networks: networks.byaddr networks.byname -protocols: protocols.bynumber protocols.byname -rpc: rpc.byname rpc.bynumber -services: services.byname -passwd: passwd.byname passwd.byuid -group: group.byname group.bygid -netgrp: netgroup -netid: netid.byname -servers: ypservers -publickey: publickey.byname - -master.passwd: master.passwd.byname master.passwd.byuid - - -ypservers: $(YPSERVERS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(YPSERVERS) | \ - $(AWK) '{ if ($$1 != "" && $$1 != "#") print $$0"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - -ethers.byname: $(ETHERS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(ETHERS) | \ - $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ - print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ - -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) -i $(ETHERS) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -ethers.byaddr: $(ETHERS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(ETHERS) | \ - $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ - print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ - -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -bootparams: $(BOOTPARAMS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(BOOTPARAMS) | \ - $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ - print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \ - -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(NETGROUP) | \ - $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ - print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ - -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - @$(MAKE) -f ../Makefile netid - - -netgroup.byhost: $(NETGROUP) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \ - $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ - print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ - -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -netgroup.byuser: $(NETGROUP) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \ - $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ - print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ - -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -hosts.byname: $(HOSTS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(HOSTS) | \ - $(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "#"; n++) \ - print $$n"\t"$$0 }' $^ | $(DBLOAD) -i $(HOSTS) \ - -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - @$(MAKE) -f ../Makefile netid - -hosts.byaddr: $(HOSTS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(HOSTS) | \ - $(AWK) '$$1 !~ "#" { print $$1"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(HOSTS) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - @$(MAKE) -f ../Makefile netid - - -networks.byname: $(NETWORKS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(NETWORKS) | \ - $(AWK) \ - '$$1 !~ "#" { print $$1"\t"$$0; \ - for (n=3; n<=NF && $$n !~ "#"; n++) \ - print $$n"\t"$$0 \ - }' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -networks.byaddr: $(NETWORKS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(NETWORKS) | \ - $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -protocols.byname: $(PROTOCOLS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(PROTOCOLS) | \ - $(AWK) \ - '$$1 !~ "#" { print $$1"\t"$$0; \ - for (n=3; n<=NF && $$n !~ "#"; n++) \ - print $$n"\t"$$0 \ - }' $^ | $(DBLOAD) -i $(PROTOCOLS) \ - -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -protocols.bynumber: $(PROTOCOLS) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(PROTOCOLS) | \ - $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -rpc.byname: $(RPC) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(RPC) | \ - $(AWK) \ - '$$1 !~ "#" { print $$1"\t"$$0; \ - for (n=3; n<=NF && $$n !~ "#"; n++) \ - print $$n"\t"$$0 \ - }' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -rpc.bynumber: $(RPC) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(RPC) | \ - $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -services.byname: $(SERVICES) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(SERVICES) | \ - $(AWK) \ - '$$1 !~ "#" { if (index($$2,"udp")) { printf("%s/udp",$$1) } \ - else { printf("%s/tcp",$$1) }; print "\t"$$0 \ - }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -publickey.byname: $(PUBLICKEY) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(PUBLICKEY) | \ - $(AWK) '$$1 !~ "#" { print $$1"\t"$$2 }' $^ \ - | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -$(PASSWD): $(MASTER) - @echo "Creating new $@ file from $(MASTER)..." - $(RM) $@ - @if [ ! $(UNSECURE) ]; then \ - $(RCAT) $(MASTER) | \ - $(AWK) -F: '{if ($$1 != "+") \ - print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ - > $(PASSWD) ; \ - else $(RCAT) $(MASTER) | \ - $(AWK) -F: '{if ($$1 != "+") \ - print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ - > $(PASSWD) ; fi - - -passwd.byname: $(PASSWD) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(PASSWD) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - -passwd.byuid: $(PASSWD) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(PASSWD) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - @$(MAKE) -f ../Makefile netid - - -group.byname: $(GROUP) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(GROUP) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -group.bygid: $(GROUP) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(GROUP) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - @$(MAKE) -f ../Makefile netid - - -netid.byname: $(GROUP) $(PASSWD) - @echo "Updating $@..." - $(RM) $@ - @$(MKNETID) $(PASSWD) $(GROUP) `basename \`pwd\`` \ - | $(DBLOAD) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -master.passwd.byname: $(MASTER) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(MASTER) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - - -master.passwd.byuid: $(MASTER) - @echo "Updating $@..." - $(RM) $@ - $(CAT) $(MASTER) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ - | $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $@ - @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi - @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi diff --git a/gnu/usr.sbin/ypserv/dnslookup.c b/gnu/usr.sbin/ypserv/dnslookup.c deleted file mode 100644 index 9d10ecfde76c..000000000000 --- a/gnu/usr.sbin/ypserv/dnslookup.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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: dnslookup.c,v 1.1 1995/01/31 08:58:52 wpaul Exp $ - */ - -/* -** 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 <sys/types.h> -#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/mknetid b/gnu/usr.sbin/ypserv/mknetid deleted file mode 100644 index 6619b5d8acf1..000000000000 --- a/gnu/usr.sbin/ypserv/mknetid +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# Produce netid.byname map file -# -# Written by O.Kirch, 1994. -# -PASSWD=$1 -GROUP=$2 -DOMAIN=$3 - -tempsed=/tmp/pass.$$ - - # First, get all login/uid info from passwd file - grep -v '^+:' $PASSWD | - awk -F: '{ printf "s/^%s:/%s/\n", $1, $3; }' >$tempsed - # next one is a giant pipe: - grep -v '^+:' $GROUP | - grep -v ':[ ]*$' | - sed 's/^[^:]*:[^:]*:\([0-9]*\):\(.*\)/\1,\2/' | - awk -F, '{ for (n=2; n<=NF; n++) - if ($n != "") print $n":\t"$1; - }' | - sed -f $tempsed | sort | grep -v ':' | - awk 'BEGIN { uid=-1; } - { if (uid == $1) { - groups=groups","$2; - } else { - if (uid != -1) - print uid":"groups; - uid=$1; groups=$2; - } - } - END { if (uid != -1) printf("%s:%s\n", uid, groups); }' | - sed "s/\(.*\):/unix.\1@$DOMAIN &/" - rm -f $tempsed - exit 0 diff --git a/gnu/usr.sbin/ypserv/server.c b/gnu/usr.sbin/ypserv/server.c deleted file mode 100644 index 205a8467ed1f..000000000000 --- a/gnu/usr.sbin/ypserv/server.c +++ /dev/null @@ -1,1384 +0,0 @@ -/* -** 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: server.c,v 1.11 1995/07/15 23:27:47 wpaul Exp $ -** -*/ - -#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 <signal.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 "tcpd.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; -int children = 0; -int forked = 0; - -void verr(fmt, ap) - const char *fmt; - _BSD_VA_LIST_ ap; - -{ - if (debug_flag) - vfprintf(stderr, fmt, ap); - else - vsyslog(LOG_NOTICE, 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 - -#ifndef FROM_UNKNOWN -#define FROM_UNKNOWN STRING_UNKNOWN -#endif - - status = hosts_ctl(progname, - h?h:FROM_UNKNOWN, - inet_ntoa(sin->sin_addr), - ""); - - if (!status && (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; - - sprintf (buf, "%s/%s", domain, map); - - dbp = dbopen(buf,O_RDONLY|O_EXCL, PERM_SECURE, DB_HASH, &openinfo); - - if (debug_flag > 1 && dbp == NULL) - Perror("dbopen(%s): %s", map, strerror(errno)); - - return dbp; -} - - -#define F_ALL 0x01 -#define F_NEXT 0x02 -#define F_YPALL 0x08 - -/* -** 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. - */ - if (flags < F_YPALL) - { - (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; -#ifdef GNU_YPSERV_ARTIFACT - free(dummyval.data); -#endif - } - else - ckey = *ikey; - } - - if (ckey.data == NULL) - { - return (flags & F_NEXT) ? YP_NOMORE : YP_NOKEY; - } - - while (1) - { - if ((dbp->get)(dbp,&ckey,dval,0)) - { -#ifdef GNU_YPSERV_ARTIFACT - /* Free key, unless it comes from the caller! */ - if (ikey == NULL || ckey.data != ikey->data) - free(ckey.data); -#endif - 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; -#ifdef GNU_YPSERV_ARTIFACT - else if (ikey == NULL || ikey->data != ckey.data) - free(ckey.data); -#endif - return YP_TRUE; - } - - /* Free old value */ -#ifdef GNU_YPSERV_ARTIFACT - free(dval->data); -#endif - if ((dbp->seq)(dbp,&nkey,&dummyval,R_NEXT)) - nkey.data = NULL; -#ifdef GNU_YPSERV_ARTIFACT - free(dummyval.data); - - /* Free old key, unless it comes from the caller! */ - if (ikey == NULL || ckey.data != ikey->data) - free(ckey.data); -#endif - 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) - { -#ifdef GNU_YPSERV_ARTIFACT - /* - * In general, if you malloc() data in an RPC service - * routine, you have to free() it the next time that - * routine is called since the XDR routines won't free - * it for you. However, in this case, we don't have to - * do that because the DB routines do garbage collection - * for us. - */ - free(result.val.valdat_val); -#endif - 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. - ** - ** DNS lookups are handled in a subprocess so that the server - ** doesn't block while waiting for requests to complete. - */ - if (result.stat != YP_TRUE && strstr(key->map, "hosts") && dns_flag) - { - char *cp = NULL; - - if (children < MAX_CHILDREN && fork()) - { - children++; - return NULL; - } - else - forked++; - - 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) - { -#ifdef GNU_YPSERV_ARTIFACT - free(result.key.keydat_val); -#endif - result.key.keydat_val = NULL; - } - - result.val.valdat_len = 0; - if (result.val.valdat_val) - { -#ifdef GNU_YPSERV_ARTIFACT - free(result.val.valdat_val); -#endif - 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) - { -#ifdef GNU_YPSERV_ARTIFACT - free(result.key.keydat_val); -#endif - result.key.keydat_val = NULL; - } - - result.val.valdat_len = 0; - if (result.val.valdat_val) - { -#ifdef GNU_YPSERV_ARTIFACT - free(result.val.valdat_val); -#endif - 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); -} - - -/* -** Clean up after child processes signal their termination. -*/ -void reapchild(sig) -int sig; -{ - int st; - - while (wait3(&st, WNOHANG, NULL) > 0) - children--; -} - -/* -** 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: - { - 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 | F_YPALL); - - 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; - } - - if (children < MAX_CHILDREN && fork()) - { - children++; - return NULL; - } - else - forked++; - - __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) - { -#ifdef GNU_YPSERV_ARTIFACT - free(result.peer); -#endif - 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)) - { - /* 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"; - - if ((dbp->get)(dbp,&key,&val,0)) - { - /* No YP_LAST_MODIFIED record in map? Use DTM timestamp.. */ - result.ordernum = get_dtm(nokey->domain, nokey->map); - } - else - { - result.ordernum = atoi(val.data); -#ifdef GNU_YPSERV_ARTIFACT - free(val.data); -#endif - } - - 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/svc_run.c b/gnu/usr.sbin/ypserv/svc_run.c deleted file mode 100644 index 6f4a52c0b8a6..000000000000 --- a/gnu/usr.sbin/ypserv/svc_run.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#if defined(LIBC_SCCS) && !defined(lint) -/*static char *sccsid = "from: @(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";*/ -/*static char *sccsid = "from: @(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_run.c,v 1.2 1995/05/30 05:41:35 rgrimes Exp $"; -#endif - -/* - * This is the rpc server side idle loop - * Wait for input, call server program. - */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <rpc/rpc.h> -#include <sys/errno.h> - -extern int _rpc_dtablesize __P((void)); - -void -my_svc_run() -{ -#ifdef FD_SETSIZE - fd_set readfds; -#else - int readfds; -#endif /* def FD_SETSIZE */ - extern int errno; - extern int forked; - int pid; - - /* Establish the identity of the parent ypserv process. */ - pid = getpid(); - - for (;;) { -#ifdef FD_SETSIZE - readfds = svc_fdset; -#else - readfds = svc_fds; -#endif /* def FD_SETSIZE */ - switch (select(_rpc_dtablesize(), &readfds, NULL, NULL, - (struct timeval *)0)) { - case -1: - if (errno == EINTR) { - continue; - } - perror("svc_run: - select failed"); - return; - case 0: - continue; - default: - svc_getreqset(&readfds); - if (forked && pid != getpid()) - exit(0); - } - } -} diff --git a/gnu/usr.sbin/ypserv/system.h b/gnu/usr.sbin/ypserv/system.h deleted file mode 100644 index 838430a38c4e..000000000000 --- a/gnu/usr.sbin/ypserv/system.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $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 deleted file mode 100644 index 5a3b33a9124d..000000000000 --- a/gnu/usr.sbin/ypserv/yp.h +++ /dev/null @@ -1,611 +0,0 @@ -/* - * 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: yp.h,v 1.1 1995/01/31 08:58:55 wpaul Exp $ - */ - -#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 deleted file mode 100644 index 739a0e3e2a74..000000000000 --- a/gnu/usr.sbin/ypserv/yp_svc.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * 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: yp_svc.c,v 1.5 1995/07/08 21:42:59 ats Exp $ - */ - -#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> -#include <signal.h> - -extern int errno; -extern void Perror __P((char *, ...)); -extern void my_svc_run __P((void)); -extern void reapchild __P((int)); - -#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; - int sunos_4_kludge = 0; - struct sigaction sa; - - 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 if (strcmp(argv[i], "-k") == 0) - sunos_4_kludge = 1; - 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.13]\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); - } - - /* - * Ignore SIGPIPEs. They can hurt us if someone does a ypcat - * and then hits CTRL-C before it terminates. - */ - sigaction(SIGPIPE, NULL, &sa); - sa.sa_handler = SIG_IGN; - sa.sa_flags |= SA_RESTART; - sigemptyset(&sa.sa_mask); - sigaction(SIGPIPE, &sa, NULL); - sigaction(SIGCHLD, NULL, &sa); - sa.sa_flags |= SA_RESTART; - sa.sa_handler = reapchild; - sigemptyset(&sa.sa_mask); - sigaction(SIGCHLD, &sa, NULL); - - (void) pmap_unset(YPPROG, YPVERS); - if (sunos_4_kludge) - (void) pmap_unset(YPPROG, 1); - - 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 (sunos_4_kludge) { - /* - ** This is just to make us reply to YP version 1 calls which SunOS 4's - ** ypbind seems to insist on finding. If someone _really_ tries to - ** use this the they will probably be bitten - _hard_, since I haven't - ** got the faintest idea on how the XDR calls for YP version 1 should - ** look like. The Domain_NoNack call seems to be compatible though :-) - */ - if (!svc_register(transp, YPPROG, 1, ypprog_2, IPPROTO_UDP)) { - fprintf(stderr, "unable to register (YPPROG, 1, 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); - } - - my_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 deleted file mode 100644 index 9e8864578be3..000000000000 --- a/gnu/usr.sbin/ypserv/yp_xdr.c +++ /dev/null @@ -1,415 +0,0 @@ -/* - * 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: yp_xdr.c,v 1.1 1995/01/31 08:58:57 wpaul Exp $ - */ - -#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; -} diff --git a/gnu/usr.sbin/ypserv/ypserv.8 b/gnu/usr.sbin/ypserv/ypserv.8 deleted file mode 100644 index 43ac853e9784..000000000000 --- a/gnu/usr.sbin/ypserv/ypserv.8 +++ /dev/null @@ -1,293 +0,0 @@ -.\" Copyright (c) 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" 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 the University of -.\" California, Berkeley and its contributors. -.\" 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: ypserv.8,v 1.2 1995/02/07 05:04:51 wpaul Exp $ -.\" -.Dd February 4, 1995 -.Dt YPSERV 8 -.Os -.Sh NAME -.Nm ypserv -.Nd "NIS database server" -.Sh SYNOPSIS -.Nm ypserv -.Op Fl dns -.Op Fl debug -.Op Fl k -.Op Fl p Ar port -.Sh DESCRIPTION -.Nm NIS -is an RPC-based service designed to allow a number of UNIX-based -machines to share a common set of configuration files. Rather than -requiring a system administrator to update several copies of files -such as -.Pa /etc/hosts , -.Pa /etc/passwd -and -.Pa /etc/group , -which tend to require frequent changes in most environments, NIS -allows groups of computers to share one set of data which can be -updated from a single location. -.Pp -.Nm ypserv -is the server that distributes NIS databases -to client systems within an NIS -.Nm domain. -Each client in an NIS domain must have its domainname set to -one of the domains served by -.Nm ypserv -using the -.Xr domainname 1 -command. The clients must also run -.Xr ypbind 8 -in order to attach to a particular server, since it is possible to -have serveral servers within a single NIS domain. -.Pp -The databases distributed by -.Nm ypserv -are stored in -.Pa /var/yp/[domainname] -where -.Pa domainname -is the name of the domain being served. There can be several -such directories with different domainnames, and -.Nm ypserv -can handle them all. -.Pp -The databases, or -.Pa maps -as they are often called, -are created by -.Nm /var/yp/Makefile -using several system files as source. The database files are in -.Xr db 3 -format to help speed retrieval when there are many records involved. -In FreeBSD, the -maps are always readable and writable only by root for security -reasons. Technically this is only necessary for the password -maps, but since the data in the other maps can be found in -other world-readable files anyway, it doesn't hurt and it's considered -good general practice. -.Pp -.Nm ypserv -is started by -.Nm /etc/rc -if it has been enabled in -.Nm /etc/sysconfig. -.Sh SPECIAL FEATURES -There are some problems associated with distributing FreeBSD's password -database via NIS: FreeBSD normally only stores encrypted passwords -in -.Pa /etc/master.passwd , -which is readable and writable only by root. By turning this file -into an NIS map, this security feature would be completely defeated. -.Pp -To make up for this, the FreeBSD version of -.Nm ypserv -handles the -.Pa master.passwd.byname -and -.Pa master.basswd.byuid -maps in a special way. When the server receives a request to access -either of these two maps, it will check the TCP port from which the -request originated and return an error if the port number is greater -than 1023. Since only the superuser is allowed to bind to TCP ports -with values less than 1024, the server can use this test to determine -whether or not the access request came from a privileged user. -Any requests made by non-privileged users are therefore rejected. -.Pp -Furthermore, the -.Xr getpwent 3 -routines in FreeBSD's standard C libarary will only attempt to retrieve -data from the -.Pa master.passwd.byname -and -.Pa master.passwd.byuid -maps for the superuser: if a normal user calls any of these functions, -the standard -.Pa passwd.byname -and -.Pa passwd.byuid -maps will be accessed instead. The latter two maps are constructed by -.Nm /var/yp/Makefile -by parsing the -.Pa master.passwd -file and stripping out the password fields, and are therefore -safe to pass on to unprivileged users. In this way, the shadow password -aspect of the protected -.Pa master.passwd -database is maintained through NIS. -.Pp -.Sh NOTES -.Ss Limitations -There are two problems inherent with password shadowing in NIS -that users should -be aware of: -.Bl -enum -offset indent -.It -The 'TCP port less than 1024' test is trivial to defeat for users with -unrestricted access to machines on your network (even those machines -which do not run UNIX-based operating systems). -.It -If you plan to use a FreeBSD system to serve non-FreeBSD clients that -have no support for password shadowing (which is most of them), you -will have to disable the password shadowing entirely by uncommenting the -.Nm UNSECURE=True -entry in -.Nm /var/yp/Makefile . -This will cause the standard -.Pa passwd.byname -and -.Pa passwd.byuid -maps to be generated with valid encrypted password fields, which is -neccesary in order for non-FreeBSD clients to perform user -authentication through NIS. -.El -.Pp -.Ss Security -.Nm ypserv -has support for Wietse Venema's -.Pa tcpwrapper -package built in, though it is not compiled in by default since -the -.Pa tcpwrapper -package is not distributed with FreeBSD. However, if you have -.Nm libwrap.a -and -.Nm tcpd.h , -you can easily recompile -.Nm ypserv -with them, thereby enabling its 'securenets' features: you can -configure -.Nm ypserv -to only handle resquests from machines listed -in the -.Pa tcpwrapper -configuration files, which would help limit vulnerability to the -first limitation listed above. -.Pp -.Ss NIS servers that are also NIS clients -Care must be taken when running -.Nm ypserv -in a multi-server domain where the server machines are also -NIS clients. It is generally a good idea to force the servers to -bind to themselves rather than allowing them to broadcast bind -requests and possibly become bound to each other: strange failure -modes can result if one server goes down and -others are dependent upon on it. (Eventually all the clients will -time out and attempt to bind to other servers, but the delay -involved can be considerable and the failure mode is still present -since the servers might bind to each other all over again). -.Pp -Refer to the -.Xr ypbind 8 -man page for details on how to force it to bind to a particular -server. -.Sh OPTIONS -The following options are supported by -.Nm ypserv : -.Bl -tag -width flag -.It Fl dns -This option affects the way -.Nm ypserv -handles yp_match requests for the -.Pa hosts.byname -and -.Pa hosts.byaddress -maps. By default, if -.Nm ypserv -can't find an entry for a given host in its hosts maps, it will -return an error and perform no further processing. With the -.Fl dns -flag, -.Nm ypserv -will go one step further: rather than giving up immediately, it -will try to resolve the hostname or address using a DNS query. -If the query is successful, -.Nm ypserv -will construct a fake database record and return it to the client, -thereby making it seem as though the client's yp_match request -succeeded. -.Pp -This functionality is provided for compatiblity with SunOS 4.1.x, -which has brain-damaged resolver functions in its standard C -library that depend on NIS for hostname and address resolution. -FreeBSD's resolver can be configured to do DNS -queries directly, therefore it is not necessary to enable this -option when serving only FreeBSD NIS clients. -.It Fl debug -Run the server in debugging mode: the server does not background -itself and prints copious debugging output to stderr for -each -request that it revceives. -.It Fl k -This flag is provided for compatibility with SunOS 4. The -.Xr ypbind 8 -command in SunOS 4 apparently expects to obtain a response from an -NIS v1 server. Starting -.Xr ypserv 8 -with the -.Fl k -flag causes it to register itself as an NIS v1 server and -respond to DOMAIN_NONACK requests. Note carefully: this is merely a -kludge (hence the 'k') to pacify SunOS 4's -.Xr ypbind 8 -command: attempts to make the server actually handle NIS v1 queries -will undoubtedly fail quite miserably. -.It Fl p Ar port -Normally, -.Nm ypserv -will bind itself to a randomly chosen TCP port when it is first -started. This option can be used to force the server to bind to -a particular port instead. -.El -.Sh FILES -.Bl -tag -width Pa -compact -.It Pa /var/yp/[domainname]/[maps] -The NIS maps. -.It Pa /etc/host.conf -Resolver configuration file. -.El -.Sh SEE ALSO -.Xr ypbind 8 , -.Xr yppasswdd 8 , -.Xr yppush 8 , -.Xr ypxfr 8 , -.Xr ypcat 1 , -.Xr yp 8 , -.Xr db 3 -.Sh LICENSE -This program is covered by the GNU Public License version 2. -.Sh AUTHOR -Peter Eriksson <pem@signum.se> (original version) -.br -Bill Paul <wpaul@ctr.columbia.edu> (port to FreeBSD and various -changes) |