Take #2. Import bind-4.9.4-P1 into the intended directory!

This has most of the non-essential stuff removed (ie: what is not built)

bmake glue to follow.
This commit is contained in:
Peter Wemm 1996-08-29 19:20:22 +00:00
commit d6da9453b6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/bind/dist/; revision=17892
svn path=/vendor/bind/4.9.4p1/; revision=17894; tag=vendor/bind/4.9.4p1
139 changed files with 53867 additions and 0 deletions

2600
contrib/bind/CHANGES Normal file

File diff suppressed because it is too large Load Diff

74
contrib/bind/INSTALL Normal file
View File

@ -0,0 +1,74 @@
$Id: INSTALL,v 8.6 1995/12/24 06:43:57 vixie Exp $
THE FILES:
----------
INSTALL -- This file
README -- Release announcements, tips and traps (some out of date)
OPTIONS -- The options that can be turned on and off
RUNSON -- What machines/compilers is BIND known to build on
TODO -- Have spare time? Consider contributing to the project!
doc/info/* -- Platform-dependent build hints
HOW TO BUILD:
-------------
4.9.3 is considerably easier to build than previous releases. These
are the instructions on how to compile the software. For information
on how to create your configuration files (resolv.conf, named.boot, and
zone files) see the doc/bog directory and/or get "DNS and BIND" by C.
Liu and P. Albitz from O'Reilly & Associates, Sebastopol, CA, ISBN
0-937175-82-X 1992
Note: If you maintain a BSD or are otherwise running a 4.4BSD-based system
and want to integrate BIND into it, check out BSD/README.
1. (optional) If you are going to compile for multiple platforms, you
can make a symbolic link tree for each platform to save disk space. To
create a directory called "sun4.dir", do:
make DST=sun4.dir links
Now "cd sun4.dir" and you can do everything as if you had a complete
copy of the source. Just be careful if you are modifying a file, make
sure you turn any links into files:
mv file file.tmp ; cp file.tmp file ; rm file.tmp
2. Edit "conf/options.h" and turn on any options that you want. The
defaults are pretty reasonable for most installations.
3. Edit "Makefile". Go to the section that describes your operating
system and uncoment it out. Add any other variables (for example,
I added a line "DISTHELP=/usr/local/lib".) If in doubt, use the
default!
4. "make" should build everything. Consider putting "./bin" in your
path if "make depend" fails and you think bin/mkdep will help you out.
*** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
The next step (#5) will burn down files which were supplied with
your operating system. You should run the suggested "-n" first
and make sure you have saved any files you want to save.
*** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
5. "make install" will install everything. You might first do
"make -n install" to see what commands would be executed by "make install"
to make sure you understand where everything is about to be installed.
6. (optional, SunOS 4.1.x/NetBSD-1.x/Solaris 2.x only): You can integrate
the new resolver (client-side) code into the shared libraries of your
operating system so that all dynamicly linked programs take advantage of
the new resolver. Read shres/<osname>/INSTALL to find out how to do it.
HOW TO GET HELP:
----------------
If you have any problems or fixes send them to
bind@uunet.uu.net
To be added to that mailing list, send mail to
bind-request@uunet.uu.net
This INSTALL was originally written on 15Jul94 by Tom Limoncelli <tal@plts.org>
Minor changes 23Dec95 by Christopher Davis <ckd@kei.com>

783
contrib/bind/Makefile Normal file
View File

@ -0,0 +1,783 @@
# Makefile for BIND>=4.9 top level
# vixie@decwrl December, 1992 [original]
#
# $Id: Makefile,v 8.39 1996/08/05 08:31:20 vixie Exp $
## ++Copyright++ 1989
## -
## Copyright (c) 1989
## 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.
## -
## Portions Copyright (c) 1993 by Digital Equipment Corporation.
##
## Permission to use, copy, modify, and distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
## copyright notice and this permission notice appear in all copies, and that
## the name of Digital Equipment Corporation not be used in advertising or
## publicity pertaining to distribution of the document or software without
## specific, written prior permission.
##
## THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
## WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
## OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
## CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
## PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
## -
## --Copyright--
VER = 4.9.4-P1
SHELL = /bin/sh
MAKE = make
DESTDIR =
INCL = include
RES = res/libresolv.a
COMPLIB = compat/lib/lib44bsd.a
# The default build parameters are given for 4.4 BSD. They should
# be overridden for other operating systems as indicated below.
#(BSD4.4, BSD/OS, FreeBSD, NetBSD, other net2-alikes)
#
# DO NOT COMMENT THESE OUT. OVERRIDE THEM BELOW.
#
CC = cc $(CPPFLAGS)
LDFLAGS =
CDEBUG = -O -g
CPPFLAGS=
INDOT =
XFER_INDOT =
LEX = lex -I
LIBS = -ll -lutil
PIDDIR = /var/run
DESTBIN = /usr/bin
DESTSBIN = /usr/sbin
DESTEXEC = /usr/libexec
DESTMAN = /usr/share/man
DESTHELP = /usr/share/misc
DESTLIB = /usr/lib
DESTINC = /usr/include
COMPINCL = compat/include
LDS =
CATEXT = 0
INSTALL_COMPAT = install
INSTALL = install
RANLIB = ranlib
AR = ar cru
MANROFF = ( tbl | nroff -man )
MANDIR = cat
PS = ps
IOT = ABRT
SHCC =
SHLD =
# (NetBSD - for details on shared library building, see shres/netbsd/INSTALL)
#uncomment next three lines to build a shared library version of libresolv
#SHRES = shres/netbsd
#SHCC = cc
#PIC = -fpic
#(Linux - on modern systems, all you need to do is rename or remove
# compat/include/sys/cdefs.h. See doc/info/Linux for more information.)
#CC = gcc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS = -DSYSV
#LIBS = -lfl
#DESTEXEC = /usr/sbin
#DESTMAN = /usr/man
#DESTHELP = /usr/lib
#CATEXT = $$$$N
#PS = ps -p
#IOT = IOT
#(CRAY)
#CDEBUG = -g
#LEX=lex
#IOT = IOT
#(DEC AXP OSF/1 Version 2.1 and earlier)
#CC = cc $(CPPFLAGS)
#CDEBUG = -g3 -O2 -Olimit 2000
#CPPFLAGS =
#LEX = lex
#LIBS = -ll -lutil
#DESTEXEC = /usr/sbin
#COMPINCL = compat/include
#INSTALL_COMPAT = install-compat
#INSTALL = installbsd
#MANDIR = man
#MANROFF = cat
#CATEXT = $$$$N
#PS = ps -p
#IOT = IOT
#(DEC AXP OSF/1 Version 3.0 and after)
#CC = cc $(CPPFLAGS) -std
#CDEBUG = -g3 -O2 -Olimit 2000
#CPPFLAGS =
#LEX = lex
#LIBS = -ll -lutil
#DESTEXEC = /usr/sbin
#COMPINCL = compat/include
#INSTALL_COMPAT = install-compat
#INSTALL = installbsd
#MANDIR = man
#MANROFF = cat
#CATEXT = $$$$N
#PS = ps -p
#IOT = IOT
#(irix4)
#CC = cc $(CPPFLAGS) -xansi -signed
#CDEBUG = -g
#CPPFLAGS = -D__STDC__ -D_BSD_SIGNALS -DSIG_FN=int
#LEX = lex
#LIBS = -ll
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTMAN = /usr/catman/local
#DESTHELP = /usr/lib
#INSTALL = bsdinstall.sh
#RANLIB = :
#PS = ps -p
#(bsdinstall.sh is in conf/)
#IOT = IOT
#(irix5)
#CC = cc $(CPPFLAGS) -xansi -signed
#CDEBUG = -g
#CPPFLAGS = -D__STDC__ -D_BSD_SIGNALS -DSIG_FN=void -D__BIT_TYPES_DEFINED__
#LEX = lex
#LIBS = -ll
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTMAN = /usr/share/catman/local
#DESTHELP = /usr/lib
#INSTALL = bsdinstall.sh
#RANLIB = :
#PS = ps -p
#(bsdinstall.sh is in conf/)
#IOT = IOT
#(sunos4.x)
#CC = /usr/bin/cc
#CDEBUG = -g
#CPPFLAGS = -DSUNOS4 -DSPRINTF_CHAR
#INDOT = in.
#XFER_INDOT = in.
#LEX = lex
#LIBS = -ll
#(add "-ldl" to LIBS if your links fail with "dlopen" problems. this indicates
# that your libc.so file is screwed up, but it's easier to fix this than that.)
#PIDDIR = /etc
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTHELP = /usr/lib
#COMPINCL = compat/include
#MANDIR = man
#CATEXT = $$$$N
#MANROFF = cat
#INSTALL_COMPAT = install-compat
#INSTALL = install
#IOT = IOT
# (for details on shared library building, see shres/sunos/INSTALL;
# note that shres/solaris/INSTALL has some good testing notes for sunos)
#uncomment next line to build a shared library version of libresolv
#SHRES = shres/sunos
# uncomment only one of the pairs of lines below
# -- if you use gcc (recommended)
# (if -fpic doesn't work, see shres/sunos/PROBLEMS)
#SHCC = gcc -DSUNSECURITY $(CPPFLAGS)
#PIC= -fpic -D_res=_res_shlib
# -- if you use Sun's cc
#SHCC = /usr/bin/cc -DSUNSECURITY $(CPPFLAGS)
#PIC = -pic -D_res=_res_shlib
#(ULTRIX/RISC - also see below)
#CC = cc $(CPPFLAGS) -Olimit 2000 -YPOSIX
#(ULTRIX, other 4.[23]bsd-alikes)
#CDEBUG = -g
#CPPFLAGS =
#LEX = lex
#LIBS = -ll
#PIDDIR = /etc
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTHELP = /usr/lib
#COMPINCL = compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = install
#DESTMAN = /usr/man
#MANDIR = man
#MANROFF = cat
#IOT = IOT
#(solaris2.x/sunos5.x)
#be careful with installation - note in particular that the system ships
#with /usr/sbin/in.named (with in.) and /usr/sbin/named-xfer (without in.)
#to emulate this naming, INDOT should be set to 'in.' while XFER_INDOT
#should be empty. also, under solaris2.x, use 'make install' at your own risk.
#don't include sys/stream.h via netinet/in.h by defining _SYS_STREAM_H.
#->and note that sun moved their nslookup to /usr/sbin for some odd reason;
# when you install this one in /usr/bin you should delete sun's or else you
# will get confusing results since you never know which nslookup you're using.
#PIDDIR = /etc
#LEX = lex
#uncomment next line for Sun C compiler
#CC = /opt/SUNWspro/bin/cc $(CPPFLAGS) -R$(DESTLIB)
#uncomment next line for GNU C compiler
#CC = gcc $(CPPFLAGS) -Xlinker -R$(DESTLIB)
#otherwise uncomment the next line and hope for the best
#CC = cc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS = -DSVR4 -D_SYS_STREAM_H $(SOLCOMPAT)
#INDOT = in.
#XFER_INDOT =
#LIBS = -ll -lnsl -lsocket
#DESTEXEC = /usr/sbin
#DESTHELP = /usr/lib
#LDS = :
#INSTALL = /usr/ucb/install
#RANLIB = :
#ARPREF = `lorder
#ARSUFF = | tsort`
#MANDIR = man
#MANROFF = cat
#CATEXT = $$$$N
#PS = ps -p
#IOT = IOT
#uncomment next line for link-compatibility with Solaris resolver library
#SOLCOMPAT = -Dgethostbyname=res_gethostbyname \
# -Dgethostbyaddr=res_gethostbyaddr -Dgetnetbyname=res_getnetbyname \
# -Dgetnetbyaddr=res_getnetbyaddr -Dsethostent=res_sethostent \
# -Dendhostent=res_endhostent -Dgethostent=res_gethostent \
# -Dsetnetent=res_setnetent -Dendnetent=res_endnetent \
# -Dgetnetent=res_getnetent
# for details on shared library building, see shres/solaris/INSTALL
#uncomment next line to build a shared library version of libresolv
#SHRES = shres/solaris
#uncomment next line to build tools and named with shared libresolv
#if you do so, you *must* define SOLCOMPAT as well (and it must be in CPPFLAGS)
#RES = $(SHRES)/libresolv.so
# uncomment only one of the triplets of lines below
# -- if you use gcc (recommended)
# (if -fpic doesn't work, see shres/solaris/ISSUES)
#SHCC = gcc -DSVR4 -D_SYS_STREAM_H
#PIC= -fpic
#SHLD = /usr/ccs/bin/ld -G
# -- if you use Sun's cc
#SHCC = /opt/SUNWspro/bin/cc -DSVR4 -D_SYS_STREAM_H
#PIC = -Kpic
#SHLD = /opt/SUNWspro/bin/cc -G
#(hpux7.0,hpux8.0,hpux9.0,)
#CC = cc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS =
#LEX = lex
#LIBS = -ll -lBSD
#PIDDIR = /etc
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTMAN = /usr/man
#DESTHELP = /usr/lib
#INSTALL = bsdinstall.sh
#RANLIB = :
#MANROFF = cat
#PS = ps -p
#(bsdinstall.sh is in conf/)
#(apollo domainos)
#CC = cc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS = -U_APOLLO_SOURCE -D_BSD_SOURCE -DSPRINTF_CHAR -D_CLASSIC_BSD_SPRINTF
#LIBS = -ll
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTHELP = /usr/lib
#DESTMAN = /usr/man
#PIDDIR = /etc
#LEX = lex
#PS = /bsd4.3/bin/ps
#IOT = IOT
#(AIX3)
#CC = bsdcc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS = -DBSD=43
#LIBS = -ll
#DESTEXEC = /usr/sbin
#INSTALL = /usr/ucb/install
#CATEXT = $$$$N
#LEX = lex
#PS = ps -p
#IOT = IOT
# (ConvexOS-10.x)
#CC = gcc $(CPPFLAGS) -g -O2 -fpcc-struct-return -fno-builtin -funsigned-char
#CDEBUG = -g
#CPPFLAGS =
#INDOT =
#LEX = flex -8 -I
#LIBS = -lfl
#PIDDIR = /usr/local/etc
#DESTBIN = /usr/local/bin
#DESTSBIN = /usr/local/bin
#DESTEXEC = /usr/local/etc
#DESTMAN = /usr/local/man
#DESTHELP = /usr/local/etc
#DESTLIB = /usr/local/lib
#DESTINC = /usr/local/include
#COMPINCL = compat/include
#LDS =
#INSTALL_COMPAT = install
#INSTALL = install
#RANLIB = ranlib
#IOT = IOT
#(NEC EWS4800 EWS-UX/V Rel4.0/Rel4.2,UX/4800)
#be careful with installation - note in particular that the system ships
#with /usr/sbin/in.named (with in.) and /usr/sbin/named-xfer (without in.)
#to emulate this naming, INDOT should be set to in. and XFER_INDOT should be
#set to empty. also, under EWS4800, use 'make install' at your own risk.
#CC = /usr/necccs/bin/cc $(CPPFLAGS)
#CC = /usr/abiccs/bin/cc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS = -DSVR4 -DUSE_POSIX
#INDOT = in.
#XFER_INDOT =
#LEX = lex
#LIBS = -ll -lnsl -lsocket
#DESTBIN = /usr/local/bin
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTHELP = /usr/local/lib
#DESTLIB = /usr/local/lib
#DESTINC = /usr/local/include
#DESTMAN = /usr/local/man
#PIDDIR = /etc
#LDS = :
#RANLIB = :
#COMPINCL = compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = /usr/ucb/install
#PS = ps -p
#IOT = IOT
# SCO Unix 3.4.2 / ODT 3.0 using gcc (the only choice for now)
#CC = gcc $(CPPFLAGS)
#CPPFLAGS = -DSYSV -DSYSV3
#CDEBUG=-O6
#LDFLAGS=-s
#INDOT=
#LEX=lex
#LIBS=-ll -lnsl_s -lsocket -lc_s
#DESTBIN=/usr/bin
#DESTSBIN = /etc
#DESTEXEC=/etc
#DESTHELP=/usr/lib
#DESTMAN=/usr/local/man
#PIDDIR = /etc
#LDS=:
#RANLIB=:
#COMPINCL=compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = scoinst
#MANROFF= (tbl | groff -man -Tascii)
#PS = ps -p
#IOT = IOT
#(UNIXWARE)
#CC = cc $(CPPFLAGS)
#CPPFLAGS = -DSVR4 -DBSD_COMP -DUSE_POSIX -D_SYS_STREAM_H
#CDEBUG = -O
#LEX = lex
#INDOT = in.
#XFER_INDOT =
#INSTALL = /usr/ucb/install
# (1.X)
#LIBS = -ll -lsocket -lnsl
# (2.X)
#LIBS = -ll -lsocket -lnsl -lgen
#DESTSBIN = /usr/sbin
#DESTEXEC = /usr/sbin
#ARPREF = `lorder
#ARSUFF = | tsort`
#CATEXT = $$$$N
#PS = ps -p
#PIDDIR = /etc/inet
#INSTALL_COMPAT = install-compat
#RANLIB = :
#LDS = :
#DESTHELP=/usr/lib
#IOT = IOT
#(NeXTstep 2.0ff, single architecture make)
#CC = cc $(CPPFLAGS) #you can use -O2 for 3.2ff
#CPPFLAGS = -Dpid_t=int
#CDEBUG = -g
#LIBS = -ll
#LEX = lex
#DESTEXEC = /usr/etc
#DESTHELP = /usr/lib
#DESTMAN = /usr/man
#DESTSBIN = /usr/etc
#PIDDIR = /etc
#MANDIR = man
#CATEXT = $$$$N
#MANROFF = cat
#INSTALL_COMPAT = install-compat
#IOT = IOT
#(NeXTstep 3.3 Multi Architecture Binaries)
#CC = cc $(CPPFLAGS) -arch i386 -arch m68k -arch hppa -arch sparc
#CDEBUG = -O2
#CPPFLAGS = -Dpid_t=int
#LDS = :
#AR = libtool -o
#RANLIB = :
#LIBS = -ll
#LEX = lex
#DESTEXEC = /usr/etc
#DESTHELP = /usr/lib
#DESTMAN = /usr/man
#DESTSBIN = /usr/etc
#PIDDIR = /etc
#MANDIR = man
#CATEXT = $$$$N
#MANROFF = cat
#INSTALL_COMPAT = install-compat
#IOT = IOT
#(Pyramid dcosx)
#CC = cc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS = -DSVR4 -DPOSIX_SIGNALS
#LEX = lex
#LIBS = -ll -lnsl -lsocket
#RANLIB = :
#PS = ps -p
#IOT = IOT
#(Sequent Dynix/PTX)
#CC = cc $(CPPFLAGS) -Wc,-pw
#CDEBUG = -g
#CPPFLAGS = -Du_int=\"unsigned int\" -DSYSV
#RANLIB = :
#LIBS = -ll -lsocket -linet -lnsl -lseq
#PIDDIR = /etc
#DESTSBIN = /usr/local/etc
#DESTEXEC = /usr/local/etc
#DESTHELP = /usr/local/lib
#LEX = lex
#PS = ps -p
#IOT = IOT
#(dgux)
#LEX = lex
#RANLIB =
#CC = gcc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS = -D__STDC__ -DDGUX
#LIBS = -ll
#DESTBIN = /usr/bin
#DESTSBIN = /usr/bin
#DESTEXEC = /usr/bin
#DESTMAN = /usr/local/man
#DESTHELP = /usr/lib
#DESTLIB = /usr/lib
#DESTINC = /usr/include
#PIDDIR = /etc
#PS = ps -p
#IOT = IOT
#(epix) Has to be compiled and loaded with -systype bsd43
# Epix 2.x.x requires /bsd43/bin in front of the PATH variable
#CC = cc $(CPPFLAGS) -signed -systype bsd43
#CDEBUG = -g
#CPPFLAGS = -DSTDIN_FILENO=0
#LEX = lex
#LIBS = -ll
#DESTSBIN = /etc/local
#DESTEXEC = /etc/local
#DESTMAN = /usr/local/man
#DESTHELP = /usr/lib
#INSTALL = install.sh
#RANLIB = :
#PS = ps -p
#IOT = IOT
#Mips RISC/os 4.52
#CC = cc $(CPPFLAGS) -systype bsd43
#CPPFLAGS = -Dpid_t=int
#CDEBUG = -O -g3 -Olimit 1000
#LEX = lex
#LIBS = -ll
#PIDDIR = /etc
#DESTBIN = /usr/local/bin
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTMAN = /usr/local/man
#DESTHELP = /usr/local/lib
#DESTLIB = /usr/local/lib
#DESTINC = /usr/local/include
#PS = ps -p
#IOT = IOT
#Esix SVR4.0.4 with gcc
# also works for Dell 2.2 and other i386 SVR4.0. Probably Unixware 1.1 as well.
#Be careful with installation - note in particular that the system ships
#with /usr/sbin/in.named (with in.) and /usr/sbin/named-xfer (without in.)
#to emulate this naming, INDOT should be set to in. and XFER_INDOT should be
#set to empty. also, use 'make install' at your own risk.
#don't include sys/stream.h via netinet/in.h by defining _SYS_STREAM_H.
#CC = gcc $(CPPFLAGS)
#CPPFLAGS = -DSVR4 -DBSD_COMP -DUSE_POSIX -D_SYS_STREAM_H
#CDEBUG = -O
#LEX = lex
#INDOT = in.
#XFER_INDOT =
#PIDDIR = /etc
#INSTALL = /usr/ucb/install
#LIBS = -ll -lsocket -lnsl
#DESTSBIN = /usr/sbin
#DESTEXEC = /usr/sbin
#LDS = @:
#RANLIB = @:
#ARPREF = `lorder
#ARSUFF = | tsort`
#CATEXT = $$$$N
#PS = ps -p
#IOT = IOT
#(ISC4.0 using GCC)
#CC = gcc -DISC -posix
#CPPFLAGS =
#CDEBUG = -g
#LEX = flex -I
#LIBS = -lbsd
#PIDDIR = /etc
#DESTBIN = /usr/bin
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTHELP = /etc
#DESTMAN = /usr/catman/l_man
#CATEXT = $$$$N
#RANLIB = @:
#LDS = @:
#PS = ps -p
#ARPREF = `lorder
#ARSUFF = | tsort`
#IOT = IOT
# AUX 3.x (I used 3.1.1)
#CC = gcc $(CPPFLAGS)
#CDEBUG = -O2
#CPPFLAGS = -D_POSIX_SOURCE -DSYSV
#LEX = lex
#LIBS = -ll -lposix -lmalloc -s
#PIDDIR = /etc
#DESTBIN = /etc
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTMAN = /usr/local/man
#DESTHELP = /etc
#COMPINCL = compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = install
#RANLIB = @:
#PS = ps -p
#IOT = IOT
#NCR System V/MLS
#use same definitions as for sunos4.x except for the following
#be careful with installation - note in particular that the system ships
#with /usr/sbin/in.named (with in.) and /usr/sbin/named-xfer (without in.)
#to emulate this naming, INDOT should be set to 'in.' while XFER_INDOT
#should be empty. also, under solaris2.x, use 'make install' at your own risk.
#don't include sys/stream.h via netinet/in.h by defining _SYS_STREAM_H.
#PIDDIR = /usr/local/lib
#LEX = lex
#CC = cc $(CPPFLAGS)
#CDEBUG = -g
#CPPFLAGS = -DSVR4 -D_SYS_STREAM_H -Hnocopyr -DPOSIX_SIGNALS -DNCR -w
#INDOT = in.
#XFER_INDOT =
#LIBS = -ll -lnsl -lsocket
#DESTEXEC = /usr/local/bin
#LDS = :
#RANLIB = :
#ARPREF = `lorder
#ARSUFF = | tsort`
#CATEXT = $$$$N
#PS = ps -p
#IOT = IOT
####################################################################
############ no user servicable parts beyond this point ############
####################################################################
MANARGS = \
"SHELL=${SHELL}" "INDOT=${INDOT}" "XFER_INDOT=${XFER_INDOT}" \
"DESTDIR=${DESTDIR}" "DESTMAN=${DESTMAN}" "INSTALL=${INSTALL}" \
CATEXT='${CATEXT}' MANDIR='${MANDIR}' MANROFF='${MANROFF}'
MARGS = "VER=${VER}" "CC=${CC}" "CDEBUG=${CDEBUG}" "LIBS=${LIBS}" \
"INCL=../${INCL}" "RES=../${RES}" "LEX=${LEX}" "LDFLAGS=${LDFLAGS}" \
"PIDDIR=${PIDDIR}" "DESTBIN=${DESTBIN}" "DESTSBIN=${DESTSBIN}" \
"DESTEXEC=${DESTEXEC}" "COMPINCL=../${COMPINCL}" \
"COMPLIB=../${COMPLIB}" "DESTLIB=${DESTLIB}" "DESTINC=${DESTINC}" \
"DESTHELP=${DESTHELP}" "PIC=${PIC}" "SHCC=${SHCC}" "SHLD=${SHLD}" \
"AR=${AR}" "RANLIB=${RANLIB}" "LDS=${LDS}" 'ARPREF=${ARPREF}' \
'ARSUFF=${ARSUFF}' $(MANARGS) PS="${PS}" "IOT=${IOT}" \
"CPPFLAGS=${CPPFLAGS}"
MACHINE = native
DST = $(MACHINE).b
SRC = ..
SUBDIRS = res $(SHRES) include compat named tools man
all:: FRC
all clean depend:: FRC
@for x in $(SUBDIRS); do \
(cd $$x; pwd; $(MAKE) $(MARGS) $@); \
done
$(SUBDIRS):: FRC
@for x in $@; do \
(cd $$x; pwd; $(MAKE) $(MARGS) all); \
done
clean:: FRC
-test -d doc/bog && (cd doc/bog; pwd; $(MAKE) $(MARGS) $@)
(cd conf; rm -f *~ *.CKP *.BAK *.orig)
rm -f *~ *.CKP *.BAK *.orig
depend:: FRC
mkdirs: FRC
-set +e; for x in $(DESTBIN) $(DESTSBIN) $(DESTEXEC) \
$(DESTMAN) $(DESTHELP) $(DESTLIB) $(DESTINC); do \
test -d $$x || mkdir -p $$x; \
done
install: FRC
@for x in $(SUBDIRS); do \
y=`if [ "X$$x" = "Xcompat" ]; \
then echo ${INSTALL_COMPAT}; \
else echo install; \
fi`; \
(cd $$x; pwd; $(MAKE) $(MARGS) $$y); \
done
D = OPTIONS master bin doc named CHANGES README compat include res \
Makefile TODO conf man tools
copyright: FRC
bin/copyright <conf/copyright `find ${D} -type f ! -name '*,v' -print`
tar: FRC
( cd doc/bog; make file.psf file.lst )
find * '(' -name RCS -o -name obj -o -name .depend ')' \
-print >/tmp/bindXf
gnutar -c -z -f ../bind-${VER}.tar.gz -X /tmp/bindXf .
rm -f /tmp/bindXf
links: $(DST)
$(DST): FRC
@set -ex; mkdir $(DST); cd $(DST); \
ln -s $(SRC) SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
( mkdir include; cd include; ln -s ../SRC/include SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/*.h SRC/arpa .; \
); \
( mkdir conf; cd conf; ln -s ../SRC/conf SRC; \
ln -s SRC/*.h .; \
); \
( mkdir tools; cd tools; ln -s ../SRC/tools SRC; \
ln -s SRC/*.[ch] .; \
cp SRC/Makefile .; chmod +w Makefile; \
( mkdir nslookup; cd nslookup; ln -s ../SRC/nslookup SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/[a-z]* .; \
); \
); \
( mkdir res; cd res; ln -s ../SRC/res SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/*.[ch] .; \
); \
( mkdir compat; cd compat; ln -s ../SRC/compat SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/include .; \
( mkdir lib; cd lib; ln -s ../SRC/lib SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/*.c .; \
); \
); \
( mkdir named; cd named; ln -s ../SRC/named SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/*.[ch] SRC/*.sh .; \
); \
( mkdir shres; cd shres; ln -s ../SRC/shres SRC; \
( mkdir sunos; cd sunos; ln -s ../../SRC/shres/sunos SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/makeshlib SRC/*.patch* .; \
); \
( mkdir netbsd; cd netbsd; ln -s ../../SRC/shres/netbsd SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/makeshlib SRC/lorder-sparc.sed SRC/shlibname.awk .; \
); \
( mkdir solaris; cd solaris; ln -s ../../SRC/shres/solaris SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
); \
); \
( mkdir man; cd man; ln -s ../SRC/man SRC; \
cp SRC/Makefile .; chmod +w Makefile; \
ln -s SRC/*.[0-9] .; \
)
gcc2-lint: FRC
@-make CC="gcc2 -Wall -Wno-comment -Wno-parentheses -Dlint" all \
2>&1 | grep '\.[ch]:[0-9]'
FRC:

412
contrib/bind/OPTIONS Normal file
View File

@ -0,0 +1,412 @@
OPTIONS
Original: Paul Vixie, 28Mar92
Revised: $Id: OPTIONS,v 8.6 1996/05/21 07:32:31 vixie Exp $
Options available in this version of BIND are controlled by conf/options.h,
rather than by $(DEFS) in the Makefile. The options are:
DEBUG (origin: U C Berkeley)
enables the -d command line option, and allows SIGUSR1 to increment
and SIGUSR2 to clear the internal variable "debug", which in turn controls
hundreds of fprintf()'s out to /usr/tmp/named.run.
you probably want this. it makes the binary bigger but not slower (or
at least not much slower), but SIGUSR[12] are the only way you'll track down
misconfigured name servers that hose you down with billions of bogus requests.
you may need this, it is on by default.
ALLOW_T_UNSPEC (origin: MIT Project Athena)
enables the "unspec" RR type for ancient Athena software that does not
know about TXT RR's.
you probably do not care about this, it is off by default.
ALLOW_UPDATES (origin: Mike Schwartz, University of Washington)
enables "dynamic updates", described in "doc/DynamicUpdate". this lets
you update named's in-memory database on the fly if you have the right client.
there is absolutely no security around this; if you enable it, anyone who can
reach your server can update your database.
this code doesn't compile any more and will be removed shortly.
INVQ (origin: U C Berkeley, with #ifdef's by Paul Vixie)
enables "inverse queries", which in all of the internet only one
client ever uses: ancient nslookup. if you build named with INVQ defined,
you get the time-honored behaviour of supporting this whole class of queries
for no real purpose other than to waste a few hundred kilobytes of your
memory and about 3% of named's total CPU time. if you build with INVQ
undefined, old nslookups will not be able to reach your server in their
startup phase, and you will have to use the "server" command after it fails
over to some other server, or use "nslookup - 0" to get in from the shell.
if you need to support old nslookups try "options fake-iquery"
instead of enabling this option.
you probably do not want this.
DSTORAGE (origin: U C Berkeley, with #ifdef's by Paul Vixie)
enables a malloc-debugger that checks for overruns on both ends of
each allocated block of memory. used when debugging since C has no bounds
or type checking.
you probably do not want this, it is off by default.
DMALLOC (origin: Paul Vixie of Digital)
enables a malloc-debugger that traces all allocated blocks of memory
such that SIGIOT's output (see STATS option) includes a list of all mallocs
in the program, how many times each has been called, how many blocks of memory
allocated by that malloc are not yet free, and how many bytes they use up.
under each one will be a list of each free/realloc that has deallocated a block
of that malloc's memory, and how many times it has done so.
this is extremely helpful for finding memory leaks. as such, you
probably do not want this unless you are debugging named.
you probably do not need this, it is off by default.
XFRNETS (origin: Paul Vixie of Digital)
enables the "xfrnets" command in named.boot. this has the same
syntax as "forwarders" and "sortlist" -- that is, a list of dotted quads.
each one is a network (16.0.0.0 and 130.180.0.0 are examples) or a host.
if you put any xfrnets commands into your named.boot, then zone transfers
will only be honored if they come from inside one of the specified
networks. this is very useful if you want to keep people outside from
being able to trivially map your entire network, but it doesn't stop them
from iterating so it's more annoying than secure.
this feature was once called "tcplist" out of ignorance on my part,
but with advice from phil almquist i decided to rename it "xfrnets" and make
it only control zone transfers -- previously it controlled all TCP connections
which made certain TCP-only resolvers unable to use our servers. the "tcplist"
syntax still works; it is a synonym for "xfrnets".
it is also nice if you want to keep the outside world from making your
nameserver fork and swap trying to do unauthorized zone transfers. if you have
large zone files or use BIND for TXT records you will find this useful.
you probably want this, it is on by default.
PID_FIX (origin: Don Lewis of Harris)
tells named that if it starts up but can't keep going because another
nameserver is already running (and sitting on the server port), it should
put the /etc/named.pid (/var/run/named.pid) file back the way it found it.
you probably want this, it is on by default.
FWD_LOOP (origin: Don Lewis of Harris)
tells named that if you list any of your own IP addresses in a
"forwarders" command in your named.boot file, you should be scolded.
you probably want this, it is on by default.
NO_GLUE (origin: Don Lewis of Harris, and Andrew Partan of UUNET)
tells named-xfer that incoming zone transfers should be checked
for "glue" that comes from a zone outside the zone being transfered, and
comment this garbage out in the zone file so that when named reads in the
zone file after named-xfer exits, the garbage will not be entered into the
memory-resident database.
also tells named that when it is performing an outgoing zone
transfer, it should not send any of these "glue" records.
you definitely want this, it is on by default.
BOGUSNS (origin: Piet Beertema of EUNet)
enables the "bogusns" command in named.boot. this has the same
syntax as forwarders and sortlist. any NS RR's that come in whose addresses
are on the list of "bogusns" addresses will be ignored. this is the last
resort when someone is bogusly advertising themselves as a root server.
just in case, though you won't use it often.
you probably want this, it is on by default.
QRYLOG (origin: Bryan Beecher of UMich)
enables "query logging", such that SIGWINCH toggles tracing of all
incoming queries. the trace is sent to syslog, and is huge, but when you
need this you will need it bad and it does not slow named down or make it
larger.
If you define QRYLOG you may also start up named in query logging
mode by using the -q flag. If you do so you will probably want to analyze
the logs produced, the dnsstats and lamers scrips (in the contrib/umich
and contrib/lamers directories) will do it for you.
you probably want this, it is on by default.
LOGFAC (origin: various people)
If you start up named with the -q flag you will be logging
large amounts of data, and probably will not want them logged to the
default logging facility, which is LOG_DAEMON. You will want to
redefine LOGFAC, presumably to LOC_LOCALn (0 <= n <= 7). Remember to
modify /etc/syslog.conf appropriately.
This only works on a system with a modern syslogd.
as such, it is on by default.
YPKLUDGE (origin: Piet Beertema of EUNet)
certain versions of NIS/YP are capable of using the DNS for names
that cannot be found in the YP servers. of these, certain versions can't
tell the difference between a dotted quad and a domain name, and they send
queries to the DNS for dotted quads as if they were domain names. if your
named does not do anything special with these queries, they will end up
getting forwarded to other servers, effectively hosing all of you down with
endless useless network traffic. YPKLUDGE enables some checking in named
that lets it catch these bogus queries and send back immediate errors.
If you run "ypserv -i" you definitely want this, as a malconfigured
NIS server can cause DNS "flood" queries otherwise. Trust me.
this is off by default.
TRACEROOT (origin: pma@cnd.hp.com and Bryan Beecher of UMich)
enables some checking in named for bogus root nameservers. This
code has been in use at U-M for years, so it is pretty well tested, plus we
have never been burned by the "bogus root NS scares" that have plagued the
DNS off and on.
this feature people will very much want to use, it is on by default.
LOCALDOM (origin: Berkeley)
if set, the "domain" directive is recognized in the named.boot file.
this causes us to retry queries with the specified domain appended to the
name if the first lookup fails. this is a very bad idea since a given name
server will often be used by clients in more than one domain -- a name server
should _not_ make any presumptions as to the "home domain" of a requestor.
you almost certainly do not want this, it is off by default.
SLAVE_FORWARD (origin: pma@sdd.hp.com)
if set, "slave" servers behave in an arguably more-correct way. this
is an experimental addition to BIND 4.9 that causes slaves to time out queries
in 60/N seconds where N is the number of forwarders defined. previously a
query would time out almost immediately, which caused a lot of unnecessary
network traffic.
you probably want this, it is on by default.
FORCED_RELOAD (origin: pma@sdd.hp.com)
if set, then when a HUP signal is received, all secondary zones are
scheduled for serial-number comparison with the primaries. this has the effect
that if you HUP your server, it will refresh any zones which have changed,
even if those zones' refresh times have not been reached.
you probably want this, it is on by default.
WANT_PIDFILE (origin: berkeley, parameterized by arc@sgi)
if set, a file called named.pid will be created in /etc or /var/run
when the name server has started. this file can be used to send signals to
BIND, as in "kill -HUP `cat /etc/named.pid`".
unless you are only on an SGI (where killall(1M) makes the pid file
unnecessary);
you probably want this, it is on by default.
DOTTED_SERIAL (origin: berkeley; parameterized by vixie)
if set, allows a somewhat arcane n.m syntax in the serial number
field of an SOA. this is officially deprecated for 4.9; you should use
straight integer values and find an encoding that does not depend on
scaled-integer pseudodecimals. i suggest YYYYMMDDnn where YYYY is the
four-digit year, MM is the two-digit month, DD is the two-digit day-of-month,
and nn is a daily version number in case you change your serial number more
than once in a day. this encoding will overflow in the year 4294 gregorian.
you almost certainly do not want this, but if you have old zone files
lying around and you don't want to think your way through converting their
serial numbers, this deprecated behaviour is available.
graciously, it is on by default.
SENSIBLE_DOTS (origin: kagotani@cs.titech.ac.jp; parameterized by vixie)
if set, changes the semantics of an "n.m" serial number from
n*10^(3+int(0.9+log10(m))) + m
to
n*10000+m
if you are using DOTTED_SERIAL in spite of its deprecated status,
and you are interested in a more predictable and sensible interpretation of
dotted numbers, then you probably want this.
it is off by default.
VALIDATE (origin: USC/ISI)
enables a validation procedure to provide some security in an
otherwise insecure environment. Any RRs are accepted from a server only if
the server is authoritative over that domain. We consider a server
authoritative (for validation purposes) for even the sub-domains that it has
delegated to others. RRs are validated against the data we have in cache
already. Invalid records are neither cached nor returned.
it is off by default because it is hopeless, and the code will all
be ripped out of BIND in the near future.
NCACHE (origin: USC/ISI)
enables negative caching. We cache only authoritative NXDOMAIN or
authoritative NOERROR with zero RR count. Non-authoritative NXDOMAIN answers
now contain NS records in the authority section. Non-authoritative NOERROR
responses have no authority or additional records to differentiate them from
referrals. They are cached for NTTL secs (currently 10 minutes) and are timed
out when the ttl expires.
you probably want this, it is on by default.
RESOLVSORT (origin: marka@syd.dms.csiro.au)
enable sorting of addresses returned by gethostbyname. Sorting order
is specified by address/netmask pairs. This enables a host to override the
sortlist specified in the nameserver.
you probably want this, it is on by default.
STUBS (origin: marka@syd.dms.csiro.au)
enable transfer and loading of NS records only for a zone.
still experimental. it won't hurt to enable it, but it may not work perfectly
so using it could lead to some confusion.
you probably don't care, it is on by default.
SUNSECURITY (origin: rossc@ucc.su.oz.au)
enable checking of PTR records in gethostbyaddr() to detect
spoofing. Forced on SunOS 4 shared library as rlogin etc. depend on this.
you should probably not set this by hand.
SECURE_ZONES (origin: gshapiro@guest.wpi.edu)
enables support for secure zones. This restricts access to
information in the zone according to the information found in the
secure_zone TXT RR found in the zone. If none is found, the zone is
world-readable. For information on the format of the secure_zone TXT
RR, see the Name Server Operations Guide for BIND.
you probably want this, it is on by default.
ROUND_ROBIN (origin: Marshall Rose of TPC.INT)
if set, causes the databuf list in a namebuf to be rotated by one
slot after each access to it. this has the effect that if multiple RR's
of a given type are present, they will be given in "round robin" order
instead of always being given in the same order.
you probably want this, it is on by default.
ADDAUTH (origin: marka@syd.dms.csiro.au)
if set, cause NS and glue A records to be returned with authoritative
answers. this causes slightly larger replies but less DNS traffic overall.
unless you have Mac's with an older version of Mac/TCP;
you probably want this, it is on by default.
RFC1535 (origin: paul@vix.com)
if set, the resolver's default "search" list will be just the entire
"domain" name rather than the sliding window it had before 4.9.2. this will
make the default search list shorter, so folks who are saying "domain a.b.c"
and relying on the implicit "search a.b.c a.b c" will miss "a.b" and "c".
this option is on for compatibility with RFC 1535.
you should NOT turn it off, it is on by default.
GEN_AXFR (origin: mark@comp.vuw.ac.nz, tytso@ATHENA.MIT.EDU, gdmr@dcs.ed.ac.uk)
if set, allows specification of zones in classes other than "IN" in
the named.boot file. Allows an optional "/class" on the "primary" and
"secondary" directives. Also fixes zone transfers so only data in the class
requested is transfered.
you probably want this, it is on by default.
DATUMREFCNT (origin: mark andrews)
you want this. it will not be optional in future releases.
LAME_DELEGATION (origin: don lewis; reworked by bryan beecher and don lewis)
this will detect the condition where some other server has told you
that a given set of servers is authoritative for some domain, and at least
one of those "delegated" servers disagrees (i.e., answers non-authoritatively).
you probably want this, it is on by default.
LAME_LOGGING (origin: don lewis)
enable logging of lame delegations and set the log level
you may want this, it is on by default.
RETURNSOA (origin: mark andrews)
This allows negative caching to work. Without this, older
pre-4.9.3 nameservers will not accept -ve cached anwsers. We actually
store the SOA record from the authority section rather that what was
requested because it is the existence of the NXDOMAIN that matters not
the type of data. The zone of the SOA record is tagged to the end of
the SOA record to allow it to be reconstructed.
You probably DO NOT WANT THIS, it's experimental and dangerous.
it is off by default.
CLEANCACHE (origin: mark andrews)
Bind consumes memory without bound without this option. This
patch allows bind to periodically remove any stale entries in the
cache. Bind's memory usage should stabilize after approximately 1 day of
operation, as most TTL's are <= 1 day. Without this option stale entries
are only removed when they are looked up.
You probably want this, it is on by default.
PURGE_ZONE (origin: mark andrews)
Various junk below a zone tends to hang around and corrupt future
zone data if a zone grows deeper. PURGE_ZONE will remove all traces of or
data which could be part of zone before loading a new one.
You probably want this, it is on by default.
STATS (origin: Paul Vixie)
Named's internal statistics can take a fair amount of memory and
if you aren't interested in looking at these numbers you should disable
the feature. Future versions may require this.
You probably want this, it is on by default.
RENICE (origin: bp@deins.informatik.uni-dortmund.de)
if set, the process priority of the AXFR subprocesses is changed to
"normal". If you are planning to raise the priority of the main nameserver
process, you will use this.
You probably want this, it is on by default.
GETSER_LOGGING (origin: Paul Vixie)
if set, errors that occur during the fetch of serial numbers for zone
transfer consideration will be syslog()'d. this can lead to a lot of logging,
but is very helpful if you don't know why a zone isn't transfering.
You may not want this, but it is on by default.
SHORT_FNAMES (origin: pma@sdd.hp.com)
on systems whose file names can only be 14 characters long, the temp
files created by named-xfer need to be constructed somewhat differently. this
should probably become the default since it is harmless.
you probably don't care one way or the other, it is off by default.
XSTATS (origin: Benoit.Grange@inria.fr)
if set, the name server keeps more STATS about requests
received, and logs to syslog total counters from time to time. If you
aren't interested in looking at these numbers you should not enable
the feature. Requires STATS.
You may want this, but it is off by default.
BIND_NOTIFY (origin: paul@vix.com)
experimental at this time; an internet draft is circulating. this
option informs slaves ("secondary" servers in BIND's erroneous terminology)
instantly when the master (primary, or another slave) loads a new zone. it
works fine and seems to cause no problems with slaves that don't support it,
but it does not implement the current internet draft (it lacks some necessary
delays) and causes a lot of extra syslog traffic, especially at startup. if
you don't mind running code that will absolutely NOT be compatible with the
eventual standard when the RFC is released, go ahead and turn this on.
vendors should not enable this in versions shipped to customers.
You will want this when it becomes compliant, it is off by default.
LOC_RR (origin: ckd@kei.com)
incorporates support for the (RFC 1876) LOC RR type.
You may want this, it is on by default.
SORT_RESPONSE (legacy)
should responses be sorted in what the server considers an optimal
order for the client? this is on by default but it does very little good.
## ++Copyright++ 1989
## -
## Copyright (c) 1989
## 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.
## -
## Portions Copyright (c) 1993 by Digital Equipment Corporation.
##
## Permission to use, copy, modify, and distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
## copyright notice and this permission notice appear in all copies, and that
## the name of Digital Equipment Corporation not be used in advertising or
## publicity pertaining to distribution of the document or software without
## specific, written prior permission.
##
## THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
## WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
## OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
## CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
## PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
## -
## --Copyright--

483
contrib/bind/README Normal file
View File

@ -0,0 +1,483 @@
The official way to get BIND is: ftp ftp.vix.com
cd pub/bind/release
binary
get bind.tar.gz
The official mailing lists are: bind-users@vix.com - users/admins
(use *-request@* for admin mail) bind-workers@vix.com - developers
The official Usenet newsgroups are: comp.protocols.tcp-ip.domains
BIND is currently sponsored by: The Internet Software Consortium
(send to <info@isc.org> for details.)
----- 4.9.3 BETA33 - December, 1995 - paul@vix.com
Take a look around in doc/misc/ and contrib/. Reread INSTALL. Have fun.
----- 4.9.3 BETA11, BETA12 release - December, 1994 - paul@vix.com
If you maintain a BSD or are otherwise running a 4.4BSD-based system and want
to integrate BIND into it, check out BSD/README.
Read the top of CHANGES for interesting stuff.
Don't forget to purge all your secondary zone files before upgrading to this
BIND if your existing one came from a vendor.
The NOTIFY feature is turned off by default, but it's really cool and you
should consider turning it on if you are willing to risk having it not work
after the RFC process is complete (if the protocol has to change at all.)
It already does not conform to the draft protocol so you should consider it
"experimental" even if it happens to work fine.
----- 4.9.3 BETA10 release - August, 1994 - paul@vix.com
I recommend reading this ENTIRE FILE before you attempt to build or use BIND.
However, you can get started quickly by scanning down this file for "QUICK" in
the right margin and just reading those sections. You can also look at the
INSTALL file. You should look at doc/info/* if you have trouble building.
There are at least two known bugs in this BIND:
1. if you have two authoritative zones (primary or secondary) where
one is a subzone of the other, e.g.,
primary pa.dec.com z/pa.dec.com
primary dec.com z/dec.com
and you remove or comment out the subzone (pa.dec.com in our example)
and SIGHUP named, the delegation and other RR's at "pa.dec.com" will
be missing from your cache. to avoid this, you should "named.restart"
rather than SIGHUP ("named.reload") when making changes of this kind.
2. the /HS qualifier doesn't work on "cache" directives. you will have
to put your hesiod root information into your main "root.cache" file.
Also, you may find that your utilities will not link with this -lresolv
unless you also install lib44bsd.a and link with -lresolv -l44bsd. This
is because older systems do not include inet_aton() and other functions.
----- 4.9.3 BETA6 release - June, 1994 - paul@vix.com
Several private beta test releases have come and gone, and we've fixed a
number of things. See CHANGES for details.
There is a new Sun Shared Library update mechanism in place, and it works
quite well. See shres/*.
Versions of NSLOOKUP up through BIND 4.8.3's used IQUERY to ask the local
server for information about the server's own name. I assume that this was
done in a "what the heck, nothing uses these, how can we contrive a need?"
sort of spirit. I removed this code as of BIND 4.9's NSLOOKUP and had it
use the standard gethostbyaddr() mechanisms (which depend on normal queries
of PTR data). Disabling INVQ and putting "options fake-iquery" in the boot
file will cause IQUERY to be answered bogusly but in a way that old nslookup
programs won't trip on. INVQ is disabled by default in conf/options.h.
----- 4.9.3 BETA2 release - June, 1994 - paul@vix.com
News flash! BIND development is now funded by the Internet Software Consortium.
Look at CHANGES to see what's new. Check out doc/misc to see some interesting
papers from Purdue (and Bell Labs, if we're lucky) on DNS security that
motivated many of the security-related changes present in this release.
Check out shres/Makefile for SunOS4 shared library support.
INVQ now defaults to "undef". See OPTIONS and conf/options.h.
ALLOW_UPDATES is no longer available, and will be removed next release.
You should look hard at the SENSIBLE_DOTS option and convert your serial
numbers either to "sensible" ones or ones without dots (YYYYMMDD## preferred).
SENSIBLE_DOTS will be the default in the next release.
NCACHE and VALIDATE are _working_ now.
Read the BOG! It's been updated since the previous release.
If you are a vendor and are including some or all of this code in your product,
please drop me a line to let me know. I field a lot of questions about BIND
and it is helpful for me to know which vendor releases contain which versions
of BIND. It's also helpful for me to have contacts within the engineering
groups of the various vendors, since when I find a heinous bug I can let you
know.
----- 4.9.2 FINAL (940221) release - February, 1994 - paul@vix.com
If you look at the last entry in TODO, you'll see that there are a lot
of things in the queue waiting to go in. However, I'm holding the line
so that 4.9.2-FINAL can be the same as what goes out with 4.4BSD-Lite.
I expect to open 4.9.3-ALPHA fairly soon, with patches comprising new
work; 4.9.2-FINAL will have patches released for it only to correct bugs.
The official way to get BIND 4.9.2 is: ftp gatekeeper.dec.com OUT OF DATE!!!
cd pub/misc/vixie OUT OF DATE!!!
binary OUT OF DATE!!!
get bind-940221.tar.gz OUT OF DATE!!!
or: get bind-940221.tar.Z OUT OF DATE!!!
The official mailing lists are: bind-users@vix.com - users/admins
(use *-request for admin mail) bind-workers@vix.com - developers
The official Usenet newsgroups are: comp.protocols.tcp-ip.domains
My official e-mail address is: paul@vix.com
----- 4.9.2 BETA5 (931205) release - December, 1993 - paul@vix.com
no comments; see CHANGES file.
----- 4.9.2 BETA4 (931104) release - November, 1993 - paul@vix.com
All reported portability problems have been fixed. All core dumps have
had changes made for them and we are ready to have them tested again. As
usual, I am running this in production on my own zones and I am rather
confident in it. Note, again, that this is a BETA release and you should
not put it up for anon-ftp or otherwise republish it in any way.
----- 4.9.2 ALPHA2 (930908) release - September, 1993 - paul@vix.com
4.9.2 has fixes for most of the bugs that smb@bellcore's white paper talked
about, and CERT is going to be knocking on vendor's doors to get it shipped
with as many operating systems as possible.
----- 4.9.2 ALPHA1 (930506) release - July, 1993 - Paul Vixie <paul@vix.com>
I don't work for DEC any more, so note the new e-mail address. The old
<bind-4.9@pa.dec.com> list has been moved to <bind-workers@vix.com>; if
you intend to help hack BIND and you want to be advised of alpha-testing
releases, send mail to <bind-workers-request@vix.com> and ask to be added
to the list.
Note that 4.9.1 was an interrim, nonpublished release intended to catch
the porting changes needed for 4.4BSD. It never really existed separately.
----- 4.9 release - April, 1993 - Paul Vixie <vixie@pa.dec.com>
For information on what's new in 4.9, see OPTIONS and CHANGES. Also note
that the man page for named(8) in man/named.8, and the entire Bind Operations
Guide in doc/BOG/*, has been updated for 4.9. Both make excellent reading.
Those of you who are thinking of adding features should first read TODO to
see if someone else has already indicated an intention to work on the same
thing. If your feature is significant you should ask <bind-workers@vix.com>
before you hack, if for no other reason than to tell other maintainers to
expect a patch soon.
Note that the resolver has a number of routines that may already be present
on your system. Efforts have been made to avoid generating code for them on
systems where they aren't needed; don't worry about them if they're
generated unneccessarily since the linker will sort things out.
This software is protected under the U C Regents' copyright. Changes made
by or released through Digital Equipment Corporation are subject to a
subsidiary copyright. The entire copyright is as follows:
++Copyright++ 1989
-
Copyright (c) 1989
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.
-
Portions Copyright (c) 1993 by Digital Equipment Corporation.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies, and that
the name of Digital Equipment Corporation not be used in advertising or
publicity pertaining to distribution of the document or software without
specific, written prior permission.
THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
-
--Copyright--
To build this: QUICK
(on SUNOS, use the BSD build environment or you will
get the wrong definition for O_NDELAY)
look at conf/options.h and edit to your tastes.
The OPTIONS file here in this directory will help you
figure out what to do.
You should also look at the Makefile to select the proper set
of definitions depending on whether you are using Ultrix,
SunOS, and other 4.[23] BSD-alikes or using BSD 4.4, BSD/386,
and other net2-alikes.
"make links" will build a shadow source tree full
of symbolic links. the default name of this tree
is "./native.b", but you can override it by setting
the DST variable on the "make" command line, as in:
make DST=vax.b SRC=..
if your DST is not a subdir of "here", you will need to
override the SRC variable's default (which is ".."),
as in:
make DST=/tmp/vax.b SRC=`pwd`
note that the DST directory must be nonexistent at
the time that you run "make links".
after "make links", you can cd to the new build
directory, check the settings in the Makefile, and
run "make depend". if you aren't using "make links"
(shame on you), just use "make depend" from "here".
"make depend" may fail on your system; if so, look in
the bin/ directory and find a mkdep that does in fact
work for you.
if you skip the "make depend" phase, or after you run it,
you can do "make all" (from the build directory if you
used "make links" or from "here" if you're just hacking
around). you will get the following new things out of it:
res/libresolv.a
compat/lib/lib44bsd.a (optional)
include/{netdb,resolv}.h
include/arpa/{inet,nameser}.h
compat/include/sys/{cdefs,bitypes}.h
tools/{nstest,nsquery,dig,host}
tools/nslookup/nslookup
named/named
named/named-xfer
if you have trouble with "make all", check conf/portability.h
for things that your system needs, or doesn't need, or whatever.
it is preferable to add #ifdef's to conf/portability.h than to
add them anywhere else.
from the build directory (or "here" if you didn't
use "make links"), you can try "make -n install"
which will tell you what will be installed. it might
actually be right; however, what you will probably have to
do is copy the above files into the places you want
run them from. the other files you will need are:
tools/nslookup/nslookup.help
named/named.restart
named/named.reload
resolver library notes: to install it, either put the .a
file into /usr/local/lib or /usr/lib (if you use -lresolv
on all the links of your networking software), or use "ar"
to put all res/*.o directly into your /lib/libc.a file.
either way you will want to copy the include files
(including those from compat/include/sys) over to
/usr/include (or /usr/local/include if you're willing to
use -I/usr/local/include on all your network-software
compiles). something like this:
cp res/libresolv.a /usr/lib; ranlib /usr/lib/libresolv.a
tar chf - include | (cd /usr/include; tar xvpf -)
cp compat/include/sys/*.h /usr/include/sys
installing the man pages is left as an exercise for the
reader. there are just too many different versions of
"man" floating around for me to be able to help you figure
out what to do for the one you happen to be using.
WARNING: If you were running a BIND 4.8.3 or earlier based
named you should remove all cache files prior to starting
named. It would generally be a good idea to remove all cache
files regardless when installing a new version. The creadability
code depends upon the cache files having been made with the
latest named-xfer for correct operation.
(special compilation-related warning about SunOS systems:)
From: Tom Limoncelli
To: vixie (Paul A Vixie)
Date: Mon, 11 Jan 93 11:30:39 EST
Sun compiler v2.0.1 hates bind4.9 code.
Sun has 3 compilers:
/usr/ucb/cc -- the default for SunOS 4.1.[123],
dropped in Solaris 2.0.
/usr/lang/cc -- the "unbundled" cc v1.0
(pretty good, but expensive), only
generates code for SunOS 4.1.x.
/usr/lang/cc.2.0.1 -- the latest "unbundled" cc,
for when they stop shipping the
bundled version altogether. This
generates code for SunOS 4.1.x and Solaris 2.x.
Sun's 2.0.1 C compiler (the one with the floating licenses) for SunOS
4.1.x outputs a HUGE number of warnings. They can be ignored.
--------------------- (4.8.3 README -- mostly obsolete now)
This directory contains all the info and sources
for the Berkeley Internet Name Domain server.
You should read and understand these directions before starting
to install the libraries and nameserver. Some of these steps
replace existing source and binary files; you should make backups
of all existing files before you begin this installation.
Two installation procedures are described. The first is for 4.3BSD
and other similar systems that are already configured to use earlier
versions of the nameserver, and which have the new version of <netdb.h>
(containing a h_addr_list field in the hostent structure). The second
procedure is for 4.2BSD and derived systems. This procedure requires
more decisions to be made, and may have to be varied due to system
or operation constraints.
The subdirectories and their contents are:
bin - shell scripts used by current Berkeley makefiles
man - manual pages & documentation
doc - copy of Bind Operations Guide, and other documents
include - include files to go in /usr/include
named - name server sources
res - source for C library resolver routines (and other libc additions)
(may be used as separate library, resolv.a)
conf/master - Sample data files
tools - some test programs
Here is how to install the name server on 4.3BSD:
0) cp bin/mkdep.append /usr/ucb/mkdep
cp bin/manroff /usr/man/manroff
1) cp include/arpa/nameser.h /usr/include/arpa
2) cp include/*.h /usr/include
3) cp man/*.1 /usr/man/manl
cp man/*.3 /usr/man/man3
cp man/*.5 /usr/man/man5
cp man/*.7 /usr/man/man7
cp man/*.8 /usr/man/man8
4) NOTE: Don't install the Makefiles on 4.3 Tahoe Release
cp res/{res*.c,herror.c} /usr/src/lib/libc/net
cp res/Makefile.libc.net /usr/src/lib/libc/net/Makefile
cp res/strcasecmp.c /usr/src/lib/libc/gen
cp res/strpbrk.c /usr/src/lib/libc/compat-sys5
cp res/named/{*.c,Makefile} /usr/src/lib/libc/net/named
5) add strcasecmp.[co] to the Makefile in /usr/src/lib/libc/gen
6) add strpbrk.[co] to the Makefile in /usr/src/lib/libc/compat-sys5
7) rebuild and install /lib/libc.a.
8) edit named/pathnames.h to correpond with your system's configuration
9) cd named; make depend; make all; make install
10) cd tools/nslookup; make nslookup; make install
11) create the master files (samples in conf/master/*)
12) edit /etc/rc.local to include:
if [ -f /etc/named ]; then
/etc/named; echo -n ' named' >/dev/console
fi
13) recompile network client and server programs that use gethostbyname, etc.
Here is how to install the name server on 4.2BSD or similar systems.
First, a few notes on the choices that must be made.
Rather than building libresolv.a, you may wish to integrate the resolver
routines into /lib/libc.a. This is recommended to make it easy to recompile
network programs once named is running. This procedure may require hand-
tayloring on some systems.
You will have to choose a version of mkdep from the bin directory
that will work on your system:
If you've modified make(1) to use .depend files as described
in the current sendmail distribution, use mkdep; otherwise,
if you have the 4.3BSD cc -M option, use mkdep.append; on ultrix,
use mkdep.ultrix (uses cc -Em); otherwise, use mkdep.old.compiler.
The mkdep script is used by "make depend" to regenerate Makefile dependency
lists.
You will need to chose a version of netdb.h. First, check /usr/include/netdb.h
on your system. If the hostent structure has a h_addr_list entry, you can
probably use your existing netdb.h or the one in include/netdb.h.
If the existing netdb.h in /usr/include does not have a h_addr_list field,
you will have to decide whether to update to the 4.3BSD format of the hostent
structure. This is the best approach, but cannot be used unless you plan
to upgrade entirely: if you use the new structure in /usr/include/resolv.h,
you must recompile everything that uses the hostent structure, including
the rest of the C library and all networking programs, without using
any pre-existing object files. If this isn't possible or desirable,
and /usr/include/netdb.h doesn't have an h_addr_list line, use
include/netdb.h.4.2 instead of netdb.h. The other version of netdb.h
(include/netdb.h.4.2.compat) may be used instead of include/netdb.h.4.2.
This version along with a change in res/named/gethostnamadr.c.compat
provide for using the new format of the hostent structure while having
binary compatibility with existing libraries.
On systems with Sun RPC, you will have to merge include/netdb.h or
include/netdb.h.4.2 with /usr/include/netdb.h; copy the rpc-related lines
into the appropriate copy of netdb.h. Alternatively, use an alternate
include path when compiling the resolver library and programs that use it.
0) cp bin/{whatever} /usr/ucb/mkdep (see above)
cp bin/manroff /usr/man/manroff
1) cp include/arpa/nameser.h /usr/include/arpa
Also, on ultrix 2.x, if you haven't fixed
the inet_addr definition in inet.h, do
cp include/arpa/inet.h /usr/include/arpa
2) cp include/resolv.h /usr/include
3) cp include/netdb.h /usr/include/netdb.h
OR
cp include/netdb.h.4.2 /usr/include/netdb.h
OR
edit /usr/include/netdb.h
4) cp man/*.1 /usr/man/manl
cp man/*.3 /usr/man/man3
cp man/*.5 /usr/man/man5
cp man/*.7 /usr/man/man7
cp man/*.8 /usr/man/man8
5) cd res; make depend;
make libresolv.a;
make install
OR
update the libc sources as in the 4.3BSD instructions above
and use res/Makefile as a guide for integration
and omit the RES=-lresolv in the next two steps
OR
compile the .o files in res according to Makefile,
then use place those object files in /lib/libc.a (keeping a backup!)
and omit the RES=-lresolv in the next two steps
6) edit named/pathnames.h to correpond with your system's configuration
7) cd named; make depend; make RES=-lresolv all; make install
(if your system defines signal-catching routines to return int
instead of void, use "make DEFINES=-DSIG_FN=int RES=-lresolv all")
8) edit tools/nslookup/pathnames.h to correpond with your system's
configuration
9) cd tools/nslookup; make RES=-lresolv nslookup install
10) create the master files (samples in conf/master/*)
11) edit /etc/rc.local to include:
if [ -f /etc/named ]; then
/etc/named; echo -n ' named' >/dev/console
fi
12) eventually, recompile network client and server programs that use
gethostbyname, etc.

187
contrib/bind/TODO Normal file
View File

@ -0,0 +1,187 @@
$Id: TODO,v 8.3 1995/06/19 08:34:22 vixie Exp $
Things to do. Each entry should contain the proposer, date proposed, and an
explaination of what's being proposed. New ones are added at the bottom.
Note that the author/coordinator of BIND does not neccessarily endorse all
of the proposals listed herein; if you did not get explicit "buy-in" then
your changes may not be accepted even if they appear in proposal form here
in this file.
[Mark.Andrews@dms.CSIRO.AU 14dec94]: rfc952/rfc1123 host name compliance:
-> Test domain names to ensure that the name conforms to the form
specified by RFC952 as modified by RFC1123.
-> WARN if the domain name does not meet the conditions set by
rfc952/rfc1123 for the following resource records.
class == C_IN && type == T_A
class == C_IN && type == T_MX
-> REJECT this records on the primary server.
-> CNAME which doesn't match pointing to the above is also
illegal but harder to check.
[paul@vix.com 30nov94]: cause NOTIFY to track the IETF process for it;
reorder ns_resp() again so that "Notify notimp" causes qdelete()
but the host source address checking and so on is still done.
[paul@vix.com 25apr93]: clean up #ifdef's and portability
feature #ifdef's should be limited to whole functions, which will be
called no matter what and would only be non-empty if the feature is
enabled. allow feature ifdef's in .h files, though.
portability #ifdef's should be limited to whole functions, too. add
a new portability.c module that implements anything which varies from
system to system.
add a second portability.h-like file that is included _before_ all the
system includes. portability.h as it stands is included _after_ all
system includes, which is convenient for most things but not all.
[sater@cs.vu.nl 26apr93]: sortlist improvement
Improve the code around the sortlist area to better cope with parallel
networks of different speeds. The -i hack I sent to you could function
as inspiration only.
[kre@munnari.oz.au 26apr93]: add an INN style control interface
to replace sending signals. With that expand debugging to
permit monitoring of actions taken on a single query
(query through control port, full traced as it occurs)
or all queries that reference some particular name or
zone, or which are forwarded, or asked, of some
particluar server. Allow reloads & dumps of a single
zone, rather than the whole universe. Allow selective
cache pruning (to edit away bad data that's been obtained
from somewhere)
[kre@munnari.oz.au 26apr93]: add a syntax to zone files (non rfc
standard, but I don't care) to permit RR's to age away
at some particular time, and others to become active at
some particular time (probably with a syntax something
like "<[date]" or "@[date]" preceding, or in the
former case, replacing, the TTL field of the record).
Approaching "date" in the "<[date]" case, the TTL's on
the record would be decreased, so no data cached anywhere
will remain valid after "date", after "date", this RR
would simply be inoperative (essentially identical to
a comment). In the "@[date]" case (or perhaps ">[date]"
for symmetry) the RR would be ignored until "date" at
which time the "@[date]" field would simply be ignored.
Both annotations could be used together (with
appropriate interpretations depending on which date is
earlier than the other). Annotations on RR's in a zone
would cause the SOA parameters to be automatically
adjusted in zone transfers (and SOA requests) so that
secondary servers would also hand out the same values
(dropping the TTL down low as a "<[date]" approaches,
and forcing a new zone transfer at "date").
[steve@uunet.uu.net 26apr93]: TXT RR improvements
- fix TXT records so that they can deal properly with multiple
strings (e.g., ``foo IN TXT "aaa" "bbb"''). This
results in a fair number of smallish changes throughout the
code and also throughout various tools (e.g., nslookup).
[kyle@uunet.uu.net 16may93]: need an option to die if primary zone file missing
as of 4.9, a server will not forward a query if it is itself on the
NS list for the relevant domain. this means that if a primary server
cannot load its zone file, it will not be able to answer queries in
that zone -- it won't even forward them. this is arguably correct,
since it prevents bad forwarding loops when two or more servers are
all unable to load the zone (primary or secondary, with secondary
failures being the more common). what is needed is real loop detection
such that reasonable non-looping queries can be forwarded. what we're
likely to actually get is an option that causes named to just syslog
and die if it can't load a primary zone file. note that at present,
named is running somewhat bare-assed since an expired zone in a
secondary (or missing zone file in a primary) will cause that named
to return SERVFAIL for all queries to that zone. if your screwed up
primary/secondary server is also the forwarding server for a collection
of hosts, those hosts will get SERVFAIL's back from queries to the
affected domains, and depending on the age of their resolvers, they
might not try other servers after they get the first SERVFAIL.
[ this entry was written by Paul Vixie after getting a problem report
from Kyle after uu.net disappeared in a brief but ugly way. --vix ]
[paul@vix.com 05jun94]: things i'm expecting to fix someday:
-> finish STATS (b+tree?), remove older A_RR-based tagging
-> (more?) svr4 changes from wisner@well, marc@cam, istewart@datlog
-> switch completely to posix-style signals
-> xfrnets directives should aggregate
-> syntactic sugar to use "mtime" of file as soa serial number
-> better support for "firewalls" (zohar@ibm, minnich@dupont)
-> attributes in TXT RR (cpw@lanl)
-> fix database consistency problems during zone reloads (Bob Heiney)
-> preliminary support for variable width subnet masks
-> failover isn't working very well for hesiod queries (gshapiro)
-> dig needs to be able to turn on RES_INSECURE{1,2} options
-> clean out old RR's that lay within a newly loaded zone file (heiney)
-> automatically refresh root.cache from the root servers periodically
-> Makefiles should use/pass CFLAGS rather than modifying CC
-> use Berkeley DB rather than malloc() for all database ops
-> include files should be generated from templates
-> use nvi-style port/* hierarchy, fewer portability #ifdef's
-> make __res static, add procedural interface to replace "extern"'ing
-> add hesiod/yp capable versions of get{pw,serv,???}by*()
-> add hesiod/yp to get{net,host}by*()
-> do something like solaris' /etc/nsswitch.conf (but in resolv.conf)
-> we should only need one copy of binary->text, text->binary, and
packet marshalling/unmarshalling. add general routines to -lresolv,
and rearrange the code to use them.
-> apps that want to do DNS queries should not have to learn res_query;
a higher level interface should be provided, that has its own cache
and/or shares with the server's DB-based one.
-> implement or integrate the next round of RFC's (coming soon).
[paul@vix.com 05jun95]: more things i'm expecting to fix someday:
-> add "ndc checkconf" (i.e., "named -v")
## ++Copyright++ 1993
## -
## Copyright (c) 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.
## -
## Portions Copyright (c) 1993 by Digital Equipment Corporation.
##
## Permission to use, copy, modify, and distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
## copyright notice and this permission notice appear in all copies, and that
## the name of Digital Equipment Corporation not be used in advertising or
## publicity pertaining to distribution of the document or software without
## specific, written prior permission.
##
## THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
## WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
## OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
## CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
## PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
## -
## --Copyright--

251
contrib/bind/conf/bsdinstall.sh Executable file
View File

@ -0,0 +1,251 @@
#! /bin/sh
## (From INN-1.4, written by Rich Salz)
## $Revision: 8.1 $
## A script to install files and directories.
PROGNAME=`basename $0`
## Paths to programs. CHOWN and WHOAMI are checked below.
CHOWN=chown
CHGRP=chgrp
CHMOD=chmod
CP=cp
LN=ln
MKDIR=mkdir
MV=mv
RM=rm
STRIP=strip
WHOAMI=whoami
## Some systems don't support -x, so we have to use -f.
if [ ${CHOWN} = chown ] ; then
if [ -f /etc/chown ] ; then
CHOWN=/etc/chown
else
if [ -f /usr/etc/chown ] ; then
CHOWN=/usr/etc/chown
fi
fi
fi
if [ ${WHOAMI} = whoami ] ; then
if [ -f /usr/ucb/whoami ] ; then
WHOAMI=/usr/ucb/whoami
fi
fi
## Defaults.
CHOWNIT=false
CHGROUPIT=false
CHMODIT=false
STRIPIT=false
BACKIT=false
TOUCHIT=true
SAVESRC=false
ROOT=unknown
## Process JCL.
MORETODO=true
while ${MORETODO} ; do
case X"$1" in
X-b)
BACKIT=true
BACKUP="$2"
shift
;;
X-b*)
BACKIT=true
BACKUP=`expr "$1" : '-b\(.*\)'`
;;
X-c)
SAVESRC=true
;;
X-g)
GROUP="$2"
CHGROUPIT=true
shift
;;
X-g*)
GROUP=`expr "$1" : '-g\(.*\)'`
CHGROUPIT=true
;;
X-G)
case ${ROOT} in
unknown)
case `${WHOAMI}` in
root)
ROOT=true
;;
*)
ROOT=false
;;
esac
;;
esac
GROUP="$2"
shift
${ROOT} && CHGROUPIT=true
;;
X-G*)
case ${ROOT} in
unknown)
case `${WHOAMI}` in
root)
ROOT=true
;;
*)
ROOT=false
;;
esac
;;
esac
if ${ROOT} ; then
GROUP=`expr "$1" : '-g\(.*\)'`
CHGROUPIT=true
fi
;;
X-m)
MODE="$2"
CHMODIT=true
shift
;;
X-m*)
MODE=`expr "$1" : '-m\(.*\)'`
CHMODIT=true
;;
X-n)
TOUCHIT=false
;;
X-o)
OWNER="$2"
CHOWNIT=true
shift
;;
X-o*)
OWNER=`expr "$1" : '-o\(.*\)'`
CHOWNIT=true
;;
X-O)
case ${ROOT} in
unknown)
case `${WHOAMI}` in
root)
ROOT=true
;;
*)
ROOT=false
;;
esac
;;
esac
OWNER="$2"
shift
${ROOT} && CHOWNIT=true
;;
X-O*)
case ${ROOT} in
unknown)
case `${WHOAMI}` in
root)
ROOT=true
;;
*)
ROOT=false
;;
esac
;;
esac
if ${ROOT} ; then
OWNER=`expr "$1" : '-o\(.*\)'`
CHOWNIT=true
fi
;;
X-s)
STRIPIT=true
;;
X--)
shift
MORETODO=false
;;
X-*)
echo "${PROGNAME}: Unknown flag $1" 1>&2
exit 1
;;
*)
MORETODO=false
;;
esac
${MORETODO} && shift
done
## Process arguments.
if [ $# -ne 2 ] ; then
echo "Usage: ${PROGNAME} [flags] source destination"
exit 1
fi
## Making a directory?
if [ X"$1" = X. ] ; then
DEST="$2"
if [ ! -d "${DEST}" ] ; then
${MKDIR} "${DEST}" || exit 1
fi
if ${CHOWNIT} ; then
${CHOWN} "${OWNER}" "${DEST}" || exit 1
fi
if ${CHGROUPIT} ; then
${CHGRP} "${GROUP}" "${DEST}" || exit 1
fi
if ${CHMODIT} ; then
umask 0
${CHMOD} "${MODE}" "${DEST}" || exit 1
fi
exit 0
fi
## Get the destination and a temp file in the destination diretory.
if [ -d "$2" ] ; then
DEST="$2/$1"
TEMP="$2/$$.tmp"
else
DEST="$2"
TEMP="`expr "$2" : '\(.*\)/.*'`/$$.tmp"
fi
## If not given the same name, we must try to copy.
if [ X"$1" != X"$2" -o $SAVESRC ] ; then
if cmp -s "$1" "${DEST}" ; then
## Files are same; touch or not.
${TOUCHIT} && touch "${DEST}"
else
## If destination exists and we wish to backup, link to backup.
if [ -f "${DEST}" ] ; then
if ${BACKIT} ; then
${RM} -f "${DEST}${BACKUP}"
${LN} "${DEST}" "${DEST}${BACKUP}"
fi
fi
## Copy source to the right dir, then move to right spot.
## Done in two parts so we can hope for atomicity.
${RM} -f "${TEMP}" || exit 1
${CP} "$1" "${TEMP}" || exit 1
${MV} -f "${TEMP}" "${DEST}" || exit 1
fi
fi
## Strip and set the modes.
if ${STRIPIT} ; then
${STRIP} "${DEST}" || exit 1
fi
if ${CHOWNIT} ; then
${CHOWN} "${OWNER}" "${DEST}" || exit 1
fi
if ${CHGROUPIT} ; then
${CHGRP} "${GROUP}" "${DEST}" || exit 1
fi
if ${CHMODIT} ; then
umask 0
${CHMOD} "${MODE}" "${DEST}" || exit 1
fi
exit 0

View File

@ -0,0 +1,50 @@
-
Copyright (c) XYZZY
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.
-
Portions Copyright (c) 1993 by Digital Equipment Corporation.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies, and that
the name of Digital Equipment Corporation not be used in advertising or
publicity pertaining to distribution of the document or software without
specific, written prior permission.
THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
-

View File

@ -0,0 +1,45 @@
How to add new hosts to the name server data base:
1) Edit 'named.hosts' file:
For each machine you need to enter the following information:
machine name, all its network addresses, host information, and common
aliases for it.
This is the entry for calder.
CALDER IN A 128.32.130.1
IN A 128.32.129.3
IN HINFO VAX-11/750 UNIX
UCBCALDER IN CNAME CALDER
For the machine you are adding:
1) replace 'CALDER' with the new machine name
2) replace '128.32.130.1' with the new machines address
if there is more then one address for the machine
then add lines like the one with '128.32.129.3'
3) replace 'VAX-11/750' with the machine type
4) If it doesn't run 'UNIX' then replace UNIX with its
operating system.
2) Edit 'named.rev' file:
For each address of a machine you need to enter the reverse
address notation for the machine:
For calder the lines look as follows:
12.0 IN PTR CALDER.BERKELEY.EDU.
3.129 IN PTR CALDER.BERKELEY.EDU.
Calder has two address '128.32.0.12' and '128.32.129.3'
You take the two numbers after 128.32 and reverse them.
Then replace CALDER with the new machine name.
*** Note the trailing "." on "EDU." it needs to be there. Otherwise
BIND will add the current $ORIGIN to this name, which won't work.
***
3) Increment the serial number on both files.

View File

@ -0,0 +1,18 @@
;
; @(#)named.boot.slave 1.13 (Berkeley) 87/07/21
;
; boot file for secondary name server
; Note that there should be one primary entry for each SOA record.
;
;
sortlist 10.0.0.0
directory /usr/local/adm/named
; type domain source host/file backup file
cache . root.cache
secondary Berkeley.EDU 128.32.137.8 128.32.137.3 ucbhosts.bak
secondary 32.128.IN-ADDR.ARPA 128.32.137.8 128.32.137.3 ucbhosts.rev.bak
primary 0.0.127.IN-ADDR.ARPA localhost.rev

View File

@ -0,0 +1,16 @@
;
; boot file for authoritive master name server for Berkeley.EDU
; Note that there should be one primary entry for each SOA record.
;
;
sortlist 10.0.0.0
directory /usr/local/adm/named
; type domain source host/file backup file
cache . root.cache
primary Berkeley.EDU berkeley.zone
primary 32.128.IN-ADDR.ARPA berkeley.rev
primary 0.0.127.IN-ADDR.ARPA localhost.rev

View File

@ -0,0 +1,22 @@
; Authoritative data for Berkeley.EDU (ORIGIN assumed Berkeley.EDU)
;
@ IN SOA ucbvax.berkeley.edu kjd.ucbvax.berkeley.edu (
1986020501 ; Serial
10800 ; Refresh 3 hours
3600 ; Retry 1 hour
3600000 ; Expire 1000 hours
86400 ) ; Minimum 24 hours
IN MX 10 ucb-vax
IN NS monet
localhost IN A 127.1
ucb-arpa IN A 10.0.0.78
IN A 128.32.0.4
IN HINFO VAX-11/780 UNIX
arpa IN CNAME ucbarpa
ucb-vax 9999 IN A 10.2.0.78
IN A 128.32.0.10
IN HINFO VAX-11/750 UNIX
ucbvax IN CNAME ucb-vax
monet IN A 128.32.0.7
IN HINFO VAX-11/750 UNIX
ucbmonet IN CNAME monet

View File

@ -0,0 +1,13 @@
;
; @(#)named.local 1.1 (Berkeley) 86/01/21
;
@ IN SOA ucbvax.Berkeley.EDU. kjd.ucbvax.Berkeley.EDU. (
1986012101 ; Serial
3600 ; Refresh
300 ; Retry
3600000 ; Expire
14400 ) ; Minimum
IN NS ucbvax.Berkeley.EDU.
0 IN PTR loopback.ucbvax.Berkeley.EDU.
1 IN PTR localhost.

View File

@ -0,0 +1,30 @@
;
; @(#)named.rev 1.1 (Berkeley) 86/02/05
;
@ IN SOA ucbvax.berkeley.edu kjd.ucbvax.berkeley.edu (
1986020501 ; Serial
10800 ; Refresh 3 hours
3600 ; Retry 1 hour
3600000 ; Expire 1000 hours
86400 ) ; Minimum 24 hours
IN NS ucbvax.Berkeley.EDU.
; RFC 1101 stuff
0.0 IN PTR Berkeley-net.Berkeley.EDU.
IN A 255.255.255.0
; real hosts
0.130 IN PTR csdiv-net.Berkeley.EDU.
2.129 IN PTR monet.Berkeley.EDU.
2.140 IN PTR ucbarpa.Berkeley.EDU.
3.132 IN PTR cad.Berkeley.EDU.
4.0 IN PTR ucbarpa.Berkeley.EDU.
5.0 IN PTR cad.Berkeley.EDU.
6.0 IN PTR ernie.Berkeley.EDU.
6.130 IN PTR monet-cs.Berkeley.EDU.
7.0 IN PTR monet.Berkeley.EDU.
7.130 IN PTR kim.Berkeley.EDU.
9.0 IN PTR esvax.Berkeley.EDU.
10.0 IN PTR ucbvax.Berkeley.EDU.
11.0 IN PTR kim.Berkeley.EDU.
11.156 IN PTR esvax-156.Berkeley.EDU.
38.131 IN PTR monet.Berkeley.EDU.

View File

@ -0,0 +1,63 @@
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC registration services
; under anonymous FTP as
; file /domain/named.root
; on server FTP.RS.INTERNIC.NET
; -OR- under Gopher at RS.INTERNIC.NET
; under menu InterNIC Registration Services (NSI)
; submenu InterNIC Registration Archives
; file named.root
;
; last update: Nov 8, 1995
; related version of root zone: 1995110800
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
; End of File

167
contrib/bind/conf/options.h Normal file
View File

@ -0,0 +1,167 @@
/* options.h - specify the conditionally-compiled features
* vix 28mar92 [moved out of the Makefile because they were getting too big]
*
* $Id: options.h,v 8.9 1996/05/17 09:10:41 vixie Exp $
*/
/*
* ++Copyright++
* -
* Copyright (c)
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/* Key:
* ucb = U C Berkeley 4.8.3 release
* vix = Paul Vixie of Digital
* del = Don Lewis of Harris
* mcsun = Piet Beertema of EUNet
* asp = Andrew Partan of UUNet
* pma = Paul Albitz of Hewlett Packard
* bb = Bryan Beecher of UMich
* mpa = Mark Andrews of CSIRO - DMS
* rossc = Ross Cartlidge of The Univeritsy of Sydney
* mtr = Marshall Rose of TPC.INT
* bg = Benoit Grange of INRIA
* ckd = Christopher Davis of Kapor Enterprises
* gns = Greg Shapiro of WPI
*/
#define DEBUG /* enable -d flag and SIGUSR[12] support (ucb) */
/*#define ALLOW_T_UNSPEC /* enable the "unspec" RR type for old athena (ucb) */
/*#define INVQ /* enable inverse queries (nslookup) (ucb/vix) */
/*#define DSTORAGE /* debug malloc overruns using storage.o (ucb/vix) */
/*#define DMALLOC /* trace malloc orphans using dmalloc.o (vix) */
#define XFRNETS /* enable "xfrnets" command in named.boot (vix) */
#define PID_FIX /* be careful about overwriting named.pid file (del) */
#define FWD_LOOP /* try to break out of forwarding loops (del) */
#define NO_GLUE /* don't accept or send out-of-zone glue (del) */
#define BOGUSNS /* detect bogus nameservers (mcsun) */
#define QRYLOG /* enable SIGWINCH for query logging (bb) */
/*#define YPKLUDGE /* deal effectively with broken "ypserv -i" (mcsun) */
#define TRACEROOT /* trace bogus root servers and ignore them (pma,bb) */
/*#define LOCALDOM /* permit "domain" directive in named.boot (ucb) */
#define FORCED_RELOAD /* refresh secondary zones on SIGHUP (pma) */
#define SLAVE_FORWARD /* use sensible timeouts on slave forwarders (pma) */
#define WANT_PIDFILE /* if you want the named.pid file (ucb/arc) */
#define DOTTED_SERIAL /* if you want to be able to specify dotted serial#s */
/*#define SENSIBLE_DOTS /* if you want dotted serial#s to make numeric sense */
#define NCACHE /* negative caching (anant@isi.edu) */
/*#define VALIDATE /* validation procedure (anant@isi.edu) (BUGGY!) */
/*#define SHORT_FNAMES /* file names used in named-xfer need to be short */
#define RESOLVSORT /* allow sorting of addresses in gethostbyname (mpa) */
#define STUBS /* allow transfers of NS only for a zone (mpa) */
#ifndef LOGFAC
#define LOGFAC LOG_DAEMON /* what syslog facility should named use? */
#endif
#define SECURE_ZONES /* if you want to inhibit world access to zones (gns)*/
#define ROUND_ROBIN /* rotate databuf list after each access (mtr) */
#define ADDAUTH /* return NS and glue w/ authorative answers (mpa) */
#define RFC1535 /* use RFC 1535 default for "search" list (vix) */
#define GEN_AXFR /* distinct zones within each class */
#define DATUMREFCNT /* use reference counts on datums (mpa) */
#define LAME_DELEGATION /* lame delegations (original-del,reworked-bb&del)*/
#define LAME_LOGGING LOG_DEBUG /* log lame delegations, set log level */
#define GETSER_LOGGING LOG_INFO /* log errors/timeouts getting serial number */
/*#define RETURNSOA /* good code that the world isn't ready for yet */
#define CLEANCACHE /* useful and necessary in the face of NCACHE */
#define PURGE_ZONE /* remove all traces of a zone when reloading (mpa) */
#define STATS /* keep nameserver statistics; uses more memory */
#define RENICE /* named-xfer should run at normal priority */
/*#define XSTATS /* extended statistics, syslogged periodically (bg) */
/*#define BIND_NOTIFY /* experimental - do not enable in customer products */
#define LOC_RR /* support for LOC record parsing (ckd/vix) */
#define SORT_RESPONSE /* should we try to sort responses optimally? (vix) */
/*--------------------------------------------*
* no user-servicable parts beyond this point *
*--------------------------------------------*/
/* if DSTORAGE is defined, we need to disable DMALLOC and remap
* malloc and free to storage.o's exported names. storage.o also
* includes a calloc and a realloc, but once we drag in its malloc
* and free we'll get the others automatically and so will never
* pull in those routines from libc.a.
*/
#ifdef DSTORAGE
# ifdef DMALLOC
# undef DMALLOC
# endif /*DMALLOC*/
# define malloc rt_malloc
# define free rt_free
#endif /*DSTORAGE*/
/* if DMALLOC is defined, grab the header file which will remap
* all the malloc-style names to those exported by dmalloc.o. note
* that DMALLOC also changes the function signatures of several
* functions in private named source modules, and that this file
* (options.h) must be included before any other private *.h files
* since those *.h files have some conditional remapping to do.
*/
#ifdef DMALLOC
# include "dmalloc.h"
#endif
/* systems with killall(1M) don't need this
*/
#ifdef __sgi
# ifdef WANT_PIDFILE
# undef WANT_PIDFILE
# endif
#endif
#ifdef LAME_LOGGING
# define LAME_DELEGATION
#endif
#if defined(XSTATS) && !defined(STATS)
# define STATS
#endif

View File

@ -0,0 +1,595 @@
/* portability.h - include or define things that aren't present on all systems
* vixie@decwrl 26dec92 [new]
*
* $Id: portability.h,v 8.14 1996/06/06 20:19:09 vixie Exp $
*/
/*
* ++Copyright++
* -
* Copyright (c)
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/* XXX: this file has become a hopeless morass, and will be redone someday. */
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/param.h>
#ifndef TIME_H_INCLUDED
# include <sys/time.h>
# define TIME_H_INCLUDED
#endif
#ifdef ISC
# ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
# endif
# define SYSV
# define SVR3
# define _SYSV3
# define NEED_STRTOUL
# define NEED_FTRUNCATE
# define USE_POSIX
# include <sys/bsdtypes.h>
# include <sys/sioctl.h>
# include <sys/stream.h>
# include <net/errno.h>
#endif
#if defined(__convex__)
# if !defined(_POSIX_SOURCE)
# define _POSIX_SOURCE
# endif
# define USE_UTIME
# define NEED_PUTENV
#endif
#if defined(_CRAY)
# if !defined(_POSIX_SOURCE)
# define _POSIX_SOURCE
# endif
# define writev(a,b,c) __writev(a,b,c)
# define setitimer(a,b,c) __setitimer(a,b,c)
#endif
/* This is defined in the Makefile for ISC compiles. */
#if defined(ISC)
# define ftruncate(a,b) __ftruncate(a,b)
# define USE_MEMCPY
# define USE_UTIME
# define HAVE_FCHMOD 0
#endif
/* SCO UNIX defines only this unique symbol, apparently. */
#if defined(M_UNIX)
/* XXX - why is this POSIX_SOURCE instead of _POSIX_SOURCE? */
# undef POSIX_SOURCE
# define POSIX_SIGNALS
# define HAVE_FCHMOD 0
# define writev(a,b,c) __writev(a,b,c)
# define ftruncate(a,b) __ftruncate(a,b)
#endif
#ifdef NeXT
# define NEED_PUTENV
# define NEED_SETENV
# define inet_addr(a) __inet_addr(a)
#endif
#if defined(__sgi)
# define BSD 43
# define vfork fork
#endif
#if defined(SUNOS4)
# define BSD 43
#endif
#if defined(__osf__) && defined(__alpha)
# undef BSD
# define BSD 199103
#endif
#if defined(_AUX_SOURCE)
# define vfork fork
# define NEED_STRERROR
# define NEED_STRTOUL
# define SIG_FN void
# define USE_MEMCPY
#endif
#if defined(SVR4) && !defined(SYSV)
# define SYSV
#endif
#if defined(_POSIX_SOURCE) || defined(__sgi) || defined(__ultrix) || \
defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || \
(defined(sun) && defined(SYSV))
# define USE_POSIX
#endif
#if defined(__ultrix) && !defined(BSD)
# define BSD 42
#endif
#if defined(host_mips) && defined(SYSTYPE_BSD43)
# define RISCOS_BSD
#endif
#if defined(SYSV) || defined(__ultrix) || defined(__osf__) \
|| (defined(BSD) && BSD >= 199306) || defined(linux)
# define USE_UTIME
# define HAVE_SETVBUF
#endif
#if defined(SYSV) && !defined(SVR4)
# define vfork fork
#endif
#if defined(sun) || defined(SVR4)
# define NETREAD_BROKEN
#endif
#if defined(BSD) && BSD >= 199006 && !defined(i386) && !defined(RISCOS_BSD)
# define HAVE_DAEMON
#endif
#if !defined(BSD) || (BSD <= 199006)
# if !defined(NeXT)
# define NEED_INETADDR
# endif
# define NEED_INETATON
#endif
#if defined(__hpux)
# if defined(__STDC__)
# define select(a,b,c,d,e) select(a, (int *)b, (int *)c, (int *)d, e)
# define ctime(x) ctime((const time_t *)x)
# endif /*__STDC__*/
# if !defined(SYSV)
# define USE_UTIME
# define setlinebuf(x) setvbuf(x, NULL, _IOLBF, BUFSIZ)
# if !defined(SIGWINCH) /*pre 9.0*/
# define SIGWINCH SIGWINDOW
# endif
# endif /*SYSV*/
/* XXX: better autodetection of the need for "struct linger" would be nice */
# if 0
struct linger {
int l_onoff; /* option on/off */
int l_linger; /* linger time */
};
# endif
#endif /*__hpux*/
#if defined(_SEQUENT_)
# include <netinet/in_systm.h>
# define USE_UTIME
# define USE_POSIX
# define NEED_GETTIMEOFDAY
# define _TIMEZONE timezoneBSD
struct timezoneBSD {
int tz_minuteswest;
int tz_dsttime;
};
#endif
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
#ifndef _TIMEZONE
# define _TIMEZONE timezone
#endif
#if defined(USE_POSIX)
# include <stdlib.h>
# include <unistd.h>
# include <limits.h>
# if defined(__ultrix)
# define NEED_STRDUP
# endif
#else
# define NEED_STRTOUL
# define NEED_STRDUP
# define STDIN_FILENO 0
# define STDOUT_FILENO 1
# define STDERR_FILENO 2
# ifndef NeXT
extern char *getenv __P((char *));
# else
extern char *getenv __P((const char *));
# endif
extern int errno;
# if !defined(DMALLOC) && !defined(NeXT)
extern char *malloc(), *realloc(), *calloc();
# if defined(sun)
extern int free();
# else
extern void free();
# endif
# endif
extern int getdtablesize __P((void));
# ifdef SHORT_FNAMES
extern long pathconf __P((const char *path, int name));
# endif
#endif /*USE_POSIX*/
#ifndef UINT_MAX
# ifdef __STDC__
# define UINT_MAX 4294967295u /* max value of an "u_int" */
# else
# define UINT_MAX ((unsigned)4294967295) /* max value of an "u_int" */
# endif
# define ULONG_MAX UINT_MAX /* max decimal value of a "u_long" */
#endif
#ifndef INT_MAX
# define INT_MAX 2147483647 /* max decimal value of an "int" */
#endif
#ifndef RAND_MAX
# define RAND_MAX 0x7fffffff
#endif
#ifndef IN_LOOPBACKNET
# define IN_LOOPBACKNET 127
#endif
#ifndef INADDR_NONE
# define INADDR_NONE 0xffffffff
#endif
#if defined(apollo)
/* Defined in /usr/include/netinet/in.h but doesn't work */
#undef IP_OPTIONS
#endif
#if !defined(__STDC__) && !defined(const)
# define const /*constant*/
#endif
#if !defined(__convex__) && (!defined(BSD) || (BSD < 199103))
int strcasecmp __P((const char *, const char *));
#endif
/* is USE_POSIX the right thing to use here? */
#if (!defined(BSD) || (BSD <= 43)) && \
!defined(NeXT) && \
!defined(__convex__) && \
!defined(USE_POSIX)
# if !defined(NCR)
extern void syslog();
# endif
extern char *ctime __P((const time_t *clock));
extern int close(), setitimer(), recv(), sendto(), sigsetmask(),
atoi(), getpid(), fork(), read(), ioctl(),
setsockopt(), socket(), bind();
#endif
#if !defined(bcopy) /* some machines have their own macros for this */
# if defined(USE_POSIX) || \
(defined(__STDC__) && !defined(sun) && !defined(sequent) \
&& !defined(M_UNIX))
/* use ANSI C3.159-1989 (``ANSI C'') functions if possible;
* ideally we would change the code to use them and then
* define them in terms of bcopy et al if !defined(__STDC__)
* but that's more work.
*/
#if defined(USE_MEMCPY)
# define bcopy(a,b,c) memcpy(b,a,c)
#else
# define bcopy(a,b,c) memmove(b,a,c)
#endif
# define bzero(a,b) memset(a,0,b)
# define bcmp(a,b,c) memcmp(a,b,c)
# else
extern void bcopy();
extern void bzero();
extern int bcmp();
# endif /* BSD */
#endif /* bcopy */
#if (!defined(BSD) || (BSD < 43) || defined(RISCOS_BSD)) \
&& !defined(USE_POSIX) && !defined(apollo) && !defined(sequent) \
&& !defined(M_UNIX)
# define NEED_STRERROR
#if !defined(ultrix) && !defined(NCR)
# define NEED_PUTENV
#endif
#endif
#if defined(SUNOS4)
# define NEED_STRERROR
# if defined(sun386)
# define pid_t int
# define NEED_STRCASECMP
# endif
#endif
#if (!defined(BSD) || (BSD < 43))
# define NEED_MKSTEMP
# if !defined(__ultrix) && !defined(apollo)
# define NEED_STRCASECMP
# define NEED_MKTEMP
# if !defined(SVR4)
# define NEED_STRPBRK
# endif
# endif
#endif
#if defined(USE_POSIX)
# define POSIX_SIGNALS
#endif
/*
* Attempt to configure for type of function returned by signal-catching
* functions (which signal and sigvec.sv_handler take a pointer to).
* This can guess for BSD; otherwise, define SIG_FN externally.
*/
#ifndef SIG_FN
# ifdef BSD
# if (BSD >= 199006) || defined(NeXT) || defined(__osf__) || defined(sun) \
|| defined(__ultrix) || defined(apollo) || defined(POSIX_SIGNALS)
# define SIG_FN void /* signal-catching functions return void */
# else
# define SIG_FN int /* signal-catching functions return int */
# endif
# else /*BSD*/
# define SIG_FN void /* signal-catching functions return void */
# endif /*BSD*/
#endif
#if !defined(SIGUSR1) && !defined(SIGUSR2)
# define SIGUSR1 SIGEMT
# define SIGUSR2 SIGFPE
#endif
#if !defined(SIGCHLD)
# define SIGCHLD SIGCLD
#endif
#if !defined(ntohl) && !defined(htonl) && defined(BSD) && (BSD <= 43)
/* if these aren't null macros in netinet/in.h, extern them here. */
extern u_short htons(), ntohs();
extern u_long htonl(), ntohl();
#endif
#if defined(USE_POSIX) && !defined(sun) && !defined(__sgi) \
&& !defined(__convex__) && !defined(__ultrix) && !defined(_AUX_SOURCE)
# define PORT_NONBLOCK O_NONBLOCK
# define PORT_WOULDBLK EAGAIN
#else
# define PORT_NONBLOCK O_NDELAY
# define PORT_WOULDBLK EWOULDBLOCK
#endif
#if defined(USE_POSIX)
# define USE_SETSID
#endif
#if defined(USE_POSIX) || !defined(SYSV)
#define USE_WAITPID
#endif
#if !defined(USE_POSIX)
#define waitpid(x,y,z) (wait3(y,z,(struct rusage *)NULL))
#endif
#if defined(NeXT) || defined(_AIX) || defined(sun386)
# undef WIFEXITED
# undef WEXITSTATUS
# undef WIFSIGNALED
# undef WTERMSIG
#endif /* NeXT */
#if defined(sequent)
#define WEXITSTATUS(x) ((x).w_retcode)
#define WTERMSIG(x) ((x).w_termsig)
#endif /* sequent */
#if !defined(WIFEXITED)
# define WIFEXITED(x) (!(x & 0177))
#endif
#if !defined(WEXITSTATUS)
# define WEXITSTATUS(x) (x >> 8)
#endif
#if !defined(WIFSIGNALED)
# define WIFSIGNALED(x) ((x & 0177) && ((x & 0377) != 0177))
#endif
#if !defined(WTERMSIG)
# define WTERMSIG(x) (x & 0177)
#endif
#ifndef S_ISDIR
# ifndef S_IFMT
# define S_IFMT 0170000
# endif
# ifndef S_IFDIR
# define S_IFDIR 0040000
# endif
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISREG
# ifndef S_IFMT
# define S_IFMT 0170000
# endif
# ifndef S_IFREG
# define S_IFREG 0100000
# endif
# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISFIFO
# ifndef S_IFMT
# define S_IFMT 0170000
# endif
# ifndef S_IFIFO
# define S_IFIFO 0010000
# endif
# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
#endif
#if defined(NEED_STRTOUL) && \
(defined(__ultrix) || defined(__osf__) || defined(NeXT))
# undef NEED_STRTOUL
#endif
#if defined(__ultrix) || defined(__osf__)
# define MAYBE_HESIOD
#endif
#ifndef FD_SET
#define NFDBITS 32
#define FD_SETSIZE 32
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
#endif
#ifndef MIN
# define MIN(x, y) ((x > y) ?y :x)
#endif
#ifndef MAX
# define MAX(x, y) ((x > y) ?x :y)
#endif
#if !defined(PATH_MAX)
# if defined(_POSIX_PATH_MAX)
# define PATH_MAX _POSIX_PATH_MAX
# else
# if defined(MAXPATHLEN)
# define PATH_MAX MAXPATHLEN
# endif
# endif
#endif
#if defined(BSD) || defined(__osf__) || defined(__convex__)
# define HAVE_GETRUSAGE
#endif
/* May be set in the Makefile. */
#if defined(HAVE_GETRUSAGE)
# include <sys/resource.h>
#endif
/*
* Because Convex has true library function feof() which is
* patently wrong (it test bit _IOREAD) we need feof() as
* a macro.
*/
#if defined(__convex__) && !defined(feof)
# define feof(p) ((p)->_flag&_IOEOF)
#endif
#if defined(M_UNIX) || defined(linux)
# define SPURIOUS_ECONNREFUSED
#endif
/*
* Assume that a system has fchmod() unless something above says otherwise.
*/
#if !defined(HAVE_FCHMOD)
# define HAVE_FCHMOD 1
#endif
/*
* Types needed for POSIX but missing on some systems.
*/
#if defined(SUNOS4)
typedef int ssize_t;
#endif
/*
* We need to know the IPv6 address family number even on IPv4-only systems.
* Note that this is NOT a protocol constant, and that if the system has its
* own AF_INET6, different from ours below, all of BIND's libraries and
* executables will need to be recompiled after the system <sys/socket.h>
* has had this type added. The type number below is correct on most BSD-
* derived systems for which AF_INET6 is defined.
*/
#ifndef AF_INET6
#define AF_INET6 24
#endif
/*
* Prototype the functions we'll be supplying.
*/
#ifdef NEED_PUTENV
extern int putenv __P((char *));
#endif
#ifdef NEED_GETTIMEOFDAY
extern int gettimeofday __P((struct timeval *, struct _TIMEZONE *));
#endif
#if defined(SVR4) && defined(sun)
extern int gethostname __P((char *, size_t));
#endif
#ifdef NEED_STRDUP
extern char *strdup __P((const char *));
#endif

View File

@ -0,0 +1,51 @@
.\" Copyright (c) 1986, 1988 Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted
.\" provided that this notice is preserved and that due credit is given
.\" to the University of California at Berkeley. The name of the University
.\" may not be used to endorse or promote products derived from this
.\" software without specific prior written permission. This software
.\" is provided ``as is'' without express or implied warranty.
.\"
.\" @(#)00macs.me 6.3 (Berkeley) 2/28/88
.\"
.\" usage: troff -me myfile
.nr EX 0
.de BX
.sp
.ba +4
.lp
.nr EX +1
.b
.ta (\\n(.lu-\\n(.iu)R
EXAMPLE \\n(EX: \(*D
.r
.lp
..
.de EX
.br
.ba
.b
.tl '''\(gr'
.r
.lp
..
.if \nl .ls 2
.if t .nr bi 5m
.nr si 3n
.de $0 \" create a table of contents magically.
.(x
.ti (\\$3u-1u)*2m
\\$2. \\$1
.)x
..
.de $1
.sp
..
.de BU
.ip "\ \(bu" \w'\ \(bu\ 'u
..
.de SM
\s-1\\$1\s0\\$2
..

View File

@ -0,0 +1,94 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.+c
.(l C
.sz 14
.b "Name Server Operations Guide"
.b "for \s-1BIND\s+1"
.sz
\fIRelease 4.9.4\fP
.eh 'SMM:10-%''Name Server Operations Guide for \s-1BIND\s+1'
.oh 'Name Server Operations Guide for \s-1BIND\s+1''\s-1SMM\s+1:10-%'
.sp
\fIReleases from 4.9\fP
Paul Vixie\**
.(f
\** This author was employed by Digital Equipment Corporation's
Network Systems Laboratory during the development and release of
\s-1BIND\s+1 4.9. Release 4.9.2 was sponsored by Vixie
Enterprises. Releases from 4.9.3 were sponsored by the Internet
Software Consortium.
.)f
<paul@vix.com>
.sp \n(psu
Internet Software Consortium
La Honda, CA
.sp 2
\fIReleases through 4.8.3\fP
Kevin J. Dunlap\**
Michael J. Karels
.sp \n(psu
Computer Systems Research Group
Computer Science Division
Department of Electrical Engineering and Computer Sciences
University of California
Berkeley, CA 94720
.)l
.sp 2
.(f
\** This author was an employee of Digital Equipment Corporation's
\s-1ULTRIX\s+1 Engineering Advanced Development Group and was on loan to
CSRG when this work was done. \s-1ULTRIX\s+1 is a trademark of Digital
Equipment Corporation.
.)f

View File

@ -0,0 +1,90 @@
# ++Copyright++ 1986, 1988
# -
# Copyright (c) 1986, 1988
# 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.
# -
# Portions Copyright (c) 1993 by Digital Equipment Corporation.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies, and that
# the name of Digital Equipment Corporation not be used in advertising or
# publicity pertaining to distribution of the document or software without
# specific, written prior permission.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
# CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# -
# --Copyright--
#
# @(#)Makefile 6.3 (Berkeley) 2/28/88
#
FILES= 00macs.me 00title.me intro.me ns.me types.me\
files.me named.boot.primary\
named.boot.secondary named.boot.cache resolv.conf\
root.cache named.local ucbhosts.rev ucbhosts \
setup.me manage.me build.me ack.me
ME= -me
NROFF= nroff -rb3
PRINTER= -Pdp
TBL= dtbl $(PRINTER)
TROFF= ditroff $(PRINTER)
GROFF= groff -Tps -t $(ME)
all: file.lst
file.lst: $(FILES)
tbl $(FILES)| $(NROFF) $(ME) $(FLAGS) > file.lst
file.psf: $(FILES)
$(GROFF) $(FILES) > file.psf
troff: $(FILES)
$(TBL) $(FILES)| $(TROFF) $(ME) $(FLAGS)
cat: $(FILES)
@cat $(FILES)
clean:
rm -f *.psf *.lst *.BAK *.CKP *~ *.orig
rm -f file
spell: $(FILES)
@for i in $(FILES); do \
echo $$i; \
spell $$i | sort | comm -23 - spell.ok > $$i.spell; \
done

287
contrib/bind/doc/bog/ack.me Normal file
View File

@ -0,0 +1,287 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)ack.me
.\"
.sx 0
.bp
.ce
.b "ACKNOWLEDGEMENTS \(em 4.9.3"
.pp
The \fI<bind-workers@vix.com>\fP mailing list was once again of great help;
this release would not be nearly as ready for prime time if not for their
efforts. Special commendations are owed to Robert Elz, Don "Truck" Lewis,
Bob Halley, Mark Andrews, Berthold Paffrath, Ruediger Volk, and Peter Koch.
.pp
Digital Equipment Corporation, Hewlett Packard, Silicon Graphics, and SunSoft
all made hardware available for integration testing; this made the release
far more solid than it would otherwise have been. More hardware loans are
welcome \(em if you are a system vendor and you would like \s-2BIND\s+2 to
run ``out of the box'' on your platform and are willing to lend some rusty
old hardware for the purpose, please contact me (\fI<paul@vix.org>\fP) to
make the arrangements.
.pp
Special thanks to the Internet Software Consortium for funding this work.
Contact \fI<isc-info@isc.org>\fP if your organization would like to
participate in funding future releases of \s-2BIND\s+2 and other freely
redistributable software packages that are in wide use on the Internet.
.sp 2
.ce
.b "ACKNOWLEDGEMENTS \(em through 4.9"
.pp
The alpha-test group was extremely helpful in furnishing improvements,
finding and repairing bugs, and being patient. I would like to express
special thanks to Brian Reid of Digital Equipment corporation for funding
this work. Robert Elz, Alan Barrett, Paul Albitz, Bryan Beecher, Andrew
Partan, Andy Cherenson, Tom Limoncelli, Berthold Paffrath, Fuat Baran, Anant
Kumar, Art Harkin, Win Treese, Don Lewis, Christophe Wolfhugel, and a cast
of dozens all helped out above and beyond the call of duty. Special thanks
to Phil Almquist, who got the project started and contributed a lot of the
code and fixed several of the worst bugs.
.sp 2
.ce
.b "ACKNOWLEDGEMENTS \(em through 4.8.3"
.pp
Many thanks to the users at U. C. Berkeley for falling into many of the holes
involved with integrating BIND into the system so that others would be
spared the trauma. I would also like to extend gratitude to Jim McGinness
and Digital Equipment Corporation for permitting me to spend most of my time
on this project.
.pp
Ralph Campbell, Doug Kingston, Craig Partridge, Smoot Carl-Mitchell, Mike
Muuss and everyone else on the DARPA Internet who has contributed to the
development of BIND. To the members of the original BIND project, Douglas
Terry, Mark Painter, David Riggle and Songnian Zhou.
.pp
Anne Hughes, Jim Bloom and Kirk McKusick and the many others who have
reviewed this paper giving considerable advice.
.pp
This work was sponsored by the Defense Advanced Research Projects Agency
(DoD), Arpa Order No. 4871 monitored by the Naval Electronics Systems
Command under contract No. N00039-84-C-0089. The views and conclusions
contained in this document are those of the authors and should not be
interpreted as representing official policies, either expressed or implied,
of the Defense Research Projects Agency, of the US Government, or of Digital
Equipment Corporation.
.bp
.ba 0
.in 0
.sp 2
.ce
.b REFERENCES
.sp
.nr ii 1i
.ip [Birrell]
Birrell, A. D.,
Levin, R.,
Needham, R. M.,
and Schroeder, M.D.,
.q "Grapevine: An Exercise in Distributed Computing."
In
.ul
Comm. A.C.M. 25,
4:260-274
April 1982.
.ip [RFC819]
Su, Z.
Postel, J.,
.q "The Domain Naming Convention for Internet User Applications."
.ul
Internet Request For Comment 819
Network Information Center,
SRI International,
Menlo Park, California.
August 1982.
.ip [RFC974]
Partridge, C.,
.q "Mail Routing and The Domain System."
.ul
Internet Request For Comment 974
Network Information Center,
SRI International,
Menlo Park, California.
February 1986.
.ip [RFC1032]
Stahl, M.,
.q "Domain Administrators Guide"
.ul
Internet Request For Comment 1032
Network Information Center,
SRI International,
Menlo Park, California.
November 1987.
.ip [RFC1033]
Lottor, M.,
.q "Domain Administrators Guide"
.ul
Internet Request For Comment 1033
Network Information Center,
SRI International,
Menlo Park, California.
November 1987.
.ip [RFC1034]
Mockapetris, P.,
.q "Domain Names - Concept and Facilities."
.ul
Internet Request For Comment 1034
Network Information Center,
SRI International,
Menlo Park, California.
November 1987.
.ip [RFC1035]
Mockapetris, P.,
.q "Domain Names - Implementation and Specification."
.ul
Internet Request For Comment 1035
Network Information Center,
SRI International,
Menlo Park, California.
November 1987.
.ip [RFC1101]
Mockapetris, P.,
.q "DNS Encoding of Network Names and Other Types."
.ul
Internet Request For Comment 1101
Network Information Center,
SRI International,
Menlo Park, California.
April 1989.
.ip [RFC1123]
R. Braden, Editor,
.q "Requirements for Internet Hosts -- Application and Support"
.ul
Internet Request For Comment 1123
Network Information Center,
SRI International,
Menlo Park, California.
October 1989.
.ip [RFC1183]
Everhart, C.,
Mamakos, L.,
Ullmann, R.,
and
Mockapetris, P.,
.q "New DNS RR Definitions"
.ul
Internet Request For Comment 1183
Network Information Center,
SRI International,
Menlo Park, California.
October 1990.
.ip [RFC1327]
Hardcastle-Kille, S.,
.q "Mapping between X.400(1988) / ISO 10021 and RFC 822"
.ul
Internet Request For Comment 1327
Network Information Center,
SRI International,
Menlo Park, California.
May 1992.
.ip [RFC1664]
Allocchio, C.,
Bonito, A.,
Cole, B.,
Giordano, S.,
Hagens, R.,
.q "Using the Internet DNS to Distribute RFC1327 Mail Address Mapping Tables"
.ul
Internet Request For Comment 1664
Network Information Center,
SRI International,
Menlo Park, California.
August 1994.
.ip [RFC1713]
Romao, A.,
.q "Tools for DNS debugging"
.ul
Internet Request For Comment 1713, also FYI27
Network Information Center,
SRI International,
Menlo Park, California.
November 1994.
.ip [Terry]
Terry, D. B.,
Painter, M.,
Riggle, D. W.,
and
Zhou, S.,
.ul
The Berkeley Internet Name Domain Server.
Proceedings USENIX Summer Conference,
Salt Lake City, Utah.
June 1984, pages 23-31.
.ip [Zhou]
Zhou, S.,
.ul
The Design and Implementation of the Berkeley Internet Name Domain (BIND) Servers.
UCB/CSD 84/177.
University of California, Berkeley,
Computer Science Division.
May 1984.
.ip [Mockapetris]
Mockapetris, P.,
Dunlap, K,
.ul
Development of the Domain Name System
ACM Computer Communications Review 18, 4:123-133.
Proceedings ACM SIGCOMM '88 Symposium,
August 1988.
.ul
.ip [Liu]
Liu, C.,
Albitz, P.,
.ul
DNS and BIND
O'Reilly & Associates, Sebastopol, CA,
502 pages, ISBN 0-937175-82-X
1992

View File

@ -0,0 +1,102 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)build.me 6.3 (Berkeley) 9/19/89
.\"
.sh 1 "Building a System with a Name Server"
.pp
BIND is composed of two parts. One is the user interface called the
\fIresolver\fP
which consists of a group of routines that reside in the C library
\fI/lib/libc.a\fP.
Second is the actual server called \fInamed\fP.
This is a daemon that runs in the background and services queries on a
given network port. The standard port for UDP and TCP is specified in
\fI/etc/services\fP.
.sh 2 "Resolver Routines in libc"
.pp
When building your 4.3BSD system you may either
build the C library to use the name server resolver routines
or use the host table lookup routines to do host name and address resolution.
The default resolver for 4.3BSD uses the name server. Newer BSD systems
include both name server and host table functionality with preference given
to the name server if there is one or if there is a \fI/etc/resolv.conf\fP
file.
.pp
Building the C library to use the name server changes the way
\fIgethostbyname\fP\|(3N), \fIgethostbyaddr\fP\|(3N), and
\fIsethostent\fP\|(3N) do their functions. The name server renders
\fIgethostent\fP\|(3N) obsolete, since it has no concept of a next line in
the database. These library calls are built with the resolver routines
needed to query the name server.
.pp
The \fIresolver\fP contains functions that build query
packets and exchange them with name servers.
.pp
Before building the 4.3BSD C library, set the variable \fIHOSTLOOKUP\fP
equal to \fInamed\fP in \fI/usr/src/lib/libc/Makefile\fP. You
then make and install the C library and compiler and then compile the rest
of the 4.3BSD system. For more information see section 6.6 of ``Installing
and Operating 4.3BSD on the VAX\(dd''.
.(f
\(ddVAX is a Trademark of Digital Equipment Corporation
.)f
.pp
If your operating system isn't VAX\(dd 4.3BSD, it is probably the case that
your vendor has included \fIresolver\fP support in the supplied C Library.
You should consult your vendor's documentation to find out what has to be
done to enable \fIresolver\fP support. Note that your vendor's \fIresolver\fP
may be out of date with respect to the one shipped with \s-1BIND\s+1, and that
you might want to build \s-1BIND\s+1's resolver library and install it, and
its include files, into your system's compile/link path so that your own
network applications will be able to use the newer features.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)intro.me 6.2 (Berkeley) 2/28/88
.\"
.sh 1 Introduction
.pp
The Berkeley Internet Name Domain (\s-1BIND\s+1) implements an Internet name
server for \s-2BSD\s+2-derived operating systems. The \s-1BIND\s+1 consists
of a server (or ``daemon'') called \fInamed\fP and a \fIresolver\fP library.
A name server is a network service that enables clients to name resources or
objects and share this information with other objects in the network. This
in effect is a distributed data base system for objects in a computer
network. The \s-1BIND\s+1 server runs in the background, servicing queries
on a well known network port. The standard port for UDP and TCP is specified
in \fI/etc/services\fP. The \fIresolver\fP is a set of routines residing
in a system library that provides the interface that programs can use to
access the domain name services.
.pp
BIND is fully integrated into BSD (4.3 and later releases)
network programs for use in storing and retrieving host names and address.
The system administrator can configure the system to use BIND as a
replacement to the older host table lookup of information in the network
hosts file \fI/etc/hosts\fP. The default configuration for BSD uses
BIND.

View File

@ -0,0 +1,156 @@
.\" ++Copyright++ 1986, 1988, 1995
.\" -
.\" Copyright (c) 1986, 1988, 1995
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)manage.me 6.6 (Berkeley) 9/19/89
.\" $Id: manage.me,v 8.4 1995/12/22 10:20:24 vixie Exp $
.\"
.sh 1 "Domain Management"
.pp
This section contains information for starting, controlling and debugging
\fInamed\fP.
.sh 2 /etc/rc.local
.pp
The hostname should be set to the full domain style name in
\fI/etc/rc.local\fP using \fIhostname\|(1)\fP. The following entry should
be added to \fI/etc/rc.local\fP to start up \fInamed\fP at system boot time:
.(b l
\fIif [ -f /usr/sbin/named ]; then
/usr/sbin/named\fP [options] \fI& echo -n ' named' >/dev/console\fP
\fIfi\fP
.)b
This usually directly follows the lines that start \fIsyslogd\fP.
\fBDo Not\fP attempt to run \fInamed\fP from \fIinetd\fP.
This will
continuously restart the name server and defeat the purpose of the cache.
.sh 2 /var/run/named.pid
.pp
When \fInamed\fP is successfully started up it writes its process id into
the file \fI/var/run/named.pid\fP. This is useful to programs that want to
send signals to \fInamed\fP. The name of this file may be changed by defining
\fIPIDFILE\fP to the new name when compiling \fInamed\fP.
.sh 2 /etc/hosts
.pp
The \fIgethostbyname\|()\fP library call can detect if \fInamed\fP is running.
If it is determined that \fInamed\fP is not running it will look in
\fI/etc/hosts\fP to resolve an address.
This option was added to allow \fIifconfig\|(8C)\fP to configure the machines
local interfaces and to enable a system manager to access the network
while the system is in single user mode.
It is advisable to put the local machines interface addresses and a couple of
machine names and address in
\fI/etc/hosts\fP so the system manager can rcp files from another machine
when the system is in single user mode.
The format of \fI/etc/hosts\fP has not changed. See \fIhosts\|(5)\fP
for more information.
Since the process of reading \fI/etc/hosts\fP is slow,
it is not advisable to use this option when the system is in multi user mode.
.sh 2 Signals
.pp
There are several signals that can be sent to the \fInamed\fP process
to have it do tasks without restarting the process.
.sh 3 Reload
.pp
SIGHUP -
Causes \fInamed\fP to read \fInamed.boot\fP and reload the database.
This is useful when you have made a change to a ``primary'' data file
and you want \fInamed\fP\|'s internal database to reflect the change.
If you build \s-1BIND\s+1 with the \s-1FORCED_RELOAD\s+1 option, then
\s-1SIGHUP\s+1 also has the effect of scheduling all ``secondary'' zones
for serial-number checks, which could lead to zone transfers ahead of
the usual schedule. Normally serial-number compares are done only at
the intervals specified in the zone's \s-1SOA\s+1 record.
.sh 3 Debugging
.pp
When \fInamed\fP is running incorrectly, look first in
\fI/var/log/messages\fP and check for any messages logged by \fIsyslog\fP.
Next send it a signal to see what is happening. Unless you run it with the
``-d'' option, \fInamed\fP has very little to say on its standard output or
standard error. Everything \fInamed\fP has to say, it says to \fIsyslog\fP.
.pp
SIGINT -
Dumps the current data base and cache to
\fI/var/tmp/named_dump.db\fP
This should give you an indication to whether the data base was loaded
correctly.
The name of the dump file may be changed
by defining \fIDUMPFILE\fP to the new name when compiling \fInamed\fP.
\fINote:\fP the following two signals only work when \fInamed\fP is built with
\fIDEBUG\fP defined.
.pp
SIGUSR1 -
Turns on debugging. Each following SIGUSR1 increments the debug level.
The output goes to \fI/var/tmp/named.run\fP
The name of this debug file may be changed
by defining \fIDEBUGFILE\fP to the new name before compiling \fInamed\fP.
.pp
SIGUSR2 -
Turns off debugging completely.
For more detailed debugging, define DEBUG when compiling the resolver
routines into \fI/lib/libc.a\fP.
.pp
SIGWINCH -
Toggles tracing of all incoming queries if \fInamed\fP has been
compiled with \fIQRYLOG\fP defined. The trace is sent to syslog, and
is huge, but it is very useful for tracking down problems.
To run with tracing of all queries specify the \fI-q\fP flag on the
command line. If you routinely log queries you will probably want to
analyze the results using the dnsstats stats script in the
contrib directory.
.pp
SIGIOT -
Dumps statistics data into \fI/var/tmp/named.stats\fP if the server
is built with \fISTATS\fP defined. Statistics are appended to the file.

View File

@ -0,0 +1,77 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)named.boot.cache 6.4 (Berkeley) 9/19/89
.\"
.ne 13v
.sh 4 "Caching Only Server"
.(b L
.TS
l.
;
; Boot file for Caching Only Name Server
;
.TE
.TS
l l l
l
l l l.
; type domain source file or host
;
directory /usr/local/adm/named
cache \fB.\fP root\fB.\fPcache
primary 0\fB.\fP0\fB.\fP127\fB.\fPin-addr\fB.\fParpa named\fB.\fPlocal
.TE
.)b

View File

@ -0,0 +1,78 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)named.boot.primary 6.4 (Berkeley) 9/19/89
.\"
.ne 15v
.sh 3 "Boot Files"
.sh 4 "Primary Server"
.(b L
.TS
l.
;
; Boot file for Primary Name Server
;
.TE
.TS
l l l
l
l l l.
; type domain source file or host
;
directory /usr/local/adm/named
primary Berkeley\fB.\fPEdu ucbhosts
primary 32\fB.\fP128\fB.\fPin-addr\fB.\fParpa ucbhosts\fB.\fPrev
primary 0\fB.\fP0\fB.\fP127\fB.\fPin-addr\fB.\fParpa named\fB.\fPlocal
cache \fB.\fP root\fB.\fPcache
.TE
.)b

View File

@ -0,0 +1,77 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)named.boot.secondary 6.4 (Berkeley) 9/19/89
.\"
.ne 12v
.sh 4 "Secondary Server"
.(b L
.TS
l.
;
; Boot file for Secondary Name Server
;
.TE
.TS
l l l
l
l l l.
; type domain source file or host
;
directory /usr/local/adm/named
secondary Berkeley\fB.\fPEdu 128\fB.\fP32\fB.\fP0\fB.\fP4 128\fB.\fP32\fB.\fP0\fB.\fP10 ucbhosts.bak
secondary 32\fB.\fP128\fB.\fPin-addr\fB.\fParpa 128\fB.\fP32\fB.\fP0\fB.\fP4 128\fB.\fP32\fB.\fP0\fB.\fP10 ucbhosts.rev.bak
primary 0\fB.\fP0\fB.\fP127\fB.\fPin-addr\fB.\fParpa named\fB.\fPlocal
cache \fB.\fP root\fB.\fPcache
.TE
.)b

View File

@ -0,0 +1,75 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)named.local 6.3 (Berkeley) 5/24/89
.\"
.ne 13v
.sh 3 "named.local"
.(b L
.TS
l l l l l s.
@ IN SOA ucbvax\fB.\fPBerkeley\fB.\fPEdu. kjd\fB.\fPucbvax\fB.\fPBerkeley\fB.\fPEdu\fB.\fP (
.T&
l l l l l.
1994072100 ; Serial
10800 ; Refresh
1800 ; Retry
3600000 ; Expire
259200 ) ; Minimum
.T&
l l l l l s.
IN NS ucbvax\fB.\fPBerkeley\fB.\fPEdu\fB.\fP ; pedantic
1 IN PTR localhost\fB.\fP
.TE
.)b

View File

@ -0,0 +1,96 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)ns.me 6.3 (Berkeley) 9/19/89
.\"
.sh 1 "The Name Service"
.pp
The basic function of the name server is to provide information about network
objects by answering queries. The specifications for this name server are
defined in RFC1034, RFC1035 and RFC974. These documents can be found in
\fI/usr/src/etc/named/doc\fP in 4.3BSD or \fIftp\fPed from
\fBftp.rs.internic.net\fP.
It is also recommended that you read the related manual pages,
\fInamed\fP\|(8),
\fIresolver\fP\|(3),
and \fIresolver\fP\|(5).
.pp
The advantage of using a name server over the host table lookup for host
name resolution is to avoid the need for a single centralized clearinghouse
for all names. The authority for this information can be delegated to the
different organizations on the network responsible for it.
.pp
The host table lookup routines require that the master file for the entire
network be maintained at a central location by a few people. This works
fine for small networks where there are only a few machines and the
different organizations responsible for them cooperate. But this does not
work well for large networks where machines cross organizational boundaries.
.pp
With the name server, the network can be broken into a hierarchy of domains.
The name space is organized as a tree according to organizational or
administrative boundaries.
Each node, called a \fIdomain\fP, is given a label, and the name of the
domain is the concatenation of all the labels of the domains from
the root to the current domain, listed from right to left separated by dots.
A label need only be unique within its domain.
The whole space is partitioned into several areas called \fIzones\fP,
each starting at a domain and extending down to the leaf domains or to
domains where other zones start.
Zones usually represent administrative boundaries.
An example of a host address for a host at the University of California,
Berkeley would look as follows:
.(b
\fImonet\fP\|\fB.\fP\|\fIBerkeley\fP\|\fB.\fP\|\fIEDU\fP
.)b
The top level domain for educational organizations is EDU;
Berkeley is a subdomain of EDU and monet is the name of the host.

View File

@ -0,0 +1,67 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)resolv.conf 6.2 (Berkeley) 2/29/88
.\"
.ne 6v
.\" .bp
.sh 3 "Remote Server / DNS Client"
.sh 4 "/etc/resolv.conf"
.(b L
domain Berkeley\fB.\fPEdu
nameserver 128\fB.\fP32\fB.\fP0\fB.\fP4
nameserver 128\fB.\fP32\fB.\fP0\fB.\fP10
sortlist 130.155.160.0/255.255.240.0 130.155.0.0
.)b

View File

@ -0,0 +1,102 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)root.cache 6.4 (Berkeley) 4/29/90
.\"
.ne 38v
.sh 3 "root.cache"
.(b L
;
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC registration services
; under anonymous FTP as
; file /domain/named.root
; on server FTP.RS.INTERNIC.NET
; -OR- under Gopher at RS.INTERNIC.NET
; under menu InterNIC Registration Services (NSI)
; submenu InterNIC Registration Archives
; file named.root
;
; last update: Oct 5, 1994
; related version of root zone: 1994100500
;
.TS
l l l l l.
\fB.\fP 604800 IN NS NS\fB.\fPINTERNIC\fB.\fPNET\fB.\fP
NS\fB.\fPINTERNIC\fB.\fPNET\fB.\fP 604800 IN A 198\fB.\fP41\fB.\fP0\fB.\fP4
\fB.\fP 604800 IN NS NS1\fB.\fPISI\fB.\fPEDU\fB.\fP
NS1\fB.\fPISI\fB.\fPEDU\fB.\fP 604800 IN A 128\fB.\fP9\fB.\fP0\fB.\fP107
\fB.\fP 604800 IN NS C\fB.\fPPSI\fB.\fPNET\fB.\fP
C\fB.\fPPSI\fB.\fPNET\fB.\fP 604800 IN A 192\fB.\fP33\fB.\fP4\fB.\fP12
\fB.\fP 604800 IN NS TERP\fB.\fPUMD\fB.\fPEDU\fB.\fP
TERP\fB.\fPUMD\fB.\fPEDU\fB.\fP 604800 IN A 128\fB.\fP8\fB.\fP10\fB.\fP90
\fB.\fP 604800 IN NS NS\fB.\fPNASA\fB.\fPGOV\fB.\fP
NS\fB.\fPNASA\fB.\fPGOV\fB.\fP 604800 IN A 128\fB.\fP102\fB.\fP16\fB.\fP10
604800 IN A 192\fB.\fP52\fB.\fP195\fB.\fP10
\fB.\fP 604800 IN NS NS\fB.\fPISC\fB.\fPORG\fB.\fP
NS\fB.\fPISC\fB.\fPORG\fB.\fP 604800 IN A 192\fB.\fP5\fB.\fP5\fB.\fP241
\fB.\fP 604800 IN NS NS\fB.\fPNIC\fB.\fPDDN\fB.\fPMIL\fB.\fP
NS\fB.\fPNIC\fB.\fPDDN\fB.\fPMIL\fB.\fP 604800 IN A 192\fB.\fP112\fB.\fP36\fB.\fP4
\fB.\fP 604800 IN NS AOS\fB.\fPARL\fB.\fPARMY\fB.\fPMIL\fB.\fP
AOS\fB.\fPARL\fB.\fPARMY\fB.\fPMIL\fB.\fP 604800 IN A 128\fB.\fP63\fB.\fP4\fB.\fP82
604800 IN A 192\fB.\fP5\fB.\fP25\fB.\fP82
\fB.\fP 604800 IN NS NIC\fB.\fPNORDU\fB.\fPNET\fB.\fP
NIC\fB.\fPNORDU\fB.\fPNET\fB.\fP 604800 IN A 192\fB.\fP36\fB.\fP148\fB.\fP17
.TE
; End of File
.)b

View File

@ -0,0 +1,88 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)setup.me 6.4 (Berkeley) 9/19/89
.\"
.sh 1 "Setting up Your Own Domain"
.pp
When setting up a domain that is going to be on a public network the site
administrator should contact the organization in charge of the network and
request the appropriate domain registration form. An organization that
belongs to multiple networks (such as the \fIInternet\fP and
\fIBITNET\fP) should register with only one network.
.sh 2 "Internet"
.pp
Sites on the Internet who need information on setting up a domain should
contact the registrar for their network, which is one of the following:
.TS
l l.
MILnet \s-1HOSTMASTER\s+1@\s-1NIC\s+1\fB\|.\|\fP\s-1DDN\s+1\fB\|.\|\fP\s-1MIL\s+1
other \s-1HOSTMASTER\s+1@\s-1INTERNIC\s+1\fB\|.\|\fP\s-1NET\s+1
.TE
You may also want to be placed on the \s-1BIND\s+1 mailing list, which is a
mail group for people on the Internet who run \s-1BIND\s+1. The group
discusses future design decisions, operational problems, and other related
topic. The address to request being placed on this mailing list is:
.(b l
\fIbind-request\|@\|uunet\fP\fB\|.\|\fP\fIuu\fP\fB\|.\|\fP\fInet\fP
.)b
.sh 2 "Subdomains of Existing Domains"
.pp
If you want a subdomain of some existing domain, you should find the contact
point for the parent domain rather than asking one of the above top-level
registrars. There should be a convention that \fBregistrar\fP@\fIdomain\fP
or \fBhostmaster\fP@\fIdomain\fP for any given domain will always be an alias
for that domain's registrar (somewhat analogous to \fBpostmaster\fP), but
there is no such convention. Try it as a last resort, but first you should
examine the \fISOA\fP record for the domain and send mail to the ``responsible
person'' shown therein. You can also try \fIwhois\fP.

View File

@ -0,0 +1,163 @@
.\" ++Copyright++ 1986, 1988, 1995
.\" -
.\" Copyright (c) 1986, 1988, 1995
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)types.me 6.3 (Berkeley) 9/19/89
.\"
.sh 1 "Types of Zones"
.pp
A ``zone'' is a point of delegation in the DNS tree. It contains all names
from a certain point ``downward'' except those which are delegated to other
zones. A ``delegation point'' has one or more \fINS\fP records in the
``parent zone'', which should be matched by equivalent \fINS\fP records at
the root of the ``delegated zone'' (i.e., the ``@'' name in the zone file).
.pp
Understanding the difference between a ``zone'' and a ``domain'' is crucial
to the proper operation of a name server. As an example, consider the
\s-1DEC.COM\s+1 \fIdomain\fP, which includes names such as
\s-1POBOX1.PA.DEC.COM\s+1 and \s-1QUABBIN.CRL.DEC.COM\s+1 even though
the \s-1DEC.COM\s+1 \fIzone\fP includes only \fIdelegations\fP for the
\s-1PA.DEC.COM\s+1 and \s-1CRL.DEC.COM\s+1 zones. A zone can map exactly
to a single domain, but could also include only part of a domain (the rest
of which could be delegated to other name servers). Technically speaking,
every name in the DNS tree is a ``domain'', even if it is ``terminal'', that
is, has no ``subdomains''. Technically speaking, every subdomain is a domain
and every domain except the root is also a subdomain. The terminology is not
intuitive and you would do well to read RFC's 1033, 1034, and 1035 to gain a
complete understanding of this difficult and subtle topic.
.pp
Though \s-1BIND\s+1 is a \fIDomain\fP Name Server, it deals primarily in terms
of \fIzones\fP. The \fIprimary\fP and \fIsecondary\fP declarations in the
\fInamed.boot\fP file specify \fIzones\fP, not \fIdomains\fP. When you ask
someone if they are willing to be a secondary server for your ``domain'', you
are actually asking for secondary service for some collection of \fIzones\fP.
.pp
Each zone will have one ``primary'' server, which loads the zone contents
from some local file which is edited by humans or perhaps generated
mechanically from some other local file which is edited by humans. Then
there will be some number of ``secondary'' servers, which load the zone
contents using the \s-1IP/DNS\s+1 protocol (that is, the secondary servers will
contact the primary and fetch the zone using \s-1IP/TCP\s+1). This set of
servers (the primary and all of the secondaries) should be listed in the
\fINS\fP records in the parent zone, which will constitute a ``delegation''.
This set of servers must also be listed in the zone file itself, usually
under the ``@'' name which is a magic cookie that means the ``top level''
or ``root'' of current zone. You can list servers in the zone's
top-level ``@'' \fINS\fP records that are not in the parent's \fINS\fP
delegation, but you cannot list servers in the parent's delegation that are
not present in the zone's ``@''. Any servers listed in the \fINS\fP records
must be configured as authoritative (either primary or secondary) for the
zone. If a server listed in a \fINS\fP record is not authoritative, it
will respond with a ``lame delegation'' when queried.
.sh 1 "Types of Servers"
.pp
Servers do not really have ``types''. A server can be a primary for some
zones and a secondary for others, or it can be only a primary, or only a
secondary, or it can serve no zones and just answer queries via its ``cache''.
Previous versions of this document referred to servers as ``master'' and
``slave'' but we now feel that those distinctions \(em and the assignment of
a ``type'' to a name server \(em are not useful.
.sh 2 "Caching Only Server"
.pp
All servers are caching servers. This means that the server caches the
information that it receives for use until the data expires. A \fICaching
Only Server\fP is a server that is not authoritative for any zone. This
server services queries and asks other servers, who have the authority, for
the information needed. All servers keep data in their cache until the data
expires, based on a \fITTL\fP (``Time To Live'') field which is maintained
for all resource records.
.sh 2 "Remote Server"
.pp
A Remote Server is an option given to people who would like to use
a name server from their workstation or on a machine that has a limited
amount of memory and CPU cycles.
With this option you can run all of the networking programs that use
the name server without the name server running on the local machine.
All of the queries are serviced by a name server that is running on another
machine on the network.
A host which has an
\fI/etc/resolv.conf\fP file listing only remote hosts, and which does not
run a name server of its own, is sometimes called a Remote Server (because
the actual server is remote?) but more
often it is called simply a DNS Client.
This kind of host is technically not a ``server'',
since it has no cache and does not answer queries.
.sh 2 "Slave Server"
.pp
A Slave Server is a server that always forwards queries it cannot
satisfy from its cache, to a fixed list of \fIforwarding\fP servers
instead of interacting
with the name servers for the root and other domains.
The queries to the \fIforwarding servers\fP are recursive queries.
There may be one or more forwarding servers, and they are tried in turn
until the list is exhausted.
A Slave and forwarder configuration is typically used when you do not
wish all the servers at a given site to interact with the rest
of the Internet servers. A typical scenario would involve a number of
workstations and a departmental timesharing machine with Internet
access. The workstations might be
administratively prohibited from having Internet access.
To give the workstations the appearance of access to the Internet
domain system, the workstations could be Slave servers to the timesharing
machine which would forward the queries and interact with other
name servers to resolve the query before returning the answer.
An added benefit of using the forwarding feature is that the central
machine develops a much more complete cache of information that
all the workstations can take advantage of. The use of Slave mode
and forwarding is discussed further under the description of
the \fInamed\fP bootfile commands.
.pp
There is no prohibition against declaring a server to be a \fIslave\fP
even though it has \fIprimary\fP and/or \fIsecondary\fP zones as well;
the effect will still be that anything in the local server's cache or
zones will be answered, and anything else will be forwarded using the
\fIforwarders\fP list.

View File

@ -0,0 +1,118 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)ucbhosts 6.3 (Berkeley) 2/8/89
.\"
.\" .ne 48v
.\" .bp
.sh 3 "Hosts"
.(b L
;
; @(#)ucb-hosts 1.2 (berkeley) 88/02/05
;
.TS
l l l l l s.
@ IN SOA ucbvax\fB.\fPBerkeley\fB.\fPEdu\fB.\fP kjd\fB.\fPmonet\fB.\fPBerkeley\fB.\fPEdu\fB.\fP (
.T&
l l l l l.
1988020501 ; Serial
10800 ; Refresh
1800 ; Retry
3600000 ; Expire
259200 ) ; Minimum
.T&
l l l l s.
IN NS ucbarpa\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
IN NS ucbvax\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
localhost IN A 127\fB.\fP1
; note that 127.1 is the same as 127.0.0.1; see inet(3n)
ucbarpa IN A 128\fB.\fP32\fB.\fP4
IN A 10\fB.\fP0\fB.\fP0\fB.\fP78
IN HINFO VAX-11/780 UNIX
arpa IN CNAME ucbarpa
ernie IN A 128\fB.\fP32\fB.\fP6
IN HINFO VAX-11/780 UNIX
ucbernie IN CNAME ernie
monet IN A 128\fB.\fP32\fB.\fP7
IN A 128\fB.\fP32\fB.\fP130\fB.\fP6
IN HINFO VAX-11/750 UNIX
ucbmonet IN CNAME monet
ucbvax IN A 10\fB.\fP2\fB.\fP0\fB.\fP78
; 128.32.10 means 128.32.0.10; see inet(3n)
IN A 128\fB.\fP32\fB.\fP10
; HINFO and WKS are widely unused,
; but we'll show them as examples.
IN HINFO VAX-11/750 UNIX
IN WKS 128.32.0.10 TCP ( echo telnet
discard sunrpc sftp
uucp-path systat daytime
netstat qotd nntp
link chargen ftp
auth time whhois mtp
pop rje finger smtp
supdup hostnames
domain
nameserver )
vax IN CNAME ucbvax
toybox IN A 128\fB.\fP32\fB.\fP131\fB.\fP119
IN HINFO Pro350 RT11
toybox IN MX 0 monet.Berkeley.Edu.
csrg IN MX 0 Ralph.CS
IN MX 0 Zhou.CS
IN MX 0 Painter.CS
IN MX 0 Riggle.CS
IN MX 0 Terry.CS
IN MX 0 Kevin.CS
.TE
.)b
.\" .bp

View File

@ -0,0 +1,86 @@
.\" ++Copyright++ 1986, 1988
.\" -
.\" Copyright (c) 1986, 1988
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)ucbhosts.rev 6.3 (Berkeley) 9/19/89
.\"
.ne 22v
.sh 3 "host.rev"
.(b L
;
; @(#)ucb-hosts.rev 1.1 (Berkeley) 86/02/05
;
.TS
l l l l l s.
@ IN SOA ucbvax\fB.\fPBerkeley\fB.\fPEdu\fB.\fP kjd\fB.\fPmonet\fB.\fPBerkeley\fB.\fPEdu\fB.\fP (
.T&
l l l l l.
1986020501 ; Serial
10800 ; Refresh
1800 ; Retry
3600000 ; Expire
259200 ) ; Minimum
.T&
l l l l s.
IN NS ucbarpa\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
IN NS ucbvax\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
0\fB.\fP0 IN PTR Berkeley-net\fB.\fPBerkeley\fB.\fPEDU\fB.\fP
IN A 255\fB.\fP255\fB.\fP255\fB.\fP0
0\fB.\fP130 IN PTR csdiv-net\fB.\fPBerkeley\fB.\fPEDU\fB.\fP
4\fB.\fP0 IN PTR ucbarpa\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
6\fB.\fP0 IN PTR ernie\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
7\fB.\fP0 IN PTR monet\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
10\fB.\fP0 IN PTR ucbvax\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
6\fB.\fP130 IN PTR monet\fB.\fPBerkeley\fB.\fPEdu\fB.\fP
.TE
.)b

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,72 @@
IPv6 notes for BIND 4.9.3 Patch 2 Candidate 5 (and later?)
Paul Vixie, May 20, 1996
doc/misc/IPv6
*** Introduction ***
The IPv6 support in this release is latent, in that its presence is not
documented. The support is not optional, since its presence ought not to
affect anyone who does not go looking for it. The support includes:
inet_ntop() new function.
inet_pton() new function.
RES_USE_INET6 causes gethostby*() to return either real IPv6
addresses (if available) or mapped (::FFFF:a.b.c.d)
addresses if only IPv4 address records are found.
gethostbyname() can search for T_AAAA in preference to T_A.
gethostbyaddr() can search in IP6.INT for PTR RR's.
named can load, transfer, cache, and dump T_AAAA RRs.
*** Some notes on the new functions ***
The inet_pton() and inet_ntop() functions differ from the current (as of
this writing) IPv6 BSD API draft. Discussions were held, primarily between
myself and Rich Stevens, on the ipng@sunroof.eng.sun.com mailing list, and
the BIND definitions of these functions are likely to go into the next draft.
(If not, and BIND has to change its definitions of these functions, then you
will know why I chose not to document them yet!)
These functions can return error values, and as such the process of porting
code that used inet_aton() to use inet_pton() is not just syntactic. Not all
nonzero values indicate success; consider "-1". Likewise, inet_ntoa() is not
just smaller than inet_ntop() -- it's a whole new approach. Inet_ntop() does
not return a static pointer, the caller has to supply a sized buffer. Also,
inet_ntop() can return NULL, so you should only printf() the result if you
have verified that your arguments will be seen as error free.
The inet_pton() function is much pickier about its input format than the old
inet_aton() function has been. You can't abbreviate 10.0.0.53 as 10.53 any
more. Hexadecimal isn't accepted. You have to supply four decimal numeric
strings, each of whose value is within the range from 0 to 255. No spaces
are allowed either before, after, or within an address. If you need the older
functionality with all the shortcuts and exceptions, continue using inet_aton()
for your IPv4 address parsing needs.
*** Some notes on RES_USE_INET6 ***
You can set this by modifying _res.options after calling res_init(), or you
can turn it on globally by setting "options inet6" in /etc/resolv.conf. This
latter option ought to be used carefully, since _all_ applications will then
receive IPv6 style h_addr_list's from their gethostby*() calls. Once you know
that every application on your system can cope with IPv6 addressing, it is safe
and reasonable to turn on the global option. Otherwise, don't do it.
*** Some notes on mapped IPv4 addresses ***
There are two IPv6 prefixes set aside for IPv4 address encapsulation. See
RFC 1884 for a detailed explaination. The ::a.b.c.d form is used for
tunnelling, which means wrapping an IPv4 header around IPv6 packets and using
the existing IPv4 routing infrastructure to reach what are actually IPv6
endpoints. The ::FFFF:a.b.c.d form can be used on dual-stack (IPv4 and IPv6)
hosts to signal a predominantly IPv6 stack that it should use ``native'' IPv4
to reach a given destination, even though the socket's address family is
AF_INET6.
BIND supports both of these address forms, to the extent that inet_pton() will
parse them, inet_ntop() will generate them, gethostby*() will map IPv4 into
IPv6 if the RES_USE_INET6 option is set, and gethostbyaddr() will search the
IN-ADDR.ARPA domain rather than the IP6.INT domain when it needs a PTR RR.
This last bit of behaviour is still under discussion and it's not clear that
tunnelled addresses should be mapped using IN-ADDR.ARPA. In other words, this
bit of behaviour may change in a subsequent BIND release. So now you know
another reason why none of this stuff is ``officially'' documented.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,172 @@
Path: vixie!vixie
From: vixie@vix.com (Paul A Vixie)
Newsgroups: comp.protocols.tcp-ip.domains
Subject: Re: Format of DNS files (style question)
Date: 28 Aug 94 03:17:08
Organization: Vixie Enterprises
Lines: 159
Distribution: inet
Message-ID: <VIXIE.94Aug28031708@office.home.vix.com>
References: <33onnr$i4u@zombie.ncsc.mil>
NNTP-Posting-Host: office.home.vix.com
In-reply-to: sjr@zombie.ncsc.mil's message of 27 Aug 1994 21:02:51 -0400
> (Style) Suggestions for how to layout DNS configuration files (both
> forward and reverse)?
I've gone back and forth on the question of whether the BOG should include a
section on this topic. I know what I myself prefer, but I'm wary of ramming
my own stylistic preferences down the throat of every BOG reader. But since
you ask :-)...
Create /var/named. If your system is too old to have a /var, either create
one or use /usr/local/adm/named instead. Put your named.boot in it, and make
/etc/named.boot a symlink to it. If your system doesn't have symlinks, you're
S-O-L (but you knew that). In named.boot, put a "directory" directive that
specifies your actual BIND working directory:
directory /var/named
All relative pathnames used in "primary", "secondary", and "cache" directives
will be evaluated relative to this directory. Create two subdirectories,
/var/named/pri and /var/named/sec. Whenever you add a "primary" directive
to your named.boot, use "pri/WHATEVER" as the path name. And then put the
primary zone file into "pri/WHATEVER". Likewise when you add "secondary"
directives, use "sec/WHATEVER" and BIND (really named-xfer) will create the
files in that subdirectory.
(Variations: (1) make a midlevel directory "zones" and put "pri" and "sec"
into it; (2) if you tend to pick up a lot of secondaries from a few hosts,
group them together in their own subdirectories -- something like
/var/named/zones/uucp if you're a UUCP Project name server.)
For your forward files, name them after the zone. dec.com becomes
"/var/named/zones/pri/dec.com". For your reverse files, name them after the
network number. 0.1.16.in-addr.arpa becomes "/var/named/zones/pri/16.1.0".
When creating or maintaining primary zone files, try to use the same SOA
values everywhere, except for the serial number which varies per zone. Put
a $ORIGIN directive at the top of the primary zone file, not because it's
needed (it's not since the default origin is the zone named in the "primary"
directive) but because it make it easier to remember what you're working on
when you have a lot of primary zones. Put some comments up there indicating
contact information for the real owner if you're proxying. Use RCS and put
the "$Id: style.txt,v 8.1 1995/12/22 21:59:52 vixie Exp $" in a ";" comment near the top of the zone file.
The SOA and other top level information should all be listed together. But
don't put IN on every line, it defaults nicely. For example:
==============
@ IN SOA gw.home.vix.com. postmaster.vix.com. (
1994082501 ; serial
3600 ; refresh (1 hour)
1800 ; retry (30 mins)
604800 ; expire (7 days)
3600 ) ; minimum (1 hour)
NS gw.home.vix.com.
NS ns.uu.net.
NS uucp-gw-1.pa.dec.com.
NS uucp-gw-2.pa.dec.com.
MX 10 gw.home.vix.com.
MX 20 uucp-gw-1.pa.dec.com.
MX 20 uucp-gw-1.pa.dec.com.
==============
I don't necessarily recommend those SOA values. Not every zone is as volatile
as the example shown. I do recommend that serial number format; it's in date
format with a 2-digit per-day revision number. This format will last us until
2147 A.D. at which point I expect a better solution will have been found :-).
(Note that it would last until 4294 A.D. except that there are some old BINDs
out there that use a signed quantity for representing serial number interally;
I suppose that as long as none of these are still running after 2047 A.D.,
that we can use the above serial number format until 4294 A.D., at which point
a better solution will HAVE to be found.)
You'll note that I use a tab stop for "IN" even though I never again specify
it. This leaves room for names longer than 7 bytes without messing up the
columns. You might also note that I've put the MX priority and destination
in the same tab stop; this is because both are part of the RRdata and both
are very different from MX which is an RRtype. Some folks seem to prefer to
group "MX" and the priority together in one tab stop. While this looks neat
it's very confusing to newcomers and for them it violates the law of least
astonishment.
If you have a multi-level zone (one which contains names that have dots in
them), you can use additional $ORIGIN statements but I recommend against it
since there is no "back" operator. That is, given the above example you can
add:
=============
$ORIGIN home
gw A 192.5.5.1
=============
The problem with this is that subsequent RR's had better be somewhere under
the "home.vix.com" name or else the $ORIGIN that introduces them will have
to use a fully qualified name. FQDN $ORIGIN's aren't bad and I won't be mad
if you use them. Unqualified ones as shown above are real trouble. I usually
stay away from them and just put the whole name in:
=============
gw.home A 192.5.5.1
=============
In your reverse zones, you're usually in some good luck because the owner name
is usually a single short token or sometimes two.
=============
$ORIGIN 5.5.192.in-addr.arpa.
@ IN SOA ...
NS ...
1 PTR gw.home.vix.com.
-------------
$ORIGIN 1.16.in-addr.arpa.
@ IN SOA ...
NS ...
2.0 PTR gatekeeper.dec.com.
=============
It is usually pretty hard to keep your forward and reverse zones in synch.
You can avoid that whole problem by just using "h2n" (see the ORA book, DNS
and BIND, and its sample toolkit, included in the BIND distribution or on
ftp.uu.net (use the QUOTE SITE EXEC INDEX command there to find this -- I
never can remember where it's at). "h2n" and many tools like it can just
read your old /etc/hosts file and churn it into DNS zone files. (May I
recommend contrib/decwrl/mkdb.pl from the BIND distribution?) However, if
you (like me) prefer to edit these things by hand, you need to follow the
simple convention of making all of your holes consistent. If you use
192.5.5.1 and 192.5.5.3 but not (yet) 192.5.5.2, then in your forward file
you will have something like
=============
...
gw.home A 192.5.5.1
;avail A 192.5.5.2
pc.home A 192.5.5.3
=============
and in your reverse file you will have something like
=============
...
1 PTR gw.home.vix.com.
;2 PTR avail
3 PTR pc.home.vix.com.
=============
This convention will allow you to keep your sanity and make fewer errors.
Any kind of automation (h2n, mkdb, or your own perl/tcl/awk/python tools)
will help you maintain a consistent universe even if it's also a complex
one. Editing by hand doesn't have to be deadly but you MUST take care.
Anyone who wants to know how to maintain nonleaf zones, i.e., zones which
have few or no hosts in them but have hundreds or thousands of delegations,
should attend Usenix LISA in San Diego and be there for the SENDS talk.
Contact office@usenix.org for conference information.
--
Paul Vixie
Redwood City, CA
decwrl!vixie!paul
<paul@vix.com>

View File

@ -0,0 +1,74 @@
# ++Copyright++ 1993
# -
# Copyright (c)
# 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.
# -
# Portions Copyright (c) 1993 by Digital Equipment Corporation.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies, and that
# the name of Digital Equipment Corporation not be used in advertising or
# publicity pertaining to distribution of the document or software without
# specific, written prior permission.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
# CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# -
# --Copyright--
SUBDIRS = arpa
HFILES = netdb.h resolv.h
DESTDIR=
DESTINC= /usr/include
MARGS= DESTDIR="${DESTDIR}" DESTINC="${DESTINC}" INSTALL="${INSTALL}" \
MAKE="${MAKE}"
all depend clean install::
@for x in ${SUBDIRS}; do \
(cd $$x; pwd; ${MAKE} ${MARGS} $@); \
done
clean::
rm -f *~ *.BAK *.CKP *.orig
install::
@set -x; for x in ${HFILES}; do \
${INSTALL} -c -m 444 $$x ${DESTDIR}${DESTINC}/$$x; \
done

View File

@ -0,0 +1,67 @@
# ++Copyright++ 1993
# -
# Copyright (c)
# 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.
# -
# Portions Copyright (c) 1993 by Digital Equipment Corporation.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies, and that
# the name of Digital Equipment Corporation not be used in advertising or
# publicity pertaining to distribution of the document or software without
# specific, written prior permission.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
# CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# -
# --Copyright--
HFILES = inet.h nameser.h
DESTDIR =
DESTINC = /usr/include
all depend:
clean:
rm -f *~ *.BAK *.CKP *.orig
install:
set -x; for x in ${HFILES}; do \
${INSTALL} -c -m 444 $$x ${DESTDIR}${DESTINC}/arpa/$$x; \
done

View File

@ -0,0 +1,88 @@
/*
* ++Copyright++ 1983, 1993
* -
* Copyright (c) 1983, 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* @(#)inet.h 8.1 (Berkeley) 6/2/93
* $Id: inet.h,v 8.5 1996/05/22 04:56:29 vixie Exp $
*/
#ifndef _INET_H_
#define _INET_H_
/* External definitions for functions in inet(3) */
#include <sys/param.h>
#if (!defined(BSD)) || (BSD < 199306)
# include <sys/bitypes.h>
#else
# include <sys/types.h>
#endif
#include <sys/cdefs.h>
__BEGIN_DECLS
unsigned long inet_addr __P((const char *));
int inet_aton __P((const char *, struct in_addr *));
unsigned long inet_lnaof __P((struct in_addr));
struct in_addr inet_makeaddr __P((u_long , u_long));
unsigned long inet_netof __P((struct in_addr));
unsigned long inet_network __P((const char *));
char *inet_ntoa __P((struct in_addr));
int inet_pton __P((int af, const char *src, void *dst));
const char *inet_ntop __P((int af, const void *src, char *dst, size_t s));
u_int inet_nsap_addr __P((const char *, u_char *, int maxlen));
char *inet_nsap_ntoa __P((int, const u_char *, char *ascii));
__END_DECLS
#endif /* !_INET_H_ */

View File

@ -0,0 +1,346 @@
/*
* ++Copyright++ 1983, 1989, 1993
* -
* Copyright (c) 1983, 1989, 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* @(#)nameser.h 8.1 (Berkeley) 6/2/93
* $Id: nameser.h,v 8.5 1996/08/05 08:31:28 vixie Exp $
*/
#ifndef _NAMESER_H_
#define _NAMESER_H_
#include <sys/param.h>
#if (!defined(BSD)) || (BSD < 199306)
# include <sys/bitypes.h>
#else
# include <sys/types.h>
#endif
#include <sys/cdefs.h>
#ifdef _AUX_SOURCE
#include <sys/types.h> /* ech for A/UX */
#define res_send ucb_res_send /* already def'd in libc */
#define _res_close _ucb_res_close /* removing res_send.o from the library */
#endif /* gives an undefined symbol... */
/*
* revision information. this is the release date in YYYYMMDD format.
* it can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__BIND > 19931104)". do not
* compare for equality; rather, use it to determine whether your resolver
* is new enough to contain a certain feature.
*/
#define __BIND 19950621 /* interface version stamp */
/*
* Define constants based on rfc883
*/
#define PACKETSZ 512 /* maximum packet size */
#define MAXDNAME 256 /* maximum domain name */
#define MAXCDNAME 255 /* maximum compressed domain name */
#define MAXLABEL 63 /* maximum length of domain label */
#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
#define QFIXEDSZ 4 /* #/bytes of fixed data in query */
#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
#define INT32SZ 4 /* for systems without 32-bit ints */
#define INT16SZ 2 /* for systems without 16-bit ints */
#define INADDRSZ 4 /* IPv4 T_A */
#define IN6ADDRSZ 16 /* IPv6 T_AAAA */
/*
* Internet nameserver port number
*/
#define NAMESERVER_PORT 53
/*
* Currently defined opcodes
*/
#define QUERY 0x0 /* standard query */
#define IQUERY 0x1 /* inverse query */
#define STATUS 0x2 /* nameserver status query */
/*#define xxx 0x3*/ /* 0x3 reserved */
#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
#ifdef ALLOW_UPDATES
/* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */
# define UPDATEA 0x9 /* add resource record */
# define UPDATED 0xa /* delete a specific resource record */
# define UPDATEDA 0xb /* delete all named resource record */
# define UPDATEM 0xc /* modify a specific resource record */
# define UPDATEMA 0xd /* modify all named resource record */
# define ZONEINIT 0xe /* initial zone transfer */
# define ZONEREF 0xf /* incremental zone referesh */
#endif
/*
* Currently defined response codes
*/
#define NOERROR 0 /* no error */
#define FORMERR 1 /* format error */
#define SERVFAIL 2 /* server failure */
#define NXDOMAIN 3 /* non existent domain */
#define NOTIMP 4 /* not implemented */
#define REFUSED 5 /* query refused */
#ifdef ALLOW_UPDATES
/* non standard */
# define NOCHANGE 0xf /* update failed to change db */
#endif
/*
* Type values for resources and queries
*/
#define T_A 1 /* host address */
#define T_NS 2 /* authoritative server */
#define T_MD 3 /* mail destination */
#define T_MF 4 /* mail forwarder */
#define T_CNAME 5 /* canonical name */
#define T_SOA 6 /* start of authority zone */
#define T_MB 7 /* mailbox domain name */
#define T_MG 8 /* mail group member */
#define T_MR 9 /* mail rename name */
#define T_NULL 10 /* null resource record */
#define T_WKS 11 /* well known service */
#define T_PTR 12 /* domain name pointer */
#define T_HINFO 13 /* host information */
#define T_MINFO 14 /* mailbox information */
#define T_MX 15 /* mail routing information */
#define T_TXT 16 /* text strings */
#define T_RP 17 /* responsible person */
#define T_AFSDB 18 /* AFS cell database */
#define T_X25 19 /* X_25 calling address */
#define T_ISDN 20 /* ISDN calling address */
#define T_RT 21 /* router */
#define T_NSAP 22 /* NSAP address */
#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */
#define T_SIG 24 /* security signature */
#define T_KEY 25 /* security key */
#define T_PX 26 /* X.400 mail mapping */
#define T_GPOS 27 /* geographical position (withdrawn) */
#define T_AAAA 28 /* IP6 Address */
#define T_LOC 29 /* Location Information */
/* non standard */
#define T_UINFO 100 /* user (finger) information */
#define T_UID 101 /* user ID */
#define T_GID 102 /* group ID */
#define T_UNSPEC 103 /* Unspecified format (binary data) */
/* Query type values which do not appear in resource records */
#define T_AXFR 252 /* transfer zone of authority */
#define T_MAILB 253 /* transfer mailbox records */
#define T_MAILA 254 /* transfer mail agent records */
#define T_ANY 255 /* wildcard match */
/*
* Values for class field
*/
#define C_IN 1 /* the arpa internet */
#define C_CHAOS 3 /* for chaos net (MIT) */
#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
/* Query class values which do not appear in resource records */
#define C_ANY 255 /* wildcard match */
/*
* Status return codes for T_UNSPEC conversion routines
*/
#define CONV_SUCCESS 0
#define CONV_OVERFLOW (-1)
#define CONV_BADFMT (-2)
#define CONV_BADCKSUM (-3)
#define CONV_BADBUFLEN (-4)
#ifndef BYTE_ORDER
#if (BSD >= 199103)
# include <machine/endian.h>
#else
#ifdef linux
# include <endian.h>
#else
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
defined(__alpha__) || defined(__alpha)
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
defined(apollo) || defined(__convex__) || defined(_CRAY) || \
defined(__hppa) || defined(__hp9000) || \
defined(__hp9000s300) || defined(__hp9000s700) || \
defined (BIT_ZERO_ON_LEFT) || defined(m68k)
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif /* linux */
#endif /* BSD */
#endif /* BYTE_ORDER */
#if !defined(BYTE_ORDER) || \
(BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
BYTE_ORDER != PDP_ENDIAN)
/* you must determine what the correct bit order is for
* your compiler - the next line is an intentional error
* which will force your compiles to bomb until you fix
* the above macros.
*/
error "Undefined or invalid BYTE_ORDER";
#endif
/*
* Structure for query header. The order of the fields is machine- and
* compiler-dependent, depending on the byte/bit order and the layout
* of bit fields. We use bit fields only in int variables, as this
* is all ANSI requires. This requires a somewhat confusing rearrangement.
*/
typedef struct {
unsigned id :16; /* query identification number */
#if BYTE_ORDER == BIG_ENDIAN
/* fields in third byte */
unsigned qr: 1; /* response flag */
unsigned opcode: 4; /* purpose of message */
unsigned aa: 1; /* authoritive answer */
unsigned tc: 1; /* truncated message */
unsigned rd: 1; /* recursion desired */
/* fields in fourth byte */
unsigned ra: 1; /* recursion available */
unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */
unsigned rcode :4; /* response code */
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
unsigned aa :1; /* authoritive answer */
unsigned opcode :4; /* purpose of message */
unsigned qr :1; /* response flag */
/* fields in fourth byte */
unsigned rcode :4; /* response code */
unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /* recursion available */
#endif
/* remaining bytes */
unsigned qdcount :16; /* number of question entries */
unsigned ancount :16; /* number of answer entries */
unsigned nscount :16; /* number of authority entries */
unsigned arcount :16; /* number of resource entries */
} HEADER;
/*
* Defines for handling compressed domain names
*/
#define INDIR_MASK 0xc0
/*
* Structure for passing resource records around.
*/
struct rrec {
int16_t r_zone; /* zone number */
int16_t r_class; /* class number */
int16_t r_type; /* type number */
u_int32_t r_ttl; /* time to live */
int r_size; /* size of data area */
char *r_data; /* pointer to data */
};
extern u_int16_t _getshort __P((const u_char *));
extern u_int32_t _getlong __P((const u_char *));
/*
* Inline versions of get/put short/long. Pointer is advanced.
*
* These macros demonstrate the property of C whereby it can be
* portable or it can be elegant but rarely both.
*/
#define GETSHORT(s, cp) { \
register u_char *t_cp = (u_char *)(cp); \
(s) = ((u_int16_t)t_cp[0] << 8) \
| ((u_int16_t)t_cp[1]) \
; \
(cp) += INT16SZ; \
}
#define GETLONG(l, cp) { \
register u_char *t_cp = (u_char *)(cp); \
(l) = ((u_int32_t)t_cp[0] << 24) \
| ((u_int32_t)t_cp[1] << 16) \
| ((u_int32_t)t_cp[2] << 8) \
| ((u_int32_t)t_cp[3]) \
; \
(cp) += INT32SZ; \
}
#define PUTSHORT(s, cp) { \
register u_int16_t t_s = (u_int16_t)(s); \
register u_char *t_cp = (u_char *)(cp); \
*t_cp++ = t_s >> 8; \
*t_cp = t_s; \
(cp) += INT16SZ; \
}
#define PUTLONG(l, cp) { \
register u_int32_t t_l = (u_int32_t)(l); \
register u_char *t_cp = (u_char *)(cp); \
*t_cp++ = t_l >> 24; \
*t_cp++ = t_l >> 16; \
*t_cp++ = t_l >> 8; \
*t_cp = t_l; \
(cp) += INT32SZ; \
}
#endif /* !_NAMESER_H_ */

View File

@ -0,0 +1,170 @@
/*
* ++Copyright++ 1980, 1983, 1988, 1993
* -
* Copyright (c) 1980, 1983, 1988, 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* $Id: netdb.h,v 8.7 1996/05/09 05:59:09 vixie Exp $
*/
#ifndef _NETDB_H_
#define _NETDB_H_
#include <sys/param.h>
#if (!defined(BSD)) || (BSD < 199306)
# include <sys/bitypes.h>
#endif
#include <sys/cdefs.h>
#define _PATH_HEQUIV "/etc/hosts.equiv"
#define _PATH_HOSTS "/etc/hosts"
#define _PATH_NETWORKS "/etc/networks"
#define _PATH_PROTOCOLS "/etc/protocols"
#define _PATH_SERVICES "/etc/services"
extern int h_errno;
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
};
/*
* Assumption here is that a network number
* fits in an unsigned long -- probably a poor one.
*/
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
unsigned long n_net; /* network # */
};
struct servent {
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char *s_proto; /* protocol to use */
};
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in extern int h_errno).
*/
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
__BEGIN_DECLS
void endhostent __P((void));
void endnetent __P((void));
void endprotoent __P((void));
void endservent __P((void));
struct hostent *gethostbyaddr __P((const char *, int, int));
struct hostent *gethostbyname __P((const char *));
struct hostent *gethostbyname2 __P((const char *, int));
struct hostent *gethostent __P((void));
struct netent *getnetbyaddr __P((unsigned long, int));
struct netent *getnetbyname __P((const char *));
struct netent *getnetent __P((void));
struct protoent *getprotobyname __P((const char *));
struct protoent *getprotobynumber __P((int));
struct protoent *getprotoent __P((void));
struct servent *getservbyname __P((const char *, const char *));
struct servent *getservbyport __P((int, const char *));
struct servent *getservent __P((void));
void herror __P((const char *));
const char *hstrerror __P((int));
void sethostent __P((int));
/* void sethostfile __P((const char *)); */
void setnetent __P((int));
void setprotoent __P((int));
void setservent __P((int));
__END_DECLS
/* This is nec'y to make this include file properly replace the sun version. */
#ifdef sun
#ifdef __GNU_LIBRARY__
#include <rpc/netdb.h>
#else
struct rpcent {
char *r_name; /* name of server for this rpc program */
char **r_aliases; /* alias list */
int r_number; /* rpc program number */
};
struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent();
#endif /* __GNU_LIBRARY__ */
#endif /* sun */
#endif /* !_NETDB_H_ */

View File

@ -0,0 +1,254 @@
/*
* ++Copyright++ 1983, 1987, 1989, 1993
* -
* Copyright (c) 1983, 1987, 1989, 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
* $Id: resolv.h,v 8.11 1996/06/02 08:20:38 vixie Exp $
*/
#ifndef _RESOLV_H_
#define _RESOLV_H_
#include <sys/param.h>
#if (!defined(BSD)) || (BSD < 199306)
# include <sys/bitypes.h>
#else
# include <sys/types.h>
#endif
#include <sys/cdefs.h>
#include <stdio.h>
/*
* revision information. this is the release date in YYYYMMDD format.
* it can change every day so the right thing to do with it is use it
* in preprocessor commands such as "#if (__RES > 19931104)". do not
* compare for equality; rather, use it to determine whether your resolver
* is new enough to contain a certain feature.
*/
#define __RES 19960229
/*
* Resolver configuration file.
* Normally not present, but may contain the address of the
* inital name server(s) to query and the domain search list.
*/
#ifndef _PATH_RESCONF
#define _PATH_RESCONF "/etc/resolv.conf"
#endif
/*
* Global defines and variables for resolver stub.
*/
#define MAXNS 3 /* max # name servers we'll track */
#define MAXDFLSRCH 3 /* # default domain levels to try */
#define MAXDNSRCH 6 /* max # domains in search path */
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
#define RES_TIMEOUT 5 /* min. seconds between retries */
#define MAXRESOLVSORT 10 /* number of net to sort on */
#define RES_MAXNDOTS 15 /* should reflect bit field size */
struct __res_state {
int retrans; /* retransmition time interval */
int retry; /* number of times to retransmit */
u_long options; /* option flags - see below. */
int nscount; /* number of name servers */
struct sockaddr_in
nsaddr_list[MAXNS]; /* address of name server */
#define nsaddr nsaddr_list[0] /* for backward compatibility */
u_short id; /* current packet id */
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
char defdname[MAXDNAME]; /* default domain */
u_long pfcode; /* RES_PRF_ flags - see below. */
unsigned ndots:4; /* threshold for initial abs. query */
unsigned nsort:4; /* number of elements in sort_list[] */
char unused[3];
struct {
struct in_addr addr;
u_int32_t mask;
} sort_list[MAXRESOLVSORT];
char pad[72]; /* On an i38this means 512b total. */
};
/*
* Resolver options (keep these in synch with res_debug.c, please)
*/
#define RES_INIT 0x00000001 /* address initialized */
#define RES_DEBUG 0x00000002 /* print debug messages */
#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
#define RES_USEVC 0x00000008 /* use virtual circuit */
#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
#define RES_IGNTC 0x00000020 /* ignore trucation errors */
#define RES_RECURSE 0x00000040 /* recursion desired */
#define RES_DEFNAMES 0x00000080 /* use default domain name */
#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
#define RES_DNSRCH 0x00000200 /* search up local domain tree */
#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
/*
* Resolver "pfcode" values. Used by dig.
*/
#define RES_PRF_STATS 0x00000001
/* 0x00000002 */
#define RES_PRF_CLASS 0x00000004
#define RES_PRF_CMD 0x00000008
#define RES_PRF_QUES 0x00000010
#define RES_PRF_ANS 0x00000020
#define RES_PRF_AUTH 0x00000040
#define RES_PRF_ADD 0x00000080
#define RES_PRF_HEAD1 0x00000100
#define RES_PRF_HEAD2 0x00000200
#define RES_PRF_TTLID 0x00000400
#define RES_PRF_HEADX 0x00000800
#define RES_PRF_QUERY 0x00001000
#define RES_PRF_REPLY 0x00002000
#define RES_PRF_INIT 0x00004000
/* 0x00008000 */
/* hooks are still experimental as of 4.9.2 */
typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
res_sendhookact;
typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr_in * const *ns,
const u_char **query,
int *querylen,
u_char *ans,
int anssiz,
int *resplen));
typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr_in *ns,
const u_char *query,
int querylen,
u_char *ans,
int anssiz,
int *resplen));
extern struct __res_state _res;
/* Private routines shared between libc/net, named, nslookup and others. */
#define res_hnok __res_hnok
#define res_ownok __res_ownok
#define res_mailok __res_mailok
#define res_dnok __res_dnok
#define loc_ntoa __loc_ntoa
#define loc_aton __loc_aton
#define dn_skipname __dn_skipname
#define fp_query __fp_query
#define fp_nquery __fp_nquery
#define hostalias __hostalias
#define putlong __putlong
#define putshort __putshort
#define p_class __p_class
#define p_time __p_time
#define p_type __p_type
#define p_cdnname __p_cdnname
#define p_cdname __p_cdname
#define p_fqname __p_fqname
#define p_rr __p_rr
#define p_option __p_option
#define res_randomid __res_randomid
#define res_isourserver __res_isourserver
#define res_nameinquery __res_nameinquery
#define res_queriesmatch __res_queriesmatch
__BEGIN_DECLS
int __res_hnok __P((const char *));
int __res_ownok __P((const char *));
int __res_mailok __P((const char *));
int __res_dnok __P((const char *));
int __loc_aton __P((const char *ascii, u_char *binary));
char * __loc_ntoa __P((const u_char *binary, char *ascii));
int __dn_skipname __P((const u_char *, const u_char *));
void __fp_resstat __P((struct __res_state *, FILE *));
void __fp_query __P((const u_char *, FILE *));
void __fp_nquery __P((const u_char *, int, FILE *));
char *__hostalias __P((const char *));
void __putlong __P((u_int32_t, u_char *));
void __putshort __P((u_int16_t, u_char *));
char *__p_time __P((u_int32_t));
void __p_query __P((const u_char *));
const u_char *__p_cdnname __P((const u_char *, const u_char *, int, FILE *));
const u_char *__p_cdname __P((const u_char *, const u_char *, FILE *));
const u_char *__p_fqname __P((const u_char *, const u_char *, FILE *));
const u_char *__p_rr __P((const u_char *, const u_char *, FILE *));
const char *__p_type __P((int));
const char *__p_class __P((int));
const char *__p_option __P((u_long option));
int dn_comp __P((const char *, u_char *, int, u_char **, u_char **));
int dn_expand __P((const u_char *, const u_char *, const u_char *,
char *, int));
int res_init __P((void));
u_int16_t res_randomid __P((void));
int res_query __P((const char *, int, int, u_char *, int));
int res_search __P((const char *, int, int, u_char *, int));
int res_querydomain __P((const char *, const char *, int, int,
u_char *, int));
int res_mkquery __P((int, const char *, int, int, const u_char *, int,
const u_char *, u_char *, int));
int res_send __P((const u_char *, int, u_char *, int));
int res_isourserver __P((const struct sockaddr_in *));
int res_nameinquery __P((const char *, int, int,
const u_char *, const u_char *));
int res_queriesmatch __P((const u_char *, const u_char *,
const u_char *, const u_char *));
__END_DECLS
#endif /* !_RESOLV_H_ */

451
contrib/bind/man/Makefile Normal file
View File

@ -0,0 +1,451 @@
#
# Makefile to install the BIND 4.9 manual entries.
#
# Default Configuration:
# There are a set of default assignments immediately following this
# note. These defaults are for BSD4.4, BSD/386, other net2-alikes,
# and will install manual entries with following characteristics:
# o They will be catable (i.e., passed through nroff)
# o They will be installed in the directories
# /usr/share/man/catN, where N is 1, 3, 5, 7, 8
# o They will have an extension of `.0'
#
# Don't change these defaults. Instead, following the default configuration
# are sets of commented values for particular systems that can be used
# to override the default values.
#
#
# Target directory for the manual directory tree. Eg., may be used to
# specify the path of an NFS-mounted directory for common files.
#
DESTDIR=
#
# Default location for manual section directories.
#
DESTMAN= /usr/share/man
#
# Install manuals in ${MANDIR}N. For systems that generate catable manual
# entries on the fly, use
# MANDIR = man
#
MANDIR = cat
#
# Default extension for manual entries. To install the manual entries under
# their `real' extensions use
# CATEXT = $$N
#
CATEXT = 0
#
# Command to install manual entries
#
INSTALL= install
#
# `install' options to set Owner and Group for manual entries. Eg. for
# BSD `install' use
# MAN_OWNER = -o bin
# MAN_GROUP = -g bin
#
MAN_OWNER =
MAN_GROUP =
SHELL= /bin/sh
INDOT=
XFER_INDOT=
#
# Uppercase versions of the above variables (`INDOT_U' and `XFER_INDOT_U')
# are defined for use in `.TH' lines.
#
#
# Command used to generate a manual entry. By default this produces catable
# manual entries.
#
# For systems that store manuals in source form (eg SunOS 4.x and SunOS 5.x)
# and generate catable manual entries on the fly the following assignment
# can be used.
# MANROFF = cat
#
MANROFF = ( tbl | nroff -man )
#
# Default extensions for installed manual entries. The following variables
# have been defined to allow BIND's manual entries to be installed in the
# right place for a given platform.
#
# CMD_EXT = extension for user commands (eg, dig)
# LIB_NETWORK_EXT = extension for network library routines (eg,
# gethostbyname)
# FORMAT_EXT = extension for files describing file formats
# (eg, resolver)
# DESC_EXT = extension for descriptive files (eg, mailaddr)
# SYS_OPS_EXT = extension system operation and maintenance commands
# and applications. (eg, named, named-xfer, syslog)
#
# Associated with each variable is an additional variable with the suffix
# `_DIR' that specifies the suffix to ${MANDIR}. It's needed because on
# some systems, eg., Ultrix, multiple subsections (eg 3x, 3m 3n) are
# stored in generic manual section directories (eg., man3).
#
# Associated with each variable is an additional variable with the suffix
# `_U' which gives the upper case form of the variable for use in `.TH'
# commands. Useful for platforms (such as Solaris 2) that include letters
# in manual sections.
#
CMD_EXT = 1
CMD_EXT_DIR = ${CMD_EXT}
LIB_NETWORK_EXT = 3
LIB_NETWORK_EXT_DIR = ${LIB_NETWORK_EXT}
FORMAT_EXT = 5
FORMAT_EXT_DIR = ${FORMAT_EXT}
DESC_EXT = 7
DESC_EXT_DIR = ${DESC_EXT}
SYS_OPS_EXT = 8
SYS_OPS_EXT_DIR = ${SYS_OPS_EXT}
#
# Additional variables are defined for cross-references within manual
# entries:
# SYSCALL_EXT = extension for system calls
# BSD_SYSCALL_EXT = extension for BSD-specifc system calls. On some
# systems (eg Ultrix) these appear in section 2.
# On other system (eg SunOS 5) these are implemented
# via a BSD-compatibility library and appear in
# section 3.
# LIB_C_EXT = extension for C library routines (eg, signal)
#
SYSCALL_EXT = 2
SYSCALL_EXT_DIR = ${SYSCALL_EXT}
BSD_SYSCALL_EXT = 2
BSD_SYSCALL_EXT_DIR = ${BSD_SYSCALL_EXT}
LIB_C_EXT = 3
LIB_C_EXT_DIR = ${LIB_C_EXT}
#
# Platform specific assignments start here:
#
#
# (CRAY)
#
#
# (DEC AXP OSF/1)
#
#DESTMAN= /usr/share/man
#MANDIR = man
#CATEXT = $$N
#MAN_OWNER = -o root
#MAN_GROUP = -g root
#INSTALL = installbsd
#MANROFF = cat
## Extensions for DEC AXP OSF/1 manual entries
#CMD_EXT = 1
#SYS_OPS_EXT = 8
#LIB_NETWORK_EXT = 3
#FORMAT_EXT = 4
#DESC_EXT = 5
#
#SYSCALL_EXT = 2
#BSD_SYSCALL_EXT = 2
#LIB_C_EXT = 3
#
# (irix4)
#
#
# (irix5)
#
#
# (sunos4.x)
#
#
# (ULTRIX, sunos, other 4.[23]bsd-alikes)
#
#DESTMAN= /usr/man
#MANDIR = man
#CATEXT = $$N
#MAN_OWNER = -o root
#MAN_GROUP = -g root
#INSTALL = install
#MANROFF = cat
## Extensions for ULTRIX, sunos, other 4.[23]bsd-alikes manual entries
#CMD_EXT = 1
#SYS_OPS_EXT = 8
#LIB_NETWORK_EXT = 3n
#LIB_NETWORK_EXT_DIR = 3
#FORMAT_EXT = 5
#DESC_EXT = 7
#
#SYSCALL_EXT = 2
#BSD_SYSCALL_EXT = 2
#LIB_C_EXT = 3
#
# SunOS 5.x (Solaris 2.x)
#
#DESTMAN= /usr/share/man
#MANDIR = man
#CATEXT = $$N
#MAN_OWNER = -o bin
#MAN_GROUP = -g bin
#INSTALL = /usr/ucb/install
#MANROFF = cat
#INDOT = in.
#XFER_INDOT =
## Extensions for Solaris 2.x manual entries
#CMD_EXT = 1
#SYS_OPS_EXT = 1m
#LIB_NETWORK_EXT = 3n
#FORMAT_EXT = 4
#DESC_EXT = 5
#
#SYSCALL_EXT = 2
#BSD_SYSCALL_EXT = 3b
#LIB_C_EXT = 3c
#
# (hpux9.0)
#
#
# (apollo domainos)
#
#
# (AIX3)
#
#
# (ConvexOS-10.x)
#
#
# (NEC EWS4800 EWS-UX/V Rel4.0/Rel4.2)
#
#
# SCO Unix 3.4.2 / ODT 3.0
#
#
# (NeXTstep 2.1 and 3.0)
#
#
# (Sequent Dynix/PTX)
#
######################################################################
#
# No user changes needed past this point.
#
######################################################################
#
# This sed command is used to update the manual entries so they refer to
# the appropriate section of the manual for a given platform.
#
EXT_SED_CMD = INDOT_U=`echo "${INDOT}"|tr "[a-z]" "[A-Z]"`; \
export INDOT_U; \
XFER_INDOT_U=`echo "${XFER_INDOT}"|tr "[a-z]" "[A-Z]"`; \
export XFER_INDOT_U; \
CMD_EXT_U=`echo "${CMD_EXT}"|tr "[a-z]" "[A-Z]"`; \
export CMD_EXT_U; \
SYS_OPS_EXT_U=`echo "${SYS_OPS_EXT}"|tr "[a-z]" "[A-Z]"`; \
export SYS_OPS_EXT_U; \
LIB_NETWORK_EXT_U=`echo "${LIB_NETWORK_EXT}"|tr "[a-z]" "[A-Z]"`; \
export LIB_NETWORK_EXT_U; \
FORMAT_EXT_U=`echo "${FORMAT_EXT}"|tr "[a-z]" "[A-Z]"`; \
export FORMAT_EXT_U; \
DESC_EXT_U=`echo "${DESC_EXT}"|tr "[a-z]" "[A-Z]"`; \
export DESC_EXT_U; \
SYSCALL_EXT_U=`echo "${SYSCALL_EXT}"|tr "[a-z]" "[A-Z]"`; \
export SYSCALL_EXT_U; \
BSD_SYSCALL_EXT_U=`echo "${BSD_SYSCALL_EXT}"|tr "[a-z]" "[A-Z]"`; \
export BSD_SYSCALL_EXT_U; \
LIB_C_EXT_U=`echo "${LIB_C_EXT}"|tr "[a-z]" "[A-Z]"`; \
export LIB_C_EXT_U; \
sed -e "s/@INDOT@/${INDOT}/g" \
-e "s/@INDOT_U@/$${INDOT_U}/g" \
-e "s/@XFER_INDOT@/${XFER_INDOT}/g" \
-e "s/@XFER_INDOT_U@/$${XFER_INDOT_U}/g" \
-e "s/@CMD_EXT@/${CMD_EXT}/g" \
-e "s/@CMD_EXT_U@/$${CMD_EXT_U}/g" \
-e "s/@LIB_NETWORK_EXT@/${LIB_NETWORK_EXT}/g" \
-e "s/@LIB_NETWORK_EXT_U@/$${LIB_NETWORK_EXT_U}/g" \
-e "s/@FORMAT_EXT@/${FORMAT_EXT}/g" \
-e "s/@FORMAT_EXT_U@/$${FORMAT_EXT_U}/g" \
-e "s/@DESC_EXT@/${DESC_EXT}/g" \
-e "s/@DESC_EXT_U@/$${DESC_EXT_U}/g" \
-e "s/@SYS_OPS_EXT@/${SYS_OPS_EXT}/g" \
-e "s/@SYS_OPS_EXT_U@/$${SYS_OPS_EXT_U}/g" \
-e "s/@SYSCALL_EXT@/${SYSCALL_EXT}/g" \
-e "s/@SYSCALL_EXT_U@/$${SYSCALL_EXT_U}/g" \
-e "s/@BSD_SYSCALL_EXT@/${BSD_SYSCALL_EXT}/g" \
-e "s/@BSD_SYSCALL_EXT_U@/$${BSD_SYSCALL_EXT_U}/g" \
-e "s/@LIB_C_EXT@/${LIB_C_EXT}/g" \
-e "s/@LIB_C_EXT_U@/$${LIB_C_EXT_U}/g"
#
# Command used to produce manual entries
#
MK_MANFILE = ( ${EXT_SED_CMD} | ${MANROFF} )
#
# Extensions for the generated manual entries
#
CMD_OUT_EXT = out${CMD_EXT}
LIB_NETWORK_OUT_EXT = out${LIB_NETWORK_EXT}
FORMAT_OUT_EXT = out${FORMAT_EXT}
DESC_OUT_EXT = out${DESC_EXT}
SYS_OPS_OUT_EXT = out${SYS_OPS_EXT}
#
# User command manual entries
#
CMD_BASE = dig host dnsquery
CMD_SRC_EXT = 1
CMD_SRC = dig.${CMD_SRC_EXT} host.${CMD_SRC_EXT} dnsquery.${CMD_SRC_EXT}
CMD_OUT = dig.${CMD_OUT_EXT} host.${CMD_OUT_EXT} dnsquery.${CMD_OUT_EXT}
#
# named manual entries
#
NAMED_BASE = named named.reload named.restart ndc
SYS_OPS_SRC_EXT = 8
NAMED_SRC = named.${SYS_OPS_SRC_EXT} named.reload.${SYS_OPS_SRC_EXT} \
named.restart.${SYS_OPS_SRC_EXT} ndc.${SYS_OPS_SRC_EXT}
NAMED_OUT = named.${SYS_OPS_OUT_EXT} named.reload.${SYS_OPS_OUT_EXT} \
named.restart.${SYS_OPS_OUT_EXT} ndc.${SYS_OPS_OUT_EXT}
#
# named-xfer manual entry
#
NAMED_XFER_BASE = named-xfer
NAMED_XFER_SRC = named-xfer.${SYS_OPS_SRC_EXT}
NAMED_XFER_OUT = named-xfer.${SYS_OPS_OUT_EXT}
#
# nslookup manual entry
#
NSLOOKUP_BASE = nslookup
NSLOOKUP_SRC = nslookup.${SYS_OPS_SRC_EXT}
NSLOOKUP_OUT = nslookup.${SYS_OPS_OUT_EXT}
#
# Network library routines manual entries
#
LIB_NETWORK_BASE = gethostbyname resolver getnetent
LIB_NETWORK_SRC_EXT = 3
LIB_NETWORK_SRC = gethostbyname.${LIB_NETWORK_SRC_EXT} \
resolver.${LIB_NETWORK_SRC_EXT} \
getnetent.${LIB_NETWORK_SRC_EXT}
LIB_NETWORK_OUT = gethostbyname.${LIB_NETWORK_OUT_EXT} \
resolver.${LIB_NETWORK_OUT_EXT} \
getnetent.${LIB_NETWORK_OUT_EXT}
#
# File format manual entries
#
FORMAT_BASE = resolver
FORMAT_SRC_EXT = 5
FORMAT_SRC = resolver.${FORMAT_SRC_EXT}
FORMAT_OUT = resolver.${FORMAT_OUT_EXT}
#
# Feature Description manual entries
#
DESC_BASE = hostname mailaddr
DESC_SRC_EXT = 7
DESC_SRC = hostname.${DESC_SRC_EXT} mailaddr.${DESC_SRC_EXT}
DESC_OUT = hostname.${DESC_OUT_EXT} mailaddr.${DESC_OUT_EXT}
.SUFFIXES: .${CMD_SRC_EXT} .${CMD_OUT_EXT} \
.${SYS_OPS_SRC_EXT} .${SYS_OPS_OUT_EXT} \
.${LIB_NETWORK_SRC_EXT} .${LIB_NETWORK_OUT_EXT} \
.${FORMAT_SRC_EXT} .${FORMAT_OUT_EXT} \
.${DESC_SRC_EXT} .${DESC_OUT_EXT}
.${CMD_SRC_EXT}.${CMD_OUT_EXT}:
${MK_MANFILE} <$*.${CMD_SRC_EXT} >$*.${CMD_OUT_EXT}
.${SYS_OPS_SRC_EXT}.${SYS_OPS_OUT_EXT}:
${MK_MANFILE} <$*.${SYS_OPS_SRC_EXT} >$*.${SYS_OPS_OUT_EXT}
.${LIB_NETWORK_SRC_EXT}.${LIB_NETWORK_OUT_EXT}:
${MK_MANFILE} <$*.${LIB_NETWORK_SRC_EXT} >$*.${LIB_NETWORK_OUT_EXT}
.${FORMAT_SRC_EXT}.${FORMAT_OUT_EXT}:
${MK_MANFILE} <$*.${FORMAT_SRC_EXT} >$*.${FORMAT_OUT_EXT}
.${DESC_SRC_EXT}.${DESC_OUT_EXT}:
${MK_MANFILE} <$*.${DESC_SRC_EXT} >$*.${DESC_OUT_EXT}
OUTFILES = ${CMD_OUT} ${NAMED_OUT} ${NAMED_XFER_OUT} ${NSLOOKUP_OUT} \
${LIB_NETWORK_OUT} ${FORMAT_OUT} ${DESC_OUT}
all: ${OUTFILES}
install: ${OUTFILES} \
${DESTDIR}${DESTMAN}/${MANDIR}${CMD_EXT_DIR} \
${DESTDIR}${DESTMAN}/${MANDIR}${SYS_OPS_EXT_DIR} \
${DESTDIR}${DESTMAN}/${MANDIR}${LIB_NETWORK_EXT_DIR} \
${DESTDIR}${DESTMAN}/${MANDIR}${FORMAT_EXT_DIR} \
${DESTDIR}${DESTMAN}/${MANDIR}${DESC_EXT_DIR}
@set -x; N=${CMD_EXT}; for f in ${CMD_BASE}; do \
${INSTALL} -c -m 444 ${MAN_OWNER} ${MAN_GROUP} \
$${f}.${CMD_OUT_EXT} \
${DESTDIR}${DESTMAN}/${MANDIR}${CMD_EXT_DIR}/$${f}.${CATEXT}; \
done
@set -x; N=${SYS_OPS_EXT}; for f in ${NAMED_BASE}; do \
${INSTALL} -c -m 444 ${MAN_OWNER} ${MAN_GROUP} \
$${f}.${SYS_OPS_OUT_EXT} \
${DESTDIR}${DESTMAN}/${MANDIR}${SYS_OPS_EXT_DIR}/${INDOT}$${f}.${CATEXT}; \
done
@set -x; N=${SYS_OPS_EXT}; for f in ${NAMED_XFER_BASE}; do \
${INSTALL} -c -m 444 ${MAN_OWNER} ${MAN_GROUP} \
$${f}.${SYS_OPS_OUT_EXT} \
${DESTDIR}${DESTMAN}/${MANDIR}${SYS_OPS_EXT_DIR}/${XFER_INDOT}$${f}.${CATEXT}; \
done
@set -x; N=${SYS_OPS_EXT}; for f in ${NSLOOKUP_BASE}; do \
${INSTALL} -c -m 444 ${MAN_OWNER} ${MAN_GROUP} \
$${f}.${SYS_OPS_OUT_EXT} \
${DESTDIR}${DESTMAN}/${MANDIR}${SYS_OPS_EXT_DIR}/$${f}.${CATEXT}; \
done
@set -x; N=${LIB_NETWORK_EXT}; for f in ${LIB_NETWORK_BASE}; do \
${INSTALL} -c -m 444 ${MAN_OWNER} ${MAN_GROUP} \
$${f}.${LIB_NETWORK_OUT_EXT} \
${DESTDIR}${DESTMAN}/${MANDIR}${LIB_NETWORK_EXT_DIR}/$${f}.${CATEXT}; \
done
@set -x; N=${FORMAT_EXT}; for f in ${FORMAT_BASE}; do \
${INSTALL} -c -m 444 ${MAN_OWNER} ${MAN_GROUP} \
$${f}.${FORMAT_OUT_EXT} \
${DESTDIR}${DESTMAN}/${MANDIR}${FORMAT_EXT_DIR}/$${f}.${CATEXT}; \
done
@set -x; N=${DESC_EXT}; for f in ${DESC_BASE}; do \
${INSTALL} -c -m 444 ${MAN_OWNER} ${MAN_GROUP} \
$${f}.${DESC_OUT_EXT} \
${DESTDIR}${DESTMAN}/${MANDIR}${DESC_EXT_DIR}/$${f}.${CATEXT}; \
done
${DESTDIR}${DESTMAN}/${MANDIR}${CMD_EXT_DIR} \
${DESTDIR}${DESTMAN}/${MANDIR}${SYS_OPS_EXT_DIR} \
${DESTDIR}${DESTMAN}/${MANDIR}${LIB_NETWORK_EXT_DIR} \
${DESTDIR}${DESTMAN}/${MANDIR}${FORMAT_EXT_DIR} \
${DESTDIR}${DESTMAN}/${MANDIR}${DESC_EXT_DIR}:
mkdir $@
depend:
clean:
rm -f *~ *.BAK *.CKP *.orig
rm -f ${OUTFILES}

364
contrib/bind/man/dig.1 Normal file
View File

@ -0,0 +1,364 @@
.\" $Id: dig.1,v 8.1 1994/12/15 06:24:10 vixie Exp $
.\"
.\" ++Copyright++ 1993
.\" -
.\" Copyright (c) 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" Distributed with 'dig' version 2.0 from University of Southern
.\" California Information Sciences Institute (USC-ISI).
.\"
.\" dig.1 2.0 (USC-ISI) 8/30/90
.\"
.\" Man page reformatted for this release by Andrew Cherenson
.\" (arc@sgi.com)
.\"
.TH DIG @CMD_EXT_U@ "August 30, 1990"
.SH NAME
dig \- send domain name query packets to name servers
.SH SYNOPSIS
.B dig
.RI [ @\fIserver\fP ]
.I domain
.RI [ "<query-type>" ]
.RI [ "<query-class>" ]
.RI [ "+<query-option>" ]
.RI [ "\-<dig-option>" ]
.RI [ "%comment" ]
.SH DESCRIPTION
\fIDig\fP (domain information groper) is a flexible command line tool
which can be used to gather information from the Domain
Name System servers. \fIDig\fP has two modes: simple interactive mode
which makes a single query, and batch which executes a query for
each in a list of several query lines. All query options are
accessible from the command line.
.PP
The usual simple use of \fIdig\fP will take the form:
.sp 1
dig @server domain query-type query-class
.sp 1
where:
.IP \fIserver\fP
may be either a domain name or a dot-notation
Internet address. If this optional field is omitted, \fIdig\fP
will attempt to use the default name server for your machine.
.sp 1
\fBNote:\fP If a domain name is specified, this will be resolved
using the domain name system resolver (i.e., BIND). If your
system does not support DNS, you may \fIhave\fP to specify a
dot-notation address. Alternatively, if there is a server
at your disposal somewhere, all that is required is that
/etc/resolv.conf be present and indicate where the default
name servers reside, so that \fIserver\fP itself can be
resolved. See
.IR resolver (@FORMAT_EXT@)
for information on /etc/resolv.conf.
(WARNING: Changing /etc/resolv.conf will affect
the standard resolver library and potentially several
programs which use it.) As an option, the user may set the
environment variable LOCALRES to name a file which is to
be used instead of /etc/resolv.conf (LOCALRES is specific
to the \fIdig\fP resolver and not referenced by the standard
resolver). If the LOCALRES variable is not set or the file
is not readable then /etc/resolv.conf will be used.
.IP \fIdomain\fP
is the domain name for which you are requesting information.
See OPTIONS [-x] for convenient way to specify inverse address
query.
.IP \fIquery-type\fP
is the type of information (DNS query type) that
you are requesting. If omitted, the default is "a" (T_A = address).
The following types are recognized:
.sp 1
.ta \w'hinfoXX'u +\w'T_HINFOXX'u
.nf
a T_A network address
any T_ANY all/any information about specified domain
mx T_MX mail exchanger for the domain
ns T_NS name servers
soa T_SOA zone of authority record
hinfo T_HINFO host information
axfr T_AXFR zone transfer
(must ask an authoritative server)
txt T_TXT arbitrary number of strings
.fi
.sp 1
(See RFC 1035 for the complete list.)
.IP \fIquery-class\fP
is the network class requested in the query. If
omitted, the default is "in" (C_IN = Internet).
The following classes are recognized:
.sp 1
.ta \w'hinfoXX'u +\w'T_HINFOXX'u
.nf
in C_IN Internet class domain
any C_ANY all/any class information
.fi
.sp 1
(See RFC 1035 for the complete list.)
.sp 1
\fBNote:\fP
"Any" can be used to specify a class and/or a type of
query. \fIDig\fP will parse the first occurrence of "any"
to mean query-type = T_ANY. To specify query-class =
C_ANY you must either specify "any" twice, or set
query-class using "\-c" option (see below).
.SH OTHER OPTIONS
.IP "%ignored-comment"
"%" is used to included an argument that is simply not
parsed. This may be useful if running \fIdig\fP in batch
mode. Instead of resolving every @server-domain-name in
a list of queries, you can avoid the overhead of doing
so, and still have the domain name on the command line
as a reference. Example:
.sp 1
dig @128.9.0.32 %venera.isi.edu mx isi.edu
.sp 1
.IP "\-<dig option>"
"\-" is used to specify an option which effects the
operation of \fIdig\fP. The following options are currently
available (although not guaranteed to be useful):
.RS
.IP "\-x \fIdot-notation-address\fP"
Convenient form to specify inverse address mapping.
Instead of "dig 32.0.9.128.in-addr.arpa" one can
simply "dig -x 128.9.0.32".
.IP "\-f \fIfile\fP"
File for \fIdig\fP batch mode. The file contains a list
of query specifications (\fIdig\fP command lines) which
are to be executed successively. Lines beginning
with ';', '#', or '\\n' are ignored. Other options
may still appear on command line, and will be in
effect for each batch query.
.IP "\-T \fItime\fP"
Time in seconds between start of successive
queries when running in batch mode. Can be used
to keep two or more batch \fIdig\fP commands running
roughly in sync. Default is zero.
.IP "\-p \fIport\fP"
Port number. Query a name server listening to a
non-standard port number. Default is 53.
.IP "\-P[\fIping-string\fP]"
After query returns, execute a
.IR ping (@SYS_OPS_EXT@)
command
for response time comparison. This rather
unelegantly makes a call to the shell. The last
three lines of statistics is printed for the
command:
.sp 1
ping \-s server_name 56 3
.sp 1
If the optional "ping string" is present, it
replaces "ping \-s" in the shell command.
.IP "\-t \fIquery-type\fP"
Specify type of query. May specify either an
integer value to be included in the type field
or use the abbreviated mnemonic as discussed
above (i.e., mx = T_MX).
.IP "\-c \fIquery-class\fP"
Specify class of query. May specify either an
integer value to be included in the class field
or use the abbreviated mnemonic as discussed
above (i.e., in = C_IN).
.IP "\-envsav"
This flag specifies that the \fIdig\fP environment
(defaults, print options, etc.), after
all of the arguments are parsed, should be saved
to a file to become the default environment.
Useful if you do not like the standard set of
defaults and do not desire to include a
large number of options each time \fIdig\fP is used.
The environment consists of resolver state
variable flags, timeout, and retries as well as
the flags detailing \fIdig\fP output (see below).
If the shell environment variable LOCALDEF is set
to the name of a file, this is where the default
\fIdig\fP environment is saved. If not, the file
"DiG.env" is created in the current working directory.
.sp 1
\fBNote:\fP LOCALDEF is specific to the \fIdig\fP resolver,
and will not affect operation of the standard
resolver library.
.sp 1
Each time \fIdig\fP is executed, it looks for "./DiG.env"
or the file specified by the shell environment variable
LOCALDEF. If such file exists and is readable, then the
environment is restored from this file
before any arguments are parsed.
.IP "\-envset"
This flag only affects
batch query runs. When "\-envset" is
specified on a line in a \fIdig\fP batch file,
the \fIdig\fP environment after the arguments are parsed,
becomes the default environment for the duration of
the batch file, or until the next line which specifies
"\-envset".
.IP "\-[no]stick"
This flag only affects batch query runs.
It specifies that the \fIdig\fP environment (as read initially
or set by "\-envset" switch) is to be restored before each query
(line) in a \fIdig\fP batch file.
The default "\-nostick" means that the \fIdig\fP environment
does not stick, hence options specified on a single line
in a \fIdig\fP batch file will remain in effect for
subsequent lines (i.e. they are not restored to the
"sticky" default).
.RE
.IP "+<query option>"
"+" is used to specify an option to be changed in the
query packet or to change \fIdig\fP output specifics. Many
of these are the same parameters accepted by
.IR nslookup (@SYS_OPS_EXT@).
If an option requires a parameter, the form is as
follows:
.sp 1
+keyword[=value]
.sp 1
Most keywords can be abbreviated. Parsing of the "+"
options is very simplistic \(em a value must not be
separated from its keyword by white space. The following
keywords are currently available:
.sp 1
.nf
.ta \w'domain=NAMEXX'u +\w'(deb)XXX'u
Keyword Abbrev. Meaning [default]
[no]debug (deb) turn on/off debugging mode [deb]
[no]d2 turn on/off extra debugging mode [nod2]
[no]recurse (rec) use/don't use recursive lookup [rec]
retry=# (ret) set number of retries to # [4]
time=# (ti) set timeout length to # seconds [4]
[no]ko keep open option (implies vc) [noko]
[no]vc use/don't use virtual circuit [novc]
[no]defname (def) use/don't use default domain name [def]
[no]search (sea) use/don't use domain search list [sea]
domain=NAME (do) set default domain name to NAME
[no]ignore (i) ignore/don't ignore trunc. errors [noi]
[no]primary (pr) use/don't use primary server [nopr]
[no]aaonly (aa) authoritative query only flag [noaa]
[no]sort (sor) sort resource records [nosor]
[no]cmd echo parsed arguments [cmd]
[no]stats (st) print query statistics [st]
[no]Header (H) print basic header [H]
[no]header (he) print header flags [he]
[no]ttlid (tt) print TTLs [tt]
[no]cl print class info [nocl]
[no]qr print outgoing query [noqr]
[no]reply (rep) print reply [rep]
[no]ques (qu) print question section [qu]
[no]answer (an) print answer section [an]
[no]author (au) print authoritative section [au]
[no]addit (ad) print additional section [ad]
pfdef set to default print flags
pfmin set to minimal default print flags
pfset=# set print flags to #
(# can be hex/octal/decimal)
pfand=# bitwise and print flags with #
pfor=# bitwise or print flags with #
.fi
.sp 1
The retry and time options affect the retransmission strategy used by resolver
library when sending datagram queries. The algorithm is as follows:
.sp 1
.in +5n
.nf
for i = 0 to retry \- 1
for j = 1 to num_servers
send_query
wait((time * (2**i)) / num_servers)
end
end
.fi
.in -5n
.sp 1
(Note: \fIdig\fP always uses a value of 1 for num_servers.)
.SH DETAILS
\fIDig\fP once required a slightly modified version of the BIND
.IR resolver (@LIB_NETWORK_EXT@)
library. BIND's resolver has (as of BIND 4.9) been augmented to work
properly with \fIDig\fP. Essentially, \fIDig\fP is a straight-forward
(albeit not pretty) effort of parsing arguments and setting appropriate
parameters. \fIDig\fP uses resolver routines res_init(), res_mkquery(),
res_send() as well as accessing _res structure.
.SH FILES
.ta \w'/etc/resolv.confXX'u
/etc/resolv.conf initial domain name and name server
\./DiG.env default save file for default options
.br
addresses
.SH ENVIRONMENT
LOCALRES file to use in place of /etc/resolv.conf
.br
LOCALDEF default environment file
.SH AUTHOR
Steve Hotz
hotz@isi.edu
.SH ACKNOWLEDGMENTS
\fIDig\fP uses functions from
.IR nslookup (@SYS_OPS_EXT@)
authored by Andrew Cherenson.
.SH BUGS
\fIDig\fP has a serious case of "creeping featurism" -- the result of
considering several potential uses during it's development. It would
probably benefit from a rigorous diet. Similarly, the print flags
and granularity of the items they specify make evident their
rather ad hoc genesis.
.PP
\fIDig\fP does not consistently exit nicely (with appropriate status)
when a problem occurs somewhere in the resolver (NOTE: most of the common
exit cases are handled). This is particularly annoying when running in
batch mode. If it exits abnormally (and is not caught), the entire
batch aborts; when such an event is trapped, \fIdig\fP simply
continues with the next query.
.SH SEE ALSO
@INDOT@named(@SYS_OPS_EXT@), resolver(@LIB_NETWORK_EXT@), resolver(@FORMAT_EXT@), nslookup(@SYS_OPS_EXT@)

164
contrib/bind/man/dnsquery.1 Normal file
View File

@ -0,0 +1,164 @@
.TH DNSQUERY @CMD_EXT_U@ "10 March 1990"
.UC 6
.SH NAME
dnsquery \- query domain name servers using resolver
.SH SYNOPSIS
.B dnsquery
[-n
.I nameserver]
[-t
.I type]
[-c
.I class]
[-r
.I retry]
[-p
.I retry period]
[-d] [-s] [-v] host
.SH DESCRIPTION
The
.IR dnsquery
program is a general interface to nameservers via
BIND resolver library calls. The program supports
queries to the nameserver with an opcode of QUERY.
This program is intended to be a replacement or
supplement to programs like nstest, nsquery and
nslookup. All arguments except for
.IR host
and
.IR ns
are treated without case-sensitivity.
.SH OPTIONS
.TP 1i
.B \-n
The nameserver to be used in the query. Nameservers can appear as either
Internet addresses of the form w.x.y.z or can appear as domain names.
(default: as specified in /etc/resolv.conf)
.TP 1i
.B \-t
The type of resource record of interest. Types include:
.RS 1.5i
.TP 1i
A
address
.PD 0
.TP 1i
NS
nameserver
.TP 1i
CNAME
canonical name
.TP 1i
PTR
domain name pointer
.TP 1i
SOA
start of authority
.TP 1i
WKS
well-known service
.TP 1i
HINFO
host information
.TP 1i
MINFO
mailbox information
.TP 1i
MX
mail exchange
.TP 1i
RP
responsible person
.TP 1i
MG
mail group member
.TP 1i
AFSDB
DCE or AFS server
.TP 1i
ANY
wildcard
.RE
.PD
.IP
Note that any case may be used. (default: ANY)
.TP 1i
.B \-c
The class of resource records of interest.
Classes include:
.RS 2i
.TP 1i
IN
Internet
.PD 0
.TP 1i
HS
Hesiod
.TP 1i
CHAOS
Chaos
.TP 1i
ANY
wildcard
.RE
.PD
.IP
Note that any case may be used. (default: IN)
.TP 1i
.B \-r
The number of times to retry if the nameserver is
not responding. (default: 4)
.TP 1i
.B \-p
Period to wait before timing out. (default: RES_TIMEOUT)
.IR options
field. (default: any answer)
.TP 1i
.B \-d
Turn on debugging. This sets the RES_DEBUG bit of the resolver's
.IR options
field. (default: no debugging)
.TP 1i
.B \-s
Use a
.IR stream
rather than a packet. This uses a TCP stream connection with
the nameserver rather than a UDP datagram. This sets the
RES_USEVC bit of the resolver's
.IR options
field. (default: UDP)
.TP 1i
.B \-v
Synonym for the 's' flag.
.TP 1i
.B host
The name of the host (or domain) of interest.
.SH FILES
/etc/resolv.conf to get the default ns and search lists
.br
<arpa/nameser.h> list of usable RR types and classes
.br
<resolv.h> list of resolver flags
.SH "SEE ALSO"
nslookup(@SYS_OPS_EXT@), nstest(@CMD_EXT@), nsquery(@CMD_EXT@),
named(@SYS_OPS_EXT@), resolver(@FORMAT_EXT@)
.SH DIAGNOSTICS
If the resolver fails to answer the query and debugging has not been
turned on,
.IR dnsquery
will simply print a message like:
.TP 1i
Query failed (rc = 1) : Unknown host
.LP
The value of the return code is supplied by h_errno.
.SH BUGS
Queries of a class other than IN can have interesting results
since ordinarily a nameserver only has a list of root nameservers
for class IN resource records.
.PP
Query uses a call to inet_addr() to determine if the argument
for the '-n' option is a valid Internet address. Unfortunately,
inet_addr() seems to cause a segmentation fault with some (bad)
addresses (e.g. 1.2.3.4.5).
.SH AUTHOR
Bryan Beecher

View File

@ -0,0 +1,226 @@
.\" Copyright (c) 1983, 1987 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement: ``This product includes software developed by the
.\" University of California, Berkeley and its contributors'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" @(#)gethostbyname.3 6.12 (Berkeley) 6/23/90
.\"
.TH GETHOSTBYNAME @LIB_NETWORK_EXT_U@ "June 23, 1990"
.UC 5
.SH NAME
gethostbyname, gethostbyaddr, gethostent, sethostent, endhostent, herror \- get network host entry
.SH SYNOPSIS
.B "#include <netdb.h>
.PP
.B "extern int h_errno;
.PP
.B "struct hostent *gethostbyname(name)
.br
.B "char *name;
.PP
.B "struct hostent *gethostbyname2(name, af)
.br
.B "char *name; int af;
.PP
.B "struct hostent *gethostbyaddr(addr, len, type)
.br
.B "char *addr; int len, type;
.PP
.B "struct hostent *gethostent()
.PP
.B "sethostent(stayopen)
.br
.B "int stayopen;
.PP
.B "endhostent()
.PP
.B "herror(string)
.br
.B "char *string;
.PP
.SH DESCRIPTION
.IR Gethostbyname ,
.IR gethostbyname2 ,
and
.I gethostbyaddr
each return a pointer to an object with the
following structure describing an internet host
referenced by name or by address, respectively.
This structure contains either the information obtained from the name server,
.IR @INDOT@named (@SYS_OPS_EXT@),
or broken-out fields from a line in
.IR /etc/hosts .
If the local name server is not running these routines do a lookup in
.IR /etc/hosts .
.RS
.PP
.nf
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
};
#define h_addr h_addr_list[0] /* address, for backward compatibility */
.ft R
.ad
.fi
.RE
.PP
The members of this structure are:
.TP \w'h_addr_list'u+2n
h_name
Official name of the host.
.TP \w'h_addr_list'u+2n
h_aliases
A zero terminated array of alternate names for the host.
.TP \w'h_addr_list'u+2n
h_addrtype
The type of address being returned; usually AF_INET.
.TP \w'h_addr_list'u+2n
h_length
The length, in bytes, of the address.
.TP \w'h_addr_list'u+2n
h_addr_list
A zero terminated array of network addresses for the host.
Host addresses are returned in network byte order.
.TP \w'h_addr_list'u+2n
h_addr
The first address in h_addr_list; this is for backward compatibility.
.PP
When using the nameserver,
.I gethostbyname
will search for the named host in the current domain and its parents
unless the name ends in a dot.
If the name contains no dot, and if the environment variable ``HOSTALAIASES''
contains the name of an alias file, the alias file will first be searched
for an alias matching the input name.
See
.IR hostname (@DESC_EXT@)
for the domain search procedure and the alias file format.
.PP
.I Gethostbyname2
is an evolution of
.I gethostbyname
intended to allow lookups in address families other than AF_INET, for example
AF_INET6. Currently the
.I af
argument must be specified as
.I AF_INET
else the function will return \s-2NULL\s+2 after having set
.I h_errno
to \s-2NETDB_INTERNAL\s+2.
.PP
.I Sethostent
may be used to request the use of a connected TCP socket for queries.
If the
.I stayopen
flag is non-zero,
this sets the option to send all queries to the name server using TCP
and to retain the connection after each call to
.I gethostbyname
or
.IR gethostbyaddr .
Otherwise, queries are performed using UDP datagrams.
.PP
.I Endhostent
closes the TCP connection.
.SH DIAGNOSTICS
.PP
Error return status from
.I gethostbyname
and
.I gethostbyaddr
is indicated by return of a null pointer.
The external integer
.IR h_errno
may then be checked to see whether this is a temporary failure
or an invalid or unknown host.
The routine
.I herror
can be used to print an error message describing the failure.
If its argument
.I string
is non-NULL, it is printed, followed by a colon and a space.
The error message is printed with a trailing newline.
.PP
.IR h_errno
can have the following values:
.RS
.IP NETDB_INTERNAL \w'HOST_NOT_FOUND'u+2n
This indicates an internal error in the library, unrelated to the network
or name service.
.I errno
will be valid in this case; see
.IR perror (3).
.IP HOST_NOT_FOUND \w'HOST_NOT_FOUND'u+2n
No such host is known.
.IP TRY_AGAIN \w'HOST_NOT_FOUND'u+2n
This is usually a temporary error
and means that the local server did not receive
a response from an authoritative server.
A retry at some later time may succeed.
.IP NO_RECOVERY \w'HOST_NOT_FOUND'u+2n
Some unexpected server failure was encountered.
This is a non-recoverable error.
.IP NO_DATA \w'HOST_NOT_FOUND'u+2n
The requested name is valid but does not have an IP address;
this is not a temporary error.
This means that the name is known to the name server but there is no address
associated with this name.
Another type of request to the name server using this domain name
will result in an answer;
for example, a mail-forwarder may be registered for this domain.
.RE
.SH FILES
/etc/hosts
.SH "SEE ALSO"
resolver(@LIB_NETWORK_EXT@), hosts(@FORMAT_EXT@), hostname(@DESC_EXT@), @INDOT@named(@SYS_OPS_EXT@)
.SH CAVEAT
.PP
.I Gethostent
is defined, and
.I sethostent
and
.I endhostent
are redefined,
when
.IR libc
is built to use only the routines to lookup in
.IR /etc/hosts
and not the name server.
.PP
.I Gethostent
reads the next line of
.IR /etc/hosts ,
opening the file if necessary.
.PP
.I Sethostent
is redefined to open and rewind the file. If the
.I stayopen
argument is non-zero,
the hosts data base will not be closed after each call to
.I gethostbyname
or
.IR gethostbyaddr .
.I Endhostent
is redefined to close the file.
.SH BUGS
All information
is contained in a static area
so it must be copied if it is
to be saved. Only the Internet
address format is currently understood.

View File

@ -0,0 +1,133 @@
.\" $Id: getnetent.3,v 8.2 1996/05/09 05:59:10 vixie Exp $
.TH getnetent @LIB_NETWORK_EXT_U@
.SH NAME
getnetent, getnetbyaddr, getnetbyname, setnetent, endnetent \- get networks
entry
.SH SYNTAX
.nf
.B #include <netdb.h>
.PP
.B struct netent *getnetent()
.PP
.B struct netent *getnetbyname(\fIname\fP)
.B char *\fIname\fP;
.PP
.B struct netent *getnetbyaddr(\fInet\fP, \fItype\fP)
.B unsigned long \fInet\fP; int \fItype\fP;
.PP
.B void setnetent(\fIstayopen\fP)
.B int \fIstayopen\fP;
.PP
.B void endnetent()
.fi
.SH DESCRIPTION
The
.IR getnetent ,
.IR getnetbyname ,
and
.I getnetbyaddr
subroutines
each return a pointer to an object with the
following structure
containing the broken-out
fields of a line in the
.I networks
database.
.RS
.PP
.nf
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net number type */
long n_net; /* net number */
};
.ft R
.ad
.fi
.RE
.PP
The members of this structure are:
.TP \w'n_addrtype'u+2n
n_name
The official name of the network.
.TP \w'n_addrtype'u+2n
n_aliases
A zero terminated list of alternate names for the network.
.TP \w'n_addrtype'u+2n
n_addrtype
The type of the network number returned: AF_INET.
.TP \w'n_addrtype'u+2n
n_net
The network number. Network numbers are returned in machine byte
order.
.PP
If the
.I stayopen
flag on a
.I setnetent
subroutine is NULL, the
.I networks
database is opened. Otherwise the
.I setnetent
has the effect of rewinding the
.I networks
database.
The
.I endnetent
may be called to
close the
.I networks
database when processing is complete.
.PP
The
.I getnetent
subroutine simply reads the next
line while
.I getnetbyname
and
.I getnetbyaddr
search until a matching
.I name
or
.I net
number is found
(or until EOF is encountered). The \fItype\fP must be AF_INET.
The
.I getnetent
subroutine keeps a pointer in the database, allowing
successive calls to be used
to search the entire file.
.PP
A call to
.I setnetent
must be made before a
.I while
loop using
.I getnetent
in order to perform initialization and an
.I endnetent
must be used after the loop. Both
.I getnetbyname
and
.I getnetbyaddr
make calls to
.I setnetent
and
.I endnetent .
.SH FILES
.I /etc/networks
.SH DIAGNOSTICS
Null pointer (0) returned on EOF or error.
.SH SEE ALSO
.nf
networks(@FORMAT_EXT@)
RFC 1101
.SH HISTORY
The getnetent(), getnetbyaddr(), getnetbyname(), setnetent(), and
endnetent() functions appeared in 4.2BSD.
.SH BUGS
The data space used by these functions is static; if future use requires the
data, it should be copied before any subsequent calls to these functions
overwrite it. Only Internet network numbers are currently understood.
Expecting network numbers to fit in no more than 32 bits is probably naive.

207
contrib/bind/man/host.1 Normal file
View File

@ -0,0 +1,207 @@
.\" ++Copyright++ 1993
.\" -
.\" Copyright (c) 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\" $Id: host.1,v 8.1 1994/12/15 06:24:10 vixie Exp $
.TH HOST @CMD_EXT_U@
.SH NAME
host \- look up host names using domain server
.SH SYNOPSIS
host [-l] [-v] [-w] [-r] [-d] [-t querytype] [-a] host [ server ]
.SH DESCRIPTION
.I Host
looks for information about Internet hosts. It gets this information
from a set of interconnected servers that are spread across the
country. By default, it simply converts between host names and
Internet addresses. However with the -t or -a options, it can be used
to find all of the information about this host that is maintained
by the domain server.
.PP
The arguments can be either host names or host numbers. The program
first attempts to interpret them as host numbers. If this fails,
it will treat them as host names. A host number consists of
first decimal numbers separated by dots, e.g. 128.6.4.194
A host name
consists of names separated by dots, e.g. topaz.rutgers.edu.
Unless the name ends in a dot, the local domain
is automatically tacked on the end. Thus a Rutgers user can say
"host topaz", and it will actually look up "topaz.rutgers.edu".
If this fails, the name is tried unchanged (in this case, "topaz").
This same convention is used for mail and other network utilities.
The actual suffix to tack on the end is obtained
by looking at the results of a "hostname" call, and using everything
starting at the first dot. (See below for a description of
how to customize the host name lookup.)
.PP
The first argument is the host name you want to look up.
If this is a number, an "inverse query" is done, i.e. the domain
system looks in a separate set of databases used to convert numbers
to names.
.PP
The second argument is optional. It
allows you to specify a particular server to query. If you don't
specify this argument, the default server (normally the local machine)
is used.
.PP
If a name is specified, you may see output of three different kinds.
Here is an example that shows all of them:
.br
% host sun4
.br
sun4.rutgers.edu is a nickname for ATHOS.RUTGERS.EDU
.br
ATHOS.RUTGERS.EDU has address 128.6.5.46
.br
ATHOS.RUTGERS.EDU has address 128.6.4.4
.br
ATHOS.RUTGERS.EDU mail is handled by ARAMIS.RUTGERS.EDU
.br
The user has typed the command "host sun4". The first line indicates
that the name "sun4.rutgers.edu" is actually a nickname. The official
host name is "ATHOS.RUTGERS.EDU'. The next two lines show the
address. If a system has more than one network interface, there
will be a separate address for each. The last line indicates
that ATHOS.RUTGERS.EDU does not receive its own mail. Mail for
it is taken by ARAMIS.RUTGERS.EDU. There may be more than one
such line, since some systems have more than one other system
that will handle mail for them. Technically, every system that
can receive mail is supposed to have an entry of this kind. If
the system receives its own mail, there should be an entry
the mentions the system itself, for example
"XXX mail is handled by XXX". However many systems that receive
their own mail do not bother to mention that fact. If a system
has a "mail is handled by" entry, but no address, this indicates
that it is not really part of the Internet, but a system that is
on the network will forward mail to it. Systems on Usenet, Bitnet,
and a number of other networks have entries of this kind.
.PP
There are a number of options that can be used before the
host name. Most of these options are meaningful only to the
staff who have to maintain the domain database.
.PP
The option -w causes host to wait forever for a response. Normally
it will time out after around a minute.
.PP
The option -v causes printout to be in a "verbose" format. This
is the official domain master file format, which is documented
in the man page for "named". Without this option, output still follows
this format in general terms, but some attempt is made to make it
more intelligible to normal users. Without -v,
"a", "mx", and "cname" records
are written out as "has address", "mail is handled by", and
"is a nickname for", and TTL and class fields are not shown.
.PP
The option -r causes recursion to be turned off in the request.
This means that the name server will return only data it has in
its own database. It will not ask other servers for more
information.
.PP
The option -d turns on debugging. Network transactions are shown
in detail.
.PP
The option -t allows you to specify a particular type of information
to be looked up. The arguments are defined in the man page for
"named". Currently supported types are a, ns, md, mf, cname,
soa, mb, mg, mr, null, wks, ptr, hinfo, minfo, mx, uinfo,
uid, gid, unspec, and the wildcard, which may be written
as either "any" or "*". Types must be given in lower case.
Note that the default is to look first for "a", and then "mx", except
that if the verbose option is turned on, the default is only "a".
.PP
The option -a (for "all") is equivalent to "-v -t any".
.PP
The option -l causes a listing of a complete domain. E.g.
.br
host -l rutgers.edu
.br
will give a listing of all hosts in the rutgers.edu domain. The -t
option is used to filter what information is presented, as you
would expect. The default is address information, which also
include PTR and NS records. The command
.br
host -l -v -t any rutgers.edu
.br
will give a complete download of the zone data for rutgers.edu,
in the official master file format. (However the SOA record is
listed twice, for arcane reasons.) NOTE: -l is implemented by
doing a complete zone transfer and then filtering out the information
the you have asked for. This command should be used only if it
is absolutely necessary.
.SH CUSTOMIZING HOST NAME LOOKUP
In general, if the name supplied by the user does not
have any dots in it, a default domain is appended to the end.
This domain can be defined in /etc/resolv.conf, but is normally derived
by taking the local hostname after its first dot. The user can override
this, and specify a different default domain, using the environment
variable
.IR LOCALDOMAIN .
In addition, the user can supply his own abbreviations for host names.
They should be in a file consisting of one line per abbreviation.
Each line contains an abbreviation, a space, and then the full
host name. This file must be pointed to by an environment variable
.IR HOSTALIASES ,
which is the name of the file.
.SH "See Also"
@INDOT@named (@SYS_OPS_EXT@)
.SH BUGS
Unexpected effects can happen when you type a name that is not
part of the local domain. Please always keep in mind the
fact that the local domain name is tacked onto the end of every
name, unless it ends in a dot. Only if this fails is the name
used unchanged.
.PP
The -l option only tries the first name server listed for the
domain that you have requested. If this server is dead, you
may need to specify a server manually. E.g. to get a listing
of foo.edu, you could try "host -t ns foo.edu" to get a list
of all the name servers for foo.edu, and then try "host -l foo.edu xxx"
for all xxx on the list of name servers, until you find one that
works.

108
contrib/bind/man/hostname.7 Normal file
View File

@ -0,0 +1,108 @@
.\" Copyright (c) 1987 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted
.\" provided that the above copyright notice and this paragraph are
.\" duplicated in all such forms and that any documentation,
.\" advertising materials, and other materials related to such
.\" distribution and use acknowledge that the software was developed
.\" by the University of California, Berkeley. The name of the
.\" University may not be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" @(#)hostname.7 6.4 (Berkeley) 1/16/90
.\"
.TH HOSTNAME @DESC_EXT_U@ "February 16, 1994"
.UC 5
.SH NAME
hostname \- host name resolution description
.SH DESCRIPTION
Hostnames are domains. A domain is a hierarchical, dot-separated list
of subdomains. For example, the machine \fImonet\fP, in the \fIBerkeley\fP
subdomain of the \fIEDU\fP subdomain of the Internet Domain Name System
would be represented as
.br
\fImonet\fP.\fIBerkeley\fP.\fIEDU\fP
.br
(with no trailing dot).
.PP
Hostnames are often used with network client and server programs,
which must generally translate the name to an address for use.
(This task is usually performed by the library routine
.IR gethostbyname (@LIB_NETWORK_EXT@).)
The default method for resolving hostnames by the Internet name resolver is
to follow \s-1RFC\s+1 1535's security recommendations. Actions can be taken
by the administrator to override these recommendations and to have the
resolver behave the same as earlier, non-\s-1RFC\s+1 1535 resolvers.
.PP
The default method (using \s-1RFC\s+1 1535 guidelines) follows:
.PP
If the name consists of a single component, i.e. contains no dot, and if the
environment variable ``\s-1HOSTALIASES\s+1'' is set to the name of a file,
that file is searched for a string matching the input hostname. The file
should consist of lines made up of two strings separated by white-space, the
first of which is the hostname alias, and the second of which is the complete
hostname to be substituted for that alias. If a case-insensitive match is
found between the hostname to be resolved and the first field of a line in
the file, the substituted name is looked up with no further processing.
.PP
If there is at least one dot in the name, then the name is first tried as
is. The number of dots to cause this action is configurable by setting the
threshold using the ``\fIndots\fP'' option in
.I /etc/resolv.conf
(default: \fI1\fP). If the name ends with a dot, the trailing dot is
removed, and the remaining name is looked up (regardless of the setting of
the 'ndots' option) and no further processing is done.
.PP
If the input name does not end with a trailing dot, it is looked up by
searching through a list of domains until a match is found. If neither the
search option in the
.I /etc/resolv.conf
file or the ``\s-1LOCALDOMAIN\s+1'' environment variable is used, then the
search list of domains contains only the full domain specified by the domain
option (in
.IR /etc/resolv.conf )
or the domain used in the local hostname (see
.IR hostname (@CMD_EXT@)
and
.IR resolver (@FORMAT_EXT@)).
For example, if the ``\fIdomain\fP'' option is set to \fICS.Berkeley.EDU\fP,
then only CS.Berkeley.EDU will be in the search list and will be the only
domain appended to the partial hostname, for example, ``\fIlithium\fP'',
making \fIlithium.CS.Berkeley.EDU\fP the only name to be tried using the
search list.
.PP
If the search option is used in
.I /etc/resolv.conf
or the environment variable, ``\s-1LOCALDOMAIN\s+1'' is set by the user, then
the search list will include what is set by these methods. For
example, if the ``\fIsearch\fP'' option contained
.br
\fICS.Berkeley.EDU CChem.Berkeley.EDU Berkeley.EDU\fP
.br
then the partial hostname (e.g., ``\fIlithium\fP'') will be tried with each
domainname appended (in the same order specified). The resulting hostnames
that would be tried are:
.nf
\fIlithium.CS.Berkeley.EDU\fP
\fIlithium.CChem.Berkeley.EDU\fP
\fIlithium.Berkeley.EDU\fP
.fi
.PP
The environment variable ``\s-1LOCALDOMAIN\s+1'' overrides the
``\fIsearch\fP'' and ``\fIdomain\fP'' options, and if both search and domain
options are present in the resolver configuration file, then only the last
one listed is used (see
.IR resolver (@FORMAT_EXT@)).
.PP
If the name was not previously tried ``as is'' (i.e., it fell below the
``\fIndots\fP'' threshold or did not contain a dot), then the name as
originally provided is attempted.
.SH SEE ALSO
.IR gethostbyname (@LIB_NETWORK_EXT@),
.IR resolver (@FORMAT_EXT@),
.IR mailaddr (@DESC_EXT@),
.IR @INDOT@named (@SYS_OPS_EXT@)

135
contrib/bind/man/mailaddr.7 Normal file
View File

@ -0,0 +1,135 @@
.\" Copyright (c) 1983, 1987 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted
.\" provided that the above copyright notice and this paragraph are
.\" duplicated in all such forms and that any documentation,
.\" advertising materials, and other materials related to such
.\" distribution and use acknowledge that the software was developed
.\" by the University of California, Berkeley. The name of the
.\" University may not be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" @(#)mailaddr.7 6.5 (Berkeley) 2/14/89
.\"
.TH MAILADDR @DESC_EXT_U@ "February 14, 1989"
.UC 5
.SH NAME
mailaddr \- mail addressing description
.SH DESCRIPTION
Mail addresses are based on the ARPANET protocol listed at the end of this
manual page. These addresses are in the general format
.PP
user@domain
.PP
where a domain is a hierarchical dot separated list of subdomains. For
example, the address
.PP
eric@monet.berkeley.edu
.PP
is normally interpreted from right to left: the message should go to the
ARPA name tables (which do not correspond exactly to the physical ARPANET),
then to the Berkeley gateway, after which it should go to the local host
monet. When the message reaches monet it is delivered to the user ``eric''.
.PP
Unlike some other forms of addressing, this does not imply any routing.
Thus, although this address is specified as an ARPA address, it might
travel by an alternate route if that were more convenient or efficient.
For example, at Berkeley, the associated message would probably go directly
to monet over the Ethernet rather than going via the Berkeley ARPANET
gateway.
.SS Abbreviation.
.PP
Under certain circumstances it may not be necessary to type the entire
domain name. In general, anything following the first dot may be omitted
if it is the same as the domain from which you are sending the message.
For example, a user on ``calder.berkeley.edu'' could send to ``eric@monet''
without adding the ``berkeley.edu'' since it is the same on both sending
and receiving hosts.
.PP
Certain other abbreviations may be permitted as special cases. For
example, at Berkeley, ARPANET hosts may be referenced without adding
the ``berkeley.edu'' as long as their names do not conflict with a local
host name.
.SS Compatibility.
.PP
Certain old address formats are converted to the new format to provide
compatibility with the previous mail system. In particular,
.PP
user@host.ARPA
.PP
is allowed and
.PP
host:user
.PP
is converted to
.PP
user@host
.PP
to be consistent with the \fIrcp\fP(@CMD_EXT@) command.
.PP
Also, the syntax
.PP
host!user
.PP
is converted to:
.PP
user@host.UUCP
.PP
This is normally converted back to the ``host!user'' form before being sent
on for compatibility with older UUCP hosts.
.PP
The current implementation is not able to route messages automatically through
the UUCP network. Until that time you must explicitly tell the mail system
which hosts to send your message through to get to your final destination.
.SS Case Distinctions.
.PP
Domain names (i.e., anything after the ``@'' sign) may be given in any mixture
of upper and lower case with the exception of UUCP hostnames. Most hosts
accept any combination of case in user names, with the notable exception of
MULTICS sites.
.SS Route-addrs.
.PP
Under some circumstances it may be necessary to route a message through
several hosts to get it to the final destination. Normally this routing
is done automatically, but sometimes it is desirable to route the message
manually. Addresses which show these relays are termed ``route-addrs.''
These use the syntax:
.PP
<@hosta,@hostb:user@hostc>
.PP
This specifies that the message should be sent to hosta, from there to hostb,
and finally to hostc. This path is forced even if there is a more efficient
path to hostc.
.PP
Route-addrs occur frequently on return addresses, since these are generally
augmented by the software at each host. It is generally possible to ignore
all but the ``user@domain'' part of the address to determine the actual
sender.
.SS Postmaster.
.PP
Every site is required to have a user or user alias designated ``postmaster''
to which problems with the mail system may be addressed.
.SS Other Networks.
.PP
Some other networks can be reached by giving the name of the network as the
last component of the domain. \fIThis is not a standard feature\fP and may
not be supported at all sites. For example, messages to CSNET or BITNET sites
can often be sent to ``user@host.CSNET'' or ``user@host.BITNET'' respectively.
.SH BUGS
The RFC822 group syntax (``group:user1,user2,user3;'') is not supported
except in the special case of ``group:;'' because of a conflict with old
berknet-style addresses.
.PP
Route-Address syntax is grotty.
.PP
UUCP- and ARPANET-style addresses do not coexist politely.
.SH SEE ALSO
mail(@CMD_EXT@), sendmail(@SYS_OPS_EXT@);
Crocker, D. H.,
.ul
Standard for the Format of Arpa Internet Text Messages,
RFC822.

View File

@ -0,0 +1,146 @@
.\" ++Copyright++ 1985
.\" -
.\" Copyright (c) 1985
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" from named.8 6.6 (Berkeley) 2/14/89
.\"
.TH @XFER_INDOT_U@NAMED-XFER @SYS_OPS_EXT_U@ "June 26, 1993"
.UC 4
.SH NAME
@XFER_INDOT@named-xfer \- ancillary agent for inbound zone transfers
.SH SYNOPSIS
.B named-xfer
.B \-z
.I zone_to_transfer
.B \-f
.I db_file
.B \-s
.I serial_no
[
.B \-d
.I debuglevel
] [
.B \-l
.I debug_log_file
] [
.B \-t
.I trace_file
] [
.B \-p
.I port#
] [
.B \-S
]
.I nameserver
...
.SH DESCRIPTION
.I Named-xfer
is an ancillary program executed by
.IR @INDOT@named (@SYS_OPS_EXT@)
to perform an inbound zone transfer. It is rarely executed directly, and
only by system administrators who are trying to debug a zone transfer problem.
See RFC's 1033, 1034, and 1035 for more information on the Internet
name-domain system.
.PP
Options are:
.TP
.B \-z
specifies the name of the zone to be transferred.
.TP
.B \-f
specifies the name of the file into which the zone should be dumped
when it is received from the primary server.
.TP
.B \-s
specifies the serial number of our current copy of this zone. If the
\s-1SOA RR\s+1 we get from the primary server does not have a serial
number higher than this, the transfer will be aborted.
.TP
.B \-d
Print debugging information.
A number after the ``d'' determines the level of
messages printed.
.TP
.B \-l
Specifies a log file for debugging messages. The default is system-
dependent but is usually in
.I /var/tmp
or
.IR /usr/tmp .
Note that this only applies if
.I \-d
is also specified.
.TP
.B \-t
Specifies a trace file which will contain a protocol trace of the zone
transfer. This is probably only of interest to people debugging the name
server itself.
.TP
.B \-p
Use a different port number. The default is the standard port number
as returned by getservbyname(@LIB_NETWORK_EXT@) for service ``domain''.
.TP
.B \-S
Perform a restricted transfer of only the SOA, NS records and glue A records
for the zone. The SOA record will not be loaded by named but will be used to
determine when to verify the NS records. See the ``stubs'' directive in
.IR @INDOT@named (@SYS_OPS_EXT@)
for more information.
.PP
Additional arguments are taken as name server addresses in so-called
``dotted-quad'' syntax only; no host name are allowed here. At least
one address must be specified. Any additional addresses will be tried
in order if the first one fails to transfer to us successfully.
.SH "SEE ALSO"
@INDOT@named(@SYS_OPS_EXT@), resolver(@LIB_NETWORK_EXT@), resolver(@FORMAT_EXT@), hostname(@DESC_EXT@),
RFC 882, RFC 883, RFC 973, RFC 974, RFC 1033, RFC 1034, RFC 1035, RFC 1123,
\fIName Server Operations Guide for \s-1BIND\s+1\fR

435
contrib/bind/man/named.8 Normal file
View File

@ -0,0 +1,435 @@
.\" ++Copyright++ 1985
.\" -
.\" Copyright (c) 1985
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)named.8 6.6 (Berkeley) 2/14/89
.\"
.TH @INDOT_U@NAMED @SYS_OPS_EXT_U@ "June 20, 1995"
.UC 4
.SH NAME
@INDOT@named \- Internet domain name server
.SH SYNOPSIS
.B @INDOT@named
[
.B \-d
.I debuglevel
] [
.B \-p
.IR port# [\fB/\fP\fIlocalport#\fP]
] [{\-b}
.I bootfile
] [
.B \-q
] [
.B \-r
]
.SH DESCRIPTION
.I Named
is the Internet domain name server.
See RFC's 1033, 1034, and 1035 for more information on the Internet
name-domain system. Without any arguments,
.I named
will read the default boot file
.IR /etc/named.boot ,
read any initial data and listen for queries.
.PP
Options are:
.TP
.B \-d
Print debugging information.
A number after the ``d'' determines the level of
messages printed.
.TP
.B \-p
Use nonstandard port numbers. The default is the standard port number
as returned by getservbyname(@LIB_NETWORK_EXT@) for service ``domain''.
The argument can specify two port numbers separated by a slash (``\fB/\fP'')
in which case the first port is that used when contacting remote servers,
and the second one is the service port bound by the local instance of
.IR named .
This is used mostly for debugging purposes.
.TP
.B \-b
Use an alternate boot file. This is optional and allows you to
specify a file with a leading dash.
.TP
.B \-q
Trace all incoming queries if \fInamed\fP has been compiled with
\fIQRYLOG\fP defined. \fINOTE:\fP this option is deprecated in favour
of the boot file directive ``options query-log''.
.TP
.B \-r
Turns recursion off in the server. Answers can come only from local
(primary or secondary) zones. This can be used on root servers.
\fINOTE:\fP this option is deprecated in favour
of the boot file directive ``options no-recursion''.
.PP
Any additional argument is taken as the name of the boot file.
If multiple boot files are specified, only the last is used.
.PP
The boot file contains information about where the name server is to get
its initial data.
Lines in the boot file cannot be continued on subsequent lines.
The following is a small example:
.in +2m
.nf
;
; boot file for name server
;
directory /usr/local/adm/named
.ta \w'forwarders\ 'u +\w'6.32.128.IN-ADDR.ARPA\ 'u +\w'128.32.137.8 128.32.137.3\ 'u
; type domain source host/file backup file
cache . root.cache
primary Berkeley.EDU berkeley.edu.zone
primary 32.128.IN-ADDR.ARPA ucbhosts.rev
secondary CC.Berkeley.EDU 128.32.137.8 128.32.137.3 cc.zone.bak
secondary 6.32.128.IN-ADDR.ARPA 128.32.137.8 128.32.137.3 cc.rev.bak
primary 0.0.127.IN-ADDR.ARPA localhost.rev
forwarders 10.0.0.78 10.2.0.78
limit transfers-in 10
limit datasize 64M
options forward-only query-log fake-iquery
check-names primary fail
check-names secondary warn
check-names response ignore
.DT
.fi
.in
The ``directory'' line causes the server to change its working directory to
the directory specified. This can be important for the correct processing
of \s-1$INCLUDE\s+1 files in primary zone files.
.LP
The ``cache'' line specifies that data in ``root.cache'' is to be placed in
the backup cache. Its main use is to specify data such as locations of root
domain servers. This cache is not used during normal operation, but is used
as ``hints'' to find the current root servers. The file ``root.cache'' is
in the same format as ``berkeley.edu.zone''. There can be more than one
``cache'' file specified. The ``root.cache'' file should be retrieved
periodically from \s-1FTP.RS.INTERNIC.NET\s+1 since it contains a list of
root servers, and this list changes periodically.
.LP
The first example ``primary'' line states that the file
``berkeley.edu.zone'' contains authoritative data for the ``Berkeley.EDU''
zone. The file ``berkeley.edu.zone'' contains data in the master file
format described in RFC 883. All domain names are relative to the origin, in
this case, ``Berkeley.EDU'' (see below for a more detailed description).
The second ``primary'' line states that the file ``ucbhosts.rev'' contains
authoritative data for the domain ``32.128.IN-ADDR.ARPA,'' which is used to
translate addresses in network 128.32 to hostnames. Each master file should
begin with an SOA record for the zone (see below).
.LP
The first example ``secondary'' line specifies that all authoritative data
under ``CC.Berkeley.EDU'' is to be transferred from the name server at
128.32.137.8. If the transfer fails it will try 128.32.137.3 and continue
trying the addresses, up to 10, listed on this line. The secondary copy is
also authoritative for the specified domain. The first non-dotted-quad
address on this line will be taken as a filename in which to backup the
transferred zone. The name server will load the zone from this backup file
if it exists when it boots, providing a complete copy even if the master
servers are unreachable. Whenever a new copy of the domain is received by
automatic zone transfer from one of the master servers, this file will be
updated. If no file name is given, a temporary file will be used, and will
be deleted after each successful zone transfer. This is not recommended
since it is a needless waste of bandwidth. The second example ``secondary''
line states that the address-to-hostname mapping for the subnet 128.32.136
should be obtained from the same list of master servers as the previous zone.
.LP
The ``forwarders'' line specifies the addresses of sitewide servers that
will accept recursive queries from other servers. If the boot file
specifies one or more forwarders, then the server will send all queries for
data not in the cache to the forwarders first. Each forwarder will be asked
in turn until an answer is returned or the list is exhausted. If no answer
is forthcoming from a forwarder, the server will continue as it would have
without the forwarders line unless it is in ``forward-only'' mode. The
forwarding facility is useful to cause a large sitewide cache to be
generated on a master, and to reduce traffic over links to outside servers.
It can also be used to allow servers to run that do not have direct access
to the Internet, but wish to look up exterior names anyway.
.LP
The ``slave'' line (deprecated) is allowed for backward compatibility. Its
meaning is identical to ``options forward-only''.
.LP
The ``sortlist'' line can be used to indicate networks that are to be
preferred over other networks. Queries for host addresses from hosts on the
same network as the server will receive responses with local network
addresses listed first, then addresses on the sort list, then other
addresses.
.LP
The ``xfrnets'' directive (not shown) can be used to implement primitive
access control. If this directive is given, then your name server will
only answer zone transfer requests from hosts which are on networks listed
in your ``xfrnets'' directives. This directive may also be given as
``tcplist'' for compatibility with older, interim servers.
.LP
The ``include'' directive (not shown) can be used to process the contents
of some other file as though they appeared in place of the ``include''
directive. This is useful if you have a lot of zones or if you have
logical groupings of zones which are maintained by different people.
The ``include'' directive takes one argument, that being the name of the
file whose contents are to be included. No quotes are necessary around
the file name.
.LP
The ``bogusns'' directive (not shown) tells \s-1BIND\s+1 that no queries
are to be sent to the specified name server addresses (which are specified
as dotted quads, not as domain names). This is useful when you know that
some popular server has bad data in a zone or cache, and you want to avoid
contamination while the problem is being fixed.
.LP
The ``limit'' directive can be used to change \s-1BIND\s+1's internal limits,
some of which (\fBdatasize\fP, for example) are implemented by the system and
others (like \fBtransfers-in\fP) by \s-1BIND\s+1 itself. The number following
the limit name can be scaled by postfixing a ``k,'' ``m,'' or ``g'' for
kilobytes, megabytes, and gigabytes respectively.
\fBdatasize\fP's argument sets the process data size enforced by the kernel.
\fINote:\fP not all systems provide a call to implement this -- on such
systems, the use of the \fBdatasize\fP parameter of ``limit'' will result in
a warning message.
\fBtransfers-in\fP's argument is the number of \fInamed-xfer\fP subprocesses
which \s-1BIND\s+1 will spawn at any one time.
\fBtransfers-per-ns\fP's argument is the maximum number of zone transfers to
be simultaneously initiated to any given remote name server.
.LP
The ``options'' directive introduces a boolean specifier that changes the
behaviour of \s-1BIND\s+1. More than one option can be specified in a single
directive. The currently defined options are as follows:
\fBno-recursion\fP, which will cause \s-1BIND\s+1 to answer with a referral
rather than actual data whenever it receives a query for a name it is not
authoritative for -- don't set this on a server that is listed in any host's
\fIresolv.conf\fP file;
\fBno-fetch-glue\fP, which keeps \s-1BIND\s+1 from fetching missing glue when
constructing the ``additional data'' section of a response; this can be used
in conjunction with \fBno-recursion\fP to prevent \s-1BIND\s+1's cache from
ever growing in size or becoming corrupted;
\fBquery-log\fP, which causes all queries to be logged via
syslog(@SYS_OPS_EXT@) -- this is a lot of data, don't turn it on lightly;
\fBforward-only\fP, which causes the server to query only its forwarders --
this option is normally used on machine that wishes to run a server but for
physical or administrative reasons cannot be given access to the Internet;
and \fBfake-iquery\fP, which tells \s-1BIND\s+1 to send back a useless and
bogus reply to ``inverse queries'' rather than responding with an error --
this is helpful if you have a lot of microcomputers or SunOS hosts or both.
.LP
The ``check-names'' directive tells \s-1BIND\s+1 to check names in either
``primary'' or ``secondary'' zone files, or in messages (``response'')
received during recursion (for example, those which would be forwarded back
to a firewalled requestor). For each type of name,
\s-1BIND\s+1 can be told to ``fail'', such that a zone would not be loaded
or a response would not be cached or forwarded, or merely ``warn'' which
would cause a message to be emitted in the system operations logs, or to
``ignore'' the badness of a name and process it in the traditional fashion.
Names are considered good if they match RFC 952's expectations (if they are
host names), or if they consist only of printable \s-1ASCII\s+1 characters
(if they are not host names).
.LP
The ``max-fetch'' directive (not shown) is allowed for backward compatibility;
its meaning is identical to ``limit transfers-in''.
.PP
The master file consists of control information and a list of resource
records for objects in the zone of the forms:
.RS
.nf
$INCLUDE <filename> <opt_domain>
$ORIGIN <domain>
<domain> <opt_ttl> <opt_class> <type> <resource_record_data>
.fi
.RE
where
.I domain
is "." for root, "@" for the current origin, or a standard domain
name. If
.I domain
is a standard domain name that does not end with ``.'', the current origin
is appended to the domain. Domain names ending with ``.'' are
unmodified.
The
.I opt_domain
field is used to define an origin for the data in an included file.
It is equivalent to placing a $ORIGIN statement before the first
line of the included file. The field is optional.
Neither the
.I opt_domain
field nor $ORIGIN statements in the included file modify the current origin
for this file.
The
.I opt_ttl
field is an optional integer number for the time-to-live field.
It defaults to zero, meaning the minimum value specified in the SOA
record for the zone.
The
.I opt_class
field is the object address type; currently only one type is supported,
.BR IN ,
for objects connected to the DARPA Internet.
The
.I type
field contains one of the following tokens; the data expected in the
.I resource_record_data
field is in parentheses.
.TP "\w'MINFO 'u"
A
a host address (dotted quad)
.IP NS
an authoritative name server (domain)
.IP MX
a mail exchanger (domain), preceded by a preference value (0..32767),
with lower numeric values representing higher logical preferences.
.IP CNAME
the canonical name for an alias (domain)
.IP SOA
marks the start of a zone of authority (domain of originating host,
domain address of maintainer, a serial number and the following
parameters in seconds: refresh, retry, expire and minimum TTL (see RFC 883)).
.IP NULL
a null resource record (no format or data)
.IP RP
a Responsible Person for some domain name (mailbox, TXT-referral)
.IP PTR
a domain name pointer (domain)
.IP HINFO
host information (cpu_type OS_type)
.PP
Resource records normally end at the end of a line,
but may be continued across lines between opening and closing parentheses.
Comments are introduced by semicolons and continue to the end of the line.
.PP
Note that there are other resource record types, not shown here. You should
consult the \s-1BIND\s+1 Operations Guide (``\s-1BOG\s+1'') for the complete
list. Some resource record types may have been standardized in newer RFC's
but not yet implemented in this version of \s-1BIND\s+1.
.PP
Each master zone file should begin with an SOA record for the zone.
An example SOA record is as follows:
.LP
.nf
@ IN SOA ucbvax.Berkeley.EDU. rwh.ucbvax.Berkeley.EDU. (
1989020501 ; serial
10800 ; refresh
3600 ; retry
3600000 ; expire
86400 ) ; minimum
.fi
.LP
The SOA specifies a serial number, which should be changed each time the
master file is changed. Note that the serial number can be given as a
dotted number, but this is a \fIvery\fP unwise thing to do since the
translation to normal integers is via concatenation rather than
multiplication and addition. You can spell out the year, month, day of
month, and 0..99 version number and still fit inside the unsigned 32-bit
size of this field. It's true that we will have to rethink this strategy in
the year 4294 (Greg.) but we're not worried about it. Secondary servers
check the serial number at intervals specified by the refresh time in
seconds; if the serial number changes, a zone transfer will be done to load
the new data. If a master server cannot be contacted when a refresh is due,
the retry time specifies the interval at which refreshes should be attempted.
If a master server cannot be contacted within the interval given by the
expire time, all data from the zone is discarded by secondary servers. The
minimum value is the time-to-live (``\s-1TTL\s+1'') used by records in the
file with no explicit time-to-live value.
.SH NOTES
The boot file directives ``domain'' and ``suffixes'' have been
obsoleted by a more useful resolver-based implementation of
suffixing for partially qualified domain names. The prior mechanisms
could fail under a number of situations, especially when then local
nameserver did not have complete information.
.sp
The following signals have the specified effect when sent to the
server process using the
.IR kill (@CMD_EXT@)
command.
.IP SIGHUP
Causes server to read named.boot and reload the database. If the server
is built with the FORCED_RELOAD compile-time option, then SIGHUP will
also cause the server to check the serial number on all secondary zones.
Normally the serial numbers are only checked at the SOA-specified intervals.
.IP SIGINT
Dumps the current data base and cache to /var/tmp/named_dump.db
.IP SIGIOT
Dumps statistics data into /var/tmp/named.stats if the server is
compiled with -DSTATS. Statistics data is appended to the file. Some
systems use SIGABRT rather than SIGIOT for this.
.IP SIGSYS
Dumps the profiling data in /var/tmp if the server is compiled
with profiling (server forks, chdirs and exits).
.IP SIGTERM
Dumps the primary and secondary database files.
Used to save modified data on shutdown if the
server is compiled with dynamic updating enabled.
.IP SIGUSR1
Turns on debugging; each SIGUSR1 increments debug level.
(SIGEMT on older systems without SIGUSR1)
.IP SIGUSR2
Turns off debugging completely.
(SIGFPE on older systems without SIGUSR2)
.IP SIGWINCH
Toggles logging of all incoming queries via syslog(@SYS_OPS_EXT@)
(requires server to have been built with the QRYLOG option).
.SH FILES
.nf
.ta \w'/var/tmp/named_dump.db 'u
/etc/named.boot name server configuration boot file
/etc/named.pid the process id (on older systems)
/var/run/named.pid the process id (on newer systems)
/var/tmp/named_dump.db dump of the name server database
/var/tmp/named.run debug output
/var/tmp/named.stats nameserver statistics data
.fi
.SH "SEE ALSO"
kill(@CMD_EXT@), gethostbyname(@LIB_NETWORK_EXT@), signal(@SYSCALL_EXT@),
resolver(@LIB_NETWORK_EXT@), resolver(@FORMAT_EXT@), hostname(@DESC_EXT@),
RFC 882, RFC 883, RFC 973, RFC 974, RFC 1033, RFC 1034, RFC 1035, RFC 1123,
\fIName Server Operations Guide for \s-1BIND\s+1\fR

View File

@ -0,0 +1,69 @@
.\" ++Copyright++ 1987, 1993
.\" -
.\" Copyright (c) 1987, 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" from hostname.7 6.4 (Berkeley) 1/16/90
.\"
.TH @INDOT_U@NAMED.RELOAD @SYS_OPS_EXT_U@ "June 26, 1993"
.UC 5
.SH NAME
@INDOT@named.reload \- cause the name server to synchronize its database
.SH DESCRIPTION
This command sends a \s-1SIGHUP\s+1 to the running name server. This
signal is documented in
.IR named (@SYS_OPS_EXT@).
.SH BUGS
Does not check to see if the name server is actually running, and could
use a stale PID cache file which may result in the death of an unrelated
process.
.SH SEE ALSO
@INDOT@named(@SYS_OPS_EXT@), @INDOT@named.restart(@SYS_OPS_EXT@)

View File

@ -0,0 +1,73 @@
.\" ++Copyright++ 1987, 1993
.\" -
.\" Copyright (c) 1987, 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" from hostname.7 6.4 (Berkeley) 1/16/90
.\"
.TH @INDOT_U@NAMED.RESTART @SYS_OPS_EXT_U@ "June 26, 1993"
.UC 5
.SH NAME
@INDOT@named.restart \- stop and restart the name server
.SH DESCRIPTION
This command sends a \s-1SIGKILL\s+1 to the running name server and then
starts a new one.
.SH BUGS
Does not check to see if the name server is actually running, and could
use a stale PID cache file which may result in the death of an unrelated
process.
.PP
Does not wait after killing the old server before starting a new one; since
the server could take some time to die and the new one will experience a
fatal error if the old one isn't gone by the time it starts, you can be left
in a situation where you have no name server at all.
.SH SEE ALSO
@INDOT@named(@SYS_OPS_EXT@), @INDOT@named.reload(@SYS_OPS_EXT@)

127
contrib/bind/man/ndc.8 Normal file
View File

@ -0,0 +1,127 @@
.\" Copyright (c) 1994
.\" 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.
.\"
.TH @INDOT_U@NDC @SYS_OPS_EXT_U@ "November 27, 1994"
.UC 5
.SH NAME
@INDOT@ndc \- name daemon control interface
.SH SYNOPSIS
.B @INDOT@ndc
.I directive
[ ... ]
.SH DESCRIPTION
This command allows the name server administrator to send various signals
to the name server, or to restart it. Zero or more directives may be given,
from the following list:
.TP
.B status
Displays the current status of
.B @INDOT@named
as shown by
.BR ps (1).
.TP
.B dumpdb
Causes
.B @INDOT@named
to dump its database and cache to
.B /var/tmp/named_dump.db
(uses the INT signal.)
.TP
.B reload
Causes
.B @INDOT@named
to check the serial numbers of all primary and secondary zones
and to reload those that have changed (uses the HUP signal.)
.TP
.B stats
Causes
.B @INDOT@named
to dump its statistics to
.B /var/tmp/named.stats
(uses the IOT or ABRT signal.)
.TP
.B trace
Causes
.B @INDOT@named
to increment its ``tracing level'' by one. Whenever the tracing level
is nonzero, trace information will be written to
.BR /var/tmp/named.run .
Higher tracing levels result in more detailed information.
(Uses the USR1 signal.)
.TP
.B notrace
Causes
.B @INDOT@named
to set its ``tracing level'' to zero, closing
.B /var/tmp/named.run
if it is open (uses the USR2 signal.)
.TP
.B querylog
Causes
.B @INDOT@named
to toggle the ``query logging'' feature, which while on will result in a
.BR syslog (3)
of each incoming query (uses the WINCH signal.) Note that query logging
consumes quite a lot of log file space. This directive may also be given as
.BR qrylog .
.TP
.B start
Causes
.B @INDOT@named
to be started, as long as it isn't already running.
.TP
.B stop
Causes
.B @INDOT@named
to be stopped, if it is running.
.TP
.B restart
Causes
.B @INDOT@named
to be killed and restarted.
.SH BUGS
Arguments to
.B @INDOT@named
are not preserved by
.BR restart ,
or known by
.BR start .
Some mechanism for controlling the parameters and environment should exist.
.PP
Implemented as a
.BR sh (1)
script.
.SH AUTHOR
Paul Vixie (Internet Software Consortium)
.SH SEE ALSO
@INDOT@named(@SYS_OPS_EXT@),
@INDOT@named.reload(@SYS_OPS_EXT@),
@INDOT@named.restart(@SYS_OPS_EXT@)

387
contrib/bind/man/nslookup.8 Normal file
View File

@ -0,0 +1,387 @@
.\"
.\" ++Copyright++ 1985, 1989
.\" -
.\" Copyright (c) 1985, 1989
.\" 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.
.\" -
.\" Portions Copyright (c) 1993 by Digital Equipment Corporation.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies, and that
.\" the name of Digital Equipment Corporation not be used in advertising or
.\" publicity pertaining to distribution of the document or software without
.\" specific, written prior permission.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
.\" CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\" -
.\" --Copyright--
.\"
.\" @(#)nslookup.8 5.3 (Berkeley) 6/24/90
.\"
.TH NSLOOKUP @SYS_OPS_EXT_U@ "June 24, 1990"
.UC 6
.SH NAME
nslookup \- query Internet name servers interactively
.SH SYNOPSIS
.B nslookup
[
.I \-option ...
]
[
.I host-to-find
| \- [
.I server
]]
.SH DESCRIPTION
.I Nslookup
is a program to query Internet domain name servers.
Nslookup has two modes: interactive and non-interactive.
Interactive mode allows the user to query name servers for
information about various hosts and domains or to print a list of hosts
in a domain.
Non-interactive mode is used to print just the name and requested information
for a host or domain.
.sp 1
.SH ARGUMENTS
Interactive mode is entered in the following cases:
.IP a) 4
when no arguments are given (the default name server will be used),
.IP b) 4
when the first argument is a hyphen (\-) and the second argument
is the host name or Internet address of a name server.
.LP
Non-interactive mode is used when the name or Internet address
of the host to be looked up
is given as the first argument. The optional second argument specifies
the host name or address of a name server.
.LP
The options listed under the ``set'' command below can be specified in
the .nslookuprc file in the user's home directory if they are listed
one per line. Options can also be specified
on the command line if they precede the arguments and are prefixed with
a hyphen. For example, to change the default query type to host information,
and the initial timeout to 10 seconds, type:
.sp .5v
nslookup \-query=hinfo \-timeout=10
.sp .5v
.SH "INTERACTIVE COMMANDS"
Commands may be interrupted at any time by typing a control-C.
To exit, type a control-D (EOF) or type exit.
The command line length must be less than 256 characters.
To treat a built-in command as a host name,
precede it with an escape character (\e).
\fBN.B.\fP an unrecognized command will be interpreted as a host name.
.sp .5v
.IP "\fIhost\fP [\fIserver\fP]"
Look up information for \fIhost\fP using the current default server
or using \fIserver\fP if specified.
If \fIhost\fP is an Internet address and the query type is A or PTR, the
name of the host is returned.
If \fIhost\fP is a name and does not have a trailing period, the default
domain name is appended to the name. (This behavior depends on the state of the
\fBset\fP options \fBdomain\fP, \fBsrchlist\fP,
\fBdefname\fP, and \fBsearch\fP).
To look up a host not in the current domain, append a period to
the name.
.sp 1
.IP "\fBserver\fP \fIdomain\fP"
.ns
.IP "\fBlserver\fP \fIdomain\fP"
Change the default server to \fIdomain\fP.
\fBLserver\fP uses the initial server to look up
information about \fIdomain\fP while \fBserver\fP
uses the current default server.
If an authoritative answer can't be found, the names of servers
that might have the answer are returned.
.sp 1
.IP \fBroot\fP
Changes the default server to the server for the root of the domain name space.
Currently, the host ns.internic.net is used.
(This command is a synonym for \fBlserver ns.internic.net.\fP)
The name of the root server can be changed with the \fBset root\fP command.
.sp 1
.IP "\fBfinger\fP [\fIname\fP] [\fB>\fP \fIfilename\fP]"
.ns
.IP "\fBfinger\fP [\fIname\fP] [\fB>>\fP \fIfilename\fP]"
Connects with the finger server on the current host.
The current host is defined when a previous lookup for a host
was successful and returned address information (see the
\fBset querytype=A\fP command).
\fIName\fP is optional.
\fB>\fP and \fB>>\fP can be used to redirect output in the
usual manner.
.sp 1
.IP "\fBls\fR [\fIoption\fR] \fIdomain\fR [\fB>\fR \fIfilename\fR]"
.ns
.IP "\fBls\fR [\fIoption\fR] \fIdomain\fR [\fB>>\fR \fIfilename\fR]"
List the information available for \fIdomain\fP, optionally creating
or appending to \fIfilename\fP.
The default output contains host names and their Internet addresses.
.I Option
can be one of the following:
.RS
.IP "\fB\-t \fIquerytype\fP" 4
lists all records of the specified type (see \fIquerytype\fP below).
.IP \fB\-a\fP 4
lists aliases of hosts in the domain.
synonym for \fB\-t\ \ CNAME\fP.
.IP \fB\-d\fP 4
lists all records for the domain.
synonym for \fB\-t\ \ ANY\fP.
.IP \fB\-h\fP 4
lists CPU and operating system information for the domain.
synonym for \fB\-t\ \ HINFO\fP.
.IP \fB\-s\fP 4
lists well-known services of hosts in the domain.
synonym for \fB\-t\ \ WKS\fP.
.P
When output is directed to a file, hash marks are printed for every
50 records received from the server.
.RE
.sp 1
.IP "\fBview\fP \fIfilename\fP"
Sorts and lists the output of previous \fBls\fP command(s) with
\fImore\fP(@CMD_EXT@).
.sp 1
.ne 4
.IP "\fBhelp\fP"
.ns
.IP "\fB?\fP"
Prints a brief summary of commands.
.sp 1
.IP "\fBexit\fP"
Exits the program.
.sp 1
.IP "\fBset\fP \fIkeyword\fP[=\fIvalue\fP]"
This command is used to change state information that affects the lookups.
Valid keywords are:
.RS
.IP "\fBall\fP"
Prints the current values of the frequently-used options to \fBset\fP.
Information about the current default server and host is also printed.
.IP "\fBclass=\fIvalue\fR"
Change the query class to one of:
.RS
.IP IN 10
the Internet class.
.IP CHAOS 10
the Chaos class.
.IP HESIOD 10
the MIT Athena Hesiod class.
.IP ANY 10
wildcard (any of the above).
.P
The class specifies the protocol group of the information.
.br
(Default = IN, abbreviation = cl)
.RE
.IP "\fB[no]debug\fP"
Turn debugging mode on. A lot more information is printed about the
packet sent to the server and the resulting answer.
.br
(Default = nodebug, abbreviation = [no]deb)
.IP "\fB[no]d2\fP"
Turn exhaustive debugging mode on.
Essentially all fields of every packet are printed.
.br
(Default = nod2)
.IP "\fBdomain=\fIname\fR"
Change the default domain name to \fIname\fP.
The default domain name is appended to a lookup request depending on the
state of the \fBdefname\fP and \fBsearch\fP options.
The domain search list contains the parents of the default domain if it has
at least two components in its name.
For example, if the default domain
is CC.Berkeley.EDU, the search list is CC.Berkeley.EDU and Berkeley.EDU.
Use the \fBset srchlist\fP command to specify a different list.
Use the \fBset all\fP command to display the list.
.br
(Default = value from hostname, /etc/resolv.conf or LOCALDOMAIN,
abbreviation = do)
.IP "\fBsrchlist=\fIname1/name2/...\fR"
Change the default domain name to \fIname1\fP and the domain search list
to \fIname1\fP, \fIname2\fP, etc. A maximum of 6 names separated by slashes (/)
can be specified.
For example,
.sp .5v
set\ srchlist=lcs.MIT.EDU/ai.MIT.EDU/MIT.EDU
.sp .5v
sets the domain to lcs.MIT.EDU and the search list to the three names.
This command overrides the
default domain name and search list of the \fBset domain\fP command.
Use the \fBset all\fP command to display the list.
.br
(Default = value based on hostname, /etc/resolv.conf or LOCALDOMAIN,
abbreviation = srchl)
.IP "\fB[no]defname\fP"
If set, append the default domain name to a single-component lookup request
(i.e., one that does not contain a period).
.br
(Default = defname, abbreviation = [no]def)
.IP "\fB[no]search\fP"
If the lookup request contains at least one period but doesn't end
with a trailing period,
append the domain names in the domain search list
to the request until an answer is received.
.br
(Default = search, abbreviation = [no]sea)
.IP "\fBport=\fIvalue\fR"
Change the default TCP/UDP name server port to \fIvalue\fP.
.br
(Default = 53, abbreviation = po)
.IP "\fBquerytype=\fIvalue\fR"
.ns
.IP "\fBtype=\fIvalue\fR"
.ns
Change the type of information query to one of:
.RS
.IP A 10
the host's Internet address.
.IP CNAME 10
the canonical name for an alias.
.IP HINFO 10
the host CPU and operating system type.
.IP MINFO 10
the mailbox or mail list information.
.IP MX 10
the mail exchanger.
.IP NS 10
the name server for the named zone.
.IP PTR 10
the host name if the query is an Internet address,
otherwise the pointer to other information.
.IP SOA 10
the domain's ``start-of-authority'' information.
.IP TXT 10
the text information.
.IP UINFO 10
the user information.
.IP WKS 10
the supported well-known services.
.P
Other types (ANY, AXFR, MB, MD, MF, NULL) are described in the
RFC-1035 document.
.br
(Default = A, abbreviations = q, ty)
.RE
.IP "\fB[no]recurse\fP"
Tell the name server to query other servers if it does not have the
information.
.br
(Default = recurse, abbreviation = [no]rec)
.IP \fBretry=\fInumber\fR
Set the number of retries to \fInumber\fP.
When a reply to a request is not received within a certain
amount of time (changed with \fBset timeout\fP),
the timeout period is doubled and the request is resent.
The retry value controls how many times a request is resent before giving up.
.br
(Default = 4, abbreviation = ret)
.IP \fBroot=\fIhost\fR
Change the name of the root server to \fIhost\fP. This
affects the \fBroot\fP command.
.br
(Default = ns.internic.net., abbreviation = ro)
.IP \fBtimeout=\fInumber\fR
Change the initial timeout interval
for waiting for a reply
to \fInumber\fP seconds.
Each retry doubles the timeout period.
.br
(Default = 5 seconds, abbreviation = ti)
.IP "\fB[no]vc\fP"
Always use a virtual circuit when sending requests to the server.
.br
(Default = novc, abbreviation = [no]v)
.IP "\fB[no]ignoretc\fP"
Ignore packet truncation errors.
.br
(Default = noignoretc, abbreviation = [no]ig)
.RE
.SH DIAGNOSTICS
If the lookup request was not successful, an error message is printed.
Possible errors are:
.IP "Timed out" 5
The server did not respond to a request after a certain amount of
time (changed with \fBset timeout=\fIvalue\fR)
and a certain number of retries (changed with \fBset retry=\fIvalue\fR).
.IP "No response from server" 5
No name server is running on the server machine.
.IP "No records" 5
The server does not have resource records of the current query type for the
host, although the host name is valid.
The query type is specified with the \fBset querytype\fP command.
.IP "Non-existent domain" 5
The host or domain name does not exist.
.IP "Connection refused" 5
.ns
.IP "Network is unreachable" 5
The connection to the name or finger server could not be made
at the current time.
This error commonly occurs with \fBls\fP and \fBfinger\fP requests.
.IP "Server failure" 5
The name server found an internal inconsistency in its database
and could not return a valid answer.
.IP "Refused" 5
The name server refused to service the request.
.IP "Format error" 5
The name server found that the request packet was not in the proper format.
It may indicate an error in \fInslookup\fP.
.sp 1
.SH FILES
.ta \w'/usr/share/misc/nslookup.helpXXX'u
/etc/resolv.conf initial domain name and
name server addresses.
.br
$HOME/.nslookuprc user's initial options.
.br
/usr/share/misc/nslookup.help summary of commands.
.SH ENVIRONMENT
.ta \w'HOSTALIASESXXXX'u
HOSTALIASES file containing host aliases.
.br
LOCALDOMAIN overrides default domain.
.SH SEE ALSO
resolver(@LIB_NETWORK_EXT@), resolver(@FORMAT_EXT@), @INDOT@named(@SYS_OPS_EXT@),
.br
RFC-1034 ``Domain Names \- Concepts and Facilities''
.br
RFC-1035 ``Domain Names \- Implementation and Specification''
.SH AUTHOR
Andrew Cherenson

339
contrib/bind/man/resolver.3 Normal file
View File

@ -0,0 +1,339 @@
.\" Copyright (c) 1985, 1995 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement: ``This product includes software developed by the
.\" University of California, Berkeley and its contributors'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" @(#)resolver.3 6.5 (Berkeley) 6/23/90
.\" $Id: resolver.3,v 8.4 1996/05/09 05:59:10 vixie Exp $
.\"
.TH RESOLVER @LIB_NETWORK_EXT_U@ "December 11, 1995
.UC 4
.SH NAME
res_query, res_search, res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.B #include <netinet/in.h>
.br
.B #include <arpa/nameser.h>
.br
.B #include <resolv.h>
.PP
.B "res_query(dname, class, type, answer, anslen)"
.br
.B const char *dname;
.br
.B int class, type;
.br
.B u_char *answer;
.br
.B int anslen;
.PP
.B "res_search(dname, class, type, answer, anslen)"
.br
.B const char *dname;
.br
.B int class, type;
.br
.B u_char *answer;
.br
.B int anslen;
.PP
.B "res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)"
.br
.B int op;
.br
.B const char *dname;
.br
.B int class, type;
.br
.B const char *data;
.br
.B int datalen;
.br
.B struct rrec *newrr;
.br
.B u_char *buf;
.br
.B int buflen;
.PP
.B res_send(msg, msglen, answer, anslen)
.br
.B const u_char *msg;
.br
.B int msglen;
.br
.B u_char *answer;
.br
.B int anslen;
.PP
.B res_init()
.PP
.B dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
.br
.B const char *exp_dn;
.br
.B u_char *comp_dn;
.br
.B int length;
.br
.B u_char **dnptrs, **lastdnptr;
.PP
.B dn_expand(msg, eomorig, comp_dn, exp_dn, length)
.br
.B const u_char *msg, *eomorig, *comp_dn;
.br
.B char *exp_dn;
.br
.B int length;
.PP
.B herror(const char *s)
.PP
.B hstrerror(int err)
.SH DESCRIPTION
These routines are used for making, sending and interpreting
query and reply messages with Internet domain name servers.
.PP
Global configuration and state information that is used by the
resolver routines is kept in the structure
.IR _res .
Most of the values have reasonable defaults and can be ignored.
Options
stored in
.I _res.options
are defined in
.I resolv.h
and are as follows.
Options are stored as a simple bit mask containing the bitwise ``or''
of the options enabled.
.IP RES_INIT
True if the initial name server address and default domain name are
initialized (i.e.,
.I res_init
has been called).
.IP RES_DEBUG
Print debugging messages.
.IP RES_AAONLY
Accept authoritative answers only.
With this option,
.I res_send
should continue until it finds an authoritative answer or finds an error.
Currently this is not implemented.
.IP RES_USEVC
Use TCP connections for queries instead of UDP datagrams.
.IP RES_STAYOPEN
Used with RES_USEVC to keep the TCP connection open between
queries.
This is useful only in programs that regularly do many queries.
UDP should be the normal mode used.
.IP RES_IGNTC
Unused currently (ignore truncation errors, i.e., don't retry with TCP).
.IP RES_RECURSE
Set the recursion-desired bit in queries.
This is the default.
(\c
.I res_send
does not do iterative queries and expects the name server
to handle recursion.)
.IP RES_DEFNAMES
If set,
.I res_search
will append the default domain name to single-component names
(those that do not contain a dot).
This option is enabled by default.
.IP RES_DNSRCH
If this option is set,
.I res_search
will search for host names in the current domain and in parent domains; see
.IR hostname (@DESC_EXT@).
This is used by the standard host lookup routine
.IR gethostbyname (@LIB_NETWORK_EXT@).
This option is enabled by default.
.IP RES_NOALIASES
This option turns off the user level aliasing feature controlled by
the HOSTALIASES environment variable. Network daemons should set this option.
.PP
The
.I res_init
routine
reads the configuration file (if any; see
.IR resolver (@FORMAT_EXT@))
to get the default domain name,
search list and
the Internet address of the local name server(s).
If no server is configured, the host running
the resolver is tried.
The current domain name is defined by the hostname
if not specified in the configuration file;
it can be overridden by the environment variable LOCALDOMAIN.
This environment variable may contain several blank-separated
tokens if you wish to override the
.I "search list"
on a per-process basis. This is similar to the
.I search
command in the configuration file.
Another environment variable (``RES_OPTIONS'') can be set to
override certain internal resolver options which are otherwise
set by changing fields in the
.I _res
structure or are inherited from the configuration file's
.I options
command. The syntax of the ``RES_OPTIONS'' environment variable
is explained in
.IR resolver (@FORMAT_EXT@).
Initialization normally occurs on the first call
to one of the other resolver routines.
.PP
The
.I res_query
function provides an interface to the server query mechanism.
It constructs a query, sends it to the local server,
awaits a response, and makes preliminary checks on the reply.
The query requests information of the specified
.I type
and
.I class
for the specified fully-qualified domain name
.I dname .
The reply message is left in the
.I answer
buffer with length
.I anslen
supplied by the caller.
.PP
The
.I res_search
routine makes a query and awaits a response like
.IR res_query ,
but in addition, it implements the default and search rules
controlled by the RES_DEFNAMES and RES_DNSRCH options.
It returns the first successful reply.
.PP
The remaining routines are lower-level routines used by
.IR res_query .
The
.I res_mkquery
function
constructs a standard query message and places it in
.IR buf .
It returns the size of the query, or \-1 if the query is
larger than
.IR buflen .
The query type
.I op
is usually QUERY, but can be any of the query types defined in
.IR <arpa/nameser.h> .
The domain name for the query is given by
.IR dname .
.I Newrr
is currently unused but is intended for making update messages.
.PP
The
.I res_send
routine
sends a pre-formatted query and returns an answer.
It will call
.I res_init
if RES_INIT is not set, send the query to the local name server, and
handle timeouts and retries.
The length of the reply message is returned, or
\-1 if there were errors.
.PP
The
.I dn_comp
function
compresses the domain name
.I exp_dn
and stores it in
.IR comp_dn .
The size of the compressed name is returned or \-1 if there were errors.
The size of the array pointed to by
.I comp_dn
is given by
.IR length .
The compression uses
an array of pointers
.I dnptrs
to previously-compressed names in the current message.
The first pointer points to
to the beginning of the message and the list ends with NULL.
The limit to the array is specified by
.IR lastdnptr .
A side effect of
.I dn_comp
is to update the list of pointers for
labels inserted into the message
as the name is compressed.
If
.I dnptr
is NULL, names are not compressed.
If
.I lastdnptr
is NULL, the list of labels is not updated.
.PP
The
.I dn_expand
entry
expands the compressed domain name
.I comp_dn
to a full domain name
The compressed name is contained in a query or reply message;
.I msg
is a pointer to the beginning of the message.
The uncompressed name is placed in the buffer indicated by
.I exp_dn
which is of size
.IR length .
The size of compressed name is returned or \-1 if there was an error.
.PP
The external variable
.B h_errno
is set whenever an error occurs during resolver operation. The following
definitions are given in
.BR <netdb.h> :
.PP
.nf
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive not found, or SERVFAIL */
#define NO_RECOVERY 3 /* Nonrecoverable: FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data for requested type */
.ft R
.ad
.fi
.PP
The
.B herror
function writes a message to the diagnostic output consisting of the string
parameter
.BR s ,
the constant string ": ", and a message corresponding to the value of
.BR h_errno .
.PP
The
.B hstrerror
function returns a string which is the message text corresponding to the
value of the
.B err
parameter.
.SH FILES
/etc/resolv.conf see resolver(@FORMAT_EXT@)
.SH "SEE ALSO"
gethostbyname(@LIB_NETWORK_EXT@), @INDOT@named(@SYS_OPS_EXT@), resolver(@FORMAT_EXT@), hostname(@DESC_EXT@),
.br
RFC1032, RFC1033, RFC1034, RFC1035, RFC974,
.br
SMM:11 Name Server Operations Guide for BIND

133
contrib/bind/man/resolver.5 Normal file
View File

@ -0,0 +1,133 @@
.\" Copyright (c) 1986 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted
.\" provided that the above copyright notice and this paragraph are
.\" duplicated in all such forms and that any documentation,
.\" advertising materials, and other materials related to such
.\" distribution and use acknowledge that the software was developed
.\" by the University of California, Berkeley. The name of the
.\" University may not be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" @(#)resolver.5 5.9 (Berkeley) 12/14/89
.\" $Id: resolver.5,v 8.3 1995/12/06 20:34:35 vixie Exp $
.\"
.TH RESOLVER @FORMAT_EXT_U@ ""November 11, 1993""
.UC 4
.SH NAME
resolver \- resolver configuration file
.SH SYNOPSIS
/etc/resolv.conf
.SH DESCRIPTION
.LP
The
.I resolver
is a set of routines in the C library (\c
.IR resolv (@LIB_NETWORK_EXT@))
that provide access to the Internet Domain Name System.
The resolver configuration file contains information that is read
by the resolver routines the first time they are invoked by a process.
The file is designed to be human readable and contains a list of
keywords with values that provide various types of resolver information.
.LP
On a normally configured system this file should not be necessary.
The only name server to be queried will be on the local machine,
the domain name is determined from the host name,
and the domain search path is constructed from the domain name.
.LP
The different configuration options are:
.TP
\fBnameserver\fP
Internet address (in dot notation) of a name server
that the resolver should query.
Up to MAXNS (currently 3) name servers may be listed,
one per keyword.
If there are multiple servers,
the resolver library queries them in the order listed.
If no \fBnameserver\fP entries are present,
the default is to use the name server on the local machine.
(The algorithm used is to try a name server, and if the query times out,
try the next, until out of name servers,
then repeat trying all the name servers
until a maximum number of retries are made).
.TP
\fBdomain\fP
Local domain name.
Most queries for names within this domain can use short names
relative to the local domain.
If no \fBdomain\fP entry is present, the domain is determined
from the local host name returned by
\fIgethostname\fP\|(@BSD_SYSCALL_EXT@);
the domain part is taken to be everything after the first `.'.
Finally, if the host name does not contain a domain part, the root
domain is assumed.
.TP
\fBsearch\fP
Search list for host-name lookup.
The search list is normally determined from the local domain name;
by default, it contains only the local domain name.
This may be changed by listing the desired domain search path
following the \fIsearch\fP keyword with spaces or tabs separating
the names.
Most resolver queries will be attempted using each component
of the search path in turn until a match is found.
Note that this process may be slow and will generate a lot of network
traffic if the servers for the listed domains are not local,
and that queries will time out if no server is available
for one of the domains.
.IP
The search list is currently limited to six domains
with a total of 256 characters.
.TP
\fBsortlist\fP
Sortlist allows addresses returned by gethostbyname to be sorted.
A sortlist is specified by IP address netmask pairs. The netmask is
optional and defaults to the natural netmask of the net. The IP address
and optional network pairs are separated by slashes. Up to 10 pairs may
be specified.
.IP
e.g. sortlist 130.155.160.0/255.255.240.0 130.155.0.0
.TP
\fBoptions\fP
Options allows certain internal resolver variables to be modified.
The syntax is
.IP
\fBoptions\fP \fIoption\fP \fI...\fP
.IP
where \fIoption\fP is one of the following:
.IP
\fBdebug\fP \(em sets RES_DEBUG in _res.options.
.IP
\fBndots:\fP\fIn\fP \(em sets a threshold for the number of dots which
must appear in a name given to \fBres_query\fP (see \fIresolver\fP(@LIB_NETWORK_EXT@))
before an \fIinitial absolute query\fP will be made. The default for
\fIn\fP is ``1'', meaning that if there are any dots in a name, the name
will be tried first as an absolute name before any \fIsearch list\fP
elements are appended to it.
.LP
The \fIdomain\fP and \fIsearch\fP keywords are mutually exclusive.
If more than one instance of these keywords is present,
the last instance wins.
.LP
The \fIsearch\fP keyword of a system's \fIresolv.conf\fP file can be
overridden on a per-process basis by setting the environment variable
``\s-1LOCALDOMAIN\s+1'' to a space-separated list of search domains.
.LP
The \fIoptions\fP keyword of a system's \fIresolv.conf\fP file can be
amended on a per-process basis by setting the environment variable
``\s-1RES_OPTIONS\s+1'' to a space-separated list of resolver options
as explained above under \fBoptions\fP.
.LP
The keyword and value must appear on a single line, and the keyword
(e.g. \fBnameserver\fP) must start the line. The value follows
the keyword, separated by white space.
.SH FILES
.I /etc/resolv.conf
.SH SEE ALSO
gethostbyname(@LIB_NETWORK_EXT@), resolver(@LIB_NETWORK_EXT@), hostname(@DESC_EXT@), @INDOT@named(@SYS_OPS_EXT@)
.br
Name Server Operations Guide for BIND

196
contrib/bind/named/Makefile Normal file
View File

@ -0,0 +1,196 @@
#
# @(#)Makefile.dist 5.4 (Berkeley) 8/15/90
# $Id: Makefile,v 8.7 1995/12/22 10:20:30 vixie Exp $
#
## ++Copyright++ 1987, 1988, 1990
## -
## Copyright (c) 1987, 1988, 1990
## 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.
## -
## Portions Copyright (c) 1993 by Digital Equipment Corporation.
##
## Permission to use, copy, modify, and distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
## copyright notice and this permission notice appear in all copies, and that
## the name of Digital Equipment Corporation not be used in advertising or
## publicity pertaining to distribution of the document or software without
## specific, written prior permission.
##
## THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
## WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
## OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
## CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
## PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
## -
## --Copyright--
## NOTE: customizing this Makefile is almost certainly the wrong thing to do.
## unless you are a developer and intend to run "make" here a lot of times
## per day, you should just run "make" from the top-level directory after
## configuring _that_ Makefile with the right system-dependent values.
VER = LOCAL-`date +%y%m%d.%H%M%S`
SHELL = /bin/sh
DESTDIR =
INDOT=
XFER_INDOT=
#(sunos)
#INDOT=in.
#XFER_INDOT=in.
HOSTNAMECMD = hostname || uname -n
#(these defaults are reasonable for a BSD/OS test environment;
# for real configuration, edit ../Makefile and run make from there.)
COMPINCL = ../compat/include
INCL= ../include
RES= ../res/libresolv.a
DESTSBIN = ${DESTDIR}/usr/sbin
DESTEXEC = ${DESTDIR}/usr/libexec
PIDDIR = /var/run
CC= cc
#CC= gcc2 -Wimplicit -Wunused -Wreturn-type
SHELL= /bin/sh
CDEBUG= -g
LIBS=
COMPLIB= ../compat/lib/lib44bsd.a
PATH_XFER = ${DESTEXEC}/${XFER_INDOT}named-xfer
DEFS = -D_PATH_XFER=\"${PATH_XFER}\" -D_PATH_PIDFILE=\"${PIDDIR}/named.pid\"
INSTALL = install
PS=ps
IOT=ABRT
CFLAGS = ${CDEBUG} -I${INCL} -I${COMPINCL} ${DEFS}
HDRS= db_defs.h db_glob.h ns_defs.h ns_glob.h named.h pathnames.h tree.h
SRCS= db_dump.c db_load.c db_lookup.c db_reload.c db_save.c db_update.c \
db_secure.c db_glue.c \
ns_forw.c ns_init.c ns_main.c ns_maint.c ns_req.c ns_resp.c \
ns_sort.c ns_stats.c ns_validate.c ns_ncache.c \
storage.c dmalloc.c tree.c
OBJS= db_dump.o db_load.o db_lookup.o db_reload.o db_save.o db_update.o \
db_secure.o db_glue.o \
ns_forw.o ns_init.o ns_main.o ns_maint.o ns_req.o ns_resp.o \
ns_sort.o ns_stats.o ns_validate.o ns_ncache.o \
storage.o dmalloc.o tree.o
XFERSRCS= named-xfer.c
XFEROBJ= named-xfer.o db_glue.o storage.o dmalloc.o version.o
all: named named-xfer named.reload named.restart ndc
named: ${OBJS} ${RES} ${COMPLIB} version.o
${CC} ${CDEBUG} ${LDFLAGS} -o $@ version.o ${OBJS} \
${RES} ${COMPLIB} ${LIBS}
version.o: version.c
version.c: Version.c Makefile ../Makefile ${SRCS} ${HDRS}
(u=$${USER-root} d=`pwd` h=`${HOSTNAMECMD}` t=`date`; \
sed -e "s|%WHEN%|$${t}|" -e "s|%VERSION%|"${VER}"|" \
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
< Version.c > version.c)
named.reload: named.reload.sh Makefile
sed -e "s|%INDOT%|${INDOT}|" \
-e "s|%DESTSBIN%|${DESTSBIN}|" \
< named.reload.sh > named.reload
chmod +x named.reload
named.restart: named.restart.sh Makefile
sed -e "s|%INDOT%|${INDOT}|" \
-e "s|%DESTSBIN%|${DESTSBIN}|" \
< named.restart.sh > named.restart
chmod +x named.restart
ndc: ndc.sh Makefile
sed -e "s|%PIDDIR%|${PIDDIR}|" \
-e "s|%INDOT%|${INDOT}|" \
-e "s|%PS%|${PS}|" \
-e "s|%IOTPS%|${IOT}|" \
-e "s|%DESTSBIN%|${DESTSBIN}|" \
-e "s|%IOT%|${IOT}|" \
< ndc.sh > ndc
chmod +x ndc
named-xfer: ${XFEROBJ} ${RES} ${COMPLIB}
${CC} ${CDEBUG} ${LDFLAGS} -o $@ ${XFEROBJ} \
${RES} ${COMPLIB} ${LIBS}
centerline_named:
#load -I${INCL} -I${COMPINCL} ${CFLAGS} ${SRCS} \
version.c ${RES} ${COMPLIB} ${LIBS}
centerline_obj:
#load -I${INCL} -I${COMPINCL} ${CFLAGS} ${OBJS} \
version.o ${RES} ${COMPLIB} ${LIBS}
centerline_xfer:
#load -DXFER ${CFLAGS} ${XFERSRCS} ${RES} ${COMPLIB} ${LIBS}
clean:
rm -f ${OBJS} ${XFEROBJ} core named named-xfer version.o version.c
rm -f *~ *.BAK *.CKP
rm -f tags .depend core named.reload named.restart ndc
rm -f *.orig
depend .depend: ${SRCS} ${XFERSRCS}
mkdep ${CPPFLAGS} -I${INCL} -I${COMPINCL} ${SRCS} ${XFERSRCS}
install:
${INSTALL} -c -s -o bin -g bin -m 555 \
named ${DESTDIR}${DESTSBIN}/${INDOT}named
${INSTALL} -c -s -o bin -g bin -m 555 \
named-xfer ${DESTDIR}${PATH_XFER}
${INSTALL} -c -o bin -g bin -m 555 \
named.restart ${DESTDIR}${DESTSBIN}/${INDOT}named.restart
${INSTALL} -c -o bin -g bin -m 555 \
named.reload ${DESTDIR}${DESTSBIN}/${INDOT}named.reload
${INSTALL} -c -o bin -g bin -m 555 \
ndc ${DESTDIR}${DESTSBIN}/${INDOT}ndc
@echo "*** Install symlinks if needed ***"
lint: ${SRCS} ${HDRS} ${XFERSRCS}
lint -x -Dlint ${CFLAGS} ${SRCS} ${XFERSRCS} 2>&1 \
| grep -v 'warning: nested comments not supported'
tags: ${SRCS} ${XFERSRCS} Makefile
ctags -t `echo ${SRCS} ${HDRS} ${XFERSRCS}|tr ' ' '\012'|sort -u`
$(SRCS):: $(HDRS)
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

View File

@ -0,0 +1,83 @@
#
# @(#)Makefile 5.8 (Berkeley) 7/28/90
# $Id: Makefile.reno,v 8.1 1994/12/15 06:24:14 vixie Exp $
#
## ++Copyright++ 1985, 1989
## -
## Copyright (c) 1985, 1989
## 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.
## -
## Portions Copyright (c) 1993 by Digital Equipment Corporation.
##
## Permission to use, copy, modify, and distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
## copyright notice and this permission notice appear in all copies, and that
## the name of Digital Equipment Corporation not be used in advertising or
## publicity pertaining to distribution of the document or software without
## specific, written prior permission.
##
## THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
## WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
## OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
## CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
## PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
## -
## --Copyright--
### -DALLOW_T_UNSPEC -Dmalloc=rt_malloc -Dfree=rt_free
### ALLOC=storage.o
PROG= named
MAN8= named.0
CFLAGS= -O -DDEBUG -DSTATS
LDADD= -lutil
SRCS= db_dump.c db_glue.c db_load.c db_lookup.c db_reload.c db_save.c \
db_update.c ns_forw.c ns_init.c ns_main.c ns_maint.c ns_req.c \
ns_resp.c ns_sort.c ns_stats.c
OBJS+= version.o
CLEANFILES+=version.c version.o
SUBDIR= tools xfer
version.c: ${.CURDIR}/Version.c
(u=$${USER-root} d=`pwd |sed -e 's|/obj/|/src/|'` \
h=`hostname` t=`date`; \
sed -e "s|%WHEN%|$${t}|" \
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
< ${.CURDIR}/Version.c > version.c)
afterinstall:
install -c -o ${BINOWN} -g ${BINGRP} -m 555 ${.CURDIR}/named.restart \
${.CURDIR}/named.reload ${DESTDIR}${BINDIR}
.include <bsd.prog.mk>

View File

@ -0,0 +1,88 @@
/*
* @(#)Version.c 4.9 (Berkeley) 7/21/90
* $Id: Version.c,v 8.1 1994/12/15 06:24:14 vixie Exp $
*/
#ifndef lint
char sccsid[] = "@(#)named %VERSION% %WHEN% %WHOANDWHERE%";
char rcsid[] = "$Id: Version.c,v 8.1 1994/12/15 06:24:14 vixie Exp $";
#endif /* not lint */
char Version[] = "named %VERSION% %WHEN%\n\t%WHOANDWHERE%";
#ifdef COMMENT
SCCS/s.Version.c:
D 4.8.3 90/06/27 17:05:21 bloom 37 35 00031/00028/00079
Version distributed with 4.3 Reno tape (June 1990)
D 4.8.2 89/09/18 13:57:11 bloom 35 34 00020/00014/00087
Interim fixes release
D 4.8.1 89/02/08 17:12:15 karels 34 33 00026/00017/00075
branch for 4.8.1
D 4.8 88/07/09 14:27:00 karels 33 28 00043/00031/00049
4.8 is here!
D 4.7 87/11/20 13:15:52 karels 25 24 00000/00000/00062
4.7.3 beta
D 4.6 87/07/21 12:15:52 karels 25 24 00000/00000/00062
4.6 declared stillborn
D 4.5 87/02/10 12:33:25 kjd 24 18 00000/00000/00062
February 1987, Network Release. Child (bind) grows up, parent (kevin) leaves home.
D 4.4 86/10/01 10:06:26 kjd 18 12 00020/00017/00042
October 1, 1986 Network Distribution
D 4.3 86/06/04 12:12:18 kjd 12 7 00015/00028/00044
Version distributed with 4.3BSD
D 4.2 86/04/30 20:57:16 kjd 7 1 00056/00000/00016
Network distribution Freeze and one more version until 4.3BSD
D 1.1 86/04/30 19:30:00 kjd 1 0 00016/00000/00000
date and time created 86/04/30 19:30:00 by kjd
code versions:
Makefile
Makefile 4.14 (Berkeley) 2/28/88
db.h
db.h 4.13 (Berkeley) 2/17/88
db_dump.c
db_dump.c 4.20 (Berkeley) 2/17/88
db_load.c
db_load.c 4.26 (Berkeley) 2/28/88
db_lookup.c
db_lookup.c 4.14 (Berkeley) 2/17/88
db_reload.c
db_reload.c 4.15 (Berkeley) 2/28/88
db_save.c
db_save.c 4.13 (Berkeley) 2/17/88
db_update.c
db_update.c 4.16 (Berkeley) 2/28/88
ns_forw.c
ns_forw.c 4.26 (Berkeley) 3/28/88
ns_init.c
ns_init.c 4.23 (Berkeley) 2/28/88
ns_main.c
Copyright (c) 1986 Regents of the University of California.\n\
ns_main.c 4.30 (Berkeley) 3/7/88
ns_maint.c
ns_maint.c 4.23 (Berkeley) 2/28/88
ns_req.c
ns_req.c 4.32 (Berkeley) 3/31/88
ns_resp.c
ns_resp.c 4.50 (Berkeley) 4/7/88
ns_sort.c
ns_sort.c 4.3 (Berkeley) 2/17/88
ns_stats.c
ns_stats.c 4.3 (Berkeley) 2/17/88
newvers.sh
newvers.sh 4.4 (Berkeley) 3/28/88
#endif /* COMMENT */

View File

@ -0,0 +1,183 @@
/*
* from db.h 4.16 (Berkeley) 6/1/90
* $Id: db_defs.h,v 8.4 1996/05/17 09:10:46 vixie Exp $
*/
/*
* ++Copyright++ 1985, 1990
* -
* Copyright (c) 1985, 1990
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* Global definitions for data base routines.
*/
#define INVBLKSZ 7 /* # of namebuf pointers per block */
#define INVHASHSZ 919 /* size of inverse hash table */
/* max length of data in RR data field */
#define MAXDATA 2048
#define DB_ROOT_TIMBUF 3600
#define TIMBUF 300
/*
* Hash table structures.
*/
struct databuf {
struct databuf *d_next; /* linked list */
u_int32_t d_ttl; /* time to live */
/* if d_zone == DB_Z_CACHE, then
* d_ttl is actually the time when
* the record will expire.
* otherwise (for authoritative
* primary and secondary zones),
* d_ttl is the time to live.
*/
unsigned d_flags :7; /* see below */
unsigned d_cred :3; /* DB_C_{??????} */
unsigned d_clev :6;
int16_t d_zone; /* zone number or 0 for the cache */
int16_t d_class; /* class number */
int16_t d_type; /* type number */
int16_t d_mark; /* place to mark data */
int16_t d_size; /* size of data area */
#ifdef NCACHE
int16_t d_rcode; /* rcode added for negative caching */
#endif
int16_t d_rcnt;
#ifdef STATS
struct nameser *d_ns; /* NS from whence this came */
#endif
/*XXX*/ u_int32_t d_nstime; /* NS response time, milliseconds */
u_char d_data[sizeof(char*)]; /* malloc'd (padded) */
};
#define DATASIZE(n) (sizeof(struct databuf) - sizeof(char*) + n)
/*
* d_flags definitions
*/
#define DB_F_HINT 0x01 /* databuf belongs to fcachetab */
/*
* d_cred definitions
*/
#define DB_C_ZONE 4 /* authoritative zone - best */
#define DB_C_AUTH 3 /* authoritative answer */
#define DB_C_ANSWER 2 /* non-authoritative answer */
#define DB_C_ADDITIONAL 1 /* additional data */
#define DB_C_CACHE 0 /* cache - worst */
struct namebuf {
u_int n_hashval; /* hash value of n_dname */
struct namebuf *n_next; /* linked list */
struct databuf *n_data; /* data records */
struct namebuf *n_parent; /* parent domain */
struct hashbuf *n_hash; /* hash table for children */
char _n_name[sizeof(void*)]; /* Counted str, malloc'ed. */
};
#define NAMESIZE(n) (sizeof(struct namebuf) - sizeof(void*) + 1 + n + 1)
#define NAMELEN(nb) ((nb)._n_name[0])
#define NAME(nb) ((nb)._n_name + 1)
#ifdef INVQ
struct invbuf {
struct invbuf *i_next; /* linked list */
struct namebuf *i_dname[INVBLKSZ]; /* domain name */
};
#endif
struct hashbuf {
int h_size; /* size of hash table */
int h_cnt; /* number of entries */
struct namebuf *h_tab[1]; /* malloc'ed as needed */
};
#define HASHSIZE(s) (s*sizeof(struct namebuf *) + 2*sizeof(int))
#define HASHSHIFT 3
#define HASHMASK 0x1f
/*
* Flags to updatedb
*/
#define DB_NODATA 0x01 /* data should not exist */
#define DB_MEXIST 0x02 /* data must exist */
#define DB_DELETE 0x04 /* delete data if it exists */
#define DB_NOTAUTH 0x08 /* must not update authoritative data */
#define DB_NOHINTS 0x10 /* don't reflect update in fcachetab */
#define DB_PRIMING 0x20 /* is this update the result of priming? */
#define DB_Z_CACHE (0) /* cache-zone-only db_dump() */
#define DB_Z_ALL (-1) /* normal db_dump() */
/*
* Error return codes
*/
#define OK 0
#define NONAME -1
#define NOCLASS -2
#define NOTYPE -3
#define NODATA -4
#define DATAEXISTS -5
#define NODBFILE -6
#define TOOMANYZONES -7
#define GOODDB -8
#define NEWDB -9
#define AUTH -10
/*
* getnum() options
*/
#define GETNUM_NONE 0x00 /* placeholder */
#define GETNUM_SERIAL 0x01 /* treat as serial number */
#define GETNUM_SCALED 0x02 /* permit "k", "m" suffixes, scale result */

View File

@ -0,0 +1,924 @@
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)db_dump.c 4.33 (Berkeley) 3/3/91";
static char rcsid[] = "$Id: db_dump.c,v 8.14 1996/08/05 08:31:30 vixie Exp $";
#endif /* not lint */
/*
* ++Copyright++ 1986, 1988, 1990
* -
* Copyright (c) 1986, 1988, 1990
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <syslog.h>
#include <resolv.h>
#include <errno.h>
#include "named.h"
static int scan_root __P((struct hashbuf *));
static const char *MkCredStr __P((int));
#ifdef ALLOW_T_UNSPEC
static void putbyte __P((int, char **));
#endif
/*
* Dump current cache in a format similar to RFC 883.
*
* We try to be careful and determine whether the operation succeeded
* so that the new cache file can be installed.
*/
void
doachkpt()
{
FILE *fp;
char tmpcheckfile[256];
/* nowhere to checkpoint cache... */
if (cache_file == NULL) {
dprintf(3, (ddt, "skipping doachkpt (cache_file == NULL)\n"));
return;
}
dprintf(3, (ddt, "doachkpt()\n"));
(void) sprintf(tmpcheckfile, "%s.chk", cache_file);
if ((fp = fopen(tmpcheckfile, "w")) == NULL) {
dprintf(3, (ddt,
"doachkpt(can't open %s for write)\n", tmpcheckfile));
return;
}
(void) gettime(&tt);
fprintf(fp, "; Dumped at %s", ctimel(tt.tv_sec));
fflush(fp);
if (ferror(fp)) {
dprintf(3, (ddt, "doachkpt(write to checkpoint file failed)\n"));
return;
}
if (fcachetab != NULL) {
int n = scan_root(hashtab);
if (n < MINROOTS) {
syslog(LOG_NOTICE, "%d root hints... (too low)", n);
fprintf(fp, "; ---- Root hint cache dump ----\n");
(void) db_dump(fcachetab, fp, DB_Z_CACHE, "");
}
}
if (hashtab != NULL) {
fprintf(fp, "; ---- Cache dump ----\n");
if (db_dump(hashtab, fp, DB_Z_CACHE, "") == NODBFILE) {
dprintf(3, (ddt, "doachkpt(checkpoint failed)\n"));
(void) my_fclose(fp);
return;
}
}
if (my_fclose(fp) == EOF) {
return;
}
if (rename(tmpcheckfile, cache_file)) {
dprintf(3, (ddt, "doachkpt(install %s to %s failed, %d)\n",
tmpcheckfile, cache_file, errno));
}
}
/*
* What we do is scan the root hint cache to make sure there are at least
* MINROOTS root pointers with non-0 TTL's so that the checkpoint will not
* lose the root. Failing this, all pointers are written out w/ TTL ~0
* (root pointers timed out and prime_cache() not done or failed).
*/
static int
scan_root(htp)
struct hashbuf *htp;
{
register struct databuf *dp;
register struct namebuf *np;
struct timeval soon;
int roots = 0;
dprintf(1, (ddt, "scan_root(0x%lx)\n", (u_long)htp));
/* metric by which we determine whether a root NS pointer is still */
/* valid (will be written out if we do a dump). we also add some */
/* time buffer for safety... */
(void) gettime(&soon);
soon.tv_sec += TIMBUF;
for (np = htp->h_tab[0]; np != NULL; np = np->n_next) {
if (NAME(*np)[0] == '\0') {
dp = np->n_data;
while (dp != NULL) {
if (dp->d_type == T_NS &&
dp->d_ttl > soon.tv_sec) {
roots++;
if (roots >= MINROOTS)
return (roots);
}
dp = dp->d_next;
}
}
}
return (roots);
}
#ifdef notdef
mark_cache(htp, ttl)
struct hashbuf *htp;
int ttl;
{
register struct databuf *dp;
register struct namebuf *np;
struct namebuf **npp, **nppend;
struct timeval soon;
dprintf(1, (ddt, "mark_cache()\n"));
(void) gettime(&soon);
soon.tv_sec += TIMBUF;
npp = htp->h_tab;
nppend = npp + htp->h_size;
while (npp < nppend) {
for (np = *npp++; np != NULL; np = np->n_next) {
if (np->n_data == NULL)
continue;
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
if (dp->d_ttl < soon.tv_sec)
dp->d_ttl = ttl;
}
}
}
npp = htp->h_tab;
nppend = npp + htp->h_size;
while (npp < nppend) {
for (np = *npp++; np != NULL; np = np->n_next) {
if (np->n_hash == NULL)
continue;
mark_cache(np->n_hash, ttl);
}
}
}
#endif /* notdef */
/*
* Dump current data base in a format similar to RFC 883.
*/
void
doadump()
{
FILE *fp;
dprintf(3, (ddt, "doadump()\n"));
syslog(LOG_NOTICE, "dumping nameserver data\n");
if ((fp = fopen(dumpfile, "w")) == NULL)
return;
gettime(&tt);
fprintf(fp, "; Dumped at %s", ctimel(tt.tv_sec));
if (zones && nzones)
zt_dump(fp);
fputs(
"; Note: Cr=(auth,answer,addtnl,cache) tag only shown for non-auth RR's\n",
fp);
fputs(
"; Note: NT=milliseconds for any A RR which we've used as a nameserver\n",
fp);
fprintf(fp, "; --- Cache & Data ---\n");
if (hashtab != NULL)
(void) db_dump(hashtab, fp, DB_Z_ALL, "");
fprintf(fp, "; --- Hints ---\n");
if (fcachetab != NULL)
(void) db_dump(fcachetab, fp, DB_Z_ALL, "");
(void) my_fclose(fp);
syslog(LOG_NOTICE, "finished dumping nameserver data\n");
}
#ifdef ALLOW_UPDATES
/* Create a disk database to back up zones
*/
void
zonedump(zp)
register struct zoneinfo *zp;
{
FILE *fp;
char *fname;
struct hashbuf *htp;
char *op;
struct stat st;
/* Only dump zone if there is a cache specified */
if (zp->z_source && *(zp->z_source)) {
dprintf(1, (ddt, "zonedump(%s)\n", zp->z_source));
if ((fp = fopen(zp->z_source, "w")) == NULL)
return;
if (op = strchr(zp->z_origin, '.'))
op++;
gettime(&tt);
htp = hashtab;
if (nlookup(zp->z_origin, &htp, &fname, 0) != NULL) {
db_dump(htp, fp, zp-zones, (op == NULL ? "" : op));
zp->z_flags &= ~Z_CHANGED; /* Checkpointed */
}
(void) my_fclose(fp);
if (stat(zp->z_source, &st) == 0)
zp->z_ftime = st.st_mtime;
} else {
dprintf(1, (ddt, "zonedump: no zone to dump\n"));
}
}
#endif
int
zt_dump(fp)
FILE *fp;
{
register struct zoneinfo *zp;
fprintf(fp, ";; ++zone table++\n");
for (zp = &zones[1]; zp < &zones[nzones]; zp++) {
char *pre, buf[64];
u_int cnt;
if (!zp->z_origin)
continue;
fprintf(fp, "; %s (type %d, class %d, source %s)\n",
zp->z_origin
? (*zp->z_origin ? zp->z_origin : ".")
: "Nil",
zp->z_type, zp->z_class,
zp->z_source ? zp->z_source : "Nil");
fprintf(fp, ";\ttime=%lu, lastupdate=%lu, serial=%u,\n",
(u_long)zp->z_time, (u_long)zp->z_lastupdate,
zp->z_serial);
fprintf(fp, ";\trefresh=%u, retry=%u, expire=%u, minimum=%u\n",
zp->z_refresh, zp->z_retry,
zp->z_expire, zp->z_minimum);
fprintf(fp, ";\tftime=%lu, xaddr=[%s], state=%04x, pid=%d\n",
(u_long)zp->z_ftime, inet_ntoa(zp->z_xaddr),
zp->z_flags, (int)zp->z_xferpid);
sprintf(buf, ";\tz_addr[%d]: ", zp->z_addrcnt);
pre = buf;
for (cnt = 0; cnt < zp->z_addrcnt; cnt++) {
fprintf(fp, "%s[%s]", pre, inet_ntoa(zp->z_addr[cnt]));
pre = ", ";
}
if (zp->z_addrcnt)
fputc('\n', fp);
#ifdef BIND_NOTIFY
if (zp->z_notifylist) {
register struct notify *ap;
for (ap = zp->z_notifylist; ap; ap = ap->next)
fprintf(fp, ";\tNotify [%s] %s",
inet_ntoa(ap->addr),
ctime(&ap->last));
}
#endif
}
fprintf(fp, ";; --zone table--\n");
return (0);
}
int
db_dump(htp, fp, zone, origin)
struct hashbuf *htp;
FILE *fp;
int zone;
char *origin;
{
register struct databuf *dp = NULL;
register struct namebuf *np;
struct namebuf **npp, **nppend;
char dname[MAXDNAME];
u_int32_t n;
u_int32_t addr;
int j, i;
register u_char *cp;
u_char *end;
char *proto, *sep;
int found_data = 0, tab, printed_origin = 0;
npp = htp->h_tab;
nppend = npp + htp->h_size;
while (npp < nppend) {
for (np = *npp++; np != NULL; np = np->n_next) {
if (np->n_data == NULL)
continue;
/* Blecch - can't tell if there is data here for the
* right zone, so can't print name yet
*/
found_data = 0;
/* we want a snapshot in time... */
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
/* Is the data for this zone? */
if (zone != DB_Z_ALL && dp->d_zone != zone)
continue;
if (dp->d_zone == DB_Z_CACHE &&
dp->d_ttl <= tt.tv_sec &&
(dp->d_flags & DB_F_HINT) == 0)
continue;
if (!printed_origin) {
fprintf(fp, "$ORIGIN %s.\n", origin);
printed_origin++;
}
tab = 0;
#ifdef NCACHE
if (dp->d_rcode == NXDOMAIN ||
dp->d_rcode == NOERROR_NODATA) {
fputc(';', fp);
} else if (found_data == 0 || found_data == 1) {
found_data = 2;
}
#endif /*NCACHE*/
if (found_data == 0 || found_data == 2) {
if (NAME(*np)[0] == '\0') {
if (origin[0] == '\0')
fprintf(fp, ".\t");
else
fprintf(fp, ".%s.\t", origin); /* ??? */
} else
fprintf(fp, "%s\t", NAME(*np));
if (NAMELEN(*np) < (size_t)8)
tab = 1;
found_data++;
} else {
(void) putc('\t', fp);
tab = 1;
}
if (dp->d_zone == DB_Z_CACHE) {
if (dp->d_flags & DB_F_HINT
&& (int32_t)(dp->d_ttl - tt.tv_sec)
< DB_ROOT_TIMBUF)
fprintf(fp, "%d\t", DB_ROOT_TIMBUF);
else
fprintf(fp, "%d\t",
(int)(dp->d_ttl - tt.tv_sec));
} else if (dp->d_ttl != USE_MINIMUM &&
dp->d_ttl != zones[dp->d_zone].z_minimum)
fprintf(fp, "%d\t", (int)dp->d_ttl);
else if (tab)
(void) putc('\t', fp);
fprintf(fp, "%s\t%s\t",
p_class(dp->d_class),
p_type(dp->d_type));
cp = (u_char *)dp->d_data;
sep = "\t;";
#ifdef NCACHE
#ifdef RETURNSOA
if (dp->d_rcode == NOERROR_NODATA) {
fprintf(fp, "NODATA%s-$", sep);
goto eoln;
}
#else
if (dp->d_rcode == NXDOMAIN ||
dp->d_rcode == NOERROR_NODATA) {
fprintf(fp, "%s%s-$",
(dp->d_rcode == NXDOMAIN)
?"NXDOMAIN" :"NODATA",
sep);
goto eoln;
}
#endif
#endif
/*
* Print type specific data
*/
switch (dp->d_type) {
case T_A:
switch (dp->d_class) {
case C_IN:
case C_HS:
GETLONG(n, cp);
n = htonl(n);
fputs(inet_ntoa(*(struct in_addr *)&n),
fp);
break;
}
if (dp->d_nstime) {
fprintf(fp, "%sNT=%d",
sep, dp->d_nstime);
sep = " ";
}
break;
case T_CNAME:
case T_MB:
case T_MG:
case T_MR:
case T_PTR:
fprintf(fp, "%s.", cp);
break;
case T_NS:
cp = (u_char *)dp->d_data;
if (cp[0] == '\0')
fprintf(fp, ".\t");
else
fprintf(fp, "%s.", cp);
break;
case T_HINFO:
case T_ISDN:
if ((n = *cp++) != '\0') {
fprintf(fp, "\"%.*s\"", (int)n, cp);
cp += n;
} else
fprintf(fp, "\"\"");
if ((n = *cp++) != '\0')
fprintf(fp, " \"%.*s\"", (int)n, cp);
else
fprintf(fp, " \"\"");
break;
case T_SOA:
fprintf(fp, "%s.", cp);
cp += strlen((char *)cp) + 1;
fprintf(fp, " %s. (\n", cp);
#if defined(RETURNSOA) && defined(NCACHE)
if (dp->d_rcode == NXDOMAIN)
fputs(";", fp);
#endif
cp += strlen((char *)cp) + 1;
GETLONG(n, cp);
fprintf(fp, "\t\t%lu", (u_long)n);
GETLONG(n, cp);
fprintf(fp, " %lu", (u_long)n);
GETLONG(n, cp);
fprintf(fp, " %lu", (u_long)n);
GETLONG(n, cp);
fprintf(fp, " %lu", (u_long)n);
GETLONG(n, cp);
fprintf(fp, " %lu )", (u_long)n);
#if defined(RETURNSOA) && defined(NCACHE)
if (dp->d_rcode == NXDOMAIN) {
fprintf(fp,";%s.;NXDOMAIN%s-$",cp,sep);
}
#endif
break;
case T_MX:
case T_AFSDB:
case T_RT:
GETSHORT(n, cp);
fprintf(fp, "%lu", (u_long)n);
fprintf(fp, " %s.", cp);
break;
case T_PX:
GETSHORT(n, cp);
fprintf(fp, "%lu", (u_long)n);
fprintf(fp, " %s.", cp);
cp += strlen((char *)cp) + 1;
fprintf(fp, " %s.", cp);
break;
case T_TXT:
case T_X25:
end = (u_char *)dp->d_data + dp->d_size;
(void) putc('"', fp);
while (cp < end) {
if ((n = *cp++) != '\0') {
for (j = n ; j > 0 && cp < end ; j--)
if (*cp == '\n') {
(void) putc('\\', fp);
(void) putc(*cp++, fp);
} else
(void) putc(*cp++, fp);
}
}
(void) fputs("\"", fp);
break;
case T_NSAP:
(void) fputs(inet_nsap_ntoa(dp->d_size,
dp->d_data, NULL),
fp);
break;
case T_AAAA: {
char t[sizeof
"ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"
];
(void) fputs(inet_ntop(AF_INET6, dp->d_data,
t, sizeof t),
fp);
break;
}
#ifdef LOC_RR
case T_LOC: {
char t[256];
(void) fputs(loc_ntoa(dp->d_data, t), fp);
break;
}
#endif /* LOC_RR */
case T_UINFO:
fprintf(fp, "\"%s\"", cp);
break;
case T_UID:
case T_GID:
if (dp->d_size == INT32SZ) {
GETLONG(n, cp);
} else {
n = -2; /* XXX - hack */
}
fprintf(fp, "%u", n);
break;
case T_WKS:
GETLONG(addr, cp);
addr = htonl(addr);
fputs(inet_ntoa(*(struct in_addr *)&addr), fp);
proto = protocolname(*cp);
cp += sizeof(char);
fprintf(fp, " %s ", proto);
i = 0;
while(cp < (u_char *)dp->d_data + dp->d_size) {
j = *cp++;
do {
if (j & 0200)
fprintf(fp, " %s",
servicename(i, proto));
j <<= 1;
} while (++i & 07);
}
break;
case T_MINFO:
case T_RP:
fprintf(fp, "%s.", cp);
cp += strlen((char *)cp) + 1;
fprintf(fp, " %s.", cp);
break;
#ifdef ALLOW_T_UNSPEC
case T_UNSPEC:
/* Dump binary data out in an ASCII-encoded
format */
{
/* Allocate more than enough space:
* actually need 5/4 size + 20 or so
*/
int TmpSize = 2 * dp->d_size + 30;
char *TmpBuf = (char *) malloc(TmpSize);
if (TmpBuf == NULL) {
TmpBuf = "BAD_MALLOC";
}
if (btoa(cp, dp->d_size, TmpBuf, TmpSize)
== CONV_OVERFLOW) {
TmpBuf = "OVERFLOW";
}
fprintf(fp, "%s", TmpBuf);
}
break;
#endif /* ALLOW_T_UNSPEC */
default:
fprintf(fp, "%s?d_type=%d?",
sep, dp->d_type);
sep = " ";
}
if (dp->d_cred < DB_C_ZONE) {
fprintf(fp, "%sCr=%s",
sep, MkCredStr(dp->d_cred));
sep = " ";
} else {
fprintf(fp, "%sCl=%d",
sep, dp->d_clev);
sep = " ";
}
eoln:
#ifdef STATS
if (dp->d_ns) {
fprintf(fp, "%s[%s]",
sep, inet_ntoa(dp->d_ns->addr));
sep = " ";
}
#endif
putc('\n', fp);
}
}
}
if (ferror(fp))
return(NODBFILE);
npp = htp->h_tab;
nppend = npp + htp->h_size;
while (npp < nppend) {
for (np = *npp++; np != NULL; np = np->n_next) {
if (np->n_hash == NULL)
continue;
getname(np, dname, sizeof(dname));
if (db_dump(np->n_hash, fp, zone, dname) == NODBFILE)
return(NODBFILE);
}
}
return(OK);
}
static const char *
MkCredStr(cred)
int cred;
{
static char badness[20];
switch (cred) {
case DB_C_ZONE: return "zone";
case DB_C_AUTH: return "auth";
case DB_C_ANSWER: return "answer";
case DB_C_ADDITIONAL: return "addtnl";
case DB_C_CACHE: return "cache";
default: break;
}
sprintf(badness, "?%d?", cred);
return (badness);
}
#ifdef ALLOW_T_UNSPEC
/*
* Subroutines to convert between 8 bit binary bytes and printable ASCII.
* Computes the number of bytes, and three kinds of simple checksums.
* Incoming bytes are collected into 32-bit words, then printed in base 85:
* exp(85,5) > exp(2,32)
* The ASCII characters used are between '!' and 'u';
* 'z' encodes 32-bit zero; 'x' is used to mark the end of encoded data.
*
* Originally by Paul Rutter (philabs!per) and Joe Orost (petsd!joe) for
* the atob/btoa programs, released with the compress program, in mod.sources.
* Modified by Mike Schwartz 8/19/86 for use in BIND.
*/
/* Make sure global variable names are unique */
#define Ceor T_UNSPEC_Ceor
#define Csum T_UNSPEC_Csum
#define Crot T_UNSPEC_Crot
#define word T_UNSPEC_word
#define bcount T_UNSPEC_bcount
static int32_t Ceor, Csum, Crot, word, bcount;
#define EN(c) ((int) ((c) + '!'))
#define DE(c) ((c) - '!')
#define AddToBuf(bufp, c) **bufp = c; (*bufp)++;
#define times85(x) ((((((x<<2)+x)<<2)+x)<<2)+x)
/* Decode ASCII-encoded byte c into binary representation and
* place into *bufp, advancing bufp
*/
static int
byte_atob(c, bufp)
register c;
char **bufp;
{
if (c == 'z') {
if (bcount != 0)
return(CONV_BADFMT);
else {
putbyte(0, bufp);
putbyte(0, bufp);
putbyte(0, bufp);
putbyte(0, bufp);
}
} else if ((c >= '!') && (c < ('!' + 85))) {
if (bcount == 0) {
word = DE(c);
++bcount;
} else if (bcount < 4) {
word = times85(word);
word += DE(c);
++bcount;
} else {
word = times85(word) + DE(c);
putbyte((int)((word >> 24) & 255), bufp);
putbyte((int)((word >> 16) & 255), bufp);
putbyte((int)((word >> 8) & 255), bufp);
putbyte((int)(word & 255), bufp);
word = 0;
bcount = 0;
}
} else
return(CONV_BADFMT);
return(CONV_SUCCESS);
}
/* Compute checksum info and place c into *bufp, advancing bufp */
static void
putbyte(c, bufp)
register c;
char **bufp;
{
Ceor ^= c;
Csum += c;
Csum += 1;
if ((Crot & 0x80000000)) {
Crot <<= 1;
Crot += 1;
} else {
Crot <<= 1;
}
Crot += c;
AddToBuf(bufp, c);
}
/* Read the ASCII-encoded data from inbuf, of length inbuflen, and convert
it into T_UNSPEC (binary data) in outbuf, not to exceed outbuflen bytes;
outbuflen must be divisible by 4. (Note: this is because outbuf is filled
in 4 bytes at a time. If the actual data doesn't end on an even 4-byte
boundary, there will be no problem...it will be padded with 0 bytes, and
numbytes will indicate the correct number of bytes. The main point is
that since the buffer is filled in 4 bytes at a time, even if there is
not a full 4 bytes of data at the end, there has to be room to 0-pad the
data, so the buffer must be of size divisible by 4). Place the number of
output bytes in numbytes, and return a failure/success status */
int
atob(inbuf, inbuflen, outbuf, outbuflen, numbytes)
char *inbuf;
int inbuflen;
char *outbuf;
int outbuflen;
int *numbytes;
{
int inc, nb;
int32_t oeor, osum, orot;
char *inp, *outp = outbuf, *endoutp = &outbuf[outbuflen];
if ( (outbuflen % 4) != 0)
return(CONV_BADBUFLEN);
Ceor = Csum = Crot = word = bcount = 0;
for (inp = inbuf, inc = 0; inc < inbuflen; inp++, inc++) {
if (outp > endoutp)
return(CONV_OVERFLOW);
if (*inp == 'x') {
inp +=2;
break;
} else {
if (byte_atob(*inp, &outp) == CONV_BADFMT)
return(CONV_BADFMT);
}
}
/* Get byte count and checksum information from end of buffer */
if (sscanf(inp, "%d %lx %lx %lx", numbytes, &oeor, &osum, &orot) != 4)
return(CONV_BADFMT);
if ((oeor != Ceor) || (osum != Csum) || (orot != Crot))
return(CONV_BADCKSUM);
return(CONV_SUCCESS);
}
/* Encode binary byte c into ASCII representation and place into *bufp,
advancing bufp */
static void
byte_btoa(c, bufp)
register c;
char **bufp;
{
Ceor ^= c;
Csum += c;
Csum += 1;
if ((Crot & 0x80000000)) {
Crot <<= 1;
Crot += 1;
} else {
Crot <<= 1;
}
Crot += c;
word <<= 8;
word |= c;
if (bcount == 3) {
if (word == 0) {
AddToBuf(bufp, 'z');
} else {
register int tmp = 0;
register int32_t tmpword = word;
if (tmpword < 0) {
/* Because some don't support unsigned long */
tmp = 32;
tmpword -= (int32_t)(85 * 85 * 85 * 85 * 32);
}
if (tmpword < 0) {
tmp = 64;
tmpword -= (int32_t)(85 * 85 * 85 * 85 * 32);
}
AddToBuf(bufp,
EN((tmpword / (int32_t)(85 * 85 * 85 * 85)) + tmp));
tmpword %= (int32_t)(85 * 85 * 85 * 85);
AddToBuf(bufp, EN(tmpword / (85 * 85 * 85)));
tmpword %= (85 * 85 * 85);
AddToBuf(bufp, EN(tmpword / (85 * 85)));
tmpword %= (85 * 85);
AddToBuf(bufp, EN(tmpword / 85));
tmpword %= 85;
AddToBuf(bufp, EN(tmpword));
}
bcount = 0;
} else {
bcount += 1;
}
}
/*
* Encode the binary data from inbuf, of length inbuflen, into a
* null-terminated ASCII representation in outbuf, not to exceed outbuflen
* bytes. Return success/failure status
*/
static int
btoa(inbuf, inbuflen, outbuf, outbuflen)
char *inbuf;
int inbuflen;
char *outbuf;
int outbuflen;
{
int32_t inc, nb;
int32_t oeor, osum, orot;
char *inp, *outp = outbuf, *endoutp = &outbuf[outbuflen -1];
Ceor = Csum = Crot = word = bcount = 0;
for (inp = inbuf, inc = 0; inc < inbuflen; inp++, inc++) {
byte_btoa((unsigned char) (*inp), &outp);
if (outp >= endoutp)
return(CONV_OVERFLOW);
}
while (bcount != 0) {
byte_btoa(0, &outp);
if (outp >= endoutp)
return(CONV_OVERFLOW);
}
/* Put byte count and checksum information at end of buffer, delimited
by 'x' */
(void) sprintf(outp, "x %d %lx %lx %lx", inbuflen, Ceor, Csum, Crot);
if (&outp[strlen(outp) - 1] >= endoutp)
return(CONV_OVERFLOW);
else
return(CONV_SUCCESS);
}
#endif /* ALLOW_T_UNSPEC */

View File

@ -0,0 +1,113 @@
/* db_proc.h - prototypes for functions in db_*.c
*
* $Id: db_func.h,v 8.9 1996/06/02 08:20:39 vixie Exp $
*/
/* ++from db_update.c++ */
extern int db_update __P((char name[],
struct databuf *odp,
struct databuf *newdp,
int flags,
struct hashbuf *htp)),
findMyZone __P((struct namebuf *np, int class));
/* --from db_update.c-- */
/* ++from db_reload.c++ */
extern void db_reload __P((void));
/* --from db_reload.c-- */
/* ++from db_save.c++ */
extern struct namebuf *savename __P((const char *, int));
#ifdef DMALLOC
extern struct databuf *savedata_tagged __P((char *, int,
int, int, u_int32_t,
u_char *, int));
#define savedata(class, type, ttl, data, size) \
savedata_tagged(__FILE__, __LINE__, class, type, ttl, data, size)
#else
extern struct databuf *savedata __P((int, int, u_int32_t,
u_char *, int));
#endif
extern struct hashbuf *savehash __P((struct hashbuf *));
/* --from db_save.c-- */
/* ++from db_dump.c++ */
extern int db_dump __P((struct hashbuf *, FILE *, int, char *)),
zt_dump __P((FILE *)),
atob __P((char *, int, char *, int, int *));
extern void doachkpt __P((void)),
doadump __P((void));
#ifdef ALLOW_UPDATES
extern void zonedump __P((struct zoneinfo *));
#endif
extern u_int db_getclev __P((const char *));
/* --from db_dump.c-- */
/* ++from db_load.c++ */
extern void endline __P((FILE *)),
get_netlist __P((FILE *, struct netinfo **,
int, char *)),
free_netlist __P((struct netinfo **));
extern int getword __P((char *, int, FILE *, int)),
getnum __P((FILE *, const char *, int)),
db_load __P((const char *, const char *,
struct zoneinfo *, const char *)),
position_on_netlist __P((struct in_addr,
struct netinfo *));
extern struct netinfo *addr_on_netlist __P((struct in_addr,
struct netinfo *));
/* --from db_load.c-- */
/* ++from db_glue.c++ */
extern const char *sin_ntoa __P((const struct sockaddr_in *));
extern void panic __P((int, const char *)),
buildservicelist __P((void)),
buildprotolist __P((void)),
gettime __P((struct timeval *)),
getname __P((struct namebuf *, char *, int));
extern int servicenumber __P((char *)),
protocolnumber __P((char *)),
my_close __P((int)),
my_fclose __P((FILE *)),
#ifdef GEN_AXFR
get_class __P((char *)),
#endif
writemsg __P((int, u_char *, int)),
dhash __P((const u_char *, int)),
nhash __P((const char *)),
samedomain __P((const char *, const char *));
extern char *protocolname __P((int)),
*servicename __P((u_int16_t, char *)),
*savestr __P((const char *));
#ifndef BSD
extern int getdtablesize __P((void));
#endif
extern struct databuf *rm_datum __P((struct databuf *,
struct namebuf *,
struct databuf *));
extern struct namebuf *rm_name __P((struct namebuf *,
struct namebuf **,
struct namebuf *));
#ifdef INVQ
extern void addinv __P((struct namebuf *, struct databuf *)),
rminv __P((struct databuf *));
struct invbuf *saveinv __P((void));
#endif
extern char * ctimel __P((long));
extern struct in_addr data_inaddr __P((const u_char *data));
extern void setsignal __P((int, int, SIG_FN (*)())),
resignal __P((int, int, SIG_FN (*)()));
/* --from db_glue.c-- */
/* ++from db_lookup.c++ */
extern struct namebuf *nlookup __P((const char *, struct hashbuf **,
const char **, int));
extern struct namebuf *np_parent __P((struct namebuf *));
extern int match __P((struct databuf *, int, int));
/* --from db_lookup.c-- */
/* ++from db_secure.c++ */
#ifdef SECURE_ZONES
extern int build_secure_netlist __P((struct zoneinfo *));
#endif
/* --from db_secure.c-- */

View File

@ -0,0 +1,93 @@
/*
* from db.h 4.16 (Berkeley) 6/1/90
* $Id: db_glob.h,v 8.3 1995/12/06 20:34:38 vixie Exp $
*/
/*
* ++Copyright++ 1985, 1990
* -
* Copyright (c) 1985, 1990
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* Global variables for data base routines.
*/
/* ONE_WEEK maximum ttl */
DECL int max_cache_ttl INIT(7*24*60*60);
/* no minimum ttl */
DECL int min_cache_ttl INIT(0);
/* current line number */
DECL int lineno;
#ifdef DUMPFILE
DECL char *dumpfile INIT(DUMPFILE);
#else
DECL char *dumpfile INIT(_PATH_DUMPFILE);
#endif
/* root hash table */
DECL struct hashbuf *hashtab INIT(NULL);
/* hash table of cache read from file */
DECL struct hashbuf *fcachetab INIT(NULL);
#ifdef INVQ
/* Inverse query hash table */
DECL struct invbuf *invtab[INVHASHSZ];
#endif
#ifdef FORCED_RELOAD
DECL int reloading INIT(0);
#endif /* FORCED_RELOAD */

View File

@ -0,0 +1,835 @@
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)db_glue.c 4.4 (Berkeley) 6/1/90";
static char rcsid[] = "$Id: db_glue.c,v 8.13 1996/06/02 08:20:39 vixie Exp $";
#endif /* not lint */
/*
* ++Copyright++ 1986, 1988
* -
* Copyright (c) 1986, 1988
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <stdio.h>
#include <syslog.h>
#include <ctype.h>
#include <netdb.h>
#include <resolv.h>
#include <errno.h>
#include <signal.h>
#include "named.h"
struct valuelist {
struct valuelist *next, *prev;
char *name;
char *proto;
int port;
};
static struct valuelist *servicelist, *protolist;
#if defined(ultrix)
/* ultrix 4.0 has some icky packaging details. work around them here.
* since this module is linked into named and named-xfer, we end up
* forcing both to drag in our own res_send rather than ultrix's hesiod
* version of that.
*/
static const int (*unused_junk)__P((const u_char *, int, u_char *, int)) =
res_send;
;
#endif
/*XXX: sin_ntoa() should probably be in libc*/
const char *
sin_ntoa(sin)
const struct sockaddr_in *sin;
{
static char ret[sizeof "[111.222.333.444].55555"];
if (!sin)
strcpy(ret, "[sin_ntoa(NULL)]");
else
sprintf(ret, "[%s].%u",
inet_ntoa(sin->sin_addr),
ntohs(sin->sin_port));
return (ret);
}
/*
* XXX: some day we'll make this a varargs function
*/
void
panic(err, msg)
int err;
const char *msg;
{
if (err == -1)
syslog(LOG_CRIT, "%s - ABORT", msg);
else
syslog(LOG_CRIT, "%s: %s - ABORT", msg, strerror(err));
signal(SIGIOT, SIG_DFL); /* no POSIX needed here. */
abort();
}
void
buildservicelist()
{
struct servent *sp;
struct valuelist *slp;
#ifdef MAYBE_HESIOD
setservent(0);
#else
setservent(1);
#endif
while (sp = getservent()) {
slp = (struct valuelist *)malloc(sizeof(struct valuelist));
if (!slp)
panic(errno, "malloc(servent)");
slp->name = savestr(sp->s_name);
slp->proto = savestr(sp->s_proto);
slp->port = ntohs((u_int16_t)sp->s_port); /* host byt order */
slp->next = servicelist;
slp->prev = NULL;
if (servicelist)
servicelist->prev = slp;
servicelist = slp;
}
endservent();
}
void
buildprotolist()
{
struct protoent *pp;
struct valuelist *slp;
#ifdef MAYBE_HESIOD
setprotoent(0);
#else
setprotoent(1);
#endif
while (pp = getprotoent()) {
slp = (struct valuelist *)malloc(sizeof(struct valuelist));
if (!slp)
panic(errno, "malloc(protoent)");
slp->name = savestr(pp->p_name);
slp->port = pp->p_proto; /* host byte order */
slp->next = protolist;
slp->prev = NULL;
if (protolist)
protolist->prev = slp;
protolist = slp;
}
endprotoent();
}
static int
findservice(s, list)
register char *s;
register struct valuelist **list;
{
register struct valuelist *lp = *list;
int n;
for (; lp != NULL; lp = lp->next)
if (strcasecmp(lp->name, s) == 0) {
if (lp != *list) {
lp->prev->next = lp->next;
if (lp->next)
lp->next->prev = lp->prev;
(*list)->prev = lp;
lp->next = *list;
*list = lp;
}
return (lp->port); /* host byte order */
}
if (sscanf(s, "%d", &n) != 1 || n <= 0)
n = -1;
return (n);
}
/*
* Convert service name or (ascii) number to int.
*/
int
servicenumber(p)
char *p;
{
return (findservice(p, &servicelist));
}
/*
* Convert protocol name or (ascii) number to int.
*/
int
protocolnumber(p)
char *p;
{
return (findservice(p, &protolist));
}
#if defined(__STDC__) || defined(__GNUC__)
static struct servent *
cgetservbyport(u_int16_t port, /* net byte order */
char *proto)
#else
static struct servent *
cgetservbyport(port, proto)
u_int16_t port; /* net byte order */
char *proto;
#endif
{
register struct valuelist **list = &servicelist;
register struct valuelist *lp = *list;
static struct servent serv;
port = ntohs(port);
for (; lp != NULL; lp = lp->next) {
if (port != (u_int16_t)lp->port) /* host byte order */
continue;
if (strcasecmp(lp->proto, proto) == 0) {
if (lp != *list) {
lp->prev->next = lp->next;
if (lp->next)
lp->next->prev = lp->prev;
(*list)->prev = lp;
lp->next = *list;
*list = lp;
}
serv.s_name = lp->name;
serv.s_port = htons((u_int16_t)lp->port);
serv.s_proto = lp->proto;
return (&serv);
}
}
return (0);
}
static struct protoent *
cgetprotobynumber(proto)
register int proto; /* host byte order */
{
register struct valuelist **list = &protolist;
register struct valuelist *lp = *list;
static struct protoent prot;
for (; lp != NULL; lp = lp->next)
if (lp->port == proto) { /* host byte order */
if (lp != *list) {
lp->prev->next = lp->next;
if (lp->next)
lp->next->prev = lp->prev;
(*list)->prev = lp;
lp->next = *list;
*list = lp;
}
prot.p_name = lp->name;
prot.p_proto = lp->port; /* host byte order */
return (&prot);
}
return (0);
}
char *
protocolname(num)
int num;
{
static char number[8];
struct protoent *pp;
pp = cgetprotobynumber(num);
if(pp == 0) {
(void) sprintf(number, "%d", num);
return (number);
}
return (pp->p_name);
}
#if defined(__STDC__) || defined(__GNUC__)
char *
servicename(u_int16_t port, char *proto) /* host byte order */
#else
char *
servicename(port, proto)
u_int16_t port; /* host byte order */
char *proto;
#endif
{
static char number[8];
struct servent *ss;
ss = cgetservbyport(htons(port), proto);
if (ss == 0) {
(void) sprintf(number, "%d", port);
return (number);
}
return (ss->s_name);
}
u_int
db_getclev(origin)
const char *origin;
{
u_int lev = 0;
dprintf(12, (ddt, "db_getclev of \"%s\"", origin));
if (origin && *origin)
lev++;
while (origin && (origin = strchr(origin, '.'))) {
origin++;
lev++;
}
dprintf(12, (ddt, " = %d\n", lev));
return (lev);
}
void
gettime(ttp)
struct timeval *ttp;
{
if (gettimeofday(ttp, NULL) < 0)
syslog(LOG_ERR, "gettimeofday: %m");
return;
}
#if !defined(BSD)
int
getdtablesize()
{
#if defined(USE_POSIX)
int j = (int) sysconf(_SC_OPEN_MAX);
if (j >= 0)
return (j);
#endif /* POSIX */
return (FD_SETSIZE);
}
#endif /* BSD */
int
my_close(fd)
int fd;
{
int s;
do {
errno = 0;
s = close(fd);
} while (s < 0 && errno == EINTR);
if (s < 0 && errno != EBADF)
syslog(LOG_INFO, "close(%d) failed: %m", fd);
else
dprintf(3, (ddt, "close(%d) succeeded\n", fd));
return (s);
}
#ifdef GEN_AXFR
/*
* Map class names to number
*/
struct map {
char *token;
int val;
};
static struct map map_class[] = {
{ "in", C_IN },
{ "chaos", C_CHAOS },
{ "hs", C_HS },
{ NULL, 0 }
};
int
get_class(class)
char *class;
{
struct map *mp;
if (isdigit(*class))
return (atoi(class));
for (mp = map_class; mp->token != NULL; mp++)
if (strcasecmp(class, mp->token) == 0)
return (mp->val);
return (C_IN);
}
#endif
int
my_fclose(fp)
FILE *fp;
{
int fd = fileno(fp),
s = fclose(fp);
if (s < 0)
syslog(LOG_INFO, "fclose(%d) failed: %m", fd);
else
dprintf(3, (ddt, "fclose(%d) succeeded\n", fd));
return (s);
}
/*
* Make a copy of a string and return a pointer to it.
*/
char *
savestr(str)
const char *str;
{
char *cp = strdup(str);
if (!cp)
panic(errno, "malloc(savestr)");
return (cp);
}
int
writemsg(rfd, msg, msglen)
int rfd;
u_char *msg;
int msglen;
{
struct iovec iov[2];
u_char len[INT16SZ];
__putshort(msglen, len);
iov[0].iov_base = (char *)len;
iov[0].iov_len = INT16SZ;
iov[1].iov_base = (char *)msg;
iov[1].iov_len = msglen;
if (writev(rfd, iov, 2) != INT16SZ + msglen) {
dprintf(1, (ddt, "write failed %d\n", errno));
return (-1);
}
return (0);
}
/* rm_datum(dp, np, pdp)
* remove datum 'dp' from name 'np'. pdp is previous data pointer.
* return value:
* "next" field from removed datum, suitable for relinking
*/
struct databuf *
rm_datum(dp, np, pdp)
register struct databuf *dp;
register struct namebuf *np;
register struct databuf *pdp;
{
register struct databuf *ndp = dp->d_next;
dprintf(3, (ddt, "rm_datum(%lx, %lx, %lx) -> %lx\n",
(u_long)dp, (u_long)np->n_data, (u_long)pdp, (u_long)ndp));
#ifdef INVQ
rminv(dp);
#endif
if (pdp == NULL)
np->n_data = ndp;
else
pdp->d_next = ndp;
#ifdef DATUMREFCNT
if (--(dp->d_rcnt)) {
switch(dp->d_type) {
case T_NS:
dprintf(1, (ddt, "rm_datum: %s rcnt = %d\n",
dp->d_data, dp->d_rcnt));
break;
case T_A:
dprintf(1, (ddt, "rm_datum: %08.8X rcnt = %d\n",
*(int32_t*)(dp->d_data), dp->d_rcnt));
break;
default:
dprintf(1, (ddt, "rm_datum: rcnt = %d\n", dp->d_rcnt));
}
} else
#endif
free((char *)dp);
return (ndp);
}
/* rm_name(np, he, pnp)
* remove name 'np' from parent 'pp'. pnp is previous name pointer.
* return value:
* "next" field from removed name, suitable for relinking
*/
struct namebuf *
rm_name(np, pp, pnp)
struct namebuf *np, **pp, *pnp;
{
struct namebuf *nnp = np->n_next;
char *msg;
/* verify */
if ( (np->n_data && (msg = "data"))
|| (np->n_hash && (msg = "hash"))
) {
syslog(LOG_ERR,
"rm_name(%#lx(%s)): non-nil %s pointer\n",
(u_long)np, NAME(*np), msg);
panic(-1, "rm_name");
}
/* unlink */
if (pnp) {
pnp->n_next = nnp;
} else {
*pp = nnp;
}
/* deallocate */
free((char*) np);
/* done */
return (nnp);
}
/*
* Get the domain name of 'np' and put in 'buf'. Bounds checking is done.
*/
void
getname(np, buf, buflen)
struct namebuf *np;
char *buf;
int buflen;
{
register char *cp;
register int i;
cp = buf;
while (np != NULL) {
i = NAMELEN(*np);
if (i + 1 >= buflen) {
*cp = '\0';
syslog(LOG_INFO, "domain name too long: %s...\n", buf);
strcpy(buf, "Name_Too_Long");
return;
}
if (cp != buf)
*cp++ = '.';
bcopy(NAME(*np), cp, i);
cp += i;
buflen -= i + 1;
np = np->n_parent;
}
*cp = '\0';
}
#ifdef INVQ
/*
* Add data 'dp' to inverse query tables for name 'np'.
*/
void
addinv(np, dp)
struct namebuf *np;
struct databuf *dp;
{
register struct invbuf *ip;
register int hval, i;
switch (dp->d_type) {
case T_A:
case T_UID:
case T_GID:
break;
default:
return;
}
hval = dhash(dp->d_data, dp->d_size);
for (ip = invtab[hval]; ip != NULL; ip = ip->i_next)
for (i = 0; i < INVBLKSZ; i++)
if (ip->i_dname[i] == NULL) {
ip->i_dname[i] = np;
return;
}
ip = saveinv();
ip->i_next = invtab[hval];
invtab[hval] = ip;
ip->i_dname[0] = np;
}
/*
* Remove data 'odp' from inverse query table.
*/
void
rminv(odp)
struct databuf *odp;
{
register struct invbuf *ip;
register struct databuf *dp;
struct namebuf *np;
register int i;
for (ip = invtab[dhash(odp->d_data, odp->d_size)]; ip != NULL;
ip = ip->i_next) {
for (i = 0; i < INVBLKSZ; i++) {
if ((np = ip->i_dname[i]) == NULL)
break;
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
if (dp != odp)
continue;
while (i < INVBLKSZ-1) {
ip->i_dname[i] = ip->i_dname[i+1];
i++;
}
ip->i_dname[i] = NULL;
return;
}
}
}
}
/*
* Allocate an inverse query buffer.
*/
struct invbuf *
saveinv()
{
register struct invbuf *ip;
ip = (struct invbuf *) malloc(sizeof(struct invbuf));
if (!ip)
panic(errno, "malloc(saveinv)");
ip->i_next = NULL;
bzero((char *)ip->i_dname, sizeof(ip->i_dname));
return (ip);
}
/*
* Compute hash value from data.
*/
int
dhash(dp, dlen)
register const u_char *dp;
int dlen;
{
register u_char *cp;
register unsigned hval;
register int n;
n = dlen;
if (n > 8)
n = 8;
hval = 0;
while (--n >= 0) {
hval <<= 1;
hval += *dp++;
}
return (hval % INVHASHSZ);
}
#endif /*INVQ*/
/* int
* nhash(name)
* compute hash for this name and return it; ignore case differences
*/
int
nhash(name)
register const char *name;
{
register u_char ch;
register unsigned hval;
hval = 0;
while ((ch = (u_char)*name++) != (u_char)'\0') {
if (isascii(ch) && isupper(ch))
ch = tolower(ch);
hval <<= 1;
hval += ch;
}
return (hval % INVHASHSZ);
}
/*
** SAMEDOMAIN -- Check whether a name belongs to a domain
** ------------------------------------------------------
**
** Returns:
** TRUE if the given name lies in the domain.
** FALSE otherwise.
**
** Trailing dots are first removed from name and domain.
** Always compare complete subdomains, not only whether the
** domain name is the trailing string of the given name.
**
** "host.foobar.top" lies in "foobar.top" and in "top" and in ""
** but NOT in "bar.top"
**
** this implementation of samedomain() is thanks to Bob Heiney.
*/
int
samedomain(a, b)
const char *a, *b;
{
size_t la, lb;
const char *cp;
la = strlen(a);
lb = strlen(b);
/* don't count trailing dots, if any. */
if (la && a[la-1]=='.')
la--;
if (lb && b[lb-1]=='.')
lb--;
/* lb==0 means b is the root domain, so a must be in b. */
if (lb == 0)
return (1);
/* b longer than a means a can't be in b. */
if (lb > la)
return (0);
/* We use strncasecmp because we might be trying to
* ignore trailing dots. */
if (lb == la)
return (strncasecmp(a, b, lb) == 0);
/* Ok, we know la > lb. */
/* Point at the character before the last 'lb' characters of a. */
cp = a + (la - lb - 1);
/* If it isn't '.', can't be a match (this lets us avoid
* having "foobar.com" match "bar.com"). */
if (*cp != '.')
return (0);
cp++;
/* We use strncasecmp because we might be trying to
* ignore trailing dots. */
return (strncasecmp(cp, b, lb)==0);
}
/*
* Since the fields in a "struct timeval" are longs, and the argument to ctime
* is a pointer to a time_t (which might not be a long), here's a bridge.
*/
char *
ctimel(l)
long l;
{
time_t t = (time_t)l;
return (ctime(&t));
}
/*
* This is nec'y for systems that croak when deref'ing unaligned pointers.
* SPARC is an example. Note that in_addr.s_addr needn't be a 32-bit int,
* so we want to avoid bcopy and let the compiler do the casting for us.
*/
struct in_addr
data_inaddr(data)
const u_char *data;
{
struct in_addr ret;
u_int32_t tmp;
bcopy((char *)data, (char *)&tmp, INADDRSZ);
ret.s_addr = tmp;
return (ret);
}
/* Signal abstraction. */
void
setsignal(catch, block, handler)
int catch, block;
SIG_FN (*handler)();
{
#ifdef POSIX_SIGNALS
/* Modern system - preferred. */
struct sigaction sa;
memset(&sa, 0, sizeof sa);
sa.sa_handler = handler;
sigemptyset(&sa.sa_mask);
if (block != -1)
sigaddset(&sa.sa_mask, block);
(void) sigaction(catch, &sa, NULL);
#else /*POSIX_SIGNALS*/
#ifdef SYSV
/* Ancient system - ugly. */
if (block != -1)
syslog(LOG_DEBUG, "danger - unable to block signal %d from %d",
block, catch);
(void) signal(catch, handler);
#else /*SYSV*/
/* BSD<=4.3 system - odd. */
struct sigvec sv;
bzero(&sv, sizeof sv);
sv.sv_handler = handler;
sv.sv_mask = sigmask(block);
(void) sigvec(catch, &sv, NULL);
#endif /*SYSV*/
#endif /*POSIX_SIGNALS*/
}
void
resignal(catch, block, handler)
int catch, block;
SIG_FN (*handler)();
{
#if !defined(POSIX_SIGNALS) && defined(SYSV)
/* Unreliable signals. Set it back up again. */
setsignal(catch, block, handler);
#endif
}

1501
contrib/bind/named/db_load.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,249 @@
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)db_lookup.c 4.18 (Berkeley) 3/21/91";
static char rcsid[] = "$Id: db_lookup.c,v 8.7 1996/08/05 08:31:30 vixie Exp $";
#endif /* not lint */
/*
* ++Copyright++ 1986
* -
* Copyright (c) 1986
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* Table lookup routines.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <ctype.h>
#include <stdio.h>
#include <syslog.h>
#include "named.h"
/*
* Lookup 'name' and return a pointer to the namebuf;
* NULL otherwise. If 'insert', insert name into tables.
* Wildcard lookups are handled.
*/
struct namebuf *
nlookup(name, htpp, fname, insert)
const char *name;
struct hashbuf **htpp;
const char **fname;
int insert;
{
register struct namebuf *np;
register const char *cp;
register int c;
register unsigned hval;
register struct hashbuf *htp;
struct namebuf *parent = NULL;
int escaped = 0;
htp = *htpp;
hval = 0;
*fname = "???";
for (cp = name; c = *cp++; ) {
if (!escaped && (c == '.')) {
parent = np = nlookup(cp, htpp, fname, insert);
if (np == NULL)
return (NULL);
if (*fname != cp)
return (np);
if ((htp = np->n_hash) == NULL) {
if (!insert) {
if (ns_wildcard(NAME(*np)))
*fname = name;
return (np);
}
htp = savehash((struct hashbuf *)NULL);
np->n_hash = htp;
}
*htpp = htp;
break;
}
/* rotate left HASHSHIFT */
hval = (hval << HASHSHIFT) |
(hval>>((sizeof(hval)*8)-HASHSHIFT));
hval += (isupper(c) ? tolower(c) : c) & HASHMASK;
if (escaped)
escaped = 0;
else if (c == '\\')
escaped = 1;
}
cp--;
/*
* Lookup this label in current hash table.
*/
for (np = htp->h_tab[hval % htp->h_size];
np != NULL;
np = np->n_next) {
if (np->n_hashval == hval &&
(NAMELEN(*np) == (cp - name)) &&
(strncasecmp(name, NAME(*np), cp - name) == 0)) {
*fname = name;
return (np);
}
}
if (!insert) {
/*
* Look for wildcard in this hash table.
* Don't use a cached "*" name as a wildcard,
* only authoritative.
*/
hval = ('*' & HASHMASK) % htp->h_size;
for (np = htp->h_tab[hval]; np != NULL; np = np->n_next) {
if (ns_wildcard(NAME(*np)) &&
np->n_data && np->n_data->d_zone != 0) {
*fname = name;
return (np);
}
}
return (parent);
}
np = savename(name, cp - name);
np->n_parent = parent;
np->n_hashval = hval;
hval %= htp->h_size;
np->n_next = htp->h_tab[hval];
htp->h_tab[hval] = np;
/* Increase hash table size. */
if (++htp->h_cnt > htp->h_size * 2) {
*htpp = savehash(htp);
if (parent == NULL) {
if (htp == hashtab) {
hashtab = *htpp;
} else {
fcachetab = *htpp;
}
}
else
parent->n_hash = *htpp;
htp = *htpp;
}
*fname = name;
return (np);
}
/* struct namebuf *
* np_parent(struct namebuf *np)
* Find the "parent" namebuf of np.
* This is tricky since the parent of "com" is "" and both are stored
* in the same hashbuf.
* See also:
* the AXFR wart description in ns_req.c
*/
struct namebuf *
np_parent(np)
struct namebuf *np;
{
struct hashbuf *htp;
struct namebuf *np2;
if (np->n_parent != NULL || NAME(*np)[0] == '\0')
return (np->n_parent);
/* Try to figure out if np is pointing into the cache or hints. */
/* Try the cache first. */
htp = hashtab;
try_again:
/* Search the hash chain that np should be part of. */
for (np2 = htp->h_tab[np->n_hashval % htp->h_size];
np2 != NULL;
np2 = np2->n_next) {
if (np == np2) { /* found it! */
/* "" hashes into the first bucket */
for (np = htp->h_tab[0]; np ; np=np->n_next) {
if (NAME(*np)[0] == '\0')
/* found the root namebuf */
return (np);
}
dprintf(1, (ddt,
"np_parent(0x%lx) couldn't find root entry\n",
(u_long) np));
return (NULL); /* XXX shouldn't happen */
}
}
/* Try the hints. */
if (htp == hashtab) {
htp = fcachetab;
goto try_again;
}
dprintf(1, (ddt, "np_parent(0x%lx) couldn't namebuf\n", (u_long) np));
return (NULL); /* XXX shouldn't happen */
}
/* int
* match(dp, class, type)
* Does data record `dp' match the class and type?
* return value:
* boolean
*/
int
match(dp, class, type)
register struct databuf *dp;
register int class, type;
{
dprintf(5, (ddt, "match(0x%lx, %d, %d) %d, %d\n",
(u_long)dp, class, type, dp->d_class, dp->d_type));
if (dp->d_class != class && class != C_ANY)
return (0);
if (dp->d_type != type && type != T_ANY)
return (0);
return (1);
}

View File

@ -0,0 +1,126 @@
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)db_reload.c 4.22 (Berkeley) 3/21/91";
static char rcsid[] = "$Id: db_reload.c,v 8.2 1996/08/05 08:31:30 vixie Exp $";
#endif /* not lint */
/*
* ++Copyright++ 1986, 1988
* -
* Copyright (c) 1986, 1988
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <stdio.h>
#include <syslog.h>
#include "named.h"
/*
* Flush and reload data base.
*/
void
db_reload()
{
dprintf(3, (ddt, "reload()\n"));
syslog(LOG_NOTICE, "reloading nameserver\n");
qflush();
sqflush(NULL);
getnetconf();
#ifdef FORCED_RELOAD
reloading = 1; /* to force transfer if secondary and backing up */
#endif
ns_init(bootfile);
time(&resettime);
#ifdef FORCED_RELOAD
reloading = 0;
if (!needmaint)
sched_maint();
#endif /* FORCED_RELOAD */
dprintf(1, (ddt, "Ready to answer queries.\n"));
syslog(LOG_NOTICE, "Ready to answer queries.\n");
}
#if 0
/* someday we'll need this.. (untested since before 1990) */
void
db_free(htp)
struct hashbuf *htp;
{
register struct databuf *dp, *nextdp;
register struct namebuf *np, *nextnp;
struct namebuf **npp, **nppend;
npp = htp->h_tab;
nppend = npp + htp->h_size;
while (npp < nppend) {
for (np = *npp++; np != NULL; np = nextnp) {
if (np->n_hash != NULL)
db_free(np->n_hash);
(void) free((char *)np->n_dname);
for (dp = np->n_data; dp != NULL; ) {
nextdp = dp->d_next;
(void) free((char *)dp);
dp = nextdp;
}
nextnp = np->n_next;
free((char *)np);
}
}
(void) free((char *)htp);
}
#endif

View File

@ -0,0 +1,208 @@
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)db_save.c 4.16 (Berkeley) 3/21/91";
static char rcsid[] = "$Id: db_save.c,v 8.4 1996/08/05 08:31:30 vixie Exp $";
#endif /* not lint */
/*
* ++Copyright++ 1986
* -
* Copyright (c) 1986
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* Buffer allocation and deallocation routines.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <syslog.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include "named.h"
/*
* Allocate a name buffer & save name.
*/
struct namebuf *
savename(name, len)
const char *name;
int len;
{
register struct namebuf *np;
assert(len >= 0 && len <= (MAXLABEL * 2));
np = (struct namebuf *) malloc(NAMESIZE(len));
if (np == NULL)
panic(errno, "savename: malloc");
bzero((char*)np, NAMESIZE(len));
NAMELEN(*np) = len;
bcopy(name, NAME(*np), len);
NAME(*np)[len] = '\0';
return (np);
}
/*
* Allocate a data buffer & save data.
*/
struct databuf *
#ifdef DMALLOC
savedata_tagged(file, line, class, type, ttl, data, size)
char *file;
int line;
#else
savedata(class, type, ttl, data, size)
#endif
int class, type;
u_int32_t ttl;
u_char *data;
int size;
{
register struct databuf *dp;
int bytes = (type == T_NS) ? DATASIZE(size)+INT32SZ : DATASIZE(size);
dp = (struct databuf *)
#ifdef DMALLOC
dmalloc(file, line, bytes)
#else
malloc(bytes)
#endif
;
if (dp == NULL)
panic(errno, "savedata: malloc");
bzero((char*)dp, bytes);
dp->d_next = NULL;
dp->d_type = type;
dp->d_class = class;
dp->d_ttl = ttl;
dp->d_size = size;
dp->d_mark = 0;
dp->d_flags = 0;
dp->d_cred = 0;
dp->d_clev = 0;
#ifdef NCACHE
dp->d_rcode = NOERROR;
#endif
#ifdef STATS
dp->d_ns = NULL;
#endif
dp->d_nstime = 0;
bcopy(data, dp->d_data, dp->d_size);
return (dp);
}
int hashsizes[] = { /* hashtable sizes */
2,
11,
113,
337,
977,
2053,
4073,
8011,
16001,
0
};
/*
* Allocate a data buffer & save data.
*/
struct hashbuf *
savehash(oldhtp)
register struct hashbuf *oldhtp;
{
register struct hashbuf *htp;
register struct namebuf *np, *nnp, **hp;
register int n;
int newsize;
if (oldhtp == NULL)
newsize = hashsizes[0];
else {
for (n = 0; newsize = hashsizes[n++]; )
if (oldhtp->h_size == newsize) {
newsize = hashsizes[n];
break;
}
if (newsize == 0)
newsize = oldhtp->h_size * 2 + 1;
}
dprintf(4, (ddt, "savehash GROWING to %d\n", newsize));
htp = (struct hashbuf *) malloc((unsigned)HASHSIZE(newsize));
if (htp == NULL) {
syslog(LOG_ERR, "savehash: %m");
exit(1);
}
htp->h_size = newsize;
bzero((char *) htp->h_tab, newsize * sizeof(struct namebuf *));
if (oldhtp == NULL) {
htp->h_cnt = 0;
return (htp);
}
dprintf(4, (ddt, "savehash(%#lx) cnt=%d, sz=%d, newsz=%d\n",
(u_long)oldhtp, oldhtp->h_cnt, oldhtp->h_size, newsize));
htp->h_cnt = oldhtp->h_cnt;
for (n = 0; n < oldhtp->h_size; n++) {
for (np = oldhtp->h_tab[n]; np != NULL; np = nnp) {
nnp = np->n_next;
hp = &htp->h_tab[np->n_hashval % htp->h_size];
np->n_next = *hp;
*hp = np;
}
}
free((char *) oldhtp);
return (htp);
}

View File

@ -0,0 +1,153 @@
#ifndef LINT
static char rcsid[] = "$Id: db_secure.c,v 8.6 1996/05/17 09:10:46 vixie Exp $";
#endif
/* this file was contributed by Gregory Neil Shapiro of WPI in August 1993 */
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <syslog.h>
#include <errno.h>
#include "named.h"
#ifdef SECURE_ZONES
#ifndef SECURE_ZONE_RR
#define SECURE_ZONE_RR "secure_zone"
#endif
#ifndef MASK_SEP
#define MASK_SEP ':'
#endif
int
build_secure_netlist(zp)
struct zoneinfo *zp;
{
struct netinfo *ntp = NULL, **netlistp, **end;
char buf[BUFSIZ];
struct hashbuf *htp;
struct namebuf *snp;
struct databuf *dp;
const char *fname;
char *dname, dnbuf[MAXDNAME];
int errs = 0, securezone = 0;
if (zp->secure_nets) {
free_netlist(&zp->secure_nets);
}
netlistp = &zp->secure_nets;
end = netlistp;
strcat(strcat(strcpy(dnbuf, SECURE_ZONE_RR), "."), zp->z_origin);
dname = dnbuf;
htp = hashtab;
if ((snp = nlookup(dname, &htp, &fname, 0)) == NULL) {
dprintf(1, (ddt,
"build_secure_netlist(%s): FAIL on nlookup %s\n",
zp->z_origin, dname));
zp->secure_nets=NULL;
return(0);
}
/* A parent's RR's aren't valid */
if (strcasecmp(NAME(*snp), SECURE_ZONE_RR)) {
zp->secure_nets=NULL;
return(0);
}
/* Collect secure nets into secure_nets */
for (dp = snp->n_data; dp != NULL; dp = dp->d_next) {
char *maskptr = NULL;
if (!match(dp, zp->z_class, T_TXT)) {
continue;
}
bzero(buf, sizeof(buf));
bcopy(dp->d_data+1, buf, dp->d_size-1);
maskptr=strchr(buf, MASK_SEP);
if (maskptr) {
*maskptr++ = 0;
}
dprintf(3, (ddt,
"build_secure_netlist(%s): Found secure zone %s\n",
zp->z_origin, buf));
if (ntp == NULL) {
ntp = (struct netinfo *)malloc(sizeof(struct netinfo));
if (!ntp)
panic(errno, "malloc(netinfo)");
}
if (!inet_aton(buf, &ntp->my_addr)) {
syslog(LOG_INFO,
"build_secure_netlist (%s): Bad address: %s",
zp->z_origin, buf);
errs++;
continue;
}
if (maskptr && *maskptr) {
if (*maskptr == 'h' || *maskptr == 'H') {
ntp->mask = (u_int32_t)-1;
} else {
if (!inet_aton(maskptr,
(struct in_addr *)&ntp->mask)) {
dprintf(1, (ddt,
"build_secure_netlist (%s): Bad mask: %s\n",
zp->z_origin, maskptr));
syslog(LOG_INFO,
"build_secure_netlist (%s): Bad mask: %s",
zp->z_origin, maskptr);
errs++;
continue;
}
}
} else {
ntp->mask = net_mask(ntp->my_addr);
}
if (ntp->my_addr.s_addr & ~(ntp->mask)) {
syslog(LOG_INFO,
"build_secure_netlist (%s): addr (%s) is not in mask (%#lx)",
zp->z_origin,
inet_ntoa(ntp->my_addr),
(u_long)ntp->mask);
errs++;
}
ntp->next = NULL;
ntp->addr = ntp->my_addr.s_addr & ntp->mask;
/* Check for duplicates */
if (addr_on_netlist(ntp->my_addr, *netlistp)) {
syslog(LOG_INFO,
"build_secure_netlist (%s): duplicate address %s\n",
zp->z_origin, inet_ntoa(ntp->my_addr));
errs++;
continue;
}
*end = ntp;
end = &ntp->next;
ntp = NULL;
securezone++;
}
if (ntp) {
free((char *)ntp);
}
if (!securezone) {
zp->secure_nets=NULL;
}
#ifdef DEBUG
if (debug > 1) {
for (ntp = *netlistp; ntp != NULL; ntp = ntp->next) {
fprintf(ddt, "ntp x%lx addr x%lx mask x%lx",
(u_long)ntp, (u_long)ntp->addr,
(u_long)ntp->mask);
fprintf(ddt, " my_addr %#lx",
(u_long)ntp->my_addr.s_addr);
fprintf(ddt, " %s", inet_ntoa(ntp->my_addr));
fprintf(ddt, " next x%lx\n", (u_long)ntp->next);
}
}
#endif
return (errs);
}
#endif /*SECURE_ZONES*/

View File

@ -0,0 +1,737 @@
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)db_update.c 4.28 (Berkeley) 3/21/91";
static char rcsid[] = "$Id: db_update.c,v 8.12 1996/08/05 08:31:30 vixie Exp $";
#endif /* not lint */
/*
* ++Copyright++ 1986, 1990
* -
* Copyright (c) 1986, 1990
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#include <stdio.h>
#include <syslog.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include "named.h"
static void fixttl __P((struct databuf *));
static int db_cmp __P((struct databuf *,
struct databuf *));
/* int
* isRefByNS(name, htp)
* recurse through all of `htp' looking for NS RR's that refer to `name'.
* returns:
* nonzero if at least one such NS RR exists
* cautions:
* this is very expensive; probably you only want to use on fcachetab.
*/
static int
isRefByNS(name, htp)
char name[];
struct hashbuf *htp;
{
register struct namebuf *np;
register struct databuf *dp;
for (np = htp->h_tab[0]; np != NULL; np = np->n_next) {
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
if ((dp->d_class == C_ANY ||
dp->d_class == C_IN ||
dp->d_class == C_HS) &&
dp->d_type == T_NS &&
#ifdef NCACHE
!dp->d_rcode &&
#endif
!strcasecmp(name, (char *)dp->d_data)) {
return (1);
}
}
if (np->n_hash && isRefByNS(name, np->n_hash))
return (1);
}
return (0);
}
/* int
* findMyZone(struct namebuf *np, int class)
* surf the zone cuts and find this zone the hard way
* return value:
* zone number or DB_Z_CACHE if it's outside a zone
* interesting cases:
* DEC.COM SOA (primary)
* CRL.DEC.COM NS (in primary)
* if you start at CRL.. here, you find the DEC.COM zone
* if you start at NS.CRL.. here, you're in the cache
* DEC.COM SOA (primary)
* CRL.DEC.COM NS (in primary)
* CRL.DEC.COM SOA (secondary)
* CRL.DEC.COM NS (in secondary)
* if you start at CRL.. here, you find the CRL.DEC.COM zone
* if you start at NS.CRL.. here, you're in the CRL.. zone
*/
int
findMyZone(np, class)
struct namebuf *np;
register int class;
{
for (; np; np = np_parent(np)) {
register struct databuf *dp;
/* if we encounter an SOA, we're in its zone (which can be
* the cache or an authoritative zone, depending).
*/
for (dp = np->n_data; dp; dp = dp->d_next)
if (match(dp, class, T_SOA))
return (dp->d_zone);
/* if we find an NS at some node without having seen an SOA
* (above), then we're out in the cache somewhere.
*/
for (dp = np->n_data; dp; dp = dp->d_next)
if (match(dp, class, T_NS))
return (DB_Z_CACHE);
}
/* getting all the way to the root without finding an NS or SOA
* probably means that we are in deep dip, but we'll treat it as
* being in the cache. (XXX?)
*/
return (DB_Z_CACHE);
}
#ifdef NO_GLUE
#define ISVALIDGLUE(xdp) ((xdp)->d_type == T_NS || (xdp)->d_type == T_A \
|| (xdp)->d_type == T_AAAA)
#else
#define ISVALIDGLUE(xdp) (1)
#endif /*NO_GLUE*/
/* int
* db_update(name, odp, newdp, flags, htp)
* update data base node at `name'. `flags' controls the action.
* side effects:
* inverse query tables modified, if we're using them.
* return value:
* OK - success
* NONAME - name doesn't exist
* AUTH - you can't do that
* DATAEXISTS - there's something there and DB_NODATA was specified
* NODATA - there's no data, and (DB_DELETE or DB_MEXIST) was spec'd
*
* Policy: How to add data if one more RR is -ve data
*
* NEND NOERROR_NODATA
* NXD NXDOMAIN
*
* match
* old
* Data NEND NXD
* Data Merge Data Data
* new NEND NEND NEND NEND
* NXD NXD NXD NXD
*
* no match
* old
* Data NEND NXD
* Data Merge Merge Data
* new NEND Merge Merge NEND
* NXD NXD NXD NXD
*
*/
/* XXX: this code calls nlookup, which can create namebuf's. if this code
* has to exit with a fatal error, it should scan from the new np upward
* and for each node which has no children and no data it should remove
* the namebuf. design notes: (1) there's no harm in doing this even if
* success occurred; (2) stopping on the first nonremovable np is optimal;
* the code for removal should be taken out of remove_zone() and made
* general enough for this use, and for remove_zone()'s continued use.
* vix, 21jul94
*/
int
db_update(name, odp, newdp, flags, htp)
char name[];
struct databuf *odp, *newdp;
int flags;
struct hashbuf *htp;
{
register struct databuf *dp, *pdp;
register struct namebuf *np;
int zn, isHintNS;
const char *fname;
dprintf(3, (ddt, "db_update(%s, 0x%lx, 0x%lx, 0%o, 0x%lx)%s\n",
name, (u_long)odp, (u_long)newdp, flags, (u_long)htp,
(odp && (odp->d_flags&DB_F_HINT)) ? " hint":"" ));
np = nlookup(name, &htp, &fname, newdp != NULL);
if (np == NULL || fname != name)
return (NONAME);
/* don't let nonauthoritative updates write in authority zones */
if (newdp && ((zn = findMyZone(np, newdp->d_class)) != DB_Z_CACHE) &&
#ifdef STUBS
(zones[zn].z_type != Z_STUB) &&
#endif
(flags & DB_NOTAUTH)) {
int foundRR = 0;
/*
* Don't generate the warning if the update
* would have been harmless (identical data).
*/
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
if (!db_cmp(dp, newdp)) {
foundRR++;
break;
}
}
if (!foundRR)
dprintf(5, (ddt,
"[%s].%d update? to auth zone \"%s\" (%s)",
inet_ntoa(from_addr.sin_addr),
ntohs(from_addr.sin_port),
zones[zn].z_origin,
name));
return (AUTH);
}
if (newdp && zn && !(flags & DB_NOTAUTH)) {
if (db_getclev(zones[zn].z_origin) > newdp->d_clev) {
dprintf(5,(ddt, "attempted update child zone %s, %s\n",
zones[zn].z_origin, name));
return(AUTH);
}
}
/* some special checks for root NS' A RR's */
isHintNS = isRefByNS(name, fcachetab);
#ifdef DEPRECATED
if (newdp && isHintNS && newdp->d_type == T_A) {
/* upgrade credibility of additional data for rootsrv addrs */
if (newdp->d_cred == DB_C_ADDITIONAL) {
dprintf(3, (ddt,
"upgrading credibility for A RR (%s)\n",
name));
/* XXX: should copy NS RR's, but we really just want
* to prevent deprecation later so this will do.
*/
newdp->d_cred = DB_C_ANSWER;
newdp->d_clev = 0;
}
}
#endif
/* Reflect certain updates in hint cache also... */
/* Don't stick data we are authoritative for in hints. */
if (!(flags & DB_NOHINTS) &&
(flags & DB_PRIMING) &&
(odp != NULL) &&
(htp != fcachetab) &&
(odp->d_zone <= 0) &&
!(odp->d_flags & DB_F_HINT) &&
#ifdef NCACHE
(!newdp || !newdp->d_rcode) &&
#endif
((name[0] == '\0' && odp->d_type == T_NS) ||
(odp->d_type == T_A && isHintNS)
)
)
{
dprintf(3, (ddt, "db_update: hint '%s' %d\n",
name, odp->d_ttl));
dp = savedata(odp->d_class, odp->d_type, odp->d_ttl,
odp->d_data, odp->d_size);
dp->d_zone = DB_Z_CACHE;
dp->d_flags = DB_F_HINT;
dp->d_cred = DB_C_CACHE;
dp->d_clev = 0;
if (db_update(name,
dp, dp,
(flags|DB_NOHINTS),
fcachetab)
!= OK) {
dprintf(3, (ddt, "db_update: hint %lx freed\n",
(u_long)dp));
(void) free((char *)dp);
}
}
if (odp != NULL) {
int foundRR = 0;
pdp = NULL;
for (dp = np->n_data; dp != NULL; ) {
if (!match(dp, odp->d_class, odp->d_type)) {
/* {class,type} doesn't match. these are
* the aggregation cases.
*/
if ((dp->d_type == T_CNAME ||
odp->d_type == T_CNAME) &&
odp->d_class == dp->d_class &&
odp->d_mark == dp->d_mark &&
#ifdef NCACHE
/* neither the odp nor the new dp are
* negatively cached records...
*/
!dp->d_rcode &&
!odp->d_rcode &&
#endif /*NCACHE*/
zones[odp->d_zone].z_type != Z_CACHE) {
syslog(LOG_INFO,
"%s has CNAME and other data (illegal)\n",
name);
goto skip;
}
if (!newdp || newdp->d_class != dp->d_class)
goto skip;
/* if the new data is authorative
* remove any data for this domain with
* the same class that isn't as credable
*/
if (newdp->d_cred == DB_C_ZONE &&
newdp->d_cred > dp->d_cred)
/* better credibility and the old datum
* was not from a zone file. remove
* the old datum.
*/
goto delete;
#if 0 /* caught by findMyZone() now. */
/* if we have authoritative data for a
* node, don't add in other data.
*/
if (dp->d_cred == DB_C_ZONE &&
newdp->d_cred < dp->d_cred)
return (AUTH);
#endif
/* if the new data is authoritative but
* but isn't as credible, reject it.
*/
if (newdp->d_cred == DB_C_ZONE &&
dp->d_cred == DB_C_ZONE) {
/* Both records are from a zone file.
* If their credibility levels differ,
* we're dealing with a zone cut. The
* record with lower clev is from the
* upper zone's file and is therefore
* glue.
*/
if (newdp->d_clev < dp->d_clev) {
if (!ISVALIDGLUE(newdp)) {
syslog(LOG_INFO,
"domain %s %s record in zone %s should be in zone %s, ignored",
name, p_type(newdp->d_type),
zones[newdp->d_zone].z_origin,
zones[dp->d_zone].z_origin);
}
return (AUTH);
}
if (newdp->d_clev > dp->d_clev) {
if (!ISVALIDGLUE(dp)) {
syslog(LOG_INFO,
"domain %s %s record in zone %s should be in zone %s, deleted",
name, p_type(dp->d_type),
zones[dp->d_zone].z_origin,
zones[newdp->d_zone].z_origin);
}
goto delete;
}
}
#ifdef NCACHE
/* process NXDOMAIN */
/* policy */
if (newdp->d_rcode == NXDOMAIN) {
if (dp->d_cred < DB_C_AUTH)
goto delete;
else
return (DATAEXISTS);
}
if (dp->d_rcode == NXDOMAIN)
goto delete;
/* process NOERROR_NODATA */
/* NO PROCESSING REQUIRED */
#endif /*NCACHE*/
goto skip;
} /*if {class,type} did not match*/
/* {type,class} did match. this is the replace case.
*/
dprintf(5, (ddt,
"db_update: flags = %#x, sizes = %d, %d (cmp %d)\n",
flags, odp->d_size, dp->d_size,
db_cmp(dp, odp)));
if (newdp) {
dprintf(4, (ddt,
"credibility for %s is %d(%d) from [%s].%d, is %d(%d) in cache\n",
*name? name : ".",
newdp->d_cred,
newdp->d_clev,
inet_ntoa(from_addr.sin_addr),
ntohs(from_addr.sin_port),
dp->d_cred,
dp->d_clev));
if (newdp->d_cred > dp->d_cred) {
/* better credibility.
* remove the old datum.
*/
goto delete;
}
if (newdp->d_cred < dp->d_cred) {
/* credibility is worse. ignore it. */
return (AUTH);
}
if (newdp->d_cred == DB_C_ZONE &&
dp->d_cred == DB_C_ZONE ) {
/* Both records are from a zone file.
* If their credibility levels differ,
* we're dealing with a zone cut. The
* record with lower clev is from the
* upper zone's file and is therefore
* glue.
*/
/* XXX - Tricky situation here is you
* have 2 zones a.b.c and sub.a.b.c
* being served by the same server.
* named will send NS records for
* sub.a.b.c during zone transfer of
* a.b.c zone. If we're secondary for
* both zones, and we reload zone
* a.b.c, we'll get the NS records
* (and possibly A records to go with
* them?) for sub.a.b.c as part of the
* a.b.c zone transfer. But we've
* already got a more credible record
* from the sub.a.b.c zone. So we want
* to ignore the new record, but we
* shouldn't syslog because there's
* nothing the user can do to prevent
* the situation. Perhaps we should
* only complain when we are primary?
*/
if (newdp->d_clev < dp->d_clev) {
if (!ISVALIDGLUE(newdp)) {
syslog(LOG_INFO,
"domain %s %s record in zone %s should be in zone %s, ignored",
name, p_type(newdp->d_type),
zones[newdp->d_zone].z_origin,
zones[dp->d_zone].z_origin);
}
return (AUTH);
}
if (newdp->d_clev > dp->d_clev) {
if (!ISVALIDGLUE(dp)) {
syslog(LOG_INFO,
"domain %s %s record in zone %s should be in zone %s, deleted",
name, p_type(dp->d_type),
zones[dp->d_zone].z_origin,
zones[newdp->d_zone].z_origin);
}
goto delete;
}
}
/* credibility is the same.
* let it aggregate in the normal way.
*/
#ifdef NCACHE
/*
* if the new or old RR is -ve, delete old.
*/
if (dp->d_rcode || newdp->d_rcode) {
/* XXX: how can a zone rr be neg? */
if (dp->d_cred != DB_C_ZONE)
goto delete;
else
return (DATAEXISTS);
}
#endif
/*
* Some RR types should not be aggregated.
*/
if (dp->d_type == T_SOA)
goto delete;
if (dp->d_type == T_WKS &&
!bcmp(dp->d_data, newdp->d_data,
INT32SZ + sizeof(u_char)))
goto delete;
}
if ((flags & DB_NODATA) && !db_cmp(dp, odp)) {
/* refresh ttl if cache entry */
if (dp->d_zone == 0) {
if (odp->d_zone != 0) { /* XXX */
/* changing cache->auth */
dp->d_zone = odp->d_zone;
dp->d_ttl = odp->d_ttl;
dprintf(4, (ddt,
"db_update: cache entry now in auth zone\n"
));
return (DATAEXISTS);
}
fixttl(odp);
if (odp->d_ttl > dp->d_ttl)
dp->d_ttl = odp->d_ttl;
dprintf(3, (ddt,
"db_update: new ttl %ld +%ld\n",
(u_long)dp->d_ttl,
(u_long)
(dp->d_ttl - tt.tv_sec)));
}
return (DATAEXISTS);
}
/*
* If the old databuf has some data, check that the
* data matches that in the new databuf (so UPDATED
* will delete only the matching RR)
*/
if (odp->d_size > 0)
if (db_cmp(dp, odp))
goto skip;
foundRR = 1;
if (flags & DB_DELETE) {
delete: dp = rm_datum(dp, np, pdp);
} else {
skip: pdp = dp;
dp = dp->d_next;
}
}
if (!foundRR) {
if (flags & DB_DELETE)
return (NODATA);
if (flags & DB_MEXIST)
return (NODATA);
}
}
if (newdp == NULL)
return (OK);
/* XXX: empty nodes bypass credibility checks above; should check
* response source address here if flags&NOTAUTH.
*/
fixttl(newdp);
dprintf(3, (ddt, "db_update: adding%s %lx\n",
(newdp->d_flags&DB_F_HINT) ? " hint":"", (u_long)newdp));
#ifdef INVQ
if (!(newdp->d_flags & DB_F_HINT))
addinv(np, newdp); /* modify inverse query tables */
#endif
#ifdef STATS
if (!newdp->d_zone && !(newdp->d_flags & DB_F_HINT))
newdp->d_ns = nameserFind(from_addr.sin_addr, NS_F_INSERT);
#endif
/* Add to end of list, generally preserving order */
newdp->d_next = NULL;
if ((dp = np->n_data) == NULL) {
#ifdef DATUMREFCNT
newdp->d_rcnt = 1;
#endif
np->n_data = newdp;
return (OK);
}
while (dp->d_next != NULL) {
if ((flags & DB_NODATA) && !db_cmp(dp, newdp))
return (DATAEXISTS);
dp = dp->d_next;
}
if ((flags & DB_NODATA) && !db_cmp(dp, newdp))
return (DATAEXISTS);
#ifdef DATUMREFCNT
newdp->d_rcnt = 1;
#endif
dp->d_next = newdp;
return (OK);
}
static void
fixttl(dp)
register struct databuf *dp;
{
if (dp->d_zone == 0 && !(dp->d_flags & DB_F_HINT)) {
if (dp->d_ttl <= tt.tv_sec)
return;
else if (dp->d_ttl < tt.tv_sec+min_cache_ttl)
dp->d_ttl = tt.tv_sec+min_cache_ttl;
else if (dp->d_ttl > tt.tv_sec+max_cache_ttl)
dp->d_ttl = tt.tv_sec+max_cache_ttl;
}
return;
}
/*
* Compare type, class and data from databufs for equivalence.
* Must be case insensitive for some domain names.
* Return 0 if equivalent, nonzero otherwise.
*/
static int
db_cmp(dp1, dp2)
register struct databuf *dp1, *dp2;
{
register u_char *cp1, *cp2;
int len, len2;
if (dp1->d_type != dp2->d_type || dp1->d_class != dp2->d_class)
return (1);
if (dp1->d_size != dp2->d_size)
return (1);
if (dp1->d_mark != dp2->d_mark)
return (1); /* old and new RR's are distinct */
#ifdef NCACHE
if (dp1->d_rcode && dp2->d_rcode)
return ((dp1->d_rcode == dp1->d_rcode)?0:1);
if (dp1->d_rcode || dp2->d_rcode)
return (1);
#endif
switch (dp1->d_type) {
case T_A:
case T_UID:
case T_GID:
case T_WKS:
case T_NULL:
case T_NSAP:
case T_AAAA:
case T_LOC:
#ifdef ALLOW_T_UNSPEC
case T_UNSPEC:
#endif
return (bcmp(dp1->d_data, dp2->d_data, dp1->d_size));
case T_NS:
case T_CNAME:
case T_PTR:
case T_MB:
case T_MG:
case T_MR:
case T_UINFO:
return (strcasecmp((char *)dp1->d_data, (char *)dp2->d_data));
case T_HINFO:
case T_ISDN:
cp1 = dp1->d_data;
cp2 = dp2->d_data;
len = *cp1;
len2 = *cp2;
if (len != len2)
return (1);
if (strncasecmp((char *)++cp1, (char *)++cp2, len))
return (1);
cp1 += len;
cp2 += len;
len = *cp1;
len2 = *cp2;
if (len != len2)
return (1);
return (strncasecmp((char *)++cp1, (char *)++cp2, len));
case T_SOA:
case T_MINFO:
case T_RP:
if (strcasecmp((char *)dp1->d_data, (char *)dp2->d_data))
return (1);
cp1 = dp1->d_data + strlen((char *)dp1->d_data) + 1;
cp2 = dp2->d_data + strlen((char *)dp2->d_data) + 1;
if (dp1->d_type != T_SOA)
return (strcasecmp((char *)cp1, (char *)cp2));
if (strcasecmp((char *)cp1, (char *)cp2))
return (1);
cp1 += strlen((char *)cp1) + 1;
cp2 += strlen((char *)cp2) + 1;
return (bcmp(cp1, cp2, INT32SZ * 5));
case T_MX:
case T_AFSDB:
case T_RT:
cp1 = dp1->d_data;
cp2 = dp2->d_data;
if (*cp1++ != *cp2++ || *cp1++ != *cp2++) /* cmp prio */
return (1);
return (strcasecmp((char *)cp1, (char *)cp2));
case T_PX:
cp1 = dp1->d_data;
cp2 = dp2->d_data;
if (*cp1++ != *cp2++ || *cp1++ != *cp2++) /* cmp prio */
return (1);
if (strcasecmp((char *)cp1, (char *)cp2))
return (1);
cp1 += strlen((char *)cp1) + 1;
cp2 += strlen((char *)cp2) + 1;
return (strcasecmp((char *)cp1, (char *)cp2));
case T_TXT:
case T_X25:
if (dp1->d_size != dp2->d_size)
return (1);
return (bcmp(dp1->d_data, dp2->d_data, dp1->d_size));
default:
return (1);
}
}

View File

@ -0,0 +1,315 @@
/* dmalloc - debugging layer on top of malloc
* vix 25mar92 [fixed bug in round-up calcs in alloc()]
* vix 24mar92 [added size calcs, improved printout]
* vix 22mar92 [original work]
*
* $Id: dmalloc.c,v 8.3 1996/05/17 09:10:46 vixie Exp $
*/
/*
* ++Copyright++ 1993
* -
* Copyright (c) 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#include <stdio.h>
#include <signal.h>
#include "../conf/portability.h"
#include "../conf/options.h"
#ifdef DMALLOC
#define TRUE 1
#define FALSE 0
typedef unsigned bool;
#define MAX_MEMORY 65536 /* must fit in typeof(datum.size) */
#define MAX_CALLERS 256 /* must be **2 */
typedef struct caller {
struct caller *next;
struct filenam *file;
struct calltab *frees;
unsigned line;
unsigned calls;
unsigned blocks;
unsigned bytes;
} caller;
typedef struct filenam {
struct filenam *next;
char *name;
} filenam;
typedef struct calltab {
struct caller *callers[MAX_CALLERS];
} calltab;
typedef struct datum {
unsigned size; /* size of malloc'd item */
unsigned caller; /* offset into memory[] */
/* user data follows */
} datum;
static char memory[MAX_MEMORY];
static char *nextmem = memory;
static char *alloc(size) unsigned size; {
char *thismem = nextmem;
int oddness = (size % sizeof(char*));
if (oddness)
size += (sizeof(char*) - oddness);
nextmem += size;
if (nextmem >= &memory[MAX_MEMORY]) {
fprintf(stderr, "dmalloc.alloc: out of mem\n");
kill(0, SIGBUS);
}
return thismem;
}
static filenam *Files;
static calltab Callers;
/*--------------------------------------------------- imports
*/
#undef malloc
#undef calloc
#undef realloc
#undef free
char *malloc(), *calloc(), *realloc();
#if defined(sun)
int free();
#else
void free();
#endif
/*--------------------------------------------------- private
*/
#define STR_EQ(l,r) (((l)[0] == (r)[0]) && !strcmp(l, r))
static filenam *
findFile(file, addflag)
char *file;
bool addflag;
{
filenam *f;
for (f = Files; f; f = f->next)
if (STR_EQ(file, f->name))
return f;
if (!addflag)
return NULL;
f = (filenam*) alloc(sizeof(filenam));
f->next = Files;
Files = f;
f->name = alloc(strlen(file) + 1);
strcpy(f->name, file);
return f;
}
static caller *
findCaller(ctab, file, line, addflag)
calltab *ctab;
char *file;
unsigned line;
bool addflag;
{
unsigned hash = line & (MAX_CALLERS - 1);
caller *c;
for (c = ctab->callers[hash]; c; c = c->next)
if ((c->line == line) && STR_EQ(c->file->name, file))
return c;
if (!addflag)
return NULL;
c = (caller*) alloc(sizeof(caller));
c->next = ctab->callers[hash];
c->file = findFile(file, TRUE);
c->line = line;
c->calls = 0;
c->frees = (calltab *) alloc(sizeof(calltab));
ctab->callers[hash] = c;
return c;
}
/*--------------------------------------------------- public
*/
char *
dmalloc(file, line, size)
char *file;
unsigned line;
unsigned size;
{
caller *c;
datum *d;
c = findCaller(&Callers, file, line, TRUE);
d = (datum *) malloc(sizeof(datum) + size);
if (!d)
return (NULL);
d->size = size;
d->caller = ((char *)c) - memory;
c->calls++;
c->blocks++;
c->bytes += size;
return (char *) (d+1);
}
void
dfree(file, line, ptr)
char *file;
unsigned line;
char *ptr;
{
caller *c, *a;
datum *d;
d = (datum *) ptr; d--;
a = (caller *) (memory + d->caller);
a->bytes -= d->size;
a->blocks--;
c = findCaller(a->frees, file, line, TRUE);
c->calls++;
free((char*) d);
}
char *
dcalloc(file, line, nelems, elsize)
char *file;
unsigned line;
unsigned nelems, elsize;
{
unsigned size = (nelems * elsize);
char *ptr;
ptr = dmalloc(file, line, size);
if (ptr)
bzero(ptr, size);
return ptr;
}
char *
drealloc(file, line, ptr, size)
char *file;
unsigned line;
char *ptr;
unsigned size;
{
caller *c, *a;
datum *d;
d = (datum *) ptr; d--;
/* fix up stats from allocation */
a = (caller *) (memory + d->caller);
a->bytes -= d->size;
a->blocks--;
/* we are a "freer" of this allocation */
c = findCaller(a->frees, file, line, TRUE);
c->calls++;
/* get new allocation and stat it */
c = findCaller(&Callers, file, line, TRUE);
d = (datum *) realloc((char *) d, sizeof(datum) + size);
d->size = size;
d->caller = ((char *)c) - memory;
c->calls++;
c->blocks++;
c->bytes += size;
return (char *) (d+1);
}
static void
dmalloccallers(outf, prefix, ctab)
FILE *outf;
char *prefix;
calltab *ctab;
{
/* this bizarre logic is to print all of a file's entries together */
filenam *f;
for (f = Files; f; f = f->next) {
int i;
for (i = MAX_CALLERS-1; i >= 0; i--) {
caller *c;
for (c = ctab->callers[i]; c; c = c->next) {
if (f != c->file)
continue;
fprintf(outf, "%s\"%s\":%u calls=%u",
prefix, c->file->name, c->line,
c->calls);
if (c->blocks || c->bytes)
fprintf(outf, " blocks=%u bytes=%u",
c->blocks, c->bytes);
fputc('\n', outf);
if (c->frees)
dmalloccallers(outf,
"\t\t", c->frees);
}
}
}
}
void
dmallocstats(outf)
FILE *outf;
{
fprintf(outf, "dallocstats [ private mem used=%u, avail=%u ]\n",
nextmem - memory, &memory[MAX_MEMORY] - nextmem);
dmalloccallers(outf, "\t", &Callers);
}
#endif /*DMALLOC*/

View File

@ -0,0 +1,68 @@
/* dmalloc - debugging layer on top of malloc
* vix 22mar92 [written]
*
* $Id: dmalloc.h,v 8.1 1994/12/15 06:24:14 vixie Exp $
*/
/*
* ++Copyright++
* -
* Copyright (c)
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#define malloc(s) dmalloc(__FILE__, __LINE__, s)
#define free(p) dfree(__FILE__, __LINE__, p)
#define calloc(n, s) dcalloc(__FILE__, __LINE__, n, s)
#define realloc(p, s) drealloc(__FILE__, __LINE__, p, s)
char *dmalloc(), *dcalloc(), *drealloc();
void dfree(), dmallocstats();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
/* named.h - include the local definitions in the right order
* vix 28aug93 [original]
*
* $Id: named.h,v 8.1 1994/12/15 06:24:14 vixie Exp $
*/
#include "../conf/portability.h"
#include "../conf/options.h"
#include "pathnames.h"
#include "ns_defs.h"
#include "db_defs.h"
#include "ns_glob.h"
#include "db_glob.h"
#include "ns_func.h"
#include "db_func.h"

View File

@ -0,0 +1,7 @@
#!/bin/sh -
#
# from named.reload 5.2 (Berkeley) 6/27/89
# $Id: named.reload.sh,v 8.1 1994/12/15 06:24:14 vixie Exp $
#
exec %DESTSBIN%/%INDOT%ndc reload

View File

@ -0,0 +1,7 @@
#!/bin/sh -
#
# from named.restart 5.4 (Berkeley) 6/27/89
# $Id: named.restart.sh,v 8.1 1994/12/15 06:24:14 vixie Exp $
#
exec %DESTSBIN%/%INDOT%ndc restart

83
contrib/bind/named/ndc.sh Normal file
View File

@ -0,0 +1,83 @@
#!/bin/sh
USAGE='echo \
"usage: $0 \
(status|dumpdb|reload|stats|trace|notrace|querylog|start|stop|restart) \
... \
"; exit 1'
PATH=%DESTSBIN%:/bin:/usr/bin:/usr/ucb:$PATH
PIDFILE=%PIDDIR%/named.pid
if [ -f $PIDFILE ]
then
PID=`cat $PIDFILE`
PS=`%PS% $PID | tail -1 | grep $PID`
RUNNING=1
[ `echo $PS | wc -w` -ne 0 ] || {
PS="named (pid $PID?) not running"
RUNNING=0
}
else
PS="named (no pid file) not running"
RUNNING=0
fi
for ARG
do
case $ARG in
start|stop|restart)
;;
*)
[ $RUNNING -eq 0 ] && {
echo $PS
exit 1
}
esac
case $ARG in
status) echo "$PS";;
dumpdb) kill -INT $PID && echo Dumping Database;;
reload) kill -HUP $PID && echo Reloading Database;;
stats) kill -%IOT% $PID && echo Dumping Statistics;;
trace) kill -USR1 $PID && echo Trace Level Incremented;;
notrace) kill -USR2 $PID && echo Tracing Cleared;;
querylog|qrylog) kill -WINCH $PID && echo Query Logging Toggled;;
start)
[ $RUNNING -eq 1 ] && {
echo "$0: start: named (pid $PID) already running"
continue
}
rm -f $PIDFILE
%INDOT%named && {
sleep 5
echo Name Server Started
}
;;
stop)
[ $RUNNING -eq 0 ] && {
echo "$0: stop: named not running"
continue
}
kill $PID && {
sleep 5
rm -f $PIDFILE
echo Name Server Stopped
}
;;
restart)
[ $RUNNING -eq 1 ] && {
kill $PID && sleep 5
}
rm -f $PIDFILE
%INDOT%named && {
sleep 5
echo Name Server Restarted
}
;;
*) eval "$USAGE";;
esac
done
test -z "$ARG" && eval "$USAGE"
exit 0

View File

@ -0,0 +1,397 @@
/*
* from ns.h 4.33 (Berkeley) 8/23/90
* $Id: ns_defs.h,v 8.6 1996/05/17 09:10:46 vixie Exp $
*/
/*
* ++Copyright++ 1986
* -
* Copyright (c) 1986
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* Global definitions for the name server.
*/
/*
* Effort has been expended here to make all structure members 32 bits or
* larger land on 32-bit boundaries; smaller structure members have been
* deliberately shuffled and smaller integer sizes chosen where possible
* to make sure this happens. This is all meant to avoid structure member
* padding which can cost a _lot_ of memory when you have hundreds of
* thousands of entries in your cache.
*/
/*
* Timeout time should be around 1 minute or so. Using the
* the current simplistic backoff strategy, the sequence
* retrys after 4, 8, and 16 seconds. With 3 servers, this
* dies out in a little more than a minute.
* (sequence RETRYBASE, 2*RETRYBASE, 4*RETRYBASE... for MAXRETRY)
*/
#define MINROOTS 2 /* min number of root hints */
#define NSMAX 16 /* max number of NS addrs to try ([0..255]) */
#define RETRYBASE 4 /* base time between retries */
#define MAXCLASS 255 /* XXX - may belong elsewhere */
#define MAXRETRY 3 /* max number of retries per addr */
#define MAXCNAMES 8 /* max # of CNAMES tried per addr */
#define MAXQUERIES 20 /* max # of queries to be made */
#define MAXQSERIAL 4 /* max # of outstanding QSERIAL's */
/* (prevent "recursive" loops) */
#define INIT_REFRESH 600 /* retry time for initial secondary */
/* contact (10 minutes) */
#define NADDRECS 20 /* max addt'l rr's per resp */
#define XFER_TIMER 120 /* named-xfer's connect timeout */
#define MAX_XFER_TIME 60*60*2 /* max seconds for an xfer */
#define XFER_TIME_FUDGE 10 /* MAX_XFER_TIME fudge */
#define MAX_XFERS_RUNNING 10 /* default max value of xfers_running */
#define MAX_XFERS_PER_NS 2 /* max # of xfers per peer nameserver */
#define XFER_BUFSIZE (16*1024) /* arbitrary but bigger than most MTU's */
#define ALPHA 0.7 /* How much to preserve of old response time */
#define BETA 1.2 /* How much to penalize response time on failure */
#define GAMMA 0.98 /* How much to decay unused response times */
#define USE_MINIMUM 0xffffffff
/* sequence-space arithmetic */
#define SEQ_GT(a,b) ((int32_t)((a)-(b)) > 0)
/* cheap garbage collection */
#define FREE_ONCE(p) { if (p) { free(p); p = NULL; } }
/* these fields are ordered to maintain word-alignment;
* be careful about changing them.
*/
struct zoneinfo {
char *z_origin; /* root domain name of zone */
time_t z_time; /* time for next refresh */
time_t z_lastupdate; /* time of last refresh */
u_int32_t z_refresh; /* refresh interval */
u_int32_t z_retry; /* refresh retry interval */
u_int32_t z_expire; /* expiration time for cached info */
u_int32_t z_minimum; /* minimum TTL value */
u_int32_t z_serial; /* changes if zone modified */
char *z_source; /* source location of data */
time_t z_ftime; /* modification time of source file */
struct in_addr z_xaddr; /* override server for next xfer */
struct in_addr z_addr[NSMAX]; /* list of master servers for zone */
u_char z_addrcnt; /* number of entries in z_addr[] */
u_char z_type; /* type of zone; see below */
u_int16_t z_flags; /* state bits; see below */
pid_t z_xferpid; /* xfer child pid */
int z_class; /* class of zone */
#ifdef SECURE_ZONES
struct netinfo *secure_nets; /* list of secure networks for zone */
#endif
#ifdef BIND_NOTIFY
/* XXX - this will have to move to the name when we do !SOA notify */
struct notify *z_notifylist; /* list of servers we should notify */
#endif
};
#ifdef BIND_NOTIFY
struct notify {
struct in_addr addr; /* of server */
time_t last; /* when they asked */
struct notify *next;
/* XXX - this will need a type field when we do !SOA notify */
};
#endif
/* zone types (z_type) */
#define Z_NIL 0 /* zone slot not in use */
#define Z_PRIMARY 1
#define Z_SECONDARY 2
#define Z_CACHE 3
#define Z_STUB 4
/* zone state bits (16 bits) */
#define Z_AUTH 0x0001 /* zone is authoritative */
#define Z_NEED_XFER 0x0002 /* waiting to do xfer */
#define Z_XFER_RUNNING 0x0004 /* asynch. xfer is running */
#define Z_NEED_RELOAD 0x0008 /* waiting to do reload */
#define Z_SYSLOGGED 0x0010 /* have logged timeout */
#define Z_QSERIAL 0x0020 /* sysquery()'ing for serial number */
#define Z_FOUND 0x0040 /* found in boot file when reloading */
#define Z_INCLUDE 0x0080 /* set if include used in file */
#define Z_DB_BAD 0x0100 /* errors when loading file */
#define Z_TMP_FILE 0x0200 /* backup file for xfer is temporary */
#ifdef ALLOW_UPDATES
#define Z_DYNAMIC 0x0400 /* allow dynamic updates */
#define Z_DYNADDONLY 0x0800 /* dynamic mode: add new data only */
#define Z_CHANGED 0x1000 /* zone has changed */
#endif /* ALLOW_UPDATES */
#define Z_XFER_ABORTED 0x2000 /* zone transfer has been aborted */
#define Z_XFER_GONE 0x4000 /* zone transfer process is gone */
/* named_xfer exit codes */
#define XFER_UPTODATE 0 /* zone is up-to-date */
#define XFER_SUCCESS 1 /* performed transfer successfully */
#define XFER_TIMEOUT 2 /* no server reachable/xfer timeout */
#define XFER_FAIL 3 /* other failure, has been logged */
#include <sys/time.h>
/* XXX - "struct qserv" is deprecated in favor of "struct nameser" */
struct qserv {
struct sockaddr_in
ns_addr; /* address of NS */
struct databuf *ns; /* databuf for NS record */
struct databuf *nsdata; /* databuf for server address */
struct timeval stime; /* time first query started */
int nretry; /* # of times addr retried */
};
/*
* Structure for recording info on forwarded or generated queries.
*/
struct qinfo {
u_int16_t q_id; /* id of query */
u_int16_t q_nsid; /* id of forwarded query */
struct sockaddr_in
q_from; /* requestor's address */
u_char *q_msg, /* the message */
*q_cmsg; /* the cname message */
int16_t q_msglen, /* len of message */
q_cmsglen; /* len of cname message */
int16_t q_dfd; /* UDP file descriptor */
struct fwdinfo *q_fwd; /* last forwarder used */
time_t q_time; /* time to retry */
time_t q_expire; /* time to expire */
struct qinfo *q_next; /* rexmit list (sorted by time) */
struct qinfo *q_link; /* storage list (random order) */
struct databuf *q_usedns[NSMAX]; /* databuf for NS that we've tried */
struct qserv q_addr[NSMAX]; /* addresses of NS's */
#ifdef notyet
struct nameser *q_ns[NSMAX]; /* name servers */
#endif
u_char q_naddr; /* number of addr's in q_addr */
u_char q_curaddr; /* last addr sent to */
u_char q_nusedns; /* number of elements in q_usedns[] */
u_int8_t q_flags; /* see below */
int16_t q_cname; /* # of cnames found */
int16_t q_nqueries; /* # of queries required */
struct qstream *q_stream; /* TCP stream, null if UDP */
struct zoneinfo *q_zquery; /* Zone query is about (Q_ZSERIAL) */
#if defined(LAME_DELEGATION) || defined(VALIDATE)
char q_domain[MAXDNAME]; /* domain for servers we are querying */
#endif
#ifdef BIND_NOTIFY
int q_notifyzone; /* zone which needs a sysnotify()
* when the reply to this comes in.
*/
#endif
};
/* q_flags bits (8 bits) */
#define Q_SYSTEM 0x01 /* is a system query */
#define Q_PRIMING 0x02 /* generated during priming phase */
#define Q_ZSERIAL 0x04 /* getting zone serial for xfer test */
#define Q_NEXTADDR(qp,n) \
(((qp)->q_fwd == (struct fwdinfo *)0) ? \
&(qp)->q_addr[n].ns_addr : &(qp)->q_fwd->fwdaddr)
#define RETRY_TIMEOUT 45
#define QINFO_NULL ((struct qinfo *)0)
/*
* Return codes from ns_forw:
*/
#define FW_OK 0
#define FW_DUP 1
#define FW_NOSERVER 2
#define FW_SERVFAIL 3
struct qstream {
int s_rfd; /* stream file descriptor */
int s_size; /* expected amount of data to recive */
int s_bufsize; /* amount of data recived in s_buf */
u_char *s_buf; /* buffer of received data */
u_char *s_bufp; /* pointer into s_buf of recived data*/
struct qstream *s_next; /* next stream */
struct sockaddr_in
s_from; /* address query came from */
u_int32_t s_time; /* time stamp of last transaction */
int s_refcnt; /* number of outstanding queries */
u_int16_t s_tempsize; /* temporary for size from net */
};
#define QSTREAM_NULL ((struct qstream *)0)
struct qdatagram {
int dq_dfd; /* datagram file descriptor */
time_t dq_gen; /* generation number */
struct qdatagram
*dq_next; /* next datagram */
struct in_addr dq_addr; /* interface address */
};
#define QDATAGRAM_NULL ((struct qdatagram *)0)
struct netinfo {
struct netinfo *next;
u_int32_t addr;
u_int32_t mask;
struct in_addr my_addr;
};
#define ALLOW_NETS 0x0001
#define ALLOW_HOSTS 0x0002
#define ALLOW_ALL (ALLOW_NETS | ALLOW_HOSTS)
struct fwdinfo {
struct fwdinfo *next;
struct sockaddr_in
fwdaddr;
};
enum nameserStats { nssRcvdR, /* sent us an answer */
nssRcvdNXD, /* sent us a negative response */
nssRcvdFwdR, /* sent us a response we had to fwd */
nssRcvdDupR, /* sent us an extra answer */
nssRcvdFail, /* sent us a SERVFAIL */
nssRcvdFErr, /* sent us a FORMERR */
nssRcvdErr, /* sent us some other error */
nssRcvdAXFR, /* sent us an AXFR */
nssRcvdLDel, /* sent us a lame delegation */
nssRcvdOpts, /* sent us some IP options */
nssSentSysQ, /* sent them a sysquery */
nssSentAns, /* sent them an answer */
nssSentFwdQ, /* fwdd a query to them */
nssSentDupQ, /* sent them a retry */
nssSendtoErr, /* error in sendto */
#ifdef XSTATS
nssRcvdQ, /* sent us a query */
nssRcvdIQ, /* sent us an inverse query */
nssRcvdFwdQ, /* sent us a query we had to fwd */
nssRcvdDupQ, /* sent us a retry */
nssRcvdTCP, /* sent us a query using TCP */
nssSentFwdR, /* fwdd a response to them */
nssSentFail, /* sent them a SERVFAIL */
nssSentFErr, /* sent them a FORMERR */
nssSentNaAns, /* sent them a non autoritative answer */
nssSentNXD, /* sent them a negative response */
#endif
nssLast };
struct nameser {
struct in_addr addr; /* key */
u_long stats[nssLast]; /* statistics */
#ifdef notyet
u_int32_t rtt; /* round trip time */
/* XXX - need to add more stuff from "struct qserv", and use our rtt */
u_int16_t flags; /* see below */
#endif
u_int8_t xfers; /* #/xfers running right now */
};
#ifdef NCACHE
#define NOERROR_NODATA 6 /* only used internally by the server, used for
* -ve $ing non-existence of records. 6 is not
* a code used as yet anyway. anant@isi.edu
*/
#define NTTL 600 /* ttl for negative data: 10 minutes? */
#endif /*NCACHE*/
#define VQEXPIRY 900 /* a VQ entry expires in 15*60 = 900 seconds */
#ifdef VALIDATE
#define INVALID 0
#define VALID_NO_CACHE 1
#define VALID_CACHE 2
#define MAXNAMECACHE 100
#define MAXVQ 100 /* Max number of elements in TO_Validate queue */
struct _nameaddr {
struct in_addr ns_addr;
char *nsname;
};
typedef struct _nameaddr NAMEADDR;
struct _to_validate {
int16_t class; /* Name Class */
int16_t type; /* RR type */
char *data; /* RR data */
char *dname; /* Name */
time_t time; /* time at which inserted in queue */
struct _to_validate
*next,
*prev;
};
typedef struct _to_validate TO_Validate;
#endif /*VALIDATE*/
#ifdef DEBUG
# define dprintf(lev, args) (ddt && (debug >= lev) && fprintf args)
#else
# define dprintf(lev, args)
#endif
#ifdef INIT
error "INIT already defined, check system include files"
#endif
#ifdef DECL
error "DECL already defined, check system include files"
#endif
#ifdef MAIN_PROGRAM
#define INIT(x) = x
#define DECL
#else
#define INIT(x)
#define DECL extern
#endif

1094
contrib/bind/named/ns_forw.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,166 @@
/* ns_func.h - declarations for ns_*.c's externally visible functions
*
* $Id: ns_func.h,v 8.9 1996/05/20 15:10:01 vixie Exp $
*/
/* ++from ns_resp.c++ */
extern void ns_resp __P((u_char *, int)),
prime_cache __P((void)),
delete_all __P((struct namebuf *, int, int));
extern struct qinfo *sysquery __P((const char *, int, int,
struct in_addr *, int, int));
extern struct notify *findNotifyPeer __P((const struct zoneinfo *,
struct in_addr));
extern void sysnotify __P((const char *, int, int));
extern int doupdate __P((u_char *, int, u_char *, int,
struct databuf **, int, u_int)),
send_msg __P((u_char *, int, struct qinfo *)),
findns __P((struct namebuf **, int,
struct databuf **, int *, int)),
finddata __P((struct namebuf *, int, int, HEADER *,
char **, int *, int *)),
wanted __P((struct databuf *, int, int)),
add_data __P((struct namebuf *,
struct databuf **,
u_char *, int, int *));
/* --from ns_resp.c-- */
/* ++from ns_req.c++ */
extern void ns_req __P((u_char *, int, int,
struct qstream *,
struct sockaddr_in *,
int)),
free_addinfo __P((void)),
free_nsp __P((struct databuf **));
extern int stale __P((struct databuf *)),
make_rr __P((const char *, struct databuf *,
u_char *, int, int)),
doaddinfo __P((HEADER *, u_char *, int)),
doaddauth __P((HEADER *, u_char *, int,
struct namebuf *,
struct databuf *));
#ifdef BIND_NOTIFY
extern int findZonePri __P((const struct zoneinfo *,
const struct sockaddr_in *));
#endif
/* --from ns_req.c-- */
/* ++from ns_forw.c++ */
extern time_t retrytime __P((struct qinfo *));
extern int ns_forw __P((struct databuf *nsp[],
u_char *msg,
int msglen,
struct sockaddr_in *fp,
struct qstream *qsp,
int dfd,
struct qinfo **qpp,
char *dname,
struct namebuf *np)),
haveComplained __P((const char *, const char *)),
nslookup __P((struct databuf *nsp[],
struct qinfo *qp,
const char *syslogdname,
const char *sysloginfo)),
qcomp __P((struct qserv *, struct qserv *));
extern struct qdatagram *aIsUs __P((struct in_addr));
extern void schedretry __P((struct qinfo *, time_t)),
unsched __P((struct qinfo *)),
retry __P((struct qinfo *)),
qflush __P((void)),
qremove __P((struct qinfo *)),
qfree __P((struct qinfo *));
extern struct qinfo *qfindid __P((u_int16_t)),
#ifdef DMALLOC
*qnew_tagged __P((void));
# define qnew() qnew_tagged(__FILE__, __LINE__)
#else
*qnew();
#endif
/* --from ns_forw.c-- */
/* ++from ns_main.c++ */
extern u_int32_t net_mask __P((struct in_addr));
extern void sqrm __P((struct qstream *)),
sqflush __P((struct qstream *allbut)),
dqflush __P((time_t gen)),
sq_done __P((struct qstream *)),
ns_setproctitle __P((char *, int)),
getnetconf __P((void)),
nsid_init __P((void));
extern u_int16_t nsid_next __P((void));
extern struct netinfo *findnetinfo __P((struct in_addr));
/* --from ns_main.c-- */
/* ++from ns_maint.c++ */
extern void ns_maint __P((void)),
sched_maint __P((void)),
#ifdef CLEANCACHE
remove_zone __P((struct hashbuf *, int, int)),
#else
remove_zone __P((struct hashbuf *, int)),
#endif
#ifdef PURGE_ZONE
purge_zone __P((const char *, struct hashbuf *, int)),
#endif
loadxfer __P((void)),
qserial_query __P((struct zoneinfo *)),
qserial_answer __P((struct qinfo *, u_int32_t));
extern void holdsigchld __P((void));
extern void releasesigchld __P((void));
extern SIG_FN reapchild __P(());
extern void endxfer __P((void));
extern const char * zoneTypeString __P((const struct zoneinfo *));
#ifdef DEBUG
extern void printzoneinfo __P((int));
#endif
/* --from ns_maint.c-- */
/* ++from ns_sort.c++ */
extern struct netinfo *local __P((struct sockaddr_in *));
extern void sort_response __P((u_char *, int,
struct netinfo *,
u_char *));
/* --from ns_sort.c-- */
/* ++from ns_init.c++ */
extern void ns_refreshtime __P((struct zoneinfo *, time_t)),
ns_retrytime __P((struct zoneinfo *, time_t)),
ns_init __P((char *));
extern enum context ns_ptrcontext __P((const char *owner));
extern enum context ns_ownercontext __P((int type, enum transport));
extern int ns_nameok __P((const char *name, int class,
enum transport, enum context));
extern int ns_wildcard __P((const char *name));
/* --from ns_init.c-- */
/* ++from ns_ncache.c++ */
extern void cache_n_resp __P((u_char *, int));
/* --from ns_ncache.c-- */
/* ++from ns_stats.c++ */
extern void ns_stats __P((void));
#ifdef XSTATS
extern void ns_logstats __P((void));
#endif
extern void qtypeIncr __P((int qtype));
extern struct nameser *nameserFind __P((struct in_addr addr, int flags));
#define NS_F_INSERT 0x0001
extern void nameserIncr __P((struct in_addr addr,
enum nameserStats which));
/* --from ns_stats.c-- */
/* ++from ns_validate.c++ */
extern int
#ifdef NCACHE
validate __P((char *, char *, struct sockaddr_in *,
int, int, char *, int, int)),
#else
validate __P((char *, char *, struct sockaddr_in *,
int, int, char *, int)),
#endif
dovalidate __P((u_char *, int, u_char *, int, int,
char *, struct sockaddr_in *, int *)),
update_msg __P((u_char *, int *, int Vlist[], int));
extern void store_name_addr __P((const char *, struct in_addr,
const char *, const char *));
/* --from ns_validate.c-- */

View File

@ -0,0 +1,291 @@
/*
* from ns.h 4.33 (Berkeley) 8/23/90
* $Id: ns_glob.h,v 8.9 1996/05/20 15:10:01 vixie Exp $
*/
/*
* ++Copyright++ 1986
* -
* Copyright (c) 1986
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* Global variables for the name server.
*/
#ifdef DEBUG
DECL int debug INIT(0);
DECL FILE *ddt INIT(NULL);
#endif
/* list of open streams */
DECL struct qstream *streamq INIT(QSTREAM_NULL);
/* list of datagram interfaces */
DECL struct qdatagram *datagramq INIT(QDATAGRAM_NULL);
/* often set to the current time */
DECL struct timeval tt;
/* head of allocated queries */
DECL struct qinfo *nsqhead INIT(QINFO_NULL);
/* list of forwarding hosts */
DECL struct fwdinfo *fwdtab INIT(NULL);
/* datagram socket */
DECL int ds INIT(-1);
/* listening TCP socket */
DECL int vs INIT(-1);
/* received SIGHUP, need to reload db */
DECL int needreload INIT(0);
/* need to call ns_maint()*/
DECL int needmaint INIT(0);
/* how often does ns_maint() need to be called, in seconds? */
/* (beware: this is also the upper bound on named_xfer real time) */
DECL int maint_interval INIT(15*60);
#ifdef CLEANCACHE
/* What's the minimum interval between cache cleanings? */
DECL int cache_interval INIT(60*60);
#endif
#ifdef XSTATS
/* What's the minimum interval between stats output? */
DECL int stats_interval INIT(60*60);
#endif
/* need to process finished zone transfers */
DECL int needendxfer INIT(0);
/* need to reload secondary zone(s) */
DECL int needzoneload INIT(0);
/* need to dump database */
DECL int needToDoadump INIT(0);
/* need to checkpoint cache */
DECL int needToChkpt INIT(0);
/* need to dump statistics */
DECL int needStatsDump INIT(0);
#ifdef ALLOW_UPDATES
/* need to exit (may need to doadump
* first, if database has changed since
* it was last dumped/booted). Gets
* set by shutdown signal handler
* (onintr)
*/
DECL int needToExit INIT(0);
#endif /* ALLOW_UPDATES */
#ifdef XSTATS
/* need to exit
* set by shutdown signal handler
* (onintr)
*/
DECL int needToExit INIT(0);
#endif /* XSTATS */
#ifdef QRYLOG
/* is query logging turned on? */
DECL int qrylog INIT(0);
#endif /*QRYLOG*/
/* should this server not recurse? */
DECL int NoRecurse INIT(0);
/* should this server never fetch glue? */
DECL int NoFetchGlue INIT(0);
/*
* We keep a list of favored networks headed by nettab.
* There are three (possibly empty) parts to this list, in this order:
* 1. directly attached (sub)nets.
* 2. logical networks for directly attached subnetted networks.
* 3. networks from the sort list.
* The value (*elocal) points at the first entry in the second part of the
* list, if any, while (*enettab) points at the first entry in the sort list.
*/
DECL struct netinfo *nettab INIT(NULL);
DECL struct netinfo **elocal INIT(&nettab);
DECL struct netinfo **enettab INIT(&nettab);
#ifdef XFRNETS
/* list of nets we're willing to zone transfer to */
DECL struct netinfo *xfrnets INIT(NULL);
#endif
#ifdef BOGUSNS
/* list of bogus nameservers */
DECL struct netinfo *boglist INIT(NULL);
#endif
/* loopback net */
DECL struct netinfo netloop;
/* port to which we send queries */
DECL u_int16_t ns_port;
/* Source addr of last packet */
DECL struct sockaddr_in from_addr;
/* Used by ns_stats */
DECL time_t boottime,
resettime;
/* next query to retry */
DECL struct qinfo *retryqp INIT(NULL);
/* default boot file */
#ifdef BOOTFILE
DECL char *bootfile INIT(BOOTFILE);
#else
DECL char *bootfile INIT(_PATH_BOOT);
#endif
/* default debug output file */
#ifdef DEBUGFILE
DECL char *debugfile INIT(DEBUGFILE);
#else
DECL char *debugfile INIT(_PATH_DEBUG);
#endif
#ifdef WANT_PIDFILE
/* file to store current named PID */
#ifdef PIDFILE
DECL char *PidFile INIT(PIDFILE);
#else
DECL char *PidFile INIT(_PATH_PIDFILE);
#endif
#endif /*WANT_PIDFILE*/
/* zone information */
DECL struct zoneinfo *zones INIT(NULL);
/* number of zones in use */
DECL int nzones INIT(0);
/* true on slave server */
DECL int forward_only INIT(0);
/* set if we need a priming */
DECL int needs_prime_cache INIT(0);
/* is cache being primed */
DECL int priming INIT(0);
/* ptrs to dnames in msg for dn_comp */
DECL u_char *dnptrs[40];
/* number of names in addinfo */
DECL int addcount;
/* name of cache file */
DECL char *cache_file;
#ifdef LOCALDOM
/* our local domain (deprecated in favor of resolv.conf) */
DECL char *localdomain;
#endif
#ifdef SLAVE_FORWARD
/* retry time when a slave */
DECL int slave_retry INIT(4);
#endif
#ifdef STATSFILE
DECL const char *statsfile INIT(STATSFILE);
#else
DECL const char *statsfile INIT(_PATH_STATS);
#endif
DECL const char sendtoStr[] INIT("sendto");
/* defined in version.c, can't use DECL/INIT */
extern char Version[];
/* max value of xfers_running */
DECL int max_xfers_running INIT(MAX_XFERS_RUNNING);
/* max number of transfers to any given name server */
DECL int max_xfers_per_ns INIT(MAX_XFERS_PER_NS);
#ifndef INVQ
/* should IQUERY be answered bogusly rather than with NOTIMPL? */
DECL int fake_iquery INIT(0);
#endif
enum context { domain_ctx, owner_ctx, mailname_ctx, hostname_ctx };
DECL const char *context_strings[]
#ifdef MAIN_PROGRAM
= { "domain", "owner", "mail", "host", NULL }
#endif
;
enum transport { primary_trans, secondary_trans, response_trans, num_trans };
DECL const char *transport_strings[]
#ifdef MAIN_PROGRAM
= { "primary", "secondary", "response", NULL }
#endif
;
enum severity { ignore, warn, fail };
DECL const char *severity_strings[]
#ifdef MAIN_PROGRAM
= { "ignore", "warn", "fail", NULL }
#endif
;

1110
contrib/bind/named/ns_init.c Normal file

File diff suppressed because it is too large Load Diff

1669
contrib/bind/named/ns_main.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,154 @@
/**************************************************************************
* ns_ncache.c
* author: anant kumar
* last modification: March 17, 1993
*
* implements negative caching
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <syslog.h>
#include <errno.h>
#include <stdio.h>
#include <resolv.h>
#include "named.h"
#ifdef NCACHE
void
cache_n_resp(msg, msglen)
u_char *msg;
int msglen;
{
register struct databuf *dp;
HEADER *hp;
u_char *cp;
char dname[MAXDNAME];
int n;
int type, class;
int Vcode;
int flags;
nameserIncr(from_addr.sin_addr, nssRcvdNXD);
hp = (HEADER *)msg;
cp = msg+HFIXEDSZ;
n = dn_expand(msg, msg + msglen, cp, dname, sizeof dname);
if (n < 0) {
dprintf(1, (ddt, "Query expand name failed:cache_n_resp\n"));
hp->rcode = FORMERR;
return;
}
cp += n;
GETSHORT(type, cp);
GETSHORT(class, cp);
dprintf(1, (ddt,
"ncache: dname %s, type %d, class %d\n",
dname, type, class));
#ifdef VALIDATE
Vcode = validate(dname, dname, &from_addr, type, class, NULL, 0,
hp->rcode == NXDOMAIN ? NXDOMAIN : NOERROR_NODATA);
if (Vcode == INVALID || Vcode == VALID_NO_CACHE) {
/*Valid_no_cache should never occur but doesn't hurt to check*/
return;
}
#endif
#ifdef RETURNSOA
if (hp->rcode==NXDOMAIN) {
u_int32_t ttl;
u_int16_t atype;
u_char * tp = cp;
u_char * cp1;
u_char data[BUFSIZ+MAXDNAME];
int len = sizeof(data);
/* store ther SOA record */
if (!hp->nscount) {
dprintf(3, (ddt, "ncache: nscount == 0\n"));
return;
}
n = dn_skipname(tp, msg + msglen);
if (n < 0) {
dprintf(3, (ddt, "ncache: form error\n"));
return;
}
tp += n;
GETSHORT(atype,tp); /* type */
if (atype != T_SOA) {
dprintf(3, (ddt, "ncache: type (%d) != T_SOA\n",atype));
return;
}
tp += sizeof(u_int16_t); /* class */
GETLONG(ttl,tp); /* ttl */
tp += sizeof(u_int16_t); /* dlen */
if ((n = dn_expand(msg, msg + msglen, tp, data, len))
< 0 ) {
dprintf(3, (ddt, "ncache: form error 2\n"));
return;
} /* origin */
tp += n;
cp1 = data + (n = strlen(data) + 1);
len -= n;
if ((n = dn_expand(msg, msg + msglen, tp, cp1, len)) < 0 ) {
dprintf(3, (ddt, "ncache: form error 2\n"));
return;
} /* mail */
tp += n;
n = strlen(cp1) + 1;
cp1 += n;
len -= n;
bcopy(tp, cp1, n = 5 * sizeof(u_int32_t));
/* serial, refresh, retry, expire, min */
cp1 += n;
len -= n;
/* store the zone of the soa record */
if ((n = dn_expand(msg, msg + msglen, cp, cp1, len)) < 0 ) {
dprintf(3, (ddt, "ncache: form error 2\n"));
return;
}
n = strlen(cp1) + 1;
cp1 += n;
dp = savedata(class, T_SOA, MIN(ttl,NTTL)+tt.tv_sec, data,
cp1 - data);
} else {
#endif
dp = savedata(class, type, NTTL+tt.tv_sec, NULL, 0);
#ifdef RETURNSOA
}
#endif
dp->d_zone = DB_Z_CACHE;
dp->d_cred = hp->aa ? DB_C_AUTH : DB_C_ANSWER;
dp->d_clev = 0;
if(hp->rcode == NXDOMAIN) {
dp->d_rcode = NXDOMAIN;
flags = DB_NODATA|DB_NOTAUTH|DB_NOHINTS;
} else {
dp->d_rcode = NOERROR_NODATA;
flags = DB_NOTAUTH|DB_NOHINTS;
}
if ((n = db_update(dname,dp,dp,flags,hashtab)) != OK) {
dprintf(1, (ddt,
"db_update failed return value:%d, cache_n_resp()\n",
n));
free((char *)dp);
return;
}
dprintf(4, (ddt,
"ncache succeeded: [%s %s %s] rcode:%d ttl:%ld\n",
dname, p_type(type), p_class(class),
dp->d_rcode, (long)(dp->d_ttl-tt.tv_sec)));
return;
}
#endif /*NCACHE*/

2179
contrib/bind/named/ns_req.c Normal file

File diff suppressed because it is too large Load Diff

2743
contrib/bind/named/ns_resp.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,171 @@
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)ns_sort.c 4.10 (Berkeley) 3/3/91";
static char rcsid[] = "$Id: ns_sort.c,v 8.3 1995/12/22 10:20:30 vixie Exp $";
#endif /* not lint */
/*
* ++Copyright++ 1986, 1990
* -
* Copyright (c) 1986, 1990
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <syslog.h>
#include <resolv.h>
#include "named.h"
static int sort_rr __P((u_char *cp, int count, struct netinfo *ntp, u_char *eom));
#ifdef SORT_RESPONSE
struct netinfo *
local(from)
struct sockaddr_in *from;
{
struct netinfo *ntp;
if (from->sin_addr.s_addr == netloop.my_addr.s_addr)
return (&netloop);
for (ntp = nettab; ntp != *enettab; ntp = ntp->next) {
if (ntp->addr == (from->sin_addr.s_addr & ntp->mask))
return (ntp);
}
return (NULL);
}
void
sort_response(cp, ancount, lp, eom)
register u_char *cp;
register int ancount;
struct netinfo *lp;
u_char *eom;
{
register struct netinfo *ntp;
dprintf(3, (ddt, "sort_response(%d)\n", ancount));
if (ancount > 1) {
if (sort_rr(cp, ancount, lp, eom))
return;
for (ntp = nettab; ntp != NULL; ntp = ntp->next) {
if ((ntp->addr == lp->addr) && (ntp->mask == lp->mask))
continue;
if (sort_rr(cp, ancount, ntp, eom))
break;
}
}
}
static int
sort_rr(cp, count, ntp, eom)
register u_char *cp;
int count;
register struct netinfo *ntp;
u_char *eom;
{
int type, class, dlen, n, c;
struct in_addr inaddr;
u_char *rr1;
#ifdef DEBUG
if (debug > 2) {
inaddr.s_addr = ntp->addr;
fprintf(ddt, "sort_rr(%#lx, %d, [%s])\n",
(u_long)cp, count, inet_ntoa(inaddr));
}
#endif
rr1 = NULL;
for (c = count; c > 0; --c) {
n = dn_skipname(cp, eom);
if (n < 0)
return (1); /* bogus, stop processing */
cp += n;
if (cp + QFIXEDSZ > eom)
return (1);
GETSHORT(type, cp);
GETSHORT(class, cp);
cp += INT32SZ;
GETSHORT(dlen, cp);
if (dlen > eom - cp)
return (1); /* bogus, stop processing */
switch (type) {
case T_A:
switch (class) {
case C_IN:
case C_HS:
bcopy(cp, (char *)&inaddr, INADDRSZ);
if (rr1 == NULL)
rr1 = cp;
if ((ntp->mask & inaddr.s_addr) == ntp->addr) {
dprintf(2, (ddt,"net [%s] best choice\n",
inet_ntoa(inaddr)));
if (rr1 != cp) {
bcopy(rr1, cp, INADDRSZ);
bcopy((char *)&inaddr, rr1, INADDRSZ);
}
return (1);
}
break;
}
break;
}
cp += dlen;
}
return (0);
}
#endif

View File

@ -0,0 +1,399 @@
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)ns_stats.c 4.10 (Berkeley) 6/27/90";
static char rcsid[] = "$Id: ns_stats.c,v 8.7 1996/08/05 08:31:30 vixie Exp $";
#endif /* not lint */
/*
* ++Copyright++ 1986,1994
* -
* Copyright (c) 1986,1994
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/**************************************************************************/
/* simple monitoring of named behavior */
/* dumps a bunch of values into a well-known file */
/**************************************************************************/
#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <syslog.h>
#include <errno.h>
#include "named.h"
#include "tree.h"
static u_long typestats[T_ANY+1];
static const char *typenames[T_ANY+1] = {
/* 5 types per line */
"Unknown", "A", "NS", "invalid(MD)", "invalid(MF)",
"CNAME", "SOA", "MB", "MG", "MR",
"NULL", "WKS", "PTR", "HINFO", "MINFO",
"MX", "TXT", "RP", "AFSDB", "X25",
"ISDN", "RT", "NSAP", "NSAP_PTR", "SIG",
"KEY", "PX", "invalid(GPOS)", "AAAA", "LOC",
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
/* 20 per line */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 100 */
"UINFO", "UID", "GID", "UNSPEC", 0, 0, 0, 0, 0, 0,
/* 110 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 120 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 200 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 240 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 250 */
0, 0, "AXFR", "MAILB", "MAILA", "ANY"
};
static void nameserStats __P((FILE *));
void
ns_stats()
{
time_t timenow = time(NULL);
register FILE *f;
register int i;
syslog(LOG_NOTICE, "dumping nameserver stats\n");
if (!(f = fopen(statsfile, "a"))) {
syslog(LOG_NOTICE, "cannot open stat file, \"%s\"\n",
statsfile);
return;
}
fprintf(f, "+++ Statistics Dump +++ (%ld) %s",
(long)timenow, ctime(&timenow));
fprintf(f, "%ld\ttime since boot (secs)\n",
(long)(timenow - boottime));
fprintf(f, "%ld\ttime since reset (secs)\n",
(long)(timenow - resettime));
#ifdef DMALLOC
/* malloc statistics */
dmallocstats(f);
#endif
/* query type statistics */
fprintf(f, "%lu\tUnknown query types\n", (u_long)typestats[0]);
for(i=1; i < T_ANY+1; i++)
if (typestats[i])
if (typenames[i])
fprintf(f, "%lu\t%s queries\n",
(u_long)typestats[i], typenames[i]);
else
fprintf(f, "%lu\ttype %d queries\n",
(u_long)typestats[i], i);
/* name server statistics */
nameserStats(f);
fprintf(f, "--- Statistics Dump --- (%ld) %s",
(long)timenow, ctime(&timenow));
(void) my_fclose(f);
syslog(LOG_NOTICE, "done dumping nameserver stats\n");
}
void
qtypeIncr(qtype)
int qtype;
{
if (qtype < T_A || qtype > T_ANY)
qtype = 0; /* bad type */
typestats[qtype]++;
}
static tree *nameserTree;
static int nameserInit;
#ifdef STATS
static FILE *nameserStatsFile;
static u_long globalStats[nssLast];
static const char *statNames[nssLast] = {
"RR", /* sent us an answer */
"RNXD", /* sent us a negative response */
"RFwdR", /* sent us a response we had to fwd */
"RDupR", /* sent us an extra answer */
"RFail", /* sent us a SERVFAIL */
"RFErr", /* sent us a FORMERR */
"RErr", /* sent us some other error */
"RAXFR", /* sent us an AXFR */
"RLame", /* sent us a lame delegation */
"ROpts", /* sent us some IP options */
"SSysQ", /* sent them a sysquery */
"SAns", /* sent them an answer */
"SFwdQ", /* fwdd a query to them */
"SDupQ", /* sent them a retry */
"SErr", /* sent failed (in sendto) */
#ifdef XSTATS
"RQ", /* sent us a query */
"RIQ", /* sent us an inverse query */
"RFwdQ", /* sent us a query we had to fwd */
"RDupQ", /* sent us a retry */
"RTCP", /* sent us a query using TCP */
"SFwdR", /* fwdd a response to them */
"SFail", /* sent them a SERVFAIL */
"SFErr", /* sent them a FORMERR */
"SNaAns", /* sent them a non autoritative answer */
"SNXD", /* sent them a negative response */
#endif
};
#endif /*STATS*/
static int
nameserCompar(t1, t2)
const tree_t t1, t2;
{
u_int32_t a1 = ntohl(((struct nameser *)t1)->addr.s_addr),
a2 = ntohl(((struct nameser *)t2)->addr.s_addr);
if (a1 < a2)
return (-1);
else if (a1 > a2)
return (1);
else
return (0);
}
struct nameser *
nameserFind(addr, flags)
struct in_addr addr;
int flags;
{
struct nameser dummy;
struct nameser *ns;
if (!nameserInit) {
tree_init(&nameserTree);
nameserInit++;
}
dummy.addr = addr;
ns = (struct nameser *)tree_srch(&nameserTree, nameserCompar,
(tree_t)&dummy);
if (!ns && (flags & NS_F_INSERT)) {
ns = (struct nameser *)malloc(sizeof(struct nameser));
if (!ns) {
nomem: if (!haveComplained("nameserFind complaint", ""))
syslog(LOG_NOTICE,
"nameserFind: malloc failed; %m");
return (NULL);
}
memset(ns, 0, sizeof(struct nameser));
ns->addr = addr;
if (!tree_add(&nameserTree, nameserCompar, (tree_t)ns, NULL)) {
int save = errno;
free(ns);
errno = save;
goto nomem;
}
}
return (ns);
}
void
nameserIncr(addr, which)
struct in_addr addr;
enum nameserStats which;
{
#ifdef STATS
struct nameser *ns = nameserFind(addr, NS_F_INSERT);
if ((int)which < (int)nssLast) {
if (ns)
ns->stats[(int)which]++;
globalStats[(int)which]++;
} else {
syslog(LOG_DEBUG, "nameserIncr([%d], %d): bad 'which'",
inet_ntoa(addr), (int)which);
}
#endif /*STATS*/
}
#ifdef STATS
static void
nameserStatsOut(f, stats)
FILE *f;
u_long stats[];
{
int i;
const char *pre = "\t";
for (i = 0; i < (int)nssLast; i++) {
fprintf(f, "%s%lu", pre, (u_long)stats[i]);
pre = ((i+1) % 5) ? " " : " ";
}
fputc('\n', f);
}
static void
nameserStatsHdr(f)
FILE *f;
{
int i;
const char *pre = "\t";
fprintf(f, "(Legend)\n");
for (i = 0; i < (int)nssLast; i++) {
fprintf(f, "%s%s", pre,
statNames[i] ? statNames[i] : "");
pre = ((i+1) % 5) ? "\t" : "\n\t";
}
fputc('\n', f);
}
static int
nameserStatsTravUAR(t)
tree_t t;
{
struct nameser *ns = (struct nameser *)t;
fprintf(nameserStatsFile, "[%s]\n", /* : rtt %u */
inet_ntoa(ns->addr) /*, ns->rtt*/ );
nameserStatsOut(nameserStatsFile, ns->stats);
return (1);
}
#endif /*STATS*/
static void
nameserStats(f)
FILE *f;
{
#ifndef STATS
fprintf(f, "<<No nameserver statistics in this server>>\n");
#else
nameserStatsFile = f;
fprintf(f, "++ Name Server Statistics ++\n");
nameserStatsHdr(f);
fprintf(f, "(Global)\n");
nameserStatsOut(f, globalStats);
tree_trav(&nameserTree, nameserStatsTravUAR);
fprintf(f, "-- Name Server Statistics --\n");
nameserStatsFile = NULL;
#endif /*STATS*/
}
#ifdef XSTATS
/* Benoit Grange, log minimal statistics, called from ns_maint */
void
ns_logstats()
{
char buffer[1024];
char buffer2[32], header[64];
time_t timenow = time(NULL);
int i;
#ifdef HAVE_GETRUSAGE
# define tv_float(tv) ((tv).tv_sec + ((tv).tv_usec / 1000000.0))
struct rusage usage, childu;
getrusage(RUSAGE_SELF, &usage);
getrusage(RUSAGE_CHILDREN, &childu);
sprintf(buffer, "CPU=%gu/%gs CHILDCPU=%gu/%gs",
tv_float(usage.ru_utime), tv_float(usage.ru_stime),
tv_float(childu.ru_utime), tv_float(childu.ru_stime));
syslog(LOG_INFO, "USAGE %lu %lu %s", (u_long)timenow, (u_long)boottime,
buffer);
# undef tv_float
#endif
sprintf(header, "NSTATS %lu %lu", (u_long)timenow, (u_long)boottime);
strcpy(buffer, header);
for (i = 0; i < T_ANY+1; i++) {
if (typestats[i]) {
if (typenames[i])
sprintf(buffer2, " %s=%lu",
typenames[i], typestats[i]);
else
sprintf(buffer2, " %d=%lu", i, typestats[i]);
if (strlen(buffer) + strlen(buffer2) >
sizeof(buffer) - 1) {
syslog(LOG_INFO, buffer);
strcpy(buffer, header);
}
strcat(buffer, buffer2);
}
}
syslog(LOG_INFO, buffer);
sprintf(header, "XSTATS %lu %lu", (u_long)timenow, (u_long)boottime);
strcpy(buffer, header);
for (i = 0; i < (int)nssLast; i++) {
sprintf(buffer2, " %s=%lu",
statNames[i]?statNames[i]:"?", (u_long)globalStats[i]);
if (strlen(buffer) + strlen(buffer2) > sizeof(buffer) - 1) {
syslog(LOG_INFO, buffer);
strcpy(buffer, header);
}
strcat(buffer, buffer2);
}
syslog(LOG_INFO, buffer);
}
#endif /*XSTATS*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,122 @@
/*
* @(#)pathnames.h 5.4 (Berkeley) 6/1/90
* $Id: pathnames.h,v 8.1 1994/12/15 06:24:14 vixie Exp $
*/
/*
* ++Copyright++ 1989
* -
* Copyright (c) 1989
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#ifdef _PATH_XFER
# define _PATH_XFER_PREDEFINED /* probably from Makefile */
#endif
#if defined (__sgi) && !defined(_SYSTYPE_SVR4) && !defined(__SYSTYPE_SVR4)
#define _PATH_BOOT "/usr/etc/named.d/named.boot"
#else
#define _PATH_BOOT "/etc/named.boot"
#endif
#if defined(BSD) && BSD >= 198810
#include <paths.h>
#ifndef _PATH_XFER
# define _PATH_XFER "/usr/libexec/named-xfer"
#endif
#define _PATH_DEBUG "/var/tmp/named.run"
#define _PATH_DUMPFILE "/var/tmp/named_dump.db"
#ifndef _PATH_PIDFILE
# define _PATH_PIDFILE "/var/run/named.pid"
#endif
#define _PATH_STATS "/var/tmp/named.stats"
#define _PATH_XFERTRACE "/var/tmp/xfer.trace"
#define _PATH_XFERDDT "/var/tmp/xfer.ddt"
#define _PATH_TMPXFER "/var/tmp/xfer.ddt.XXXXXX"
#define _PATH_TMPDIR "/var/tmp"
#else /* BSD */
#define _PATH_DEVNULL "/dev/null"
#define _PATH_TTY "/dev/tty"
#ifndef _PATH_XFER
# define _PATH_XFER "/etc/named-xfer"
#endif
#define _PATH_DEBUG "/usr/tmp/named.run"
#define _PATH_DUMPFILE "/usr/tmp/named_dump.db"
#ifndef _PATH_PIDFILE
# define _PATH_PIDFILE "/etc/named.pid"
#endif
#define _PATH_STATS "/usr/tmp/named.stats"
#define _PATH_XFERTRACE "/usr/tmp/xfer.trace"
#define _PATH_XFERDDT "/usr/tmp/xfer.ddt"
#define _PATH_TMPXFER "/usr/tmp/xfer.ddt.XXXXXX"
#define _PATH_TMPDIR "/usr/tmp"
#endif /* BSD */
#ifndef _PATH_XFER_PREDEFINED
# if defined(__sgi) || defined(NeXT) || defined(__ultrix)
# undef _PATH_XFER
# define _PATH_XFER "/usr/etc/named-xfer"
# endif
# if defined(__osf__)
# undef _PATH_XFER
# define _PATH_XFER "/usr/sbin/named-xfer"
# endif
# ifdef sun
# undef _PATH_XFER
# define _PATH_XFER "/usr/etc/in.named-xfer"
# endif
#else
# undef _PATH_XFER_PREDEFINED
#endif /*_PATH_XFER_PREDEFINED*/

View File

@ -0,0 +1,205 @@
/*
* ++Copyright++ 1985, 1989
* -
* Copyright (c) 1985, 1989
* 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.
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
#include <sys/types.h>
#include <sys/param.h>
#include <syslog.h>
#include "../conf/portability.h"
#include "../conf/options.h"
extern void panic __P((int, const char *));
#ifdef DSTORAGE
/*
* S T O R A G E . C
*
* Ray Tracing program, storage manager.
*
* Functions -
* rt_malloc Allocate storage, with visibility & checking
* rt_free Similarly, free storage
* rt_prmem When debugging, print memory map
* calloc, cfree Which call rt_malloc, rt_free
*
* Author -
* Michael John Muuss
*
* Source -
* SECAD/VLD Computing Consortium, Bldg 394
* The U. S. Army Ballistic Research Laboratory
* Aberdeen Proving Ground, Maryland 21005-5066
*
* Copyright Notice -
* This software is Copyright (C) 1987 by the United States Army.
* All rights reserved.
*/
#ifndef lint
static char RCSid[] = "$Id: storage.c,v 8.2 1996/08/05 08:31:30 vixie Exp $";
#endif
#undef malloc
#undef free
#define MDB_SIZE 20000
#define MDB_MAGIC 0x12348969
struct memdebug {
char *mdb_addr;
char *mdb_str;
int mdb_len;
} rt_mdb[MDB_SIZE];
/*
* R T _ M A L L O C
*/
char *
rt_malloc(cnt)
unsigned int cnt;
{
register char *ptr;
cnt = (cnt+2*sizeof(int)-1)&(~(sizeof(int)-1));
ptr = malloc(cnt);
if( ptr==(char *)0 ) {
panic(errno, "rt_malloc: malloc failure");
} else {
register struct memdebug *mp = rt_mdb;
for( ; mp < &rt_mdb[MDB_SIZE]; mp++ ) {
if( mp->mdb_len > 0 ) continue;
mp->mdb_addr = ptr;
mp->mdb_len = cnt;
mp->mdb_str = "???";
goto ok;
}
syslog(LOG_ERR, "rt_malloc: memdebug overflow\n");
}
ok: ;
{
register int *ip = (int *)(ptr+cnt-sizeof(int));
*ip = MDB_MAGIC;
}
return(ptr);
}
/*
* R T _ F R E E
*/
void
rt_free(ptr)
char *ptr;
{
register struct memdebug *mp = rt_mdb;
for( ; mp < &rt_mdb[MDB_SIZE]; mp++ ) {
if( mp->mdb_len <= 0 ) continue;
if( mp->mdb_addr != ptr ) continue;
{
register int *ip = (int *)(ptr+mp->mdb_len-sizeof(int));
if( *ip != MDB_MAGIC )
panic(-1, "rt_free: corrupt magic");
}
mp->mdb_len = 0; /* successful free */
goto ok;
}
panic(-1, "rt_free: bad pointer");
ok:
*((int *)ptr) = -1; /* zappo! */
free(ptr);
}
/*
* R T _ P R M E M
*
* Print map of memory currently in use.
*/
void
rt_prmem(str)
char *str;
{
register struct memdebug *mp = rt_mdb;
register int *ip;
printf("\nRT memory use\t\t%s\n", str);
for( ; mp < &rt_mdb[MDB_SIZE]; mp++ ) {
if( mp->mdb_len <= 0 ) continue;
ip = (int *)(mp->mdb_addr+mp->mdb_len-sizeof(int));
printf("%7x %5x %s %s\n",
mp->mdb_addr, mp->mdb_len, mp->mdb_str,
*ip!=MDB_MAGIC ? "-BAD-" : "" );
if( *ip != MDB_MAGIC )
printf("\t%x\t%x\n", *ip, MDB_MAGIC);
}
}
char *
calloc(num, size)
register unsigned num, size;
{
register char *p;
size *= num;
if (p = rt_malloc(size))
bzero(p, size);
return (p);
}
cfree(p, num, size)
char *p;
unsigned num;
unsigned size;
{
rt_free(p);
}
#endif /*DSTORAGE*/

570
contrib/bind/named/tree.c Normal file
View File

@ -0,0 +1,570 @@
/* tree - balanced binary tree library
*
* vix 05apr94 [removed vixie.h dependencies; cleaned up formatting, names]
* vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes]
* vix 23jun86 [added delete uar to add for replaced nodes]
* vix 20jun86 [added tree_delete per wirth a+ds (mod2 v.) p. 224]
* vix 06feb86 [added tree_mung()]
* vix 02feb86 [added tree balancing from wirth "a+ds=p" p. 220-221]
* vix 14dec85 [written]
*/
/* This program text was created by Paul Vixie using examples from the book:
* "Algorithms & Data Structures," Niklaus Wirth, Prentice-Hall, 1986, ISBN
* 0-13-022005-1. Any errors in the conversion from Modula-2 to C are Paul
* Vixie's.
*
* This code and associated documentation is hereby placed in the public
* domain, with the wish that my name and Prof. Wirth's not be removed
* from the source or documentation.
*/
#ifndef LINT
static char RCSid[] = "$Id:";
#endif
/*#define DEBUG "tree"*/
#include <stdio.h>
#ifndef _PATH_XFER
# include <stdlib.h>
#else
# include "../conf/portability.h"
#endif
#include "tree.h"
#ifdef DEBUG
static int debugDepth = 0;
static char *debugFuncs[256];
# define ENTER(proc) { \
debugFuncs[debugDepth] = proc; \
fprintf(stderr, "ENTER(%d:%s.%s)\n", \
debugDepth, DEBUG,
debugFuncs[debugDepth]); \
debugDepth++; \
}
# define RET(value) { \
debugDepth--; \
fprintf(stderr, "RET(%d:%s.%s)\n", \
debugDepth, DEBUG, \
debugFuncs[debugDepth]); \
return (value); \
}
# define RETV { \
debugDepth--; \
fprintf(stderr, "RETV(%d:%s.%s)\n", \
debugDepth, DEBUG, \
debugFuncs[debugDepth]); \
return; \
}
# define MSG(msg) fprintf(stderr, "MSG(%s)\n", msg);
#else
# define ENTER(proc) ;
# define RET(value) return (value);
# define RETV return;
# define MSG(msg) ;
#endif
#ifndef TRUE
# define TRUE 1
# define FALSE 0
#endif
static tree * sprout __P( (tree **, tree_t, int *, int (*)(), void (*)()) );
static int delete __P( (tree **, int (*)(), tree_t, void (*)(),
int *, int *) );
static void del __P( (tree **, int *, tree **, void (*)(), int *) );
static void bal_L __P( (tree **, int *) );
static void bal_R __P( (tree **, int *) );
void
tree_init(ppr_tree)
tree **ppr_tree;
{
ENTER("tree_init")
*ppr_tree = NULL;
RETV
}
tree_t
tree_srch(ppr_tree, pfi_compare, p_user)
tree **ppr_tree;
int (*pfi_compare)();
tree_t p_user;
{
register int i_comp;
ENTER("tree_srch")
if (*ppr_tree) {
i_comp = (*pfi_compare)(p_user, (**ppr_tree).data);
if (i_comp > 0)
RET(tree_srch(&(**ppr_tree).right,
pfi_compare,
p_user))
if (i_comp < 0)
RET(tree_srch(&(**ppr_tree).left,
pfi_compare,
p_user))
/* not higher, not lower... this must be the one.
*/
RET((**ppr_tree).data)
}
/* grounded. NOT found.
*/
RET(NULL)
}
tree_t
tree_add(ppr_tree, pfi_compare, p_user, pfv_uar)
tree **ppr_tree;
int (*pfi_compare)();
tree_t p_user;
void (*pfv_uar)();
{
int i_balance = FALSE;
ENTER("tree_add")
if (!sprout(ppr_tree, p_user, &i_balance, pfi_compare, pfv_uar))
RET(NULL)
RET(p_user)
}
int
tree_delete(ppr_p, pfi_compare, p_user, pfv_uar)
tree **ppr_p;
int (*pfi_compare)();
tree_t p_user;
void (*pfv_uar)();
{
int i_balance = FALSE,
i_uar_called = FALSE;
ENTER("tree_delete");
RET(delete(ppr_p, pfi_compare, p_user, pfv_uar,
&i_balance, &i_uar_called))
}
int
tree_trav(ppr_tree, pfi_uar)
tree **ppr_tree;
int (*pfi_uar)();
{
ENTER("tree_trav")
if (!*ppr_tree)
RET(TRUE)
if (!tree_trav(&(**ppr_tree).left, pfi_uar))
RET(FALSE)
if (!(*pfi_uar)((**ppr_tree).data))
RET(FALSE)
if (!tree_trav(&(**ppr_tree).right, pfi_uar))
RET(FALSE)
RET(TRUE)
}
void
tree_mung(ppr_tree, pfv_uar)
tree **ppr_tree;
void (*pfv_uar)();
{
ENTER("tree_mung")
if (*ppr_tree) {
tree_mung(&(**ppr_tree).left, pfv_uar);
tree_mung(&(**ppr_tree).right, pfv_uar);
if (pfv_uar)
(*pfv_uar)((**ppr_tree).data);
free(*ppr_tree);
*ppr_tree = NULL;
}
RETV
}
static tree *
sprout(ppr, p_data, pi_balance, pfi_compare, pfv_delete)
tree **ppr;
tree_t p_data;
int *pi_balance;
int (*pfi_compare)();
void (*pfv_delete)();
{
tree *p1, *p2, *sub;
int cmp;
ENTER("sprout")
/* are we grounded? if so, add the node "here" and set the rebalance
* flag, then exit.
*/
if (!*ppr) {
MSG("grounded. adding new node, setting h=true")
*ppr = (tree *) malloc(sizeof(tree));
if (*ppr) {
(*ppr)->left = NULL;
(*ppr)->right = NULL;
(*ppr)->bal = 0;
(*ppr)->data = p_data;
*pi_balance = TRUE;
}
RET(*ppr);
}
/* compare the data using routine passed by caller.
*/
cmp = (*pfi_compare)(p_data, (*ppr)->data);
/* if LESS, prepare to move to the left.
*/
if (cmp < 0) {
MSG("LESS. sprouting left.")
sub = sprout(&(*ppr)->left, p_data, pi_balance,
pfi_compare, pfv_delete);
if (sub && *pi_balance) { /* left branch has grown */
MSG("LESS: left branch has grown")
switch ((*ppr)->bal) {
case 1: /* right branch WAS longer; bal is ok now */
MSG("LESS: case 1.. bal restored implicitly")
(*ppr)->bal = 0;
*pi_balance = FALSE;
break;
case 0: /* balance WAS okay; now left branch longer */
MSG("LESS: case 0.. balnce bad but still ok")
(*ppr)->bal = -1;
break;
case -1: /* left branch was already too long. rebal */
MSG("LESS: case -1: rebalancing")
p1 = (*ppr)->left;
if (p1->bal == -1) { /* LL */
MSG("LESS: single LL")
(*ppr)->left = p1->right;
p1->right = *ppr;
(*ppr)->bal = 0;
*ppr = p1;
} else { /* double LR */
MSG("LESS: double LR")
p2 = p1->right;
p1->right = p2->left;
p2->left = p1;
(*ppr)->left = p2->right;
p2->right = *ppr;
if (p2->bal == -1)
(*ppr)->bal = 1;
else
(*ppr)->bal = 0;
if (p2->bal == 1)
p1->bal = -1;
else
p1->bal = 0;
*ppr = p2;
} /*else*/
(*ppr)->bal = 0;
*pi_balance = FALSE;
} /*switch*/
} /*if*/
RET(sub)
} /*if*/
/* if MORE, prepare to move to the right.
*/
if (cmp > 0) {
MSG("MORE: sprouting to the right")
sub = sprout(&(*ppr)->right, p_data, pi_balance,
pfi_compare, pfv_delete);
if (sub && *pi_balance) {
MSG("MORE: right branch has grown")
switch ((*ppr)->bal) {
case -1:
MSG("MORE: balance was off, fixed implicitly")
(*ppr)->bal = 0;
*pi_balance = FALSE;
break;
case 0:
MSG("MORE: balance was okay, now off but ok")
(*ppr)->bal = 1;
break;
case 1:
MSG("MORE: balance was off, need to rebalance")
p1 = (*ppr)->right;
if (p1->bal == 1) { /* RR */
MSG("MORE: single RR")
(*ppr)->right = p1->left;
p1->left = *ppr;
(*ppr)->bal = 0;
*ppr = p1;
} else { /* double RL */
MSG("MORE: double RL")
p2 = p1->left;
p1->left = p2->right;
p2->right = p1;
(*ppr)->right = p2->left;
p2->left = *ppr;
if (p2->bal == 1)
(*ppr)->bal = -1;
else
(*ppr)->bal = 0;
if (p2->bal == -1)
p1->bal = 1;
else
p1->bal = 0;
*ppr = p2;
} /*else*/
(*ppr)->bal = 0;
*pi_balance = FALSE;
} /*switch*/
} /*if*/
RET(sub)
} /*if*/
/* not less, not more: this is the same key! replace...
*/
MSG("FOUND: Replacing data value")
*pi_balance = FALSE;
if (pfv_delete)
(*pfv_delete)((*ppr)->data);
(*ppr)->data = p_data;
RET(*ppr)
}
static int
delete(ppr_p, pfi_compare, p_user, pfv_uar, pi_balance, pi_uar_called)
tree **ppr_p;
int (*pfi_compare)();
tree_t p_user;
void (*pfv_uar)();
int *pi_balance;
int *pi_uar_called;
{
tree *pr_q;
int i_comp, i_ret;
ENTER("delete")
if (*ppr_p == NULL) {
MSG("key not in tree")
RET(FALSE)
}
i_comp = (*pfi_compare)((*ppr_p)->data, p_user);
if (i_comp > 0) {
MSG("too high - scan left")
i_ret = delete(&(*ppr_p)->left, pfi_compare, p_user, pfv_uar,
pi_balance, pi_uar_called);
if (*pi_balance)
bal_L(ppr_p, pi_balance);
} else if (i_comp < 0) {
MSG("too low - scan right")
i_ret = delete(&(*ppr_p)->right, pfi_compare, p_user, pfv_uar,
pi_balance, pi_uar_called);
if (*pi_balance)
bal_R(ppr_p, pi_balance);
} else {
MSG("equal")
pr_q = *ppr_p;
if (pr_q->right == NULL) {
MSG("right subtree null")
*ppr_p = pr_q->left;
*pi_balance = TRUE;
} else if (pr_q->left == NULL) {
MSG("right subtree non-null, left subtree null")
*ppr_p = pr_q->right;
*pi_balance = TRUE;
} else {
MSG("neither subtree null")
del(&pr_q->left, pi_balance, &pr_q,
pfv_uar, pi_uar_called);
if (*pi_balance)
bal_L(ppr_p, pi_balance);
}
if (!*pi_uar_called && pfv_uar)
(*pfv_uar)(pr_q->data);
free(pr_q); /* thanks to wuth@castrov.cuc.ab.ca */
i_ret = TRUE;
}
RET(i_ret)
}
static void
del(ppr_r, pi_balance, ppr_q, pfv_uar, pi_uar_called)
tree **ppr_r;
int *pi_balance;
tree **ppr_q;
void (*pfv_uar)();
int *pi_uar_called;
{
ENTER("del")
if ((*ppr_r)->right != NULL) {
del(&(*ppr_r)->right, pi_balance, ppr_q,
pfv_uar, pi_uar_called);
if (*pi_balance)
bal_R(ppr_r, pi_balance);
} else {
if (pfv_uar)
(*pfv_uar)((*ppr_q)->data);
*pi_uar_called = TRUE;
(*ppr_q)->data = (*ppr_r)->data;
*ppr_q = *ppr_r;
*ppr_r = (*ppr_r)->left;
*pi_balance = TRUE;
}
RETV
}
static void
bal_L(ppr_p, pi_balance)
tree **ppr_p;
int *pi_balance;
{
tree *p1, *p2;
int b1, b2;
ENTER("bal_L")
MSG("left branch has shrunk")
switch ((*ppr_p)->bal) {
case -1:
MSG("was imbalanced, fixed implicitly")
(*ppr_p)->bal = 0;
break;
case 0:
MSG("was okay, is now one off")
(*ppr_p)->bal = 1;
*pi_balance = FALSE;
break;
case 1:
MSG("was already off, this is too much")
p1 = (*ppr_p)->right;
b1 = p1->bal;
if (b1 >= 0) {
MSG("single RR")
(*ppr_p)->right = p1->left;
p1->left = *ppr_p;
if (b1 == 0) {
MSG("b1 == 0")
(*ppr_p)->bal = 1;
p1->bal = -1;
*pi_balance = FALSE;
} else {
MSG("b1 != 0")
(*ppr_p)->bal = 0;
p1->bal = 0;
}
*ppr_p = p1;
} else {
MSG("double RL")
p2 = p1->left;
b2 = p2->bal;
p1->left = p2->right;
p2->right = p1;
(*ppr_p)->right = p2->left;
p2->left = *ppr_p;
if (b2 == 1)
(*ppr_p)->bal = -1;
else
(*ppr_p)->bal = 0;
if (b2 == -1)
p1->bal = 1;
else
p1->bal = 0;
*ppr_p = p2;
p2->bal = 0;
}
}
RETV
}
static void
bal_R(ppr_p, pi_balance)
tree **ppr_p;
int *pi_balance;
{
tree *p1, *p2;
int b1, b2;
ENTER("bal_R")
MSG("right branch has shrunk")
switch ((*ppr_p)->bal) {
case 1:
MSG("was imbalanced, fixed implicitly")
(*ppr_p)->bal = 0;
break;
case 0:
MSG("was okay, is now one off")
(*ppr_p)->bal = -1;
*pi_balance = FALSE;
break;
case -1:
MSG("was already off, this is too much")
p1 = (*ppr_p)->left;
b1 = p1->bal;
if (b1 <= 0) {
MSG("single LL")
(*ppr_p)->left = p1->right;
p1->right = *ppr_p;
if (b1 == 0) {
MSG("b1 == 0")
(*ppr_p)->bal = -1;
p1->bal = 1;
*pi_balance = FALSE;
} else {
MSG("b1 != 0")
(*ppr_p)->bal = 0;
p1->bal = 0;
}
*ppr_p = p1;
} else {
MSG("double LR")
p2 = p1->right;
b2 = p2->bal;
p1->right = p2->left;
p2->left = p1;
(*ppr_p)->left = p2->right;
p2->right = *ppr_p;
if (b2 == -1)
(*ppr_p)->bal = 1;
else
(*ppr_p)->bal = 0;
if (b2 == 1)
p1->bal = -1;
else
p1->bal = 0;
*ppr_p = p2;
p2->bal = 0;
}
}
RETV
}

Some files were not shown because too many files have changed in this diff Show More