merge BIND 4.9.6

This commit is contained in:
mrg 1997-10-04 15:11:25 +00:00
parent 7ebb8314c4
commit 3bf140db34
34 changed files with 730 additions and 701 deletions

View File

@ -1,9 +1,9 @@
/* $NetBSD: portability.h,v 1.2 1997/04/13 10:50:11 mrg Exp $ */
/* $NetBSD: portability.h,v 1.3 1997/10/04 15:11:25 mrg Exp $ */
/* portability.h - include or define things that aren't present on all systems
* vixie@decwrl 26dec92 [new]
*
* from: Id: portability.h,v 8.20 1996/11/26 10:11:16 vixie Exp
* from: Id: portability.h,v 8.21 1997/06/01 20:34:27 vixie Exp
*/
/*
@ -191,7 +191,8 @@
#endif
#if defined(_POSIX_SOURCE) || defined(__sgi) || defined(__ultrix) || \
defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || defined(sun)
defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || \
defined(sun) || defined(__m88k__)
# define USE_POSIX
#endif
@ -607,6 +608,16 @@ extern u_long htonl __P((u_long)), ntohl __P((u_long));
# define __BIND_RES_TEXT
#endif
/*
* Motorola FH40.43 and FH40.44 need specific macros for
* get/settimeofday as only one argument seems to be accepted
* by the compiler. NULL generates compile errors
*/
#if defined(__m88k__) && defined(__unix__)
# define gettimeofday(tp, tzp) gettimeofday(tp)
# define settimeofday(tp, tzp) settimeofday(tp)
#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

View File

@ -1,451 +0,0 @@
#
# 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}

View File

@ -1,6 +1,6 @@
.\" $NetBSD: dig.1,v 1.2 1997/04/13 10:50:44 mrg Exp $
.\" $NetBSD: dig.1,v 1.3 1997/10/04 15:11:32 mrg Exp $
.\"
.\" from: Id: dig.1,v 8.1 1994/12/15 06:24:10 vixie Exp
.\" from: Id: dig.1,v 8.2 1997/06/01 20:34:33 vixie Exp
.\"
.\" ++Copyright++ 1993
.\" -
@ -193,7 +193,7 @@ After query returns, execute a
.IR ping (8)
command
for response time comparison. This rather
unelegantly makes a call to the shell. The last
inelegantly makes a call to the shell. The last
three lines of statistics is printed for the
command:
.sp 1

View File

@ -1,4 +1,4 @@
.\" $NetBSD: gethostbyname.3,v 1.2 1997/04/13 10:50:47 mrg Exp $
.\" $NetBSD: gethostbyname.3,v 1.3 1997/10/04 15:11:33 mrg Exp $
.\"
.\" Copyright (c) 1983, 1987 The Regents of the University of California.
.\" All rights reserved.
@ -19,7 +19,7 @@
.\"
.\" @(#)gethostbyname.3 6.12 (Berkeley) 6/23/90
.\"
.TH GETHOSTBYNAME 3 "June 23, 1990"
.TH GETHOSTBYNAME @LIB_NETWORK_EXT_U@ "June 23, 1990"
.UC 5
.SH NAME
gethostbyname, gethostbyaddr, gethostent, sethostent, endhostent, herror \- get network host entry

View File

@ -1,8 +1,61 @@
.\" $NetBSD: host.1,v 1.2 1997/04/13 10:50:50 mrg Exp $
.\" $NetBSD: host.1,v 1.3 1997/10/04 15:11:35 mrg Exp $
.\"
.\" @(#)host.1 e07@nikhef.nl (Eric Wassenaar) 961010
.\"
.TH host 1 "961010"
.\" ++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--
.\" from: Id: host.1,v 8.1 1994/12/15 06:24:10 vixie Exp
.TH HOST 1
.SH NAME
host \- query nameserver about domain names and zones
.SH SYNOPSIS
@ -871,3 +924,18 @@ This program is originally from Rutgers University.
Rewritten by Eric Wassenaar, NIKHEF, <e07@nikhef.nl>
.SH "SEE ALSO"
named(8), resolv.conf(5), resolver(3)
named (8)
.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.

View File

@ -1,4 +1,4 @@
.\" $NetBSD: named.8,v 1.5 1997/09/20 05:16:29 mikel Exp $
.\" $NetBSD: named.8,v 1.6 1997/10/04 15:11:37 mrg Exp $
.\"
.\" ++Copyright++ 1985
.\" -
@ -261,7 +261,7 @@ 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(8) -- this is a lot of data, don't turn it on lightly;
syslogd(8) -- 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;
@ -424,7 +424,7 @@ Turns on debugging; each SIGUSR1 increments debug level.
Turns off debugging completely.
(SIGFPE on older systems without SIGUSR2)
.IP SIGWINCH
Toggles logging of all incoming queries via syslog(3)
Toggles logging of all incoming queries via syslogd(8)
(requires server to have been built with the QRYLOG option).
.SH FILES
.nf
@ -437,7 +437,7 @@ Toggles logging of all incoming queries via syslog(3)
/var/tmp/named.stats nameserver statistics data
.fi
.SH "SEE ALSO"
kill(1), gethostbyname(3), signal(3),
kill(1), gethostbyname(3), signal(2),
resolver(3), resolver(5), hostname(7),
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

@ -1,4 +1,4 @@
/* $NetBSD: named-xfer.c,v 1.3 1997/04/13 10:52:02 mrg Exp $ */
/* $NetBSD: named-xfer.c,v 1.4 1997/10/04 15:12:24 mrg Exp $ */
/*
* The original version of xfer by Kevin Dunlap.
@ -94,7 +94,7 @@ char copyright[] =
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)named-xfer.c 4.18 (Berkeley) 3/7/91";
static char rcsid[] = "$Id: named-xfer.c,v 1.3 1997/04/13 10:52:02 mrg Exp $";
static char rcsid[] = "from: Id: named-xfer.c,v 8.23 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
#include <sys/types.h>
@ -154,14 +154,27 @@ static char *ProgName;
static void usage __P((const char *));
static int getzone __P((struct zoneinfo *, u_int32_t, int)),
print_output __P((u_char *, int, u_char *)),
print_output __P((struct zoneinfo *, u_int32_t,
u_char *, int, u_char *)),
netread __P((int, char *, int, int));
static SIG_FN read_alarm __P(());
static SIG_FN term_handler __P(());
static const char *soa_zinfo __P((struct zoneinfo *, u_char *, u_char*));
struct zoneinfo zp_start, zp_finish;
extern char *optarg;
extern int optind, getopt();
void
cleanup_for_exit() {
#ifdef DEBUG
if (!debug)
#endif
(void) unlink(tmpname);
}
void
main(argc, argv)
int argc;
@ -453,11 +466,8 @@ main(argc, argv)
/* fall through */
case XFER_TIMEOUT:
case XFER_FAIL:
#ifdef DEBUG
if (!debug)
#endif
(void) unlink(tmpname);
exit(result); /* error or timeout */
cleanup_for_exit();
exit(result);
}
/*NOTREACHED*/
}
@ -495,7 +505,12 @@ usage(msg)
#define DEF_DNAME '\001' /* '\0' means the root domain */
/* XXX: The following variables should probably all be "static" */
int minimum_ttl = 0, got_soa = 0;
u_int32_t minimum_ttl = 0;
int soa_cnt = 0;
#ifdef STUBS
int ns_cnt = 0;
#endif
int query_type = 0;
int prev_comment = 0; /* was previous record a comment? */
char zone_top[MAXDNAME]; /* the top of the zone */
char prev_origin[MAXDNAME]; /* from most recent $ORIGIN line */
@ -511,14 +526,13 @@ getzone(zp, serial_no, port)
HEADER *hp;
u_int16_t len;
u_int32_t serial;
int s, n, l, nscnt, soacnt, error = 0;
int s, n, l, error = 0;
u_int cnt;
u_char *cp, *nmp, *eom, *tmp ;
u_char *buf = NULL;
u_int bufsize;
char name[MAXDNAME], name2[MAXDNAME];
struct sockaddr_in sin;
struct zoneinfo zp_start, zp_finish;
#ifdef POSIX_SIGNALS
struct sigaction sv, osv;
#else
@ -550,11 +564,19 @@ getzone(zp, serial_no, port)
/* sv.sa_flags = SA_ONSTACK; */
sigfillset(&sv.sa_mask);
(void) sigaction(SIGALRM, &sv, &osv);
bzero((char *)&sv, sizeof sv);
sv.sa_handler = (SIG_FN (*)()) term_handler;
sigfillset(&sv.sa_mask);
(void) sigaction(SIGTERM, &sv, &osv);
#else
bzero((char *)&sv, sizeof sv);
sv.sv_handler = read_alarm;
sv.sv_mask = ~0;
(void) sigvec(SIGALRM, &sv, &osv);
bzero((char *)&sv, sizeof sv);
sv.sv_handler = term_handler;
sv.sv_mask = ~0;
(void) sigvec(SIGTERM, &sv, &osv);
#endif
strcpy(zone_top, zp->z_origin);
@ -783,8 +805,10 @@ getzone(zp, serial_no, port)
dprintf(1, (ddt, "need update, serial %lu\n",
(u_long)zp_start.z_serial));
hp = (HEADER *) buf;
soacnt = 0;
nscnt = 0;
soa_cnt = 0;
#ifdef STUBS
ns_cnt = 0;
#endif
gettime(&tt);
for (l = Version; l; l = nl) {
size_t len;
@ -807,21 +831,19 @@ getzone(zp, serial_no, port)
inet_ntoa(sin.sin_addr),
ctimel(tt.tv_sec));
for (;;) {
if ((soacnt == 0) || (zp->z_type == Z_STUB)) {
int type;
if ((soa_cnt == 0) || (zp->z_type == Z_STUB)) {
#ifdef STUBS
if (zp->z_type == Z_STUB) {
if (!soacnt)
type = T_SOA;
else if (!nscnt)
type = T_NS;
else
type = T_SOA;
if (soa_cnt == 1 &&
ns_cnt == 0)
query_type = T_NS;
else
query_type = T_SOA;
} else
#endif
type = T_AXFR;
query_type = T_AXFR;
n = res_mkquery(QUERY, zp->z_origin,
curclass, type,
curclass, query_type,
NULL, 0,
NULL, buf, bufsize);
if (n < 0) {
@ -829,7 +851,7 @@ getzone(zp, serial_no, port)
#ifdef STUBS
if (zp->z_type == Z_STUB)
syslog(LOG_INFO,
(type == T_SOA)
(query_type == T_SOA)
? "zone %s: res_mkquery T_SOA failed"
: "zone %s: res_mkquery T_NS failed",
zp->z_origin);
@ -864,13 +886,27 @@ getzone(zp, serial_no, port)
* Receive length & response
*/
if (netread(s, (char *)buf, INT16SZ,
(soacnt == 0) ?300 :XFER_TIMER)
(soa_cnt == 0) ?300 :XFER_TIMER)
< 0) {
error++;
break;
}
if ((len = _getshort(buf)) == 0)
break;
if (len > bufsize) {
buf = (u_char *)realloc(buf, len);
if (buf == NULL) {
syslog(LOG_INFO,
"malloc(%u) failed for packet from server [%s], zone %s\n",
len,
inet_ntoa(sin.sin_addr),
zp->z_origin);
error++;
break;
}
bufsize = len;
}
hp = (HEADER *)buf;
eom = buf + len;
if (netread(s, (char *)buf, len, XFER_TIMER)
< 0) {
@ -909,30 +945,49 @@ getzone(zp, serial_no, port)
if (zp->z_type == Z_STUB) {
ancount = ntohs(hp->ancount);
for (n = cnt = 0 ; cnt < ancount ; cnt++) {
n = print_output(buf, bufsize, cp);
n = print_output(zp, serial_no, buf,
len, cp);
if (n < 0)
break;
cp += n;
}
/*
* If we've processed the answer section and
* didn't get any useful answers, bail out.
*/
if (query_type == T_SOA && soa_cnt == 0) {
syslog(LOG_ERR,
"stubs: no SOA in answer");
error++;
break;
}
if (query_type == T_NS && ns_cnt == 0) {
syslog(LOG_ERR,
"stubs: no NS in answer");
error++;
break;
}
if (n >= 0 && hp->nscount) {
/* we should not get here */
ancount = ntohs(hp->nscount);
for (cnt = 0 ; cnt < ancount ; cnt++) {
n = print_output(buf, bufsize, cp);
if (n < 0)
break;
cp += n;
for (cnt = 0; cnt < ancount; cnt++) {
n = print_output(zp,
serial_no,
buf, len, cp);
if (n < 0)
break;
cp += n;
}
}
ancount = ntohs(hp->arcount);
for (cnt = 0 ; n >= 0 && cnt < ancount ; cnt++) {
n = print_output(buf, bufsize, cp);
for (cnt = 0; n >= 0 && cnt < ancount; cnt++) {
n = print_output(zp, serial_no, buf,
len, cp);
cp += n;
}
if (n < 0) {
syslog(LOG_INFO,
"print_output: unparseable answer (%d), zone %s",
hp->rcode, zp->z_origin);
"print_output: unparseable answer (%d), zone %s",
hp->rcode, zp->z_origin);
error++;
break;
}
@ -943,12 +998,12 @@ getzone(zp, serial_no, port)
error++;
break;
}
} else {
#endif /*STUBS*/
ancount = ntohs(hp->ancount);
for (n = cnt = 0; cnt < ancount; cnt++) {
n = print_output(buf, bufsize, cp);
n = print_output(zp, serial_no, buf,
len, cp);
if (n < 0)
break;
cp += n;
@ -971,98 +1026,10 @@ getzone(zp, serial_no, port)
#ifdef STUBS
}
#endif
GETSHORT(n, tmp);
if (n == T_SOA) {
if (soacnt == 0) {
soacnt++;
if (dn_expand(buf, buf+PACKETSZ, nmp,
name, sizeof name) < 0) {
badsoa_msg = "soa name error";
goto badsoa;
}
if (strcasecmp(name, zp->z_origin)!=0){
syslog(LOG_INFO,
"wrong zone name in AXFR (wanted \"%s\", got \"%s\")",
zp->z_origin, name);
badsoa_msg = "wrong soa name";
goto badsoa;
}
if (eom - tmp
<= 2 * INT16SZ + INT32SZ) {
badsoa_msg = "soa header";
goto badsoa;
}
tmp += 2 * INT16SZ + INT32SZ;
if ((n = dn_skipname(tmp, eom)) < 0) {
badsoa_msg = "soa mname";
goto badsoa;
}
tmp += n;
if ((n = dn_skipname(tmp, eom)) < 0) {
badsoa_msg = "soa hname";
goto badsoa;
}
tmp += n;
if (eom - tmp <= INT32SZ) {
badsoa_msg = "soa dlen";
goto badsoa;
}
GETLONG(serial, tmp);
dprintf(3, (ddt,
"first SOA for %s, serial %lu\n",
name, (u_long)serial));
continue;
}
if (dn_expand(buf, buf+PACKETSZ, nmp,
name2, sizeof name2) == -1) {
badsoa_msg = "soa name error#2";
goto badsoa;
}
if (strcasecmp((char *)name,
(char *)name2) != 0) {
syslog(LOG_INFO,
"got extra SOA for \"%s\" in zone \"%s\"",
name2, name);
continue;
}
tmp -= INT16SZ; /* Put TYPE back. */
badsoa_msg = soa_zinfo(&zp_finish, tmp, eom);
if (badsoa_msg)
goto badsoa;
dprintf(2, (ddt,
"SOA, serial %lu\n",
(u_long)zp_finish.z_serial));
if (serial != zp_finish.z_serial) {
soacnt = 0;
got_soa = 0;
minimum_ttl = 0;
strcpy(prev_origin, zp->z_origin);
prev_dname[0] = DEF_DNAME;
dprintf(1, (ddt,
"serial changed, restart\n"
));
/*
* Flush buffer, truncate file
* and seek to beginning to restart.
*/
fflush(dbfp);
if (ftruncate(fileno(dbfp), 0) != 0) {
if (!quiet)
syslog(LOG_INFO,
"ftruncate %s: %m\n",
tmpname);
return (XFER_FAIL);
}
fseek(dbfp, 0L, 0);
} else
break;
#ifdef STUBS
} else if (zp->z_type == Z_STUB && n == T_NS) {
nscnt++;
} else if (zp->z_type == Z_STUB) {
if (soa_cnt >= 2)
break;
#endif
}
}
(void) my_close(s);
if (error == 0) {
@ -1101,6 +1068,12 @@ getzone(zp, serial_no, port)
return (XFER_FAIL);
}
static SIG_FN
term_handler() {
cleanup_for_exit();
_exit(XFER_FAIL); /* not safe to call exit() from a signal handler */
}
/*
* Set flag saying to read was interrupted
* used for a read timer
@ -1218,7 +1191,9 @@ soa_zinfo(zp, cp, eom)
* Does minimal error checking on the message content.
*/
static int
print_output(msg, msglen, rrp)
print_output(zp, serial_no, msg, msglen, rrp)
struct zoneinfo *zp;
u_int32_t serial_no;
u_char *msg;
int msglen;
u_char *rrp;
@ -1228,11 +1203,13 @@ print_output(msg, msglen, rrp)
u_int32_t addr, ttl;
int i, j, tab, result, class, type, dlen, n1, n;
char data[BUFSIZ];
u_char *cp1, *cp2, *temp_ptr;
u_char *cp1, *cp2, *temp_ptr, *eom, *rr_type_ptr;
u_char *cdata;
char *origin, *proto, dname[MAXDNAME];
char *ignore = "";
const char *badsoa_msg;
eom = msg + msglen;
cp = rrp;
n = dn_expand(msg, msg + msglen, cp, dname, sizeof dname);
if (n < 0) {
@ -1240,6 +1217,7 @@ print_output(msg, msglen, rrp)
return (-1);
}
cp += n;
rr_type_ptr = cp;
GETSHORT(type, cp);
GETSHORT(class, cp);
GETLONG(ttl, cp);
@ -1251,8 +1229,8 @@ print_output(msg, msglen, rrp)
else
origin++; /* move past the '.' */
dprintf(3, (ddt,
"print_output: dname %s type %d class %d ttl %d\n",
dname, type, class, ttl));
"print_output: dname %s type %d class %d ttl %lu\n",
dname, type, class, (u_long)ttl));
/*
* Convert the resource record data into the internal database format.
* CP points to the raw resource record.
@ -1318,6 +1296,10 @@ print_output(msg, msglen, rrp)
cp += n;
cp1 += strlen((char *) cp1) + 1;
if (type == T_SOA) {
if ((eom - cp) < (5 * INT32SZ)) {
hp->rcode = FORMERR;
return (-1);
}
temp_ptr = cp + 4 * INT32SZ;
GETLONG(minimum_ttl, temp_ptr);
n = 5 * INT32SZ;
@ -1377,14 +1359,14 @@ print_output(msg, msglen, rrp)
cp += INT16SZ;
if (type == T_SRV) {
bcopy((char *)cp, data, INT16SZ*2);
bcopy((char *)cp, cp1, INT16SZ*2);
cp1 += INT16SZ*2;
cp += INT16SZ*2;
}
/* get name */
n = dn_expand(msg, msg + msglen, cp,
(char *)cp1, sizeof data - INT16SZ);
(char *)cp1, sizeof data - (cp1-(u_char *)data));
if (n < 0)
return (-1);
cp += n;
@ -1472,13 +1454,99 @@ print_output(msg, msglen, rrp)
result = cp - rrp;
/*
* Only print one SOA per db file
* Special handling for SOA records.
*/
if (type == T_SOA) {
if (got_soa)
if (strcasecmp(dname, zp->z_origin) != 0) {
syslog(LOG_INFO,
"wrong zone name in AXFR (wanted \"%s\", got \"%s\")",
zp->z_origin, dname);
hp->rcode = FORMERR;
return (-1);
}
if (!soa_cnt) {
badsoa_msg = soa_zinfo(&zp_start, rr_type_ptr, eom);
if (badsoa_msg) {
syslog(LOG_INFO,
"malformed SOA for zone %s: %s",
zp->z_origin, badsoa_msg);
hp->rcode = FORMERR;
return (-1);
}
if (SEQ_GT(zp_start.z_serial, serial_no) ||
!serial_no)
soa_cnt++;
else {
syslog(LOG_INFO,
"serial went backwards after transfer started");
return (-1);
}
} else {
badsoa_msg = soa_zinfo(&zp_finish, rr_type_ptr, eom);
if (badsoa_msg) {
syslog(LOG_INFO,
"malformed SOA for zone %s: %s",
zp->z_origin, badsoa_msg);
hp->rcode = FORMERR;
return (-1);
}
dprintf(2, (ddt, "SOA, serial %lu\n",
(u_long)zp_finish.z_serial));
if (zp_start.z_serial != zp_finish.z_serial) {
dprintf(1, (ddt, "serial changed, restart\n"));
soa_cnt = 0;
#ifdef STUBS
ns_cnt = 0;
#endif
minimum_ttl = 0;
strcpy(prev_origin, zp->z_origin);
prev_dname[0] = DEF_DNAME;
/*
* Flush buffer, truncate file
* and seek to beginning to restart.
*/
fflush(dbfp);
if (ftruncate(fileno(dbfp), 0) != 0) {
if (!quiet)
syslog(LOG_INFO,
"ftruncate %s: %m\n",
tmpname);
return (-1);
}
fseek(dbfp, 0L, 0);
return (result);
}
soa_cnt++;
return (result);
}
}
#ifdef STUBS
if (zp->z_type == Z_STUB) {
if (query_type == T_NS && type == T_NS)
ns_cnt++;
/*
* If we're processing a response to an SOA query, we don't
* want to print anything from the response except for the SOA.
* We do want to check everything in the packet, which is
* why we do this check now instead of earlier.
*/
if (query_type == T_SOA && type != T_SOA)
return (result);
}
#endif
if (!soa_cnt || soa_cnt >= 2) {
char *gripe;
if (!soa_cnt)
gripe = "got RR before first SOA";
else
got_soa++;
gripe = "got RR after second SOA";
syslog(LOG_INFO, "%s in zone %s", gripe, zp->z_origin);
hp->rcode = FORMERR;
return (-1);
}
#ifdef NO_GLUE
@ -1572,7 +1640,7 @@ print_output(msg, msglen, rrp)
}
if (ttl != minimum_ttl)
(void) fprintf(dbfp, "%d\t", (int) ttl);
(void) fprintf(dbfp, "%lu\t", (u_long) ttl);
else if (tab)
(void) putc('\t', dbfp);
@ -1839,7 +1907,7 @@ print_output(msg, msglen, rrp)
cp++;
/* orig time to live (TTL)) */
(void) fprintf(dbfp," %d", _getlong((u_char*)cp));
(void) fprintf(dbfp," %lu", (u_long)_getlong((u_char*)cp));
cp += INT32SZ;
/* expiration time */
@ -1875,6 +1943,7 @@ print_output(msg, msglen, rrp)
}
if (ferror(dbfp)) {
syslog(LOG_ERR, "%s: %m", tmpname);
cleanup_for_exit();
exit(XFER_FAIL);
}
return (result);

View File

@ -1,16 +1,17 @@
/* $NetBSD: Version.c,v 1.2 1997/04/13 10:51:05 mrg Exp $ */
/* $NetBSD: Version.c,v 1.3 1997/10/04 15:11:39 mrg Exp $ */
/*
* @(#)Version.c 4.9 (Berkeley) 7/21/90
* from: Id: Version.c,v 8.1 1994/12/15 06:24:14 vixie Exp
* from: Id: Version.c,v 8.2 1997/06/01 20:34:34 vixie Exp
*/
#ifndef lint
char sccsid[] = "@(#)named %VERSION% %WHEN% %WHOANDWHERE%";
char rcsid[] = "from: Id: Version.c,v 8.1 1994/12/15 06:24:14 vixie Exp";
char rcsid[] = "from: Id: Version.c,v 8.2 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
char Version[] = "named %VERSION% %WHEN%\n\t%WHOANDWHERE%";
char ShortVersion[] = "%VERSION%";
#ifdef COMMENT

View File

@ -1,8 +1,8 @@
/* $NetBSD: db_defs.h,v 1.2 1997/04/13 10:51:07 mrg Exp $ */
/* $NetBSD: db_defs.h,v 1.3 1997/10/04 15:11:41 mrg Exp $ */
/*
* from db.h 4.16 (Berkeley) 6/1/90
* from: Id: db_defs.h,v 8.5 1996/08/27 08:33:23 vixie Exp
* from: Id: db_defs.h,v 8.6 1997/06/01 20:34:34 vixie Exp
*/
/*
@ -78,6 +78,9 @@
*/
struct databuf {
struct databuf *d_next; /* linked list */
#ifdef STATS
struct nameser *d_ns; /* NS from whence this came */
#endif
u_int32_t d_ttl; /* time to live */
/* if d_zone == DB_Z_CACHE, then
* d_ttl is actually the time when
@ -93,12 +96,9 @@ struct databuf {
int16_t d_class; /* class number */
int16_t d_type; /* type number */
int16_t d_size; /* size of data area */
u_int32_t d_rcnt;
#ifdef NCACHE
unsigned d_rcode :4; /* rcode added for negative caching */
#endif
unsigned d_rcnt :12;
#ifdef STATS
struct nameser *d_ns; /* NS from whence this came */
#endif
u_int16_t d_nstime; /* NS response time, milliseconds */
u_char d_data[sizeof(char*)]; /* malloc'd (padded) */

View File

@ -1,8 +1,8 @@
/* $NetBSD: db_func.h,v 1.2 1997/04/13 10:51:10 mrg Exp $ */
/* $NetBSD: db_func.h,v 1.3 1997/10/04 15:11:42 mrg Exp $ */
/* db_proc.h - prototypes for functions in db_*.c
*
* from: Id: db_func.h,v 8.12 1996/09/22 00:13:10 vixie Exp
* from: Id: db_func.h,v 8.13 1997/06/01 20:34:34 vixie Exp
*/
/* ++from db_update.c++ */
@ -13,6 +13,7 @@ extern int db_update __P((char name[],
struct hashbuf *htp)),
db_cmp __P((struct databuf *,struct databuf *)),
findMyZone __P((struct namebuf *np, int class));
extern void fixttl __P((struct databuf *dp));
/* --from db_update.c-- */
/* ++from db_reload.c++ */

View File

@ -1,8 +1,8 @@
/* $NetBSD: db_load.c,v 1.2 1997/04/13 10:51:16 mrg Exp $ */
/* $NetBSD: db_load.c,v 1.3 1997/10/04 15:11:44 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)db_load.c 4.38 (Berkeley) 3/2/91";
static char rcsid[] = "from: Id: db_load.c,v 8.31 1996/12/18 04:09:48 vixie Exp";
static char rcsid[] = "from: Id: db_load.c,v 8.32 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
/*
@ -325,6 +325,13 @@ db_load(filename, in_origin, zp, def_domain)
n = n * 10 + (*cp++ - '0');
}
while (isdigit(*cp));
if (*cp != '\0') {
errs++;
syslog(LOG_INFO,
"%s: Line %d: bad TTL: %s.\n",
filename, lineno, buf);
break;
}
if (zp->z_type == Z_CACHE) {
/* this allows the cache entry to age */
/* while sitting on disk (powered off) */
@ -1990,7 +1997,7 @@ get_netlist(fp, netlistp, allow, print_tag)
char *print_tag;
{
struct netinfo *ntp, **end;
char buf[BUFSIZ], *maskp;
char buf[MAXDNAME], *maskp;
struct in_addr ina;
for (end = netlistp; *end; end = &(**end).next)

View File

@ -1,7 +1,7 @@
/* $NetBSD: db_secure.c,v 1.2 1997/04/13 10:51:21 mrg Exp $ */
/* $NetBSD: db_secure.c,v 1.3 1997/10/04 15:11:46 mrg Exp $ */
#ifndef LINT
static char rcsid[] = "from: Id: db_secure.c,v 8.6 1996/05/17 09:10:46 vixie Exp";
static char rcsid[] = "from: Id: db_secure.c,v 8.7 1997/06/01 20:34:34 vixie Exp ";
#endif
/* this file was contributed by Gregory Neil Shapiro of WPI in August 1993 */
@ -31,7 +31,7 @@ build_secure_netlist(zp)
struct zoneinfo *zp;
{
struct netinfo *ntp = NULL, **netlistp, **end;
char buf[BUFSIZ];
char buf[MAXDNAME];
struct hashbuf *htp;
struct namebuf *snp;
struct databuf *dp;

View File

@ -1,8 +1,8 @@
/* $NetBSD: db_update.c,v 1.2 1997/04/13 10:51:23 mrg Exp $ */
/* $NetBSD: db_update.c,v 1.3 1997/10/04 15:11:48 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)db_update.c 4.28 (Berkeley) 3/21/91";
static char rcsid[] = "from: Id: db_update.c,v 8.18 1996/10/08 04:51:03 vixie Exp";
static char rcsid[] = "from: Id: db_update.c,v 8.19 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
/*
@ -73,8 +73,6 @@ static char rcsid[] = "from: Id: db_update.c,v 8.18 1996/10/08 04:51:03 vixie Ex
#include "named.h"
static void fixttl __P((struct databuf *));
/* int
* isRefByNS(name, htp)
* recurse through all of `htp' looking for NS RR's that refer to `name'.
@ -639,7 +637,7 @@ db_update(name, odp, newdp, flags, htp)
return (OK);
}
static void
void
fixttl(dp)
register struct databuf *dp;
{

View File

@ -1,7 +1,7 @@
/* named.h - include the local definitions in the right order
* vix 28aug93 [original]
*
* $Id: named.h,v 1.2 1997/04/13 10:51:27 mrg Exp $
* from: Id: named.h,v 8.1 1994/12/15 06:24:14 vixie Exp
*/
#include "../conf/portability.h"

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_defs.h,v 1.3 1997/10/04 15:11:51 mrg Exp $ */
/*
* from ns.h 4.33 (Berkeley) 8/23/90
* $Id: ns_defs.h,v 1.2 1997/04/13 10:51:28 mrg Exp $
* from: Id: ns_defs.h,v 8.8 1996/09/22 00:13:10 vixie Exp
*/
/*

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_forw.c,v 1.4 1997/10/04 15:11:53 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)ns_forw.c 4.32 (Berkeley) 3/3/91";
static char rcsid[] = "$Id: ns_forw.c,v 1.3 1997/04/21 05:53:58 mrg Exp $";
static char rcsid[] = "from: Id: ns_forw.c,v 8.20 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
/*
@ -559,6 +561,13 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
qs->ns = nsdp;
qs->nsdata = dp;
qs->nretry = 0;
/*
* If this A RR has no RTT, initialize its RTT to a
* small random value.
*/
if (dp->d_nstime == 0)
dp->d_nstime = 1 +
(int)(25.0*rand()/(RAND_MAX + 1.0));
/*
* if we are being asked to fwd a query whose
* nameserver list includes our own name/address(es),

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_func.h,v 1.3 1997/10/04 15:11:55 mrg Exp $ */
/* ns_func.h - declarations for ns_*.c's externally visible functions
*
* $Id: ns_func.h,v 1.2 1997/04/13 10:51:32 mrg Exp $
* from: Id: ns_func.h,v 8.13 1996/11/11 06:36:49 vixie Exp
*/
/* ++from ns_resp.c++ */

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_glob.h,v 1.3 1997/10/04 15:11:56 mrg Exp $ */
/*
* from ns.h 4.33 (Berkeley) 8/23/90
* $Id: ns_glob.h,v 1.2 1997/04/13 10:51:34 mrg Exp $
* from: Id: ns_glob.h,v 8.12 1997/06/01 20:34:34 vixie Exp
*/
/*
@ -248,6 +250,7 @@ DECL const char sendtoStr[] INIT("sendto");
/* defined in version.c, can't use DECL/INIT */
extern char Version[];
extern char ShortVersion[];
/* max value of xfers_running */
DECL int max_xfers_running INIT(MAX_XFERS_RUNNING);

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_init.c,v 1.3 1997/10/04 15:12:00 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)ns_init.c 4.38 (Berkeley) 3/21/91";
static char rcsid[] = "$Id: ns_init.c,v 1.2 1997/04/13 10:51:35 mrg Exp $";
static char rcsid[] = "from: Id: ns_init.c,v 8.25 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
/*
@ -233,7 +235,7 @@ boot_read(filename, includefile)
int includefile;
{
register struct zoneinfo *zp;
char buf[BUFSIZ], obuf[BUFSIZ], *source;
char buf[MAXDNAME], obuf[MAXDNAME], *source;
FILE *fp;
int type;
int class;
@ -576,21 +578,25 @@ boot_read(filename, includefile)
(strcmp(source, zp->z_source) ||
(stat(zp->z_source, &f_time) == -1 ||
(zp->z_ftime != f_time.st_mtime)))) {
dprintf(1, (ddt, "backup file changed\n"));
dprintf(1, (ddt,
"backup file changed or missing\n"));
free(zp->z_source);
zp->z_source = NULL;
zp->z_flags &= ~Z_AUTH;
zp->z_serial = 0; /* force xfer */
if (zp->z_flags & Z_AUTH) {
zp->z_flags &= ~Z_AUTH;
#ifdef CLEANCACHE
remove_zone(hashtab, zp - zones, 1);
remove_zone(hashtab, zp - zones, 1);
#else
remove_zone(hashtab, zp - zones);
remove_zone(hashtab, zp - zones);
#endif
/*
* reload parent so that NS records are
* present during the zone transfer.
*/
do_reload(zp->z_origin, zp->z_type, zp->z_class);
/*
* reload parent so that NS records are
* present during the zone transfer.
*/
do_reload(zp->z_origin, zp->z_type,
zp->z_class);
}
}
if (zp->z_source)
free(source);
@ -674,7 +680,7 @@ static void
get_forwarders(fp)
FILE *fp;
{
char buf[BUFSIZ];
char buf[MAXDNAME];
register struct fwdinfo *fip = NULL, *ftp = NULL;
#ifdef SLAVE_FORWARD

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_main.c,v 1.5 1997/10/04 15:12:02 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91";
static char rcsid[] = "$Id: ns_main.c,v 1.4 1997/04/21 05:54:00 mrg Exp $";
static char rcsid[] = "from: Id: ns_main.c,v 8.25 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
/*
@ -172,7 +174,7 @@ main(argc, argv, envp)
const int on = 1;
int rfd, size, len;
time_t lasttime, maxctime;
u_char buf[BUFSIZ];
u_char buf[PACKETSZ];
#ifdef NeXT
int old_sigmask;
#endif
@ -833,7 +835,7 @@ main(argc, argv, envp)
malloc(rbufsize))
) {
sp->s_buf = buf;
sp->s_size = sizeof(buf);
sp->s_bufsize=sizeof(buf);
} else {
sp->s_bufsize = rbufsize;
}
@ -866,6 +868,12 @@ main(argc, argv, envp)
sp->s_bufp += n;
sp->s_size -= n;
}
if (sp->s_size > 0 &&
(n == -1) &&
(errno == PORT_WOULDBLK))
continue;
/*
* we don't have enough memory for the query.
* if we have a query id, then we will send an
@ -886,8 +894,10 @@ main(argc, argv, envp)
(void) writemsg(sp->s_rfd, sp->s_buf,
HFIXEDSZ);
}
sqrm(sp);
continue;
}
/*
* If the message is too short to contain a valid
* header, try to send back an error, and drop the
@ -908,10 +918,9 @@ main(argc, argv, envp)
(void) writemsg(sp->s_rfd, sp->s_buf,
HFIXEDSZ);
}
sqrm(sp);
continue;
}
if ((n == -1) && (errno == PORT_WOULDBLK))
continue;
if (n <= 0) {
sqrm(sp);
continue;

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_maint.c,v 1.3 1997/10/04 15:12:04 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)ns_maint.c 4.39 (Berkeley) 3/2/91";
static char rcsid[] = "$Id: ns_maint.c,v 1.2 1997/04/13 10:51:38 mrg Exp $";
static char rcsid[] = "from: Id: ns_maint.c,v 8.18 1996/09/22 00:13:10 vixie Exp ";
#endif /* not lint */
/*

View File

@ -69,7 +69,7 @@ cache_n_resp(msg, msglen)
u_int16_t atype;
u_char *tp = cp;
u_char *cp1;
u_char data[BUFSIZ+MAXDNAME];
u_char data[MAXDNAME*2 + INT32SZ*5];
size_t len = sizeof data;
/* we store NXDOMAIN as T_SOA regardless of the query type */

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_req.c,v 1.4 1997/10/04 15:12:07 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)ns_req.c 4.47 (Berkeley) 7/1/91";
static char rcsid[] = "$Id: ns_req.c,v 1.3 1997/04/21 05:54:02 mrg Exp $";
static char rcsid[] = "from: Id: ns_req.c,v 8.28 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
/*
@ -497,7 +499,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
PUTLONG(0, *cpp); /* TTL */
tp = *cpp; /* Temp RdLength */
PUTSHORT(0, *cpp);
copyCharString(cpp, Version);
copyCharString(cpp, ShortVersion);
PUTSHORT((*cpp) - (tp + INT16SZ), tp); /* Real RdLength */
*msglenp = *cpp - msg; /* Total message length */
return (Finish);
@ -1694,7 +1696,7 @@ doaxfr(np, rfp, top, class)
struct namebuf *tnp; /* top namebuf */
struct databuf *tdp; /* top databuf */
struct namebuf **npp, **nppend;
u_char msg[PACKETSZ];
u_char msg[64*1024];
u_char *cp;
const char *fname;
char dname[MAXDNAME];
@ -2010,8 +2012,8 @@ startxfr(qsp, np, soa, soalen, class, dname)
*/
setsockopt(qsp->s_rfd, SOL_SOCKET, SO_LINGER,
(char *)&ll, sizeof ll);
close(qsp->s_rfd);
#endif
close(qsp->s_rfd);
_exit(0);
/* NOTREACHED */
}

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_resp.c,v 1.4 1997/10/04 15:12:09 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char sccsid[] = "@(#)ns_resp.c 4.65 (Berkeley) 3/3/91";
static char rcsid[] = "$Id: ns_resp.c,v 1.3 1997/04/21 05:54:05 mrg Exp $";
static char rcsid[] = "from: Id: ns_resp.c,v 8.38 1997/06/01 20:34:34 vixie Exp vixie ";
#endif /* not lint */
/*
@ -126,6 +128,7 @@ struct flush_set {
int fs_class;
u_int fs_cred;
struct db_list *fs_list;
struct db_list *fs_last;
};
static void rrsetadd __P((struct flush_set *, char *,
@ -136,7 +139,18 @@ static int rrsetcmp __P((char *, struct db_list *)),
check_root __P((void)),
check_ns __P((void)),
rrextract __P((u_char *, int, u_char *,
struct databuf **, char *, int));
struct databuf **, char *, int,
char **));
static void add_related_additional __P((char *));
static void free_related_additional __P((void));
static int related_additional __P((char *));
static void maybe_free __P((char **));
#define MAX_RELATED 100
static int num_related = 0;
static char *related[MAX_RELATED];
#ifdef LAME_LOGGING
static char *
@ -230,11 +244,11 @@ ns_resp(msg, msglen)
struct flush_set *flushset;
struct sockaddr_in *nsa;
struct databuf *nsp[NSMAX];
int i, c, n, qdcount, ancount, aucount, nscount, arcount;
int i, c, n, qdcount, ancount, aucount, nscount, arcount, arfirst;
int qtype, qclass, dbflags;
int restart; /* flag for processing cname response */
int validanswer;
int cname, lastwascname;
int cname, lastwascname, externalcname;
int count, founddata, foundname;
int buflen;
int newmsglen;
@ -250,6 +264,9 @@ ns_resp(msg, msglen)
struct namebuf *np;
struct netinfo *lp;
struct fwdinfo *fwd;
char *tname = NULL;
free_related_additional();
nameserIncr(from_addr.sin_addr, nssRcvdR);
nsp[0] = NULL;
@ -690,7 +707,8 @@ ns_resp(msg, msglen)
/*
* Add the info received in the response to the data base.
*/
c = ancount + aucount + arcount;
arfirst = ancount + aucount;
c = arfirst + arcount;
/* -ve $ing non-existence of record, must handle non-authoritative
* NOERRORs with c == 0.
@ -754,6 +772,7 @@ ns_resp(msg, msglen)
nscount = 0;
cname = 0;
lastwascname = 0;
externalcname = 0;
strcpy(aname, qname);
if (count) {
@ -769,12 +788,14 @@ ns_resp(msg, msglen)
struct databuf *dp;
int type;
maybe_free(&tname);
if (cp >= eom) {
formerrmsg = outofDataFinal;
goto formerr;
}
n = rrextract(msg, msglen, cp, &dp, name, sizeof name);
n = rrextract(msg, msglen, cp, &dp, name, sizeof name, &tname);
if (n < 0) {
maybe_free(&tname);
formerrmsg = outofDataFinal;
goto formerr;
}
@ -784,15 +805,23 @@ ns_resp(msg, msglen)
type = dp->d_type;
if (i < ancount) {
/* Answer section. */
if (strcasecmp(name, aname) != 0) {
syslog(LOG_DEBUG, "wrong ans. name (%s != %s)",
name, aname);
if (externalcname || strcasecmp(name, aname) != 0) {
if (!externalcname)
syslog(LOG_DEBUG,
"wrong ans. name (%s != %s)",
name, aname);
else
dprintf(3, (ddt,
"ignoring answer '%s' after external cname\n",
name));
db_free(dp);
continue;
}
if (type == T_CNAME &&
qtype != T_CNAME && qtype != T_ANY) {
strcpy(aname, (char *)dp->d_data);
if (!samedomain(aname, qp->q_domain))
externalcname = 1;
cname = 1;
lastwascname = 1;
} else {
@ -800,27 +829,95 @@ ns_resp(msg, msglen)
lastwascname = 0;
}
if (tname != NULL) {
add_related_additional(tname);
tname = NULL;
}
dp->d_cred = (hp->aa && !strcasecmp(name, qname))
? DB_C_AUTH
: DB_C_ANSWER;
} else {
/* After answer section. */
if (lastwascname) {
dprintf(3, (ddt,
"last was cname, ignoring auth. and add.\n"));
db_free(dp);
break;
}
if (i < ancount + aucount && type == T_NS) {
if (i < arfirst) {
/* Authority section. */
if (!samedomain(aname, name) ||
(!cname && !samedomain(name, qp->q_domain))
) {
switch (type) {
case T_NS:
case T_SOA:
if (!samedomain(aname, name)){
syslog(LOG_DEBUG,
"bad referral (%s !< %s)",
aname[0] ? aname : ".",
name[0] ? name : ".");
db_free(dp);
continue;
} else if (!samedomain(name,
qp->q_domain)) {
if (!externalcname)
syslog(LOG_DEBUG,
"bad referral (%s !< %s)",
name[0] ? name : ".",
qp->q_domain[0] ?
qp->q_domain : ".");
db_free(dp);
continue;
}
if (type == T_NS) {
nscount++;
add_related_additional(tname);
tname = NULL;
}
break;
case T_NXT:
case T_SIG:
break;
default:
syslog(LOG_DEBUG,
"bad referral (%s !< %s)",
name, qp->q_domain);
"invalid RR type '%s' in authority section (name = '%s') from %s",
p_type(type), name,
sin_ntoa(&from_addr));
db_free(dp);
continue;
}
} else {
/* Additional section. */
switch (type) {
case T_A:
case T_AAAA:
if (externalcname ||
!samedomain(name, qp->q_domain)) {
dprintf(3, (ddt,
"ignoring additional info '%s' type %s\n",
name, p_type(type)));
db_free(dp);
continue;
}
if (!related_additional(name)) {
syslog(LOG_DEBUG,
"unrelated additional info '%s' type %s from %s",
name, p_type(type),
sin_ntoa(&from_addr));
db_free(dp);
continue;
}
break;
case T_KEY:
case T_SIG:
break;
default:
syslog(LOG_DEBUG,
"invalid RR type '%s' in additional section (name = '%s') from %s",
p_type(type), name,
sin_ntoa(&from_addr));
db_free(dp);
continue;
}
nscount++;
}
dp->d_cred = (qp->q_flags & Q_PRIMING)
? DB_C_ANSWER
@ -828,6 +925,7 @@ ns_resp(msg, msglen)
}
rrsetadd(flushset, name, dp);
}
maybe_free(&tname);
if (flushset) {
rrsetupdate(flushset, dbflags);
for (i = 0; i < count; i++)
@ -835,7 +933,7 @@ ns_resp(msg, msglen)
free(flushset[i].fs_name);
free((char*)flushset);
}
if (lastwascname)
if (lastwascname && !externalcname)
syslog(LOG_DEBUG, "%s (%s)", danglingCname, aname);
if (cp > eom) {
@ -1102,7 +1200,11 @@ ns_resp(msg, msglen)
qp->q_fwd = fwdtab;
getname(np, tmpdomain, sizeof tmpdomain);
if (qp->q_domain != NULL)
free(qp->q_domain);
qp->q_domain = strdup(tmpdomain);
if (qp->q_domain == NULL)
panic(ENOMEM, "ns_resp: strdup failed");
if ((n = nslookup(nsp, qp, dname, "ns_resp")) <= 0) {
if (n < 0) {
@ -1148,17 +1250,20 @@ ns_resp(msg, msglen)
qp->q_cmsglen = qp->q_msglen;
} else if (qp->q_msg)
(void) free(qp->q_msg);
if ((qp->q_msg = (u_char *)malloc(BUFSIZ)) == NULL) {
if ((qp->q_msg = (u_char *)malloc(PACKETSZ)) == NULL) {
syslog(LOG_NOTICE, "resp: malloc error\n");
goto servfail;
}
n = res_mkquery(QUERY, dname, qclass, qtype,
NULL, 0, NULL, qp->q_msg, BUFSIZ);
NULL, 0, NULL, qp->q_msg, PACKETSZ);
if (n < 0) {
syslog(LOG_INFO, "resp: res_mkquery(%s) failed",
dname);
goto servfail;
}
if (qp->q_name != NULL)
free(qp->q_name);
qp->q_name = savestr(dname);
qp->q_msglen = n;
hp = (HEADER *) qp->q_msg;
hp->rd = 0;
@ -1258,29 +1363,35 @@ ns_resp(msg, msglen)
(void) send_msg((u_char *)hp, (qp->q_cmsglen ? qp->q_cmsglen : qp->q_msglen),
qp);
timeout:
if (qp->q_stream != QSTREAM_NULL)
sqrm(qp->q_stream);
qremove(qp);
free_nsp(nsp);
return;
}
static int
rrextract(msg, msglen, rrp, dpp, dname, namelen)
rrextract(msg, msglen, rrp, dpp, dname, namelen, tnamep)
u_char *msg;
int msglen;
u_char *rrp;
struct databuf **dpp;
char *dname;
int namelen;
char **tnamep;
{
register u_char *cp;
register int n;
int class, type, dlen, n1;
u_int32_t ttl;
u_char *cp1;
u_char data[BUFSIZ];
u_char data[MAXDNAME*2 + INT32SZ*5];
register HEADER *hp = (HEADER *)msg;
enum context context;
if (tnamep != NULL)
*tnamep = NULL;
*dpp = NULL;
cp = rrp;
if ((n = dn_expand(msg, msg + msglen, cp, dname, namelen)) < 0) {
@ -1365,6 +1476,8 @@ rrextract(msg, msglen, rrp, dpp, dname, namelen)
cp += n;
cp1 = data;
n = strlen((char *)data) + 1;
if (tnamep != NULL && (type == T_NS || type == T_MB))
*tnamep = strdup((char *)cp1);
break;
case T_SOA:
@ -1472,7 +1585,7 @@ rrextract(msg, msglen, rrp, dpp, dname, namelen)
if (type == T_SRV) {
/* Grab weight and port. */
bcopy(cp, data, INT16SZ*2);
bcopy(cp, cp1, INT16SZ*2);
cp1 += INT16SZ*2;
cp += INT16SZ*2;
}
@ -1491,6 +1604,9 @@ rrextract(msg, msglen, rrp, dpp, dname, namelen)
}
cp += n;
if (tnamep != NULL)
*tnamep = strdup((char *)cp1);
/* compute end of data */
cp1 += strlen((char *)cp1) + 1;
/* compute size of data */
@ -1650,12 +1766,12 @@ doupdate(msg, msglen, rrp, zone, savens, flags, cred)
int class, type;
struct databuf *dp;
char dname[MAXDNAME];
u_char data[BUFSIZ+MAX_MD5RSA_KEY_BYTES];
dprintf(3, (ddt, "doupdate(zone %d, savens %#lx, flags %#lx)\n",
zone, (u_long)savens, (u_long)flags));
if ((n = rrextract(msg, msglen, rrp, &dp, dname, sizeof(dname))) == -1)
if ((n = rrextract(msg, msglen, rrp, &dp, dname, sizeof(dname), NULL))
== -1)
return (-1);
if (!dp)
return (-1);
@ -1676,7 +1792,7 @@ doupdate(msg, msglen, rrp, zone, savens, flags, cred)
}
#endif
if (!bogus &&
((temp = strrchr((char *)data, '.')) != NULL) &&
((temp = strrchr((char *)dp->d_data, '.')) != NULL) &&
!strcasecmp(temp, ".arpa")
)
bogus++;
@ -1692,7 +1808,7 @@ doupdate(msg, msglen, rrp, zone, savens, flags, cred)
"bogus root NS"))
syslog(LOG_NOTICE,
"bogus root NS %s rcvd from %s on query for \"%s\"",
data, sin_ntoa(&from_addr), qname);
dp->d_data, sin_ntoa(&from_addr), qname);
db_free(dp);
return (cp - rrp);
}
@ -1703,7 +1819,7 @@ doupdate(msg, msglen, rrp, zone, savens, flags, cred)
"bogus nonroot NS"))
syslog(LOG_INFO,
"bogus nonroot NS %s rcvd from %s on query for \"%s\"",
data, sin_ntoa(&from_addr), qname);
dp->d_data, sin_ntoa(&from_addr), qname);
db_free(dp);
return (cp - rrp);
}
@ -2024,17 +2140,19 @@ sysquery(dname, class, type, nss, nsc, opcode)
qp->q_flags |= Q_SYSTEM;
getname(np, tmpdomain, sizeof tmpdomain);
if (qp->q_domain != NULL)
free(qp->q_domain);
qp->q_domain = strdup(tmpdomain);
if (!qp->q_domain)
if (qp->q_domain == NULL)
panic(ENOMEM, "ns_resp: strdup failed");
if ((qp->q_msg = (u_char *)malloc(BUFSIZ)) == NULL) {
if ((qp->q_msg = (u_char *)malloc(PACKETSZ)) == NULL) {
syslog(LOG_NOTICE, "sysquery: malloc failed");
goto err2;
}
n = res_mkquery(opcode, dname, class,
type, NULL, 0, NULL,
qp->q_msg, BUFSIZ);
qp->q_msg, PACKETSZ);
if (n < 0) {
syslog(LOG_INFO, "sysquery: res_mkquery(%s) failed", dname);
goto err2;
@ -2734,19 +2852,25 @@ rrsetadd(flushset, name, dp)
fs->fs_type = dp->d_type;
fs->fs_cred = dp->d_cred;
fs->fs_list = NULL;
fs->fs_last = NULL;
}
dbl = (struct db_list *)malloc(sizeof(struct db_list));
if (!dbl)
panic(-1, "rrsetadd: out of memory");
dbl->db_next = fs->fs_list;
dbl->db_next = NULL;
dbl->db_dp = dp;
fs->fs_list = dbl;
if (fs->fs_last == NULL)
fs->fs_list = dbl;
else
fs->fs_last->db_next = dbl;
fs->fs_last = dbl;
}
static int
ttlcheck(name,dbl)
ttlcheck(name,dbl,update)
char *name;
struct db_list *dbl;
int update;
{
int type = dbl->db_dp->d_type;
int class = dbl->db_dp->d_class;
@ -2770,6 +2894,9 @@ ttlcheck(name,dbl)
if (!match(dp, class, type))
continue;
if (first) {
/* we can't update zone data so return early */
if (dp->d_zone != 0)
return(0);
ttl = dp->d_ttl;
first = 0;
} else if (ttl != dp->d_ttl) {
@ -2797,6 +2924,19 @@ ttlcheck(name,dbl)
}
dbp = dbp->db_next;
}
/* update ttl if required */
if (update) {
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
if (!match(dp, class, type))
continue;
if (dp->d_ttl > ttl)
break;
dp->d_ttl = ttl;
fixttl(dp);
}
}
return(1);
}
@ -2877,8 +3017,8 @@ rrsetupdate(flushset, flags)
while (fs->fs_name) {
dprintf(1,(ddt, "rrsetupdate: %s\n",
fs->fs_name[0] ? fs->fs_name : "."));
if ((n = rrsetcmp(fs->fs_name,fs->fs_list)) &&
ttlcheck(fs->fs_name,fs->fs_list)) {
if ((n = rrsetcmp(fs->fs_name, fs->fs_list)) &&
ttlcheck(fs->fs_name, fs->fs_list, 0)) {
if (n > 0)
flushrrset(fs);
@ -2895,6 +3035,8 @@ rrsetupdate(flushset, flags)
free((char *)odbp);
}
} else {
if (n == 0)
(void)ttlcheck(fs->fs_name, fs->fs_list, 1);
dbp = fs->fs_list;
while (dbp) {
db_free(dbp->db_dp);
@ -2980,3 +3122,49 @@ delete_stale(np)
}
}
}
static void
add_related_additional(name)
char *name;
{
int i;
if (num_related >= MAX_RELATED - 1)
return;
for (i = 0; i < num_related; i++)
if (strcasecmp(name, related[i]) == 0)
return;
related[num_related++] = name;
}
static void
free_related_additional() {
int i;
for (i = 0; i < num_related; i++)
free(related[i]);
num_related = 0;
}
static int
related_additional(name)
char *name;
{
int i;
for (i = 0; i < num_related; i++)
if (strcasecmp(name, related[i]) == 0)
return (1);
return (0);
}
static void
maybe_free(tname)
char **tname;
{
if (tname == NULL || *tname == NULL)
return;
free(*tname);
*tname = NULL;
}

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_sort.c,v 1.3 1997/10/04 15:12:11 mrg Exp $ */
#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 1.2 1997/04/13 10:51:47 mrg Exp $";
static char rcsid[] = "$Id: ns_sort.c,v 8.3 1995/12/22 10:20:30 vixie Exp ";
#endif /* not lint */
/*

View File

@ -1,6 +1,8 @@
/* $NetBSD: ns_stats.c,v 1.3 1997/10/04 15:12:12 mrg Exp $ */
#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 1.2 1997/04/13 10:51:49 mrg Exp $";
static char rcsid[] = "from: Id: ns_stats.c,v 8.8 1996/09/22 00:13:10 vixie Exp ";
#endif /* not lint */
/*

View File

@ -1,5 +1,7 @@
/* $NetBSD: ns_udp.c,v 1.3 1997/10/04 15:12:14 mrg Exp $ */
#if !defined(lint) && !defined(SABER)
static char rcsid[] = "$Id: ns_udp.c,v 1.2 1997/04/13 10:51:50 mrg Exp $";
static char rcsid[] = "from: Id: ns_udp.c,v 8.3 1996/08/27 08:33:23 vixie Exp ";
#endif /* not lint */
/*

View File

@ -609,7 +609,7 @@ dovalidate(msg, msglen, rrp, zone, flags, qdomain, server, VCode)
u_int32_t ttl;
char dname[MAXDNAME];
u_char *cp1;
u_char data[BUFSIZ];
u_char data[MAXDNAME*2 + INT32SZ*5];
register HEADER *hp = (HEADER *) msg;
dprintf(2, (ddt, "dovalidate(zone %d, flags %x)\n",

View File

@ -1,6 +1,8 @@
/* $NetBSD: pathnames.h,v 1.3 1997/10/04 15:12:17 mrg Exp $ */
/*
* @(#)pathnames.h 5.4 (Berkeley) 6/1/90
* $Id: pathnames.h,v 1.2 1997/04/13 10:51:53 mrg Exp $
* from: Id: pathnames.h,v 8.1 1994/12/15 06:24:14 vixie Exp
*/
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: storage.c,v 1.3 1997/10/04 15:12:18 mrg Exp $ */
/*
* ++Copyright++ 1985, 1989
* -
@ -86,7 +88,7 @@ extern void panic __P((int, const char *));
* All rights reserved.
*/
#ifndef lint
static char RCSid[] = "$Id: storage.c,v 1.2 1997/04/13 10:51:54 mrg Exp $";
static char RCSid[] = "from: Id: storage.c,v 8.2 1996/08/05 08:31:30 vixie Exp ";
#endif
#undef malloc

View File

@ -1,9 +1,11 @@
/* $NetBSD: tree.h,v 1.3 1997/10/04 15:12:19 mrg Exp $ */
/* tree.h - declare structures used by tree library
*
* vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes]
* vix 27jun86 [broken out of tree.c]
*
* $Id: tree.h,v 1.2 1997/04/13 10:51:57 mrg Exp $
* from: Id: tree.h,v 8.1 1994/12/15 06:24:14 vixie Exp
*/

View File

@ -1,3 +1,91 @@
/* $NetBSD: version.c,v 1.2 1997/04/13 10:51:58 mrg Exp $ */
/* $NetBSD: version.c,v 1.3 1997/10/04 15:12:21 mrg Exp $ */
char Version[] = "named 4.9.5-P1";
/*
* @(#)Version.c 4.9 (Berkeley) 7/21/90
* from: Id: Version.c,v 8.2 1997/06/01 20:34:34 vixie Exp
*/
#ifndef lint
char sccsid[] = "@(#)named 4.9.6";
char rcsid[] = "from: Id: Version.c,v 8.2 1997/06/01 20:34:34 vixie Exp ";
#endif /* not lint */
char Version[] = "named 4.9.6";
char ShortVersion[] = "4.9.6";
#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

@ -1,7 +1,8 @@
#!/bin/sh -
# $NetBSD: named.reload.sh,v 1.3 1997/10/04 15:12:28 mrg Exp $
#
# from named.reload 5.2 (Berkeley) 6/27/89
# $Id: named.reload.sh,v 1.2 1997/04/13 10:52:22 mrg Exp $
# from: Id: named.reload.sh,v 8.1 1994/12/15 06:24:14 vixie Exp
#
exec %DESTSBIN%/%INDOT%ndc reload

View File

@ -1,7 +1,8 @@
#!/bin/sh -
# $NetBSD: named.restart.sh,v 1.3 1997/10/04 15:12:31 mrg Exp $
#
# from named.restart 5.4 (Berkeley) 6/27/89
# $Id: named.restart.sh,v 1.2 1997/04/13 10:52:23 mrg Exp $
# from: Id: named.restart.sh,v 8.1 1994/12/15 06:24:14 vixie Exp
#
exec %DESTSBIN%/%INDOT%ndc restart