summaryrefslogtreecommitdiffstats
path: root/contrib/bind
diff options
context:
space:
mode:
authorasmodai <asmodai@FreeBSD.org>2001-01-28 23:00:22 +0000
committerasmodai <asmodai@FreeBSD.org>2001-01-28 23:00:22 +0000
commit526ae97d8eab06b1ded7a468938ed1c2c0baa576 (patch)
tree79c3598232b8ef08c8a1c0743584300e0db77a3b /contrib/bind
parent43228ef6de8ed0aac86e82b9a81f8a48d0767403 (diff)
parent1f243835b5b81bfd6b9e5f666730965fe5d60ed6 (diff)
downloadFreeBSD-src-526ae97d8eab06b1ded7a468938ed1c2c0baa576.zip
FreeBSD-src-526ae97d8eab06b1ded7a468938ed1c2c0baa576.tar.gz
This commit was generated by cvs2svn to compensate for changes in r71756,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/bind')
-rw-r--r--contrib/bind/CHANGES274
-rw-r--r--contrib/bind/INSTALL2
-rw-r--r--contrib/bind/Makefile6
-rw-r--r--contrib/bind/README31
-rw-r--r--contrib/bind/Version2
-rw-r--r--contrib/bind/bin/Makefile12
-rw-r--r--contrib/bind/bin/addr/Makefile6
-rw-r--r--contrib/bind/bin/dig/Makefile6
-rw-r--r--contrib/bind/bin/dig/dig.c69
-rw-r--r--contrib/bind/bin/dnskeygen/Makefile6
-rw-r--r--contrib/bind/bin/dnskeygen/dnskeygen.c7
-rw-r--r--contrib/bind/bin/dnsquery/Makefile6
-rw-r--r--contrib/bind/bin/dnsquery/dnsquery.c21
-rw-r--r--contrib/bind/bin/host/Makefile6
-rw-r--r--contrib/bind/bin/host/host.c145
-rw-r--r--contrib/bind/bin/irpd/Makefile6
-rw-r--r--contrib/bind/bin/irpd/irpd.c133
-rw-r--r--contrib/bind/bin/mkservdb/Makefile6
-rw-r--r--contrib/bind/bin/mkservdb/mkservdb.c27
-rw-r--r--contrib/bind/bin/named-bootconf/Makefile6
-rw-r--r--contrib/bind/bin/named-bootconf/named-bootconf.sh30
-rw-r--r--contrib/bind/bin/named-xfer/Makefile6
-rw-r--r--contrib/bind/bin/named/db_defs.h19
-rw-r--r--contrib/bind/bin/named/db_dump.c54
-rw-r--r--contrib/bind/bin/named/db_func.h108
-rw-r--r--contrib/bind/bin/named/db_glue.c15
-rw-r--r--contrib/bind/bin/named/db_ixfr.c25
-rw-r--r--contrib/bind/bin/named/db_load.c112
-rw-r--r--contrib/bind/bin/named/db_save.c4
-rw-r--r--contrib/bind/bin/named/db_sec.c4
-rw-r--r--contrib/bind/bin/named/db_update.c14
-rw-r--r--contrib/bind/bin/named/ns_config.c16
-rw-r--r--contrib/bind/bin/named/ns_ctl.c35
-rw-r--r--contrib/bind/bin/named/ns_defs.h11
-rw-r--r--contrib/bind/bin/named/ns_forw.c50
-rw-r--r--contrib/bind/bin/named/ns_func.h335
-rw-r--r--contrib/bind/bin/named/ns_glob.h7
-rw-r--r--contrib/bind/bin/named/ns_glue.c13
-rw-r--r--contrib/bind/bin/named/ns_init.c17
-rw-r--r--contrib/bind/bin/named/ns_ixfr.c56
-rw-r--r--contrib/bind/bin/named/ns_lexer.c6
-rw-r--r--contrib/bind/bin/named/ns_main.c214
-rw-r--r--contrib/bind/bin/named/ns_maint.c210
-rw-r--r--contrib/bind/bin/named/ns_notify.c5
-rw-r--r--contrib/bind/bin/named/ns_parser.y53
-rw-r--r--contrib/bind/bin/named/ns_req.c131
-rw-r--r--contrib/bind/bin/named/ns_resp.c65
-rw-r--r--contrib/bind/bin/named/ns_stats.c61
-rw-r--r--contrib/bind/bin/named/ns_update.c150
-rw-r--r--contrib/bind/bin/named/ns_xfr.c6
-rw-r--r--contrib/bind/bin/ndc/Makefile6
-rw-r--r--contrib/bind/bin/ndc/ndc.c24
-rw-r--r--contrib/bind/bin/nslookup/Makefile6
-rw-r--r--contrib/bind/bin/nslookup/list.c18
-rw-r--r--contrib/bind/bin/nslookup/pathnames.h4
-rw-r--r--contrib/bind/bin/nslookup/res.h24
-rw-r--r--contrib/bind/bin/nslookup/send.c7
-rw-r--r--contrib/bind/bin/nslookup/subr.c3
-rw-r--r--contrib/bind/bin/nsupdate/Makefile6
-rw-r--r--contrib/bind/bin/nsupdate/nsupdate.c19
-rw-r--r--contrib/bind/include/Makefile4
-rw-r--r--contrib/bind/include/arpa/nameser.h10
-rw-r--r--contrib/bind/include/irs.h4
-rw-r--r--contrib/bind/include/isc/list.h8
-rw-r--r--contrib/bind/include/isc/misc.h4
-rw-r--r--contrib/bind/include/resolv.h6
-rw-r--r--contrib/bind/lib/Makefile10
-rw-r--r--contrib/bind/lib/dst/Makefile6
-rw-r--r--contrib/bind/lib/dst/bsafe_link.c2
-rw-r--r--contrib/bind/lib/dst/cylink_link.c2
-rw-r--r--contrib/bind/lib/dst/dst_api.c9
-rw-r--r--contrib/bind/lib/dst/eay_dss_link.c2
-rw-r--r--contrib/bind/lib/dst/hmac_link.c2
-rw-r--r--contrib/bind/lib/dst/prandom.c2
-rw-r--r--contrib/bind/lib/dst/rsaref_link.c2
-rw-r--r--contrib/bind/lib/dst/support.c2
-rw-r--r--contrib/bind/lib/inet/Makefile6
-rw-r--r--contrib/bind/lib/inet/inet_cidr_pton.c5
-rw-r--r--contrib/bind/lib/inet/inet_net_ntop.c8
-rw-r--r--contrib/bind/lib/inet/inet_ntop.c4
-rw-r--r--contrib/bind/lib/irs/Makefile6
-rw-r--r--contrib/bind/lib/irs/getnameinfo.c10
-rw-r--r--contrib/bind/lib/irs/getnetent.c10
-rw-r--r--contrib/bind/lib/irs/irpmarshall.c7
-rw-r--r--contrib/bind/lib/irs/irs_data.c5
-rw-r--r--contrib/bind/lib/isc/Makefile12
-rw-r--r--contrib/bind/lib/isc/ctl_clnt.c6
-rw-r--r--contrib/bind/lib/isc/ctl_srvr.c3
-rw-r--r--contrib/bind/lib/isc/ev_connects.c3
-rw-r--r--contrib/bind/lib/isc/heap.mdoc9
-rw-r--r--contrib/bind/lib/isc/logging.c7
-rw-r--r--contrib/bind/lib/isc/movefile.c35
-rw-r--r--contrib/bind/lib/nameser/Makefile6
-rw-r--r--contrib/bind/lib/nameser/ns_parse.c6
-rw-r--r--contrib/bind/lib/nameser/ns_print.c44
-rw-r--r--contrib/bind/lib/nameser/ns_sign.c3
-rw-r--r--contrib/bind/lib/resolv/Makefile6
-rw-r--r--contrib/bind/lib/resolv/res_data.c3
-rw-r--r--contrib/bind/lib/resolv/res_debug.c19
-rw-r--r--contrib/bind/lib/resolv/res_findzonecut.c8
-rw-r--r--contrib/bind/lib/resolv/res_init.c11
-rw-r--r--contrib/bind/lib/resolv/res_mkupdate.c4
-rw-r--r--contrib/bind/lib/resolv/res_send.c46
-rw-r--r--contrib/bind/lib/resolv/res_sendsigned.c4
-rw-r--r--contrib/bind/lib/resolv/res_update.c3
-rw-r--r--contrib/bind/port/Makefile4
-rw-r--r--contrib/bind/port/freebsd/Makefile6
-rw-r--r--contrib/bind/port/freebsd/include/Makefile4
-rw-r--r--contrib/bind/port/prand_conf/Makefile4
109 files changed, 1956 insertions, 1162 deletions
diff --git a/contrib/bind/CHANGES b/contrib/bind/CHANGES
index ef04e52..4952477 100644
--- a/contrib/bind/CHANGES
+++ b/contrib/bind/CHANGES
@@ -1,3 +1,277 @@
+ --- 8.2.3-REL released ---
+
+1139. [bug] inet_{net_,}ntop() had an off-by-one error.
+
+1138. [bug] purge_nonglue() should only be fatal on master
+ servers.
+
+1138. [port] add include/errs.h to various ports.
+ winnt: #1130 caused linkage failures.
+
+ --- 8.2.3-RC5 released ---
+
+1137. [bug] rfc1034 escape sequences not processed when replaying
+ updates.
+
+1136. [port] winnt: named nolonger creates resolv.conf.
+
+1135. [bug] fixup from #1130/1132.
+
+1134. [port] winnt: SIOCGIFADDR, SIOCGIFFLAGS, SIOCGIFDSTADDR and
+ mkstemp() fixes.
+
+1133. [bug] sorting of SIG/non-SIG records prior to rrset ordering
+ of was broken.
+
+ --- 8.2.3-RC4 released ---
+
+1132. [lint] more #1130.
+
+1131. [support] TTL 0 is now allowed in zone files.
+
+1130. [lint] massive, massive delinting from "gcc -Wall".
+
+1129. [support] "max_log_size_ixfr" is now a scaled number (4m, etc).
+
+1128. [contrib] updated mdnkit.
+
+1127. [port] winnt: support for more interfaces, dnskeygen.
+
+1126. [bug] resolver: close cached file descriptors when socket()
+ fails.
+
+1125. [bug] when ns_addr_list is rotated, rotate cached file
+ descriptors.
+
+1124. [bug] the select() timeout was not always being correctly
+ computed.
+
+1123. [bug] changes to ns_addr_list were not being reflected into
+ our private copy.
+
+1122. [port] sco: DESTRUN and DESTSBIN can't be the same.
+
+1121. [cleanup] re-word "server is ??? priming" status message.
+
+1120. [bug] more #1108 fine tuning.
+
+1119. [bug] "delete all" RRs were not being printed correctly.
+
+1118. [port] winnt: always install the named executable
+
+1117. [port] linux: turn off returning ICMP port unreachables.
+
+1116. [bug] minor tweak to #1108
+
+1115. [bug] fail if tsig transfers are requested but we can't
+ communicate the keys to named-xfer.
+
+1114. [bug] remove extraneous semi-colon from ns_parser.y
+
+ --- 8.2.3-T9B released ---
+
+1113. [support] show config file name and age in "ndc status"
+
+1112. [support] "ndc status" no longer mentions loading of config.
+
+1111. [port] some versions of sunos don't have _POSIX_PATH_MAX
+
+1110. [bug] zones with Null keys at delegation incorreclty rejected.
+
+1109. [support] named-xfer was bombing on non-TSIG'd zones
+
+1108. [support] ignore queries that come in during long synch ops
+
+1107. [func] allow the default syslog facility to be set by
+ adding -DISC_FACILITY=<value> to CDEBUG in Makefile.set.
+
+1106. [func] host statistics can now be cleared after they are
+ dumped. Use "ndc stats clear".
+
+1105. [func] host-statistics-max can be used to set a upper bound
+ on the number hosts we collect statistics against.
+
+1104. [func] the source of a record is no longer dependent on
+ setting "host-statistics yes;"
+
+1103. [doc] winnt: updated port specific notes.
+
+1102. [port] winnt: BINDctrl fixes
+
+1101. [port] winnt: install fixes
+
+1100. [bug] named-xfer some memory allocations were not checked.
+
+1099. [bug] more missing INIT_LINK's.
+
+1098. [support] force gmake to fail if the sub-shell fails.
+
+1097. [port] winnt: lower the logging level so that BINDCtrl status
+ checks do not cause the eventlog to fillup.
+
+1096. [bug] don't pass '-i' to named-xfer unless we are going
+ to attempt a IXFR.
+
+1095. [bug] dig: report missing arguements.
+
+1094. [port] winnt: more cylink fixes, updated install.
+
+1093. [bug] winnt: build lib cylink correctly
+
+1092. [cleanup] winnt: snmpmib.c is nolonger required
+
+1091. [support] winnt: workout the install directory.
+
+1090. [bug] winnt: install was copying old over new.
+
+1089. [bug] winnt: fix copyright for nameserver.c
+ winnt: snmpmib.c not needed in libbind.dsp
+
+1088. [bug] #1053 still contained NAPTR problems.
+
+ --- 8.2.3-T8B released ---
+
+1087. [port] sunos/gcc _POSIX_PATH_MAX isn't defined when it should
+ be.
+
+1086. [doc] malformed man page for heap.
+
+1085. [bug] ixfr responses to zones we don't server were malformed.
+
+1084. [bug] INIT_LINK before APPEND in four more places.
+
+1083. [support] only log "no options before zone" config error
+ before FIRST zone [kjd].
+
+1082. [bug] have client-side IXFR work in single answer mode [kjd].
+
+1081. [bug] have server-side IXFR work in single answer mode [kjd].
+
+1080. [support] still do IXFR's even when a file name is not specified
+ for zone [kjd].
+
+1079. [support] need to have a file name for a hints zone [kjd].
+
+1078. [port] WinNT interface enumeration fixes from Danny Mayer.
+
+1077. [support] format string audit.
+
+1076. [port] now recognize RH7.0's "strndup()"
+
+1075. [contrib] add contrib/resparse-1.3 [Henning Schulzrinne @CU]
+
+1074. [support] INSIST that lists are correctly managed.
+
+1073. [port] Win/NT port work from Danny Mayer. Dig, host and
+ nslookup have been added.
+
+1072. [port] work around a gcc bug on solaris.
+
+1071. [bug] memory leak in res_nsendsigned().
+
+1070. [bug] We were accepting non syntactically valis SOA records.
+
+1069. [port] movefile() is now part of libbind as isc_movefile(),
+ remaining rename() calls converted to isc_movefile().
+
+1068. [bug] purge the zone from memory if an error is detected
+ on loading.
+
+1067. [bug] reload the parent zone if loading the child zone fails,
+ the parent zone may otherwise be corrupted.
+
+1066. [bug] refresh/retry timer need to be reset after IXFR
+
+1065. [bug] IXFR change list could be freed to early.
+
+1064. [bug] unchecked memget in sx_send_ixfr().
+
+1063. [bug] fix #1041 was incomplete.
+
+1062. [bug] host printed out address records multiple times if
+ they were at the end of a CNAME chain.
+
+1061. [bug] host failed to look for A records for the second an
+ subsequent entries in the search list when using
+ the default lookup.
+
+1060. [bug] $GENERATE did not reject a out of zone LHS.
+
+1059. [bug] res_findzonecut() contained a bad debugging printf.
+
+1058. [bug] possible NULL pointer de-reference in
+ dst_key_to_buffer().
+
+1057. [doc] document that bogus causes anti-alias processing.
+
+1056. [bug] ns_sprintrrf() could incorrectly print "." as "@".
+
+1055. [bug] aa was being cleared on notify "queries" prior to
+ testing.
+
+1054. [bug] NAPTR records were using name compression.
+
+1053. [bug] NAPTR records were not being printed correctly.
+
+1052. [bug] UPDATES w/ NAPTR records were failing.
+
+1051. [contrib] YADDAS: Yet another DNS database awk script.
+
+1050. [bug] named-bootconf did not handle cacheless secondary/stub
+ zones. NOTE cacheless secondary/stub zones are not
+ recommended.
+
+1049. [bug] buffer overruns by 1 in getnameinfo().
+
+1048. [bug] ns_ctl_install() was corrupting the server_controls
+ list.
+
+1047. [bug] req_iquery() wasn't doing a final update on buflenp.
+
+1046. [port] Win/NT port improved by its author.
+
+ --- 8.2.3-T7B released ---
+
+1045. [bug] forwarded and initiated TCP queries weren't affected
+ by the "query-source" config option, and weren't being
+ set nonblocking.
+
+1044. [support] add HITCOUNTS compile-time option (from lamont@hp.com).
+
+1043. [bug] dnsquery's command line args could overflow buffers.
+
+1042. [doc] maintain-ixfr-base had wrong description in
+ named.conf(5).
+
+1041. [bug] host assumed axfr returned "one-answer" responses.
+
+1040. [bug] add d_rcnt processing to update processing.
+
+1039. [bug] qcomp wasn't stable.
+
+1038. [port] solaris needs a strerror that does not return NULL,
+ call isc_strerror instead.
+
+1037. [support] soften #1025 -- continue to accept !AA notify req's.
+
+1036. [debug] add TKEY debugging support.
+
+1035. [bug] ndc's "help" command worked in signal but not channel
+ mode.
+
+1034. [bug] loc_ntoa() failed to correctly print altitudes in the
+ range [-0.99 .. -0.01].
+
+1033. [port] Win/NT portability infusion from Larry @NortelNetworks.
+
+1032. [bug] fix minor signal buglet introduced in #1029.
+
+1031. [bug] nslookup now correctly refuses to accept qtypes AXFR
+ or IXFR. (use nslookup "ls", not queries, for this.)
+
+1030. [protocol] nslookup "ls" command now uses writev() rather than two
+ write()'s, to get msglen and query into same tcp seg.
+
--- 8.2.3-T6B released ---
1029. [bug] incredibly busy systems could starve handle_needs().
diff --git a/contrib/bind/INSTALL b/contrib/bind/INSTALL
index 7ba751d..ca09497 100644
--- a/contrib/bind/INSTALL
+++ b/contrib/bind/INSTALL
@@ -175,7 +175,7 @@ Operating System Notes
"port/solaris/Makefile.set.gcc" to "port/solaris/Makefile.set".
If you're using a Solaris release earlier than 2.5 and you have
- a large number of interfaces on your system, you many need
+ a large number of interfaces on your system, you many need to
use a script to "limit descriptors N" (where 'N' is a
suitably large number) before execing "named". On Solaris
2.5 and later, the server will do this itself.
diff --git a/contrib/bind/Makefile b/contrib/bind/Makefile
index 5df7fdc..3596dd4 100644
--- a/contrib/bind/Makefile
+++ b/contrib/bind/Makefile
@@ -13,7 +13,7 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.51 1999/11/06 03:24:02 vixie Exp $
+# $Id: Makefile,v 8.52 2000/11/21 12:54:37 marka Exp $
TOP=
SUBDIRS= include port lib bin
@@ -37,7 +37,7 @@ all clean depend install distclean:: FRC
eval "${MAKE} $$settings ${MARGS} SYSTYPE=$$systype \
VER=$$version \
$@"; \
- ); \
+ ) || exit 1; \
done \
fi
@@ -52,7 +52,7 @@ links: FRC
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
${MAKE} ${MARGS} SYSTYPE=$$systype links; \
- ); \
+ ) || exit 1; \
done
stdlinks: FRC
diff --git a/contrib/bind/README b/contrib/bind/README
index 65f9664..2f1e34f 100644
--- a/contrib/bind/README
+++ b/contrib/bind/README
@@ -1,5 +1,5 @@
-This is the source portion of BIND version 8.2.3-T2B. Its companions
-are "doc" and "contrib" so you are probably not missing anything.
+This is the source portion of BIND version 8. Its companions are "doc" and
+"contrib" so you are probably not missing anything.
See the CHANGES file for a detailed listing of all changes. See the INSTALL
file for information on building and installing BIND.
@@ -7,17 +7,19 @@ file for information on building and installing BIND.
See the SUPPORT file for information on obtaining commercial support for ISC
artifacts including BIND, INN, and DHCP.
-SECURITY NOTE:
+Note that BIND 8 is in "end-of-life", having been replaced by BIND 9. See
+http://www.isc.org/ for more details.
- Solaris and other pre-4.4BSD kernels do not respect ownership or
- protections on UNIX-domain sockets. This means that the default
- path for the NDC control socket (/var/run/ndc) is such that any
- user (root or other) on such systems can issue any NDC command
- except "start" and "restart". The short term fix for this is to
- override the default path and put such control sockets into root-
- owned directories which do not permit non-root to r/w/x through them.
- The medium term fix is for BIND to enforce this requirement internally.
- The long term fix is for all kernels to upgrade to 4.4BSD semantics.
+BIND 8.2.3 Highlights
+
+ Improved support for Windows NT and Windows 2000.
+ Host stats are no longer required to track the source of a record.
+ IXFR improvements.
+ Forwarders track and use RTT to select fastest.
+ Unix domain sockets implementions that require the directory
+ to be secure, are now secured.
+ Many minor problems fixed.
+ Linux DoS removed.
BIND 8.2.2 patchlevel 5 Highlights
@@ -47,7 +49,6 @@ BIND 8.2.2 Highlights
New global options for "transfer-source" and "also-notify".
$GENERATE now supports more record types, and options.
-
BIND 8.2.1 Highlights
Bug fixes, especially to DNSSEC, TSIG, IXFR, and selective forwarding.
@@ -72,7 +73,6 @@ BIND 8.2 Highlights
Documentation improvements
Performance enhancements
-
BIND 8.1.2 Highlights
Security fixes for a number of problems including:
@@ -133,7 +133,6 @@ BIND 8.1.2 Highlights
Experimental -u (set user id), -g (set group id), and -t (chroot)
command line options. See the INSTALL file for details.
-
BIND 8 Features
-> DNS Dynamic Updates (RFC 2136)
@@ -155,7 +154,6 @@ BIND 8 Features
-> Many bug fixes
-
File and Directory Overview
CHANGES history of added features and
@@ -196,7 +194,6 @@ Kits, Questions, Comments, and Bug Reports
<URL:http://www.isc.org/bind.html> the BIND home page
<URL:mailto:bind-bugs@isc.org> bug reports
-
To Support the Effort
Note that BIND is supported by the Internet Software Consortium, and
diff --git a/contrib/bind/Version b/contrib/bind/Version
index 69ea4e2..4dc051b 100644
--- a/contrib/bind/Version
+++ b/contrib/bind/Version
@@ -1 +1 @@
-8.2.3-T6B
+8.2.3-REL
diff --git a/contrib/bind/bin/Makefile b/contrib/bind/bin/Makefile
index 57fcc58..5b56413 100644
--- a/contrib/bind/bin/Makefile
+++ b/contrib/bind/bin/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.28 2000/07/11 06:41:26 vixie Exp $
+# $Id: Makefile,v 8.30 2000/12/23 08:02:48 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ..
O=o
A=a
@@ -67,11 +67,11 @@ SUBDIRS = addr nslookup dig dnsquery host named named-xfer ndc nsupdate \
all: ${SUBDIRS}
${SUBDIRS}: FRC
- @(cd $@; pwd; ${MAKE} ${MARGS})
+ @(cd $@; pwd; ${MAKE} ${MARGS}) || exit 1
install depend tags clean distclean::
@for x in ${SUBDIRS}; do \
- (cd $$x; pwd; ${MAKE} ${MARGS} $@); \
+ (cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \
done
distclean:: clean
@@ -85,7 +85,7 @@ links: FRC
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
$(MAKE) $(MARGS) links; \
- ); \
+ ) || exit 1; \
done
FRC:
diff --git a/contrib/bind/bin/addr/Makefile b/contrib/bind/bin/addr/Makefile
index 98b7a91..1b91e47 100644
--- a/contrib/bind/bin/addr/Makefile
+++ b/contrib/bind/bin/addr/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.26 2000/07/11 06:41:27 vixie Exp $
+# $Id: Makefile,v 8.27 2000/12/23 08:02:49 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/dig/Makefile b/contrib/bind/bin/dig/Makefile
index ca7775d..b5a65fa 100644
--- a/contrib/bind/bin/dig/Makefile
+++ b/contrib/bind/bin/dig/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.26 2000/07/11 06:41:27 vixie Exp $
+# $Id: Makefile,v 8.27 2000/12/23 08:02:50 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/dig/dig.c b/contrib/bind/bin/dig/dig.c
index de192e0..01d87a9 100644
--- a/contrib/bind/bin/dig/dig.c
+++ b/contrib/bind/bin/dig/dig.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char rcsid[] = "$Id: dig.c,v 8.42 2000/07/17 07:36:52 vixie Exp $";
+static const char rcsid[] = "$Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $";
#endif
/*
@@ -201,7 +201,6 @@ static const char rcsid[] = "$Id: dig.c,v 8.42 2000/07/17 07:36:52 vixie Exp $";
static int eecode = 0;
static FILE * qfp;
-static int sockFD;
static char *defsrv, *srvmsg;
static char defbuf[40] = "default -- ";
static char srvbuf[60];
@@ -228,7 +227,7 @@ char *pager = NULL;
/* Forward. */
static void Usage(void);
-static int SetOption(const char *);
+static int setopt(const char *);
static void res_re_init(void);
static int xstrtonum(char *);
static int printZone(ns_type, const char *,
@@ -273,8 +272,7 @@ main(int argc, char **argv) {
char cmd[512];
char domain[MAXDNAME];
- char msg[120], *msgptr;
- char **vtmp;
+ char msg[120], **vtmp;
char *args[DIG_MAXARGS];
char **ax;
int once = 1, dofile = 0; /* batch -vs- interactive control */
@@ -283,7 +281,6 @@ main(int argc, char **argv) {
int wait=0, delay;
int envset=0, envsave=0;
struct __res_state res_x, res_t;
- char *pp;
ns_tsig_key key;
char *keyfile = NULL, *keyname = NULL;
@@ -402,7 +399,7 @@ main(int argc, char **argv) {
if (**argv == '%')
continue;
if (**argv == '+') {
- SetOption(*argv+1);
+ setopt(*argv+1);
continue;
}
if (**argv == '=') {
@@ -426,11 +423,16 @@ main(int argc, char **argv) {
if (**argv == '-') {
switch (argv[0][1]) {
case 'T':
- wait = atoi(*++argv);
+ if (*++argv == NULL)
+ printf("; no arg for -T?\n");
+ else
+ wait = atoi(*argv);
break;
case 'c':
- if ((tmp = atoi(*++argv))
- || *argv[0]=='0') {
+ if(*++argv == NULL)
+ printf("; no arg for -c?\n");
+ else if ((tmp = atoi(*argv))
+ || *argv[0] == '0') {
queryClass = tmp;
} else if ((tmp = StringToClass(*argv,
0, NULL)
@@ -443,7 +445,9 @@ main(int argc, char **argv) {
}
break;
case 't':
- if ((tmp = atoi(*++argv))
+ if (*++argv == NULL)
+ printf("; no arg for -t?\n");
+ else if ((tmp = atoi(*argv))
|| *argv[0]=='0') {
queryType = tmp;
qtypeSet++;
@@ -456,17 +460,15 @@ main(int argc, char **argv) {
printf(
"; invalid type specified\n"
);
- }
+ }
break;
case 'x':
if (!qtypeSet) {
queryType = T_ANY;
qtypeSet++;
}
- if (!(addrc = *++argv)) {
- printf(
- "; no arg for -x?\n"
- );
+ if ((addrc = *++argv) == NULL) {
+ printf("; no arg for -x?\n");
break;
}
addrend = addrc + strlen(addrc);
@@ -484,8 +486,10 @@ main(int argc, char **argv) {
case 'p':
if (argv[0][2] != '\0')
port = ntohs(atoi(argv[0]+2));
+ else if (*++argv == NULL)
+ printf("; no arg for -p?\n");
else
- port = htons(atoi(*++argv));
+ port = htons(atoi(*argv));
break;
case 'P':
if (argv[0][2] != '\0')
@@ -496,16 +500,21 @@ main(int argc, char **argv) {
case 'n':
if (argv[0][2] != '\0')
res.ndots = atoi(argv[0]+2);
+ else if (*++argv == NULL)
+ printf("; no arg for -n?\n");
else
- res.ndots = atoi(*++argv);
+ res.ndots = atoi(*argv);
break;
case 'b': {
char *a, *p;
if (argv[0][2] != '\0')
a = argv[0]+2;
- else
- a = *++argv;
+ else if (*++argv == NULL) {
+ printf("; no arg for -b?\n");
+ break;
+ } else
+ a = *argv;
if ((p = strchr(a, ':')) != NULL) {
*p++ = '\0';
myaddress.sin_port =
@@ -523,8 +532,11 @@ main(int argc, char **argv) {
if (argv[0][2] != '\0')
keyfile = argv[0]+2;
- else
- keyfile = *++argv;
+ else if (*++argv == NULL) {
+ printf("; no arg for -k?\n");
+ break;
+ } else
+ keyfile = *argv;
keyname = strchr(keyfile, ':');
if (keyname == NULL) {
@@ -878,8 +890,6 @@ main(int argc, char **argv) {
assert(end_time.tv_usec >= 0 && end_time.tv_usec < 1000000);
if (res.pfcode & RES_PRF_STATS) {
- time_t t;
-
query_time = difftv(start_time, end_time);
printf(";; Total query time: ");
prnttime(query_time);
@@ -954,13 +964,13 @@ where: server,\n\
fputs("\
notes: defname and search don't work; use fully-qualified names.\n\
this is DiG version " VSTRING "\n\
- $Id: dig.c,v 8.42 2000/07/17 07:36:52 vixie Exp $\n\
+ $Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $\n\
", stderr);
}
static int
-SetOption(const char *string) {
- char option[NAME_LEN], type[NAME_LEN], *ptr;
+setopt(const char *string) {
+ char option[NAME_LEN], *ptr;
int i;
i = pickString(string, option, sizeof option);
@@ -1184,12 +1194,11 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
static int answerLen = 0;
querybuf buf;
- HEADER *headerPtr;
int msglen, amtToRead, numRead, result = 0, sockFD, len;
int count, type, class, rlen, done, n;
int numAnswers = 0, numRecords = 0, soacnt = 0;
u_char *cp, tmp[NS_INT16SZ];
- char dname[2][NS_MAXDNAME], file[NAME_LEN];
+ char dname[2][NS_MAXDNAME];
enum { NO_ERRORS, ERR_READING_LEN, ERR_READING_MSG, ERR_PRINTING }
error = NO_ERRORS;
pid_t zpid;
@@ -1527,7 +1536,7 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
return (ERROR);
}
printf(";; pid %lu: exit %d, signal %d, core %c\n",
- pid, WEXITSTATUS(status),
+ (u_long)pid, WEXITSTATUS(status),
WIFSIGNALED(status) ? WTERMSIG(status) : 0,
WCOREDUMP(status) ? 't' : 'f');
}
diff --git a/contrib/bind/bin/dnskeygen/Makefile b/contrib/bind/bin/dnskeygen/Makefile
index 232a206..601375f 100644
--- a/contrib/bind/bin/dnskeygen/Makefile
+++ b/contrib/bind/bin/dnskeygen/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 1.6 2000/07/11 06:41:28 vixie Exp $
+# $Id: Makefile,v 1.7 2000/12/23 08:02:50 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/dnskeygen/dnskeygen.c b/contrib/bind/bin/dnskeygen/dnskeygen.c
index c30eae7..f226a6f 100644
--- a/contrib/bind/bin/dnskeygen/dnskeygen.c
+++ b/contrib/bind/bin/dnskeygen/dnskeygen.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: dnskeygen.c,v 1.9 1999/10/13 16:38:59 vixie Exp $";
+static const char rcsid[] = "$Id: dnskeygen.c,v 1.11 2000/12/23 08:14:31 vixie Exp $";
#endif /* not lint */
/*
@@ -50,9 +50,8 @@ main(int argc, char **argv) {
int size = -1, exp = 0;
int no_auth = 0, no_conf = 0;
int sign_val = 0, flags = 0, protocol = -1;
- int i, err = 0, n;
+ int i, err = 0;
extern char *optarg;
- char array[1024];
dst_init();
if ((prog = strrchr(argv[0],'/')) == NULL)
@@ -216,6 +215,8 @@ main(int argc, char **argv) {
}
else if (size < 0)
usage("No size specified", 0);
+ else /* size == 0 */
+ sign_val = 0;
if (err)
usage("errors encountered/unknown flag", 1);
diff --git a/contrib/bind/bin/dnsquery/Makefile b/contrib/bind/bin/dnsquery/Makefile
index 511cb66..7b52a60 100644
--- a/contrib/bind/bin/dnsquery/Makefile
+++ b/contrib/bind/bin/dnsquery/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.25 2000/07/11 06:41:29 vixie Exp $
+# $Id: Makefile,v 8.26 2000/12/23 08:02:51 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/dnsquery/dnsquery.c b/contrib/bind/bin/dnsquery/dnsquery.c
index 218c8a8..e8abd3e 100644
--- a/contrib/bind/bin/dnsquery/dnsquery.c
+++ b/contrib/bind/bin/dnsquery/dnsquery.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: dnsquery.c,v 8.13 1999/10/13 16:38:59 vixie Exp $";
+static const char rcsid[] = "$Id: dnsquery.c,v 8.15 2000/12/23 08:14:32 vixie Exp $";
#endif /* not lint */
/*
@@ -55,7 +55,6 @@ main(int argc, char *argv[]) {
struct hostent *q_nsname;
extern int optind, opterr;
extern char *optarg;
- HEADER *hp;
int stream = 0, debug = 0;
/* set defaults */
@@ -80,7 +79,12 @@ main(int argc, char *argv[]) {
case 'p' : res.retrans = atoi(optarg);
break;
- case 'h' : strcpy(name, optarg);
+ case 'h' : if (strlen(optarg) >= sizeof(name)) {
+ fprintf(stderr,
+ "Domain name too long (%s)\n", optarg);
+ exit(-1);
+ } else
+ strcpy(name, optarg);
break;
case 'c' : {
@@ -157,8 +161,15 @@ main(int argc, char *argv[]) {
exit(-1);
}
}
- if (optind < argc)
- strcpy(name, argv[optind]);
+ if (optind < argc) {
+ if (strlen(argv[optind]) >= sizeof(name)) {
+ fprintf(stderr,
+ "Domain name too long (%s)\n", argv[optind]);
+ exit(-1);
+ } else {
+ strcpy(name, argv[optind]);
+ }
+ }
len = sizeof(answer);
diff --git a/contrib/bind/bin/host/Makefile b/contrib/bind/bin/host/Makefile
index b4f07ad..8795b56 100644
--- a/contrib/bind/bin/host/Makefile
+++ b/contrib/bind/bin/host/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.25 2000/07/11 06:41:29 vixie Exp $
+# $Id: Makefile,v 8.26 2000/12/23 08:02:51 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/host/host.c b/contrib/bind/bin/host/host.c
index 77e5329..adb4feb 100644
--- a/contrib/bind/bin/host/host.c
+++ b/contrib/bind/bin/host/host.c
@@ -1,5 +1,5 @@
#ifndef lint
-static const char rcsid[] = "$Id: host.c,v 8.37 2000/07/11 07:06:14 vixie Exp $";
+static const char rcsid[] = "$Id: host.c,v 8.42 2000/12/23 08:14:32 vixie Exp $";
#endif /* not lint */
/*
@@ -126,6 +126,9 @@ static const char copyright[] =
#define SUCCESS 0
#define TIME_OUT -1
#define NO_INFO -2
+#ifdef ERROR
+#undef ERROR
+#endif
#define ERROR -3
#define NONAUTH -4
@@ -166,12 +169,13 @@ static u_char hostbuf[NS_MAXDNAME];
static int sockFD;
static FILE *filePtr;
-static struct __res_state res, orig;
+static struct __res_state res;
static char *cname = NULL;
static const char *progname = "amnesia";
static int getclass = ns_c_in, verbose = 0, list = 0;
static int server_specified = 0;
static int gettype = 0;
+static int querytype = 0;
static char getdomain[NS_MAXDNAME];
/* Forward. */
@@ -221,9 +225,9 @@ main(int argc, char **argv) {
struct in_addr addr;
struct hostent *hp;
char *s;
- int inverse = 0, waitmode = 0;
+ int waitmode = 0;
int ncnames, ch;
- int nkeychains, i;
+ int nkeychains;
dst_init();
@@ -237,7 +241,7 @@ main(int argc, char **argv) {
switch (ch) {
case 'a':
verbose = 1;
- gettype = ns_t_any;
+ querytype = ns_t_any;
break;
case 'c':
getclass = parseclass(optarg);
@@ -255,7 +259,7 @@ main(int argc, char **argv) {
sigchase = 1;
break;
case 't':
- gettype = parsetype(optarg);
+ querytype = parsetype(optarg);
break;
case 'v':
verbose = 1;
@@ -270,10 +274,10 @@ main(int argc, char **argv) {
/*NOTREACHED*/
}
}
- if ((gettype == 0) && (sigchase)) {
+ if ((querytype == 0) && (sigchase)) {
if (verbose)
printf ("Forcing `-t a' for signature trace.\n");
- gettype = ns_t_a;
+ querytype = ns_t_a;
}
argc -= optind;
argv += optind;
@@ -320,7 +324,7 @@ main(int argc, char **argv) {
res.options &= ~RES_DEFNAMES;
if (list)
- exit(ListHosts(getdomain, gettype ? gettype : ns_t_a));
+ exit(ListHosts(getdomain, querytype ? querytype : ns_t_a));
ncnames = 5; nkeychains = 18;
while (hp == NULL && res.res_h_errno == TRY_AGAIN) {
if (addr.s_addr == INADDR_NONE) {
@@ -336,18 +340,17 @@ main(int argc, char **argv) {
/* start new query, for KEY */
strcpy (getdomain, chase_signer);
strcat (getdomain, ".");
- gettype = ns_t_key;
+ querytype = ns_t_key;
} else if (!(chase_step & SD_BADSIG)) {
/* start new query, for SIG */
strcpy (getdomain, chase_domain);
strcat (getdomain, ".");
- gettype = ns_t_sig;
+ querytype = ns_t_sig;
} else if (hp && !(chase_step & SD_SIG) &&
(chase_step & SD_BADSIG)) {
printf ("%s for %s not found, last verified key %s\n",
chase_step & SD_SIG ? "Key" : "Signature",
chase_step & SD_SIG ? chase_signer : chase_domain,
- chase_domain,
chase_lastgoodkey ? chase_lastgoodkey : "None");
}
}
@@ -536,7 +539,7 @@ gethostinfo(char *name) {
char *cp, **domain;
char tmp[NS_MAXDNAME];
const char *tp;
- int hp, nDomain;
+ int hp;
int asis = 0;
u_int n;
@@ -587,8 +590,8 @@ static int
getdomaininfo(const char *name, const char *domain) {
int val1, val2;
- if (gettype)
- return (getinfo(name, domain, gettype));
+ if (querytype)
+ return (getinfo(name, domain, gettype=querytype));
else {
val1 = getinfo(name, domain, gettype=ns_t_a);
if (cname || verbose)
@@ -600,11 +603,9 @@ getdomaininfo(const char *name, const char *domain) {
static int
getinfo(const char *name, const char *domain, int type) {
- HEADER *hp;
- u_char *eom, *bp, *cp;
+ u_char *eom;
querybuf buf, answer;
- int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen;
- u_short pref, class;
+ int n;
char host[NS_MAXDNAME];
if (domain == NULL)
@@ -634,8 +635,7 @@ getinfo(const char *name, const char *domain, int type) {
static int
printinfo(const querybuf *answer, const u_char *eom, int filter, int isls) {
- int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen, savesigchase;
- u_short pref, class;
+ int n, nmx, ancount, nscount, arcount, qdcount, buflen, savesigchase;
const u_char *bp, *cp;
const HEADER *hp;
@@ -696,8 +696,18 @@ printinfo(const querybuf *answer, const u_char *eom, int filter, int isls) {
if (!hp->ad)
if (verbose && isls == 0)
printf("The following answer is not verified as authentic by the server:\n");
- while (--ancount >= 0 && cp && cp < eom)
+ while (--ancount >= 0 && cp && cp < eom) {
cp = pr_rr(cp, answer->qb2, stdout, filter);
+ /*
+ * When we ask for address and there is a CNAME, it
+ * seems to return both the CNAME and the address.
+ * Since we trace down the CNAME chain ourselves, we
+ * don't really want to print the address at this
+ * point.
+ */
+ if (cname && ! verbose)
+ return (1);
+ }
}
if (!verbose)
return (1);
@@ -967,24 +977,24 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
}
if (doprint)
- fprintf(file, "(\n\t\t\t%ld\t;serial (version)",
+ fprintf(file, "(\n\t\t\t%lu\t;serial (version)",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
- fprintf(file, "\n\t\t\t%ld\t;refresh period",
+ fprintf(file, "\n\t\t\t%lu\t;refresh period",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
fprintf(file,
- "\n\t\t\t%ld\t;retry refresh this often",
+ "\n\t\t\t%lu\t;retry refresh this often",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
- fprintf(file, "\n\t\t\t%ld\t;expiration period",
+ fprintf(file, "\n\t\t\t%lu\t;expiration period",
ns_get32(cp));
cp += INT32SZ;
if (doprint)
- fprintf(file, "\n\t\t\t%ld\t;minimum TTL\n\t\t\t)",
+ fprintf(file, "\n\t\t\t%lu\t;minimum TTL\n\t\t\t)",
ns_get32(cp));
cp += INT32SZ;
break;
@@ -1235,15 +1245,15 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
/* original ttl */
origttl = cp;
if (doprint && verbose)
- fprintf(file, " %d", ns_get32(cp));
+ fprintf(file, " %ld", ns_get32(cp));
cp += INT32SZ;
/* signature expiration */
if (doprint && verbose)
- fprintf(file, " %d", ns_get32(cp));
+ fprintf(file, " %ld", ns_get32(cp));
cp += INT32SZ;
/* time signed */
if (doprint && verbose)
- fprintf(file, " %d", ns_get32(cp));
+ fprintf(file, " %ld", ns_get32(cp));
cp += INT32SZ;
/* key footprint */
if (doprint && verbose)
@@ -1265,7 +1275,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
if (sigchase && !(chase_step & SD_SIG) &&
strcmp (chase_domain, thisdomain) == 0 &&
- chase_class == class & chase_type == tc)
+ chase_class == class && chase_type == tc)
{
u_char cdname[NS_MAXCDNAME];
@@ -1336,7 +1346,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
if (sigchase && (chase_step & (SD_SIG|SD_RR)) &&
strcmp (getdomain, name) == 0 &&
- getclass == class & gettype == type)
+ getclass == class && gettype == type)
{
DST_KEY *dstkey;
int rc, len, i, j;
@@ -1452,7 +1462,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
u_char cdname[NS_MAXCDNAME];
if (doprint && !verbose)
- fprintf (file, " (chasing signature)", sigchase-1);
+ fprintf(file, " (chasing signature)");
/* unpack rr */
@@ -1566,6 +1576,7 @@ ListHosts(char *namePtr, int queryType) {
int nshaveaddr[NUMNS];
struct in_addr nsipaddr[NUMNSADDR];
int numns, numnsaddr, thisns;
+ int qdcount, ancount;
/*
* Normalize to not have trailing dot. We do string compares below
@@ -1638,7 +1649,8 @@ ListHosts(char *namePtr, int queryType) {
cp = answer.qb2 + HFIXEDSZ;
eom = answer.qb2 + msglen;
- if (ntohs(answer.qb1.qdcount) > 0) {
+ qdcount = ntohs(answer.qb1.qdcount);
+ while (qdcount-- > 0) {
n = dn_skipname(cp, eom);
if (n < 0) {
printf("Form error.\n");
@@ -1876,35 +1888,60 @@ ListHosts(char *namePtr, int queryType) {
}
numAnswers++;
cp = buf.qb2 + HFIXEDSZ;
- if (ntohs(buf.qb1.qdcount) > 0) {
+ qdcount = ntohs(buf.qb1.qdcount);
+ while (qdcount-- > 0) {
n = dn_skipname(cp, buf.qb2 + len);
- if (n < 0) {
+ if (n <= 0) {
+ error = ERR_PRINTING;
+ break;
+ }
+ if (cp + n + QFIXEDSZ > buf.qb2 + len) {
error = ERR_PRINTING;
break;
}
cp += n + QFIXEDSZ;
}
- nmp = cp;
- n = dn_skipname(cp, buf.qb2 + len);
- if (n < 0) {
- error = ERR_PRINTING;
- break;
+ ancount = ntohs(buf.qb1.ancount);
+ while (ancount-- > 0) {
+ nmp = cp;
+ n = dn_skipname(cp, buf.qb2 + len);
+ if (n <= 0) {
+ error = ERR_PRINTING;
+ break;
+ }
+ cp += n;
+ if (cp + INT16SZ > buf.qb2 + len) {
+ error = ERR_PRINTING;
+ break;
+ }
+ type = ns_get16(cp);
+ cp += INT16SZ;
+ if (type == ns_t_soa) {
+ (void) dn_expand(buf.qb2, buf.qb2 + len, nmp,
+ dname[soacnt], sizeof dname[0]);
+ if (soacnt) {
+ if (ns_samename(dname[0], dname[1]) == 1)
+ goto done;
+ } else
+ soacnt++;
+ }
+ if (cp + INT16SZ*2 + INT32SZ > buf.qb2 + len) {
+ error = ERR_PRINTING;
+ break;
+ }
+ cp += INT32SZ + INT16SZ;
+ dlen = ns_get16(cp);
+ cp += INT16SZ;
+ if (cp + dlen > buf.qb2 + len) {
+ error = ERR_PRINTING;
+ break;
+ }
+ cp += dlen;
}
- cp += n;
- if (cp + INT16SZ > buf.qb2 + len) {
- error = ERR_PRINTING;
+ if (error != NO_ERRORS)
break;
- }
- if ((ns_get16(cp) == ns_t_soa)) {
- (void) dn_expand(buf.qb2, buf.qb2 + len, nmp,
- dname[soacnt], sizeof dname[0]);
- if (soacnt) {
- if (ns_samename(dname[0], dname[1]) == 1)
- break;
- } else
- soacnt++;
- }
}
+ done:
(void) close(sockFD);
sockFD = -1;
diff --git a/contrib/bind/bin/irpd/Makefile b/contrib/bind/bin/irpd/Makefile
index 9eaf4cc..af98cfb 100644
--- a/contrib/bind/bin/irpd/Makefile
+++ b/contrib/bind/bin/irpd/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 1.6 2000/07/17 07:15:08 vixie Exp $
+# $Id: Makefile,v 1.7 2000/12/23 08:02:52 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/irpd/irpd.c b/contrib/bind/bin/irpd/irpd.c
index 4a94d2c..e03276f 100644
--- a/contrib/bind/bin/irpd/irpd.c
+++ b/contrib/bind/bin/irpd/irpd.c
@@ -37,7 +37,7 @@ seem to be so for getnetbyaddr
#endif
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: irpd.c,v 1.8 2000/02/04 08:28:27 vixie Exp $";
+static const char rcsid[] = "$Id: irpd.c,v 1.10 2000/12/23 08:14:33 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
/* Imports. */
@@ -144,7 +144,6 @@ static struct response_buff *newbuffer(u_int length);
static void release_buffer(struct response_buff *b);
static struct arg_s *split_string(const char *string);
static void free_args(struct arg_s *args);
-static int is_all_digits(char *p);
static struct client_ctx *make_cli_ctx(void);
static struct net_data *get_net_data(struct ctl_sess *sess);
@@ -248,8 +247,6 @@ static void irpd_abort(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx);
-static void irpd_done(struct ctl_sctx *ctx, struct ctl_sess *sess,
- void *param);
static void response_done(struct ctl_sctx *ctx, struct ctl_sess *sess,
void *uap);
static void logger(enum ctl_severity, const char *fmt, ...);
@@ -333,7 +330,6 @@ main(int argc, char **argv) {
struct sockaddr_un uaddr;
#endif
struct sockaddr_in iaddr;
- log_channel chan;
short port = IRPD_PORT;
char *prog = argv[0];
char *sockname = IRPD_PATH;
@@ -344,7 +340,7 @@ main(int argc, char **argv) {
addr = (struct sockaddr *)&iaddr;
socksize = sizeof iaddr;
- openlog("iprd", LOG_CONS|LOG_PID, LOG_DAEMON);
+ openlog("iprd", LOG_CONS|LOG_PID, ISC_FACILITY);
while ((ch = getopt(argc, argv, "u:p:c:")) != -1) {
switch(ch) {
case 'c':
@@ -448,7 +444,6 @@ send_hostent(struct ctl_sess *sess, struct hostent *ho) {
if (ho == NULL)
simple_response(sess, IRPD_GETHOST_NONE, "No such host");
else {
- size_t need;
struct response_buff *b = newbuffer(0);
if (irp_marshall_ho(ho, &b->buff, &b->bufflen) != 0) {
@@ -500,7 +495,6 @@ irpd_gethostbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
{
char hname[MAXHOSTNAMELEN];
struct arg_s *args;
- int i;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -539,7 +533,6 @@ irpd_gethostbyname2(struct ctl_sctx *ctx, struct ctl_sess *sess,
{
char hname[MAXHOSTNAMELEN];
struct arg_s *args;
- int i;
int af;
struct net_data *netdata = get_net_data(sess);
@@ -591,7 +584,6 @@ irpd_gethostbyaddr(struct ctl_sctx *ctx, struct ctl_sess *sess,
char haddr[MAXHOSTNAMELEN];
char tmpaddr[NS_IN6ADDRSZ];
struct arg_s *args;
- int i;
int af;
int addrlen;
struct net_data *netdata = get_net_data(sess);
@@ -657,9 +649,6 @@ irpd_gethostent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct hostent *ho;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -683,10 +672,6 @@ irpd_sethostent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- struct hostent *ho;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -742,8 +727,6 @@ irpd_getpwnam(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct passwd *pw;
char username[64];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -786,8 +769,6 @@ irpd_getpwuid(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct passwd *pw;
char userid[64];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -847,9 +828,6 @@ irpd_getpwent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct passwd *pw;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -872,10 +850,6 @@ irpd_setpwent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- struct passwd *pw;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -917,34 +891,6 @@ send_nwent(struct ctl_sess *sess, struct nwent *nw) {
/*
* static void
- * send_netent(struct ctl_sess *sess, struct netent *ne);
- * Sends a NETENT structure over the wire, or "No such
- * Network" error if NE is NULL.
- */
-static void
-send_netent(struct ctl_sess *sess, struct netent *ne) {
- if (ne == NULL) {
- simple_response(sess, IRPD_GETNET_NONE, "No such net");
- } else {
- struct response_buff *b = newbuffer(0);
-
- if (irp_marshall_ne(ne, &b->buff,
- &b->bufflen) != 0) {
- simple_response(sess, IRPD_GETNET_ERROR,
- "Internal error");
- logger(ctl_warning, "Cant marshall ne\n");
- return;
- }
-
- strcat(b->buff, "\r\n");
-
- ctl_response(sess, IRPD_GETNET_OK, "Network found", 0, 0,
- response_done, b, b->buff, strlen(b->buff));
- }
-}
-
-/*
- * static void
* irpd_getnetbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
* const struct ctl_verb *verb, const char *rest,
* u_int respflags, void *respctx, void *uctx);
@@ -959,8 +905,6 @@ irpd_getnetbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct netent *ne;
struct nwent *nw;
char netname[MAXNETNAMELEN];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1015,7 +959,6 @@ irpd_getnetbyaddr(struct ctl_sctx *ctx, struct ctl_sess *sess,
char haddr[MAXHOSTNAMELEN];
long tmpaddr;
struct arg_s *args;
- int i;
int af;
int addrlen;
int bits;
@@ -1105,9 +1048,6 @@ irpd_getnetent(struct ctl_sctx *ctx, struct ctl_sess *sess,
{
struct netent *ne;
struct nwent *nw;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1136,11 +1076,6 @@ irpd_setnetent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- struct netent *ne;
- struct nwent *nw;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1195,8 +1130,6 @@ irpd_getgrnam(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct group *gr;
char groupname[64];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1239,8 +1172,6 @@ irpd_getgrgid(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct group *gr;
char groupid[64];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1300,9 +1231,6 @@ irpd_getgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct group *gr;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1325,10 +1253,6 @@ irpd_setgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- struct group *gr;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1372,8 +1296,6 @@ irpd_getservbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct servent *serv;
char servicename[64];
char protoname[10];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1425,8 +1347,6 @@ irpd_getservbyport(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct servent *sv;
char portnum[64];
char protoname[10];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1494,9 +1414,6 @@ irpd_getservent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct servent *sv;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1519,10 +1436,6 @@ irpd_setservent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- struct servent *sv;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1577,8 +1490,6 @@ irpd_getprotobyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct protoent *pr;
char protoname[64];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1621,8 +1532,6 @@ irpd_getprotobynumber(struct ctl_sctx *ctx, struct ctl_sess *sess,
struct arg_s *args;
struct protoent *pr;
char protonum[64];
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1682,9 +1591,6 @@ irpd_getprotoent(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct protoent *pr;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1707,10 +1613,6 @@ irpd_setprotoent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- struct protoent *pr;
- size_t need;
- size_t need_total = 0;
- struct response_buff *b;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1757,9 +1659,6 @@ irpd_getnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- char netgroupname[64];
- struct response_buff *b = NULL;
- size_t need;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1794,8 +1693,6 @@ irpd_innetgr(struct ctl_sctx *ctx, struct ctl_sess *sess,
u_int respflags, void *respctx, void *uctx)
{
struct arg_s *args;
- struct response_buff *b;
- size_t need;
struct net_data *netdata = get_net_data(sess);
char *host;
char *user;
@@ -1837,7 +1734,6 @@ irpd_innetgr(struct ctl_sctx *ctx, struct ctl_sess *sess,
memput(ngtmp, args->iov[1].iov_len + 1);
}
- untimely:
free_args(args);
}
@@ -1870,7 +1766,6 @@ irpd_setnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
"setnetgrent ok");
}
- untimely:
free_args(args);
}
@@ -1886,7 +1781,6 @@ irpd_endnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- struct arg_s *args;
struct net_data *netdata = get_net_data(sess);
INSIST(netdata != NULL);
@@ -1905,20 +1799,6 @@ irpd_endnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
/*
* static void
- * irpd_done(struct ctl_sctx *ctx, struct ctl_sess *sess, void *param)
- * Callback for when QUIT respnse is sent out.
- */
-static void
-irpd_done(struct ctl_sctx *ctx, struct ctl_sess *sess, void *param) {
- struct net_data *netdata = get_net_data(sess);
-
- INSIST(netdata != NULL);
-
- net_data_destroy(netdata);
-}
-
-/*
- * static void
* irpd_quit(struct ctl_sctx *ctx, struct ctl_sess *sess,
* const struct ctl_verb *verb, const char *rest,
* u_int respflags, void *respctx, void *uctx);
@@ -2239,15 +2119,6 @@ make_cli_ctx(void) {
return (p);
}
-static void
-release_cli_ctx(struct client_ctx *ctx) {
- INSIST(ctx != NULL);
- INSIST(ctx->net_data != NULL);
-
- net_data_destroy(ctx->net_data);
- memput(ctx, sizeof *ctx);
-}
-
static struct net_data *
get_net_data(struct ctl_sess *sess) {
struct client_ctx *ctx = ctl_getcsctx(sess);
diff --git a/contrib/bind/bin/mkservdb/Makefile b/contrib/bind/bin/mkservdb/Makefile
index 300505d..61055b5 100644
--- a/contrib/bind/bin/mkservdb/Makefile
+++ b/contrib/bind/bin/mkservdb/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 1.7 2000/07/11 06:41:30 vixie Exp $
+# $Id: Makefile,v 1.8 2000/12/23 08:02:52 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/mkservdb/mkservdb.c b/contrib/bind/bin/mkservdb/mkservdb.c
index 5647ec7..b3b758c 100644
--- a/contrib/bind/bin/mkservdb/mkservdb.c
+++ b/contrib/bind/bin/mkservdb/mkservdb.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: mkservdb.c,v 1.6 1999/10/13 16:39:00 vixie Exp $";
+static const char rcsid[] = "$Id: mkservdb.c,v 1.9 2001/01/26 06:54:11 vixie Exp $";
#endif /* not lint */
/*
@@ -29,6 +29,7 @@ static const char rcsid[] = "$Id: mkservdb.c,v 1.6 1999/10/13 16:39:00 vixie Exp
#include <ctype.h>
#ifdef IRS_LCL_SV_DB
#include <db.h>
+#include <err.h>
#endif
#include <fcntl.h>
#include <limits.h>
@@ -37,9 +38,11 @@ static const char rcsid[] = "$Id: mkservdb.c,v 1.6 1999/10/13 16:39:00 vixie Exp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "../../include/irs.h"
#include "../../lib/irs/irs_p.h"
+#include "../../include/isc/misc.h"
#include "port_after.h"
@@ -61,6 +64,7 @@ main(int argc, char **argv) {
struct servent *getnextent(FILE *);
+int
main(int argc, char **argv) {
DB *db;
DBT key;
@@ -112,24 +116,26 @@ main(int argc, char **argv) {
}
data.size = p - dbuf;
- if ((r = db->put(db, &key, &data, R_NOOVERWRITE)))
+ if ((r = db->put(db, &key, &data, R_NOOVERWRITE))) {
if (r < 0)
- errx(1, "failed to write %s", key.data);
+ errx(1, "failed to write %s", (char *)key.data);
else
- warnx("will not overwrite %s", key.data);
+ warnx("will not overwrite %s", (char *)key.data);
+ }
for (n = 0; sv->s_aliases[n]; ++n) {
if (strlen(sv->s_aliases[n]) + sizeof "/"
+ strlen(sv->s_proto) > sizeof kbuf)
continue;
key.size = SPRINTF((kbuf, "%s/%s",
sv->s_aliases[n], sv->s_proto))+1;
- if ((r = db->put(db, &key, &data, R_NOOVERWRITE)))
+ if ((r = db->put(db, &key, &data, R_NOOVERWRITE))) {
if (r < 0)
errx(1, "failed to write %s",
- key.data);
+ (char *)key.data);
else
warnx("will not overwrite %s",
- key.data);
+ (char *)key.data);
+ }
}
ports = (u_short *)kbuf;
@@ -152,16 +158,17 @@ main(int argc, char **argv) {
}
data.size = p - dbuf;
- if ((r = db->put(db, &key, &data, R_NOOVERWRITE)))
+ if ((r = db->put(db, &key, &data, R_NOOVERWRITE))) {
if (r < 0)
errx(1, "failed to write %d/%s",
ntohs(sv->s_port), sv->s_proto);
else
warnx("will not overwrite %d/%s",
- ntohs(sv->s_port), sv->s_proto);
+ ntohs(sv->s_port), sv->s_proto);
+ }
}
db->close(db);
- if (rename(tmpdatabase, database))
+ if (isc_movefile(tmpdatabase, database))
err(1, "rename %s -> %s", tmpdatabase, database);
exit(0);
}
diff --git a/contrib/bind/bin/named-bootconf/Makefile b/contrib/bind/bin/named-bootconf/Makefile
index 35403e9..54f255b 100644
--- a/contrib/bind/bin/named-bootconf/Makefile
+++ b/contrib/bind/bin/named-bootconf/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 1.2 2000/07/11 06:41:33 vixie Exp $
+# $Id: Makefile,v 1.3 2000/12/23 08:02:53 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/named-bootconf/named-bootconf.sh b/contrib/bind/bin/named-bootconf/named-bootconf.sh
index c1dfaad..3952b14 100644
--- a/contrib/bind/bin/named-bootconf/named-bootconf.sh
+++ b/contrib/bind/bin/named-bootconf/named-bootconf.sh
@@ -181,19 +181,24 @@ while read CMD ARGS; do
esac
set - X $ARGS
shift
- if [ $# -gt 2 ]; then
+ if [ $# -gt 1 ]; then
ZONE=$1
shift
- PRIMARIES=$1
- while [ $# -gt 2 ]; do
- shift
+ PRIMARIES=""
+ while [ $# -gt 1 ]; do
PRIMARIES="$PRIMARIES $1"
+ shift
done
(echo ""
cat $COMMENTFILE
echo "zone \"$ZONE\" ${class}{"
echo " type slave;"
- echo " file \"$2\";"
+ if expr x"$1" : '^x[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' > /dev/null
+ then
+ PRIMARIES="$PRIMARIES $1"
+ else
+ echo " file \"$1\";"
+ fi
echo " masters {"
for PRIMARY in $PRIMARIES; do
echo " $PRIMARY;"
@@ -215,19 +220,24 @@ while read CMD ARGS; do
esac
set - X $ARGS
shift
- if [ $# -gt 2 ]; then
+ if [ $# -gt 1 ]; then
ZONE=$1
shift
- PRIMARIES=$1
- while [ $# -gt 2 ]; do
- shift
+ PRIMARIES=""
+ while [ $# -gt 1 ]; do
PRIMARIES="$PRIMARIES $1"
+ shift
done
(echo ""
cat $COMMENTFILE
echo "zone \"$ZONE\" ${class}{"
echo " type stub;"
- echo " file \"$2\";"
+ if expr x"$1" : '^x[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' > /dev/null
+ then
+ PRIMARIES="$PRIMARIES $1"
+ else
+ echo " file \"$1\";"
+ fi
echo " masters {"
for PRIMARY in $PRIMARIES; do
echo " $PRIMARY;"
diff --git a/contrib/bind/bin/named-xfer/Makefile b/contrib/bind/bin/named-xfer/Makefile
index b85a4d5..b44ff42 100644
--- a/contrib/bind/bin/named-xfer/Makefile
+++ b/contrib/bind/bin/named-xfer/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.30 2000/07/11 06:41:34 vixie Exp $
+# $Id: Makefile,v 8.31 2000/12/23 08:02:54 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/named/db_defs.h b/contrib/bind/bin/named/db_defs.h
index 6fad285..a3e9032 100644
--- a/contrib/bind/bin/named/db_defs.h
+++ b/contrib/bind/bin/named/db_defs.h
@@ -1,6 +1,6 @@
/*
* from db.h 4.16 (Berkeley) 6/1/90
- * $Id: db_defs.h,v 8.38 2000/04/21 06:54:01 vixie Exp $
+ * $Id: db_defs.h,v 8.40 2000/11/29 06:55:46 marka Exp $
*/
/*
@@ -103,9 +103,17 @@
/*
* Hash table structures.
*/
+/*
+ * XXX
+ * For IPv6 transport support we need a seperate reference counted
+ * database of source addresses and d_addr should become a union with
+ * a pointer into that database. A bit can be robbed from d_rode to
+ * indicate what the union is being used for. This should require less
+ * memory than making d_addr a union of struct in6_addr and struct in_addr.
+ */
struct databuf {
struct databuf *d_next; /* linked list */
- struct nameser *d_ns; /* NS from whence this came */
+ struct in_addr d_addr; /* NS from whence this came */
u_int32_t d_ttl; /* time to live */
/* if d_zone == DB_Z_CACHE, then
* d_ttl is actually the time when
@@ -125,11 +133,18 @@ struct databuf {
int16_t d_type; /* type number */
int16_t d_size; /* size of data area */
u_int32_t d_rcnt;
+#ifdef HITCOUNTS
+ u_int32_t d_hitcnt; /* Number of requests for this data. */
+#endif /* HITCOUNTS */
u_int16_t d_nstime; /* NS response time, milliseconds */
u_char d_data[sizeof(void*)]; /* dynamic (padded) */
};
#define DATASIZE(n) (sizeof(struct databuf) - sizeof(void*) + n)
+#ifdef HITCOUNTS
+extern u_int32_t db_total_hits;
+#endif /* HITCOUNTS */
+
#ifdef BIND_UPDATE
/*
* d_mark definitions
diff --git a/contrib/bind/bin/named/db_dump.c b/contrib/bind/bin/named/db_dump.c
index 10acb8c..5bb9456 100644
--- a/contrib/bind/bin/named/db_dump.c
+++ b/contrib/bind/bin/named/db_dump.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_dump.c 4.33 (Berkeley) 3/3/91";
-static const char rcsid[] = "$Id: db_dump.c,v 8.43 2000/04/21 06:54:01 vixie Exp $";
+static const char rcsid[] = "$Id: db_dump.c,v 8.48 2000/12/23 08:14:34 vixie Exp $";
#endif /* not lint */
/*
@@ -125,15 +125,20 @@ static const char rcsid[] = "$Id: db_dump.c,v 8.43 2000/04/21 06:54:01 vixie Exp
#include "named.h"
+#ifdef HITCOUNTS
+u_int32_t db_total_hits;
+#endif /* HITCOUNTS */
+
static const char *MkCredStr(int);
+static int fwd_dump(FILE *fp);
+
/*
* Dump current data base in a format similar to RFC 883.
*/
void
-doadump()
-{
+doadump(void) {
FILE *fp;
ns_notice(ns_log_db, "dumping nameserver data");
@@ -141,6 +146,10 @@ doadump()
if ((fp = write_open(server_options->dump_filename)) == NULL)
return;
gettime(&tt);
+#ifdef HITCOUNTS
+ if (NS_OPTION_P(OPTION_HITCOUNT))
+ fprintf(fp, "; Total hits: %d\n",db_total_hits);
+#endif /* HITCOUNTS */
fprintf(fp, "; Dumped at %s", ctimel(tt.tv_sec));
if (zones != NULL && nzones != 0)
zt_dump(fp);
@@ -204,7 +213,8 @@ zt_dump(FILE *fp) {
fprintf(fp, ";; --zone table--\n");
return (0);
}
-int
+
+static int
fwd_dump(FILE *fp) {
int i;
fprintf(fp, ";; ++forwarders table++\n");
@@ -471,18 +481,18 @@ db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) {
NS_GET16(preference, cp);
fprintf(fp, "%u", preference);
- if ((n = *cp++) != 0) {
- fprintf(fp, "\"%.*s\"", (int)n, cp);
- cp += n;
- }
- if ((n = *cp++) != 0) {
- fprintf(fp, "\"%.*s\"", (int)n, cp);
- cp += n;
- }
- if ((n = *cp++) != 0) {
- fprintf(fp, " \"%.*s\"", (int)n, cp);
- cp += n;
- }
+ n = *cp++;
+ fprintf(fp, "\"%.*s\"", (int)n, cp);
+ cp += n;
+
+ n = *cp++;
+ fprintf(fp, "\"%.*s\"", (int)n, cp);
+ cp += n;
+
+ n = *cp++;
+ fprintf(fp, " \"%.*s\"", (int)n, cp);
+ cp += n;
+
fprintf(fp, " %s.", cp);
break;
@@ -627,18 +637,24 @@ db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) {
getname(np, dname, sizeof(dname));
when = db_lame_find(dname, dp);
if (when != 0 && when > tt.tv_sec) {
- fprintf(fp, "%sLAME=%d",
+ fprintf(fp, "%sLAME=%ld",
sep, when - tt.tv_sec);
sep = " ";
}
}
eoln:
- if (dp->d_ns != NULL){
+ if (dp->d_addr.s_addr != htonl(0)) {
fprintf(fp, "%s[%s]",
- sep, inet_ntoa(dp->d_ns->addr));
+ sep, inet_ntoa(dp->d_addr));
sep = " ";
}
+#ifdef HITCOUNTS
+ if (NS_OPTION_P(OPTION_HITCOUNT)) {
+ fprintf(fp, "%shits=%d", sep, dp->d_hitcnt);
+ sep=" ";
+ }
+#endif /* HITCOUNTS */
putc('\n', fp);
}
}
diff --git a/contrib/bind/bin/named/db_func.h b/contrib/bind/bin/named/db_func.h
index cb83beb..d01de88 100644
--- a/contrib/bind/bin/named/db_func.h
+++ b/contrib/bind/bin/named/db_func.h
@@ -90,53 +90,53 @@
/* db_proc.h - prototypes for functions in db_*.c
*
- * $Id: db_func.h,v 8.42 2000/04/21 06:54:02 vixie Exp $
+ * $Id: db_func.h,v 8.44 2000/12/02 23:28:33 vixie Exp $
*/
/* ++from db_update.c++ */
-extern int db_update(const char *name,
+int db_update(const char *name,
struct databuf *odp,
struct databuf *newdp,
struct databuf **savedpp,
int flags,
struct hashbuf *htp,
- struct sockaddr_in from),
- db_cmp(const struct databuf *, const struct databuf *),
- findMyZone(struct namebuf *np, int class);
+ struct sockaddr_in from);
+int db_cmp(const struct databuf *, const struct databuf *);
+int findMyZone(struct namebuf *np, int class);
void fixttl(struct databuf *dp);
/* --from db_update.c-- */
/* ++from db_save.c++ */
-extern struct namebuf *savename(const char *, int);
-extern struct databuf *savedata(int, int, u_int32_t, u_char *, int);
-extern struct hashbuf *savehash(struct hashbuf *);
+struct namebuf * savename(const char *, int);
+struct databuf * savedata(int, int, u_int32_t, u_char *, int);
+struct hashbuf * savehash(struct hashbuf *);
/* --from db_save.c-- */
/* ++from db_dump.c++ */
-extern int db_dump(struct hashbuf *, FILE *, int, char *),
+int db_dump(struct hashbuf *, FILE *, int, char *),
zt_dump(FILE *);
-extern void doadump(void);
+void doadump(void);
/* --from db_dump.c-- */
/* ++from db_load.c++ */
-extern int makename_ok(char *name, const char *origin, int class,
+int makename_ok(char *name, const char *origin, int class,
struct zoneinfo *zp,
enum transport transport,
enum context context,
const char *owner, const char *filename,
int lineno, int size);
-extern void endline(FILE *);
-extern int getword(char *, size_t, FILE *, int),
- getttl(FILE *, const char *, int, u_int32_t *, int *),
- getnum(FILE *, const char *, int),
- db_load(const char *, const char *, struct zoneinfo *,
+void endline(FILE *);
+int getword(char *, size_t, FILE *, int);
+int getttl(FILE *, const char *, int, u_int32_t *, int *);
+int getnum(FILE *, const char *, int, int *);
+int db_load(const char *, const char *, struct zoneinfo *,
const char *, int);
-extern int getnonblank(FILE *, const char *),
- getservices(int, char *, FILE *, const char *);
-extern char getprotocol(FILE *, const char *);
-extern int makename(char *, const char *, int);
-extern void db_err(int, char *, int, const char *, int);
-extern int parse_sec_rdata(char *inp, int inp_len, int inp_full,
+int getnonblank(FILE *, const char *, int);
+int getservices(int, char *, FILE *, const char *);
+char getprotocol(FILE *, const char *);
+int makename(char *, const char *, int);
+void db_err(int, char *, int, const char *, int);
+int parse_sec_rdata(char *inp, int inp_len, int inp_full,
u_char *data, int data_len,
FILE *fp, struct zoneinfo *zp,
char *domain, u_int32_t ttl,
@@ -146,40 +146,37 @@ extern int parse_sec_rdata(char *inp, int inp_len, int inp_full,
/* --from db_load.c-- */
/* ++from db_glue.c++ */
-extern void buildservicelist(void),
- destroyservicelist(void),
- buildprotolist(void),
- destroyprotolist(void),
- getname(struct namebuf *, char *, int);
-extern int servicenumber(const char *),
- protocolnumber(const char *),
- get_class(const char *);
-extern u_int nhash(const char *);
-extern const char *protocolname(int),
- *servicename(u_int16_t, const char *);
-#ifndef BSD
-extern int getdtablesize(void);
-#endif
-extern struct databuf *rm_datum(struct databuf *,
- struct namebuf *,
- struct databuf *,
- struct databuf **);
-extern struct namebuf *rm_name(struct namebuf *,
- struct namebuf **,
- struct namebuf *);
-extern void rm_hash(struct hashbuf *);
-extern void db_freedata(struct databuf *);
-extern void db_lame_add(char *zone, char *server, time_t when);
-extern time_t db_lame_find(char *zone, struct databuf *dp);
-extern void db_lame_clean(void);
-extern void db_lame_destroy(void);
+void buildservicelist(void);
+void destroyservicelist(void);
+void buildprotolist(void);
+void destroyprotolist(void);
+void getname(struct namebuf *, char *, int);
+int servicenumber(const char *);
+int protocolnumber(const char *);
+int get_class(const char *);
+u_int nhash(const char *);
+const char * protocolname(int);
+const char * servicename(u_int16_t, const char *);
+struct databuf * rm_datum(struct databuf *,
+ struct namebuf *,
+ struct databuf *,
+ struct databuf **);
+struct namebuf * rm_name(struct namebuf *,
+ struct namebuf **,
+ struct namebuf *);
+void rm_hash(struct hashbuf *);
+void db_freedata(struct databuf *);
+void db_lame_add(char *zone, char *server, time_t when);
+time_t db_lame_find(char *zone, struct databuf *dp);
+void db_lame_clean(void);
+void db_lame_destroy(void);
/* --from db_glue.c-- */
/* ++from db_lookup.c++ */
-extern struct namebuf *nlookup(const char *, struct hashbuf **,
- const char **, int);
-extern struct namebuf *np_parent __P((struct namebuf *));
-extern int match(struct databuf *, int, int),
+struct namebuf * nlookup(const char *, struct hashbuf **,
+ const char **, int);
+struct namebuf * np_parent(struct namebuf *);
+int match(struct databuf *, int, int),
nxtmatch(const char *, struct databuf *,
struct databuf *),
rrmatch(const char *, struct databuf *,
@@ -187,8 +184,8 @@ extern int match(struct databuf *, int, int),
/* --from db_lookup.c-- */
/* ++from db_ixfr.c++ */
-extern ns_deltalist * ixfr_get_change_list(struct zoneinfo *, u_int32_t,
- u_int32_t);
+ns_deltalist * ixfr_get_change_list(struct zoneinfo *, u_int32_t,
+ u_int32_t);
int ixfr_have_log(struct zoneinfo *, u_int32_t,
u_int32_t);
/* --from db_ixfr.c++ */
@@ -204,6 +201,7 @@ int db_set_update(char *name, struct databuf *dp,
int *rrcount, int line,
const char *file);
/* --from db_sec.c-- */
+
/* ++from db_tsig.c++ */
char * tsig_alg_name(int value);
int tsig_alg_value(char *name);
diff --git a/contrib/bind/bin/named/db_glue.c b/contrib/bind/bin/named/db_glue.c
index 8c48465..ba59802 100644
--- a/contrib/bind/bin/named/db_glue.c
+++ b/contrib/bind/bin/named/db_glue.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_glue.c 4.4 (Berkeley) 6/1/90";
-static const char rcsid[] = "$Id: db_glue.c,v 8.40 2000/04/21 06:54:02 vixie Exp $";
+static const char rcsid[] = "$Id: db_glue.c,v 8.42 2000/12/23 08:14:35 vixie Exp $";
#endif /* not lint */
/*
@@ -345,17 +345,14 @@ rm_datum(struct databuf *dp, struct namebuf *np, struct databuf *pdp,
np->n_data = ndp;
else
pdp->d_next = ndp;
-#ifdef BIND_UPDATE
if (savedpp != NULL) {
/* mark deleted or pending deletion */
dp->d_mark |= D_MARK_DELETED;
dp->d_next = *savedpp;
+ DRCNTINC(dp);
*savedpp = dp;
} else
dp->d_next = NULL;
-#else
- dp->d_next = NULL;
-#endif
dp->d_flags &= ~DB_F_ACTIVE;
DRCNTDEC(dp);
if (dp->d_rcnt) {
@@ -381,10 +378,7 @@ rm_datum(struct databuf *dp, struct namebuf *np, struct databuf *pdp,
"rm_datum: rcnt = %d", dp->d_rcnt);
}
} else
-#ifdef BIND_UPDATE
- if (savedpp == NULL)
-#endif
- db_freedata(dp);
+ db_freedata(dp);
return (ndp);
}
@@ -439,9 +433,6 @@ getname(struct namebuf *np, char *buf, int buflen) {
while (np != NULL) {
i = (int) NAMELEN(*np);
if (i + 1 >= buflen) {
- *cp = '\0';
- ns_info(ns_log_db,
- "domain name too long: %s...", buf);
strcpy(buf, "Name_Too_Long");
return;
}
diff --git a/contrib/bind/bin/named/db_ixfr.c b/contrib/bind/bin/named/db_ixfr.c
index 7a50618..14385d6 100644
--- a/contrib/bind/bin/named/db_ixfr.c
+++ b/contrib/bind/bin/named/db_ixfr.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static char rcsid[] = "$Id: db_ixfr.c,v 8.20 2000/02/29 05:15:03 vixie Exp $";
+static char rcsid[] = "$Id: db_ixfr.c,v 8.23 2000/12/23 08:14:35 vixie Exp $";
#endif
/*
@@ -370,10 +370,7 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
ns_updque *listuprec, u_int32_t *old_serial,
u_int32_t *new_serial)
{
- static int read_soa, read_ns, rrcount;
-
char data[MAXDATA], dnbuf[MAXDNAME], sclass[3];
- const char *errtype = "Database";
char *dname, *cp, *cp1;
char buf[MAXDATA];
u_int32_t serial, ttl;
@@ -388,7 +385,6 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
int zonelist[MAXDNAME];
struct databuf *dp;
struct in_addr ina;
- struct sockaddr_in empty_from;
int datasize;
ns_updrec * rrecp;
u_long l;
@@ -483,7 +479,7 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
cp = fgets(buf, sizeof buf, fp);
if (!cp)
*buf = '\0';
- n = sscanf(cp, "origin %s class %s serial %ul",
+ n = sscanf(cp, "origin %s class %s serial %lu",
origin, sclass, &serial);
if (n != 3 || ns_samename(origin, zp->z_origin) != 1)
err++;
@@ -638,14 +634,15 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
err++;
break;
}
- c = getnonblank(fp, zp->z_updatelog);
+ c = getnonblank(fp, zp->z_updatelog, 0);
if (c == '(') {
multiline = 1;
} else {
multiline = 0;
ungetc(c, fp);
}
- n = getnum(fp, zp->z_updatelog, GETNUM_SERIAL);
+ n = getnum(fp, zp->z_updatelog, GETNUM_SERIAL,
+ &multiline);
if (getnum_error) {
err++;
break;
@@ -665,11 +662,13 @@ ixfr_getdelta(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
n = l;
PUTLONG(n, cp);
}
- if (multiline &&
- getnonblank(fp, zp->z_updatelog) != ')')
- {
- err++;
- break;
+ if (multiline) {
+ c = getnonblank(fp, zp->z_updatelog, 1);
+ if (c != ')') {
+ ungetc(c, fp);
+ err++;
+ break;
+ }
}
endline(fp);
n = cp - data;
diff --git a/contrib/bind/bin/named/db_load.c b/contrib/bind/bin/named/db_load.c
index 305944c..0adb7ab 100644
--- a/contrib/bind/bin/named/db_load.c
+++ b/contrib/bind/bin/named/db_load.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_load.c 4.38 (Berkeley) 3/2/91";
-static const char rcsid[] = "$Id: db_load.c,v 8.104 2000/07/17 07:48:09 vixie Exp $";
+static const char rcsid[] = "$Id: db_load.c,v 8.110 2001/01/25 05:50:53 marka Exp $";
#endif /* not lint */
/*
@@ -252,6 +252,7 @@ db_load(const char *filename, const char *in_origin,
int genstart, genend, genstep;
char *thisfile;
void *state = NULL;
+ int loggenerr;
empty_from.sin_family = AF_INET;
empty_from.sin_addr.s_addr = htonl(INADDR_ANY);
@@ -270,6 +271,13 @@ db_load(const char *filename, const char *in_origin,
/* Any updates should be saved before we attempt to reload. */
INSIST((zp->z_flags & (Z_NEED_DUMP|Z_NEED_SOAUPDATE)) == 0);
case Z_HINT:
+ if(filename == NULL) {
+ ns_error(ns_log_load,
+ "Required filename not specified for Hint zone");
+ zp->z_flags |= Z_DB_BAD;
+ zp->z_ftime = 0;
+ return (0);
+ }
transport = primary_trans;
break;
case Z_SECONDARY:
@@ -314,7 +322,10 @@ db_load(const char *filename, const char *in_origin,
ns_warning(ns_log_load, "db_load could not open: %s: %s",
filename, strerror(errno));
zp->z_ftime = 0;
- return (-1);
+ if (ininclude)
+ return (-1);
+ errs = -1;
+ goto cleanup;
}
if (zp->z_type == Z_HINT) {
dbflags = DB_NODATA | DB_NOHINTS;
@@ -414,10 +425,21 @@ db_load(const char *filename, const char *in_origin,
}
if (!getword(genrhs, sizeof(genrhs), fp, 2))
ERRTOZ("$GENERATE missing RHS");
+ loggenerr = 1;
for (i = genstart; i <= genend; i += genstep) {
if (genname(genlhs, i, origin, domain,
sizeof domain) == -1)
ERRTOZ("$GENERATE genname LHS failed");
+ if (!ns_samedomain(domain, zp->z_origin)) {
+ /* Log first per $GENERATE. */
+ if (loggenerr) {
+ ns_info(ns_log_load,
+ "%s:%d: $GENERATE LHS out of zone (ignored)",
+ filename, lineno);
+ loggenerr = 0;
+ }
+ continue;
+ }
context = ns_ownercontext(type, transport);
if (!ns_nameok(NULL, domain, class, zp, transport,
context, domain, inaddr_any)) {
@@ -668,7 +690,7 @@ db_load(const char *filename, const char *in_origin,
filename, lineno, domain,
zp->z_origin);
}
- c = getnonblank(fp, filename);
+ c = getnonblank(fp, filename, 0);
if (c == '(') {
multiline = 1;
} else {
@@ -677,7 +699,8 @@ db_load(const char *filename, const char *in_origin,
}
serial = zp->z_serial;
zp->z_serial = getnum(fp, filename,
- GETNUM_SERIAL);
+ GETNUM_SERIAL,
+ &multiline);
if (getnum_error)
errs++;
n = (u_int32_t) zp->z_serial;
@@ -750,7 +773,7 @@ db_load(const char *filename, const char *in_origin,
ttl = n;
n = cp - (char *)data;
if (multiline) {
- buf[0] = getnonblank(fp, filename);
+ buf[0] = getnonblank(fp, filename, 1);
buf[1] = '\0';
if (buf[0] != ')')
ERRTO("SOA \")\"");
@@ -807,7 +830,8 @@ db_load(const char *filename, const char *in_origin,
PUTSHORT((u_int16_t)n, cp);
/* Preference */
- n = getnum(fp, filename, GETNUM_NONE);
+ n = getnum(fp, filename, GETNUM_NONE,
+ &multiline);
if (getnum_error || n > 65536)
ERRTO("NAPTR Preference");
PUTSHORT((u_int16_t)n, cp);
@@ -874,12 +898,14 @@ db_load(const char *filename, const char *in_origin,
PUTSHORT((u_int16_t)n, cp);
if (type == ns_t_srv) {
- n = getnum(fp, filename, GETNUM_NONE);
+ n = getnum(fp, filename, GETNUM_NONE,
+ &multiline);
if (getnum_error || n > 65536)
ERRTO("SRV RR");
PUTSHORT((u_int16_t)n, cp);
- n = getnum(fp, filename, GETNUM_NONE);
+ n = getnum(fp, filename, GETNUM_NONE,
+ &multiline);
if (getnum_error || n > 65536)
ERRTO("SRV RR");
PUTSHORT((u_int16_t)n, cp);
@@ -1095,19 +1121,27 @@ db_load(const char *filename, const char *in_origin,
}
errs += purge_nonglue(zp->z_origin,
(dataflags & DB_F_HINT) ? fcachetab :
- hashtab, zp->z_class);
+ hashtab, zp->z_class,
+ zp->z_type == z_master);
+ cleanup:
while (filenames) {
fn = filenames;
filenames = filenames->next;
freestr(fn->name);
memput(fn, sizeof *fn);
}
- if (errs != 0)
- ns_warning(ns_log_load,
+ if (errs != 0) {
+ if (errs != -1)
+ ns_warning(ns_log_load,
"%s zone \"%s\" (%s) rejected due to errors (serial %u)",
- zoneTypeString(zp->z_type), zp->z_origin,
- p_class(zp->z_class), zp->z_serial);
- else
+ zoneTypeString(zp->z_type),
+ zp->z_origin,
+ p_class(zp->z_class), zp->z_serial);
+ if ((zp->z_flags & Z_NOTIFY) != 0)
+ ns_stopnotify(zp->z_origin, zp->z_class);
+ do_reload(zp->z_origin, zp->z_type, zp->z_class,
+ loading);
+ } else
ns_info(ns_log_load,
"%s zone \"%s\" (%s) loaded (serial %u)",
zoneTypeString(zp->z_type), zp->z_origin,
@@ -1366,7 +1400,7 @@ getttl(FILE *fp, const char *fn, int lineno, u_int32_t *ttl, int *multiline) {
return (-1);
}
if (*multiline) {
- ch = getnonblank(fp, fn);
+ ch = getnonblank(fp, fn, 1);
if (ch == EOF)
return (-1);
if (ch == ';')
@@ -1447,7 +1481,7 @@ getallwords(char *buf, size_t size, FILE *fp, int preserve) {
}
int
-getnum(FILE *fp, const char *src, int opt) {
+getnum(FILE *fp, const char *src, int opt, int *multiline) {
int c, n;
int seendigit = 0;
int seendecimal = 0;
@@ -1461,8 +1495,12 @@ getnum(FILE *fp, const char *src, int opt) {
#endif
for (n = 0; (c = getc(fp)) != EOF; ) {
if (isspace(c)) {
- if (c == '\n')
- lineno++;
+ if (c == '\n') {
+ if (*multiline)
+ lineno++;
+ else if (!seendigit)
+ goto eol;
+ }
if (seendigit)
break;
continue;
@@ -1470,8 +1508,12 @@ getnum(FILE *fp, const char *src, int opt) {
if (c == ';') {
while ((c = getc(fp)) != EOF && c != '\n')
;
- if (c == '\n')
- lineno++;
+ if (c == '\n') {
+ if (*multiline)
+ lineno++;
+ else if (!seendigit)
+ goto eol;
+ }
if (seendigit)
break;
continue;
@@ -1541,32 +1583,50 @@ getnum(FILE *fp, const char *src, int opt) {
src, lineno, n+m);
}
return (n + m);
+
+ eol:
+ ns_error(ns_log_db, "%s:%d: unexpected end of line", src, lineno);
+ getnum_error = 1;
+ (void) ungetc(c, fp);
+ return (0);
}
#ifndef BIND_UPDATE
static
#endif
int
-getnonblank(FILE *fp, const char *src) {
+getnonblank(FILE *fp, const char *src, int multiline) {
int c;
while ((c = getc(fp)) != EOF) {
if (isspace(c)) {
- if (c == '\n')
- lineno++;
+ if (c == '\n') {
+ if (multiline)
+ lineno++;
+ else
+ goto eol;
+ }
continue;
}
if (c == ';') {
while ((c = getc(fp)) != EOF && c != '\n')
;
- if (c == '\n')
- lineno++;
+ if (c == '\n') {
+ if (multiline)
+ lineno++;
+ else
+ goto eol;
+ }
continue;
}
return (c);
}
ns_info(ns_log_db, "%s:%d: unexpected EOF", src, lineno);
return (EOF);
+ eol:
+ ns_error(ns_log_db, "%s:%d: unexpected end of line", src, lineno);
+ /* don't ungetc(c, fp); as the caller will do this. */
+ return(c);
}
/*
@@ -2118,7 +2178,7 @@ parse_sig_rr(char *buf, int buf_len, u_char *data, int data_size,
} else {
/* Parse and output OTTL; scan TEXP */
origTTL = wordtouint32(buf);
- if (0 >= origTTL || wordtouint32_error ||
+ if (origTTL >= 0 || wordtouint32_error ||
(origTTL > 0x7fffffff))
ERRTO("Original TTL value bad");
cp = &data[i];
diff --git a/contrib/bind/bin/named/db_save.c b/contrib/bind/bin/named/db_save.c
index 1fe0e73..2c8833c 100644
--- a/contrib/bind/bin/named/db_save.c
+++ b/contrib/bind/bin/named/db_save.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_save.c 4.16 (Berkeley) 3/21/91";
-static const char rcsid[] = "$Id: db_save.c,v 8.27 2000/04/21 06:54:03 vixie Exp $";
+static const char rcsid[] = "$Id: db_save.c,v 8.28 2000/11/29 06:55:48 marka Exp $";
#endif /* not lint */
/*
@@ -156,7 +156,7 @@ savedata(class, type, ttl, data, size)
dp->d_clev = 0;
dp->d_secure = DB_S_INSECURE;
dp->d_rcode = NOERROR;
- dp->d_ns = NULL;
+ dp->d_addr.s_addr = htonl(0);
dp->d_nstime = 0;
memcpy(dp->d_data, data, dp->d_size);
return (dp);
diff --git a/contrib/bind/bin/named/db_sec.c b/contrib/bind/bin/named/db_sec.c
index 2ed4a4c..9fb24fb 100644
--- a/contrib/bind/bin/named/db_sec.c
+++ b/contrib/bind/bin/named/db_sec.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: db_sec.c,v 8.31 2000/04/21 06:54:04 vixie Exp $";
+static const char rcsid[] = "$Id: db_sec.c,v 8.32 2000/12/23 08:14:36 vixie Exp $";
#endif /* not lint */
/*
@@ -572,7 +572,7 @@ verify_set(struct db_rrset *rrset) {
namefield == NS_KEY_NAME_RESERVED)
continue;
if (namefield == NS_KEY_NAME_ENTITY &&
- (key->dk_flags & NS_KEY_SIGNATORYMASK == 0))
+ (key->dk_flags & NS_KEY_SIGNATORYMASK) == 0)
continue;
/*
diff --git a/contrib/bind/bin/named/db_update.c b/contrib/bind/bin/named/db_update.c
index 3bd9838..b765c4d 100644
--- a/contrib/bind/bin/named/db_update.c
+++ b/contrib/bind/bin/named/db_update.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_update.c 4.28 (Berkeley) 3/21/91";
-static const char rcsid[] = "$Id: db_update.c,v 8.42 2000/04/21 06:54:04 vixie Exp $";
+static const char rcsid[] = "$Id: db_update.c,v 8.45 2000/12/23 08:14:36 vixie Exp $";
#endif /* not lint */
/*
@@ -583,7 +583,7 @@ db_update(const char *name,
goto delete;
if (dp->d_type == T_CNAME &&
!NS_OPTION_P(OPTION_MULTIPLE_CNAMES) &&
- db_cmp(dp, odp) != 0)
+ db_cmp(dp, odp) != 0) {
if ((flags & DB_REPLACE) == 0 &&
zones[dp->d_zone].z_type ==
Z_PRIMARY) {
@@ -593,6 +593,7 @@ db_update(const char *name,
return (CNAMEANDOTHER);
} else
goto delete;
+ }
#if 0
/* BEW - this _seriously_ breaks DNSSEC. Is it necessary for dynamic update? */
#ifdef BIND_UPDATE
@@ -751,10 +752,9 @@ db_update(const char *name,
ns_debug(ns_log_db, 3, "db_update: adding%s %#x",
(newdp->d_flags&DB_F_HINT) ? " hint":"", newdp);
- if (NS_OPTION_P(OPTION_HOSTSTATS) &&
- newdp->d_zone == DB_Z_CACHE &&
+ if (newdp->d_zone == DB_Z_CACHE &&
(newdp->d_flags & DB_F_HINT) == 0)
- newdp->d_ns = nameserFind(from.sin_addr, NS_F_INSERT);
+ newdp->d_addr = from.sin_addr;
/* Add to end of list, generally preserving order */
newdp->d_next = NULL;
@@ -937,10 +937,8 @@ db_cmp(const struct databuf *dp1, const struct databuf *dp2) {
cp1 += t1; cp2 += t2;
/* Replacement */
- t1 = strlen((char *)cp1); t2 = strlen((char *)cp2);
- if (t1 != t2 || memcmp(cp1, cp2, t1))
+ if (ns_samename((char *)cp1, (char *)cp2) != 1)
return (1);
- cp1 += t1 + 1; cp2 += t2 + 1;
/* they all checked out! */
return (0);
diff --git a/contrib/bind/bin/named/ns_config.c b/contrib/bind/bin/named/ns_config.c
index 670e288..82b4da6 100644
--- a/contrib/bind/bin/named/ns_config.c
+++ b/contrib/bind/bin/named/ns_config.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ns_config.c,v 8.114 2000/04/23 02:18:58 vixie Exp $";
+static const char rcsid[] = "$Id: ns_config.c,v 8.118 2000/12/23 08:14:37 vixie Exp $";
#endif /* not lint */
/*
@@ -1134,6 +1134,7 @@ new_options() {
op->stats_interval = 3600;
op->ordering = NULL;
op->max_ncache_ttl = DEFAULT_MAX_NCACHE_TTL;
+ op->max_host_stats = 0;
op->lame_ttl = NTTL;
op->heartbeat_interval = 3600;
op->max_log_size_ixfr = 20;
@@ -1189,6 +1190,9 @@ set_boolean_option(u_int *op_flags, int bool_opt, int value) {
INSIST(op_flags != NULL);
switch (bool_opt) {
+#ifdef HITCOUNTS
+ case OPTION_HITCOUNT:
+#endif /* HITCOUNTS */
case OPTION_NORECURSE:
case OPTION_NOFETCHGLUE:
case OPTION_FORWARD_ONLY:
@@ -1743,7 +1747,6 @@ free_rrset_order_list(rrset_order_list rol) {
memput(rol, sizeof (*rol));
}
-
void
add_to_rrset_order_list(rrset_order_list rol, rrset_order_element roe) {
INSIST(rol != NULL);
@@ -2956,7 +2959,7 @@ init_default_log_channels() {
char *name;
FILE *stream;
- syslog_channel = log_new_syslog_channel(0, log_info, LOG_DAEMON);
+ syslog_channel = log_new_syslog_channel(0, log_info, ISC_FACILITY);
if (syslog_channel == NULL || log_inc_references(syslog_channel) < 0)
ns_panic(ns_log_config, 0, "couldn't create syslog_channel");
@@ -3070,8 +3073,10 @@ shutdown_configuration() {
config_initialized = 0;
}
-void
+time_t
load_configuration(const char *filename) {
+ time_t mtime;
+
REQUIRE(config_initialized);
ns_debug(ns_log_config, 3, "load configuration %s", filename);
@@ -3089,7 +3094,7 @@ load_configuration(const char *filename) {
options_installed = 0;
logging_installed = 0;
- parse_configuration(filename);
+ mtime = parse_configuration(filename);
/*
* If the user didn't specify logging or options, but they previously
@@ -3123,4 +3128,5 @@ load_configuration(const char *filename) {
loading = 0;
/* release queued notifies */
notify_afterload();
+ return (mtime);
}
diff --git a/contrib/bind/bin/named/ns_ctl.c b/contrib/bind/bin/named/ns_ctl.c
index 66cb862..1950b07 100644
--- a/contrib/bind/bin/named/ns_ctl.c
+++ b/contrib/bind/bin/named/ns_ctl.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ns_ctl.c,v 8.34 2000/04/21 06:54:05 vixie Exp $";
+static const char rcsid[] = "$Id: ns_ctl.c,v 8.39 2000/12/19 23:31:38 marka Exp $";
#endif /* not lint */
/*
@@ -154,7 +154,7 @@ static struct ctl_verb verbs[] = {
{ "reload", verb_reload, "reload [zone] ..."},
{ "reconfig", verb_reconfig, "reconfig [-noexpired] (just sees new/gone zones)"},
{ "dumpdb", verb_dumpdb, "dumpdb"},
- { "stats", verb_stats, "stats"},
+ { "stats", verb_stats, "stats [clear]"},
{ "trace", verb_trace, "trace [level]"},
{ "notrace", verb_notrace, "notrace"},
{ "querylog", verb_querylog, "querylog"},
@@ -271,6 +271,7 @@ ns_ctl_install(controls *new) {
/* Add any new controls which were found. */
for (ctl = HEAD(*new); ctl != NULL; ctl = next) {
next = NEXT(ctl, link);
+ UNLINK(*new, ctl, link);
APPEND(server_controls, ctl, link);
install(ctl);
if (ctl->sctx == NULL)
@@ -636,6 +637,7 @@ getpid_closure(struct ctl_sctx *sctx, struct ctl_sess *sess, void *uap) {
enum state {
e_version = 0,
+ e_config,
e_nzones,
e_debug,
e_xfersrun,
@@ -643,7 +645,6 @@ enum state {
e_qserials,
e_qrylog,
e_priming,
- e_loading,
e_finito
};
@@ -666,7 +667,7 @@ verb_status(struct ctl_sctx *ctl, struct ctl_sess *sess,
0, NULL, NULL, NULL, NULL, 0);
return;
}
- pvt->state = e_version;
+ pvt->state = (enum state)0;
(void)ctl_setcsctx(sess, pvt);
}
switch (pvt->state++) {
@@ -674,6 +675,10 @@ verb_status(struct ctl_sctx *ctl, struct ctl_sess *sess,
strncpy(pvt->text, Version, sizeof pvt->text);
pvt->text[sizeof pvt->text - 1] = '\0';
break;
+ case e_config:
+ sprintf(pvt->text, "config (%s) last loaded at age: %24s",
+ conffile, ctime(&confmtime));
+ break;
case e_nzones:
sprintf(pvt->text, "number of zones allocated: %d", nzones);
break;
@@ -695,12 +700,10 @@ verb_status(struct ctl_sctx *ctl, struct ctl_sess *sess,
qrylog ? "ON" : "OFF");
break;
case e_priming:
- sprintf(pvt->text, "server is %s priming",
- priming ? "STILL" : "DONE");
- break;
- case e_loading:
- sprintf(pvt->text, "server %s loading its configuration",
- loading ? "IS" : "IS NOT");
+ if (priming)
+ sprintf(pvt->text, "server is initialising itself");
+ else
+ sprintf(pvt->text, "server is up and running");
break;
case e_finito:
return;
@@ -861,9 +864,15 @@ verb_stats(struct ctl_sctx *ctl, struct ctl_sess *sess,
const struct ctl_verb *verb, const char *rest,
u_int respflags, void *respctx, void *uctx)
{
- ns_need(main_need_statsdump);
- ctl_response(sess, 250, "Statistics dump initiated.",
- 0, NULL, NULL, NULL, NULL, 0);
+ if (rest != NULL && strcmp(rest, "clear") == 0) {
+ ns_need(main_need_statsdumpandclear);
+ ctl_response(sess, 250, "Statistics dump and clear initiated.",
+ 0, NULL, NULL, NULL, NULL, 0);
+ } else {
+ ns_need(main_need_statsdump);
+ ctl_response(sess, 250, "Statistics dump initiated.",
+ 0, NULL, NULL, NULL, NULL, 0);
+ }
}
static void
diff --git a/contrib/bind/bin/named/ns_defs.h b/contrib/bind/bin/named/ns_defs.h
index 56b50fe..8d480f2 100644
--- a/contrib/bind/bin/named/ns_defs.h
+++ b/contrib/bind/bin/named/ns_defs.h
@@ -1,6 +1,6 @@
/*
* from ns.h 4.33 (Berkeley) 8/23/90
- * $Id: ns_defs.h,v 8.96 2000/04/21 06:54:06 vixie Exp $
+ * $Id: ns_defs.h,v 8.102 2000/12/01 05:35:48 vixie Exp $
*/
/*
@@ -143,6 +143,9 @@
#define DEFAULT_XFERS_RUNNING 10 /* default value of transfers_in */
#define DEFAULT_XFERS_PER_NS 2 /* default # of xfers per peer nameserver */
#define XFER_BUFSIZE (16*1024) /* arbitrary but bigger than most MTU's */
+#define MAX_SYNCDELAY 3 /* Presumed timeout in use by our clients. */
+#define MAX_SYNCDRAIN 100000 /* How long we'll spin in drain_all_rcvbuf. */
+#define MAX_SYNCSTORE 500
/* maximum time to cache negative answers */
#define DEFAULT_MAX_NCACHE_TTL (3*60*60)
@@ -160,6 +163,7 @@ typedef enum need {
main_need_zoneload, /* loadxfer() needed. */
main_need_dump, /* doadump() needed. */
main_need_statsdump, /* ns_stats() needed. */
+ main_need_statsdumpandclear, /* ns_stats() needed. */
main_need_exit, /* exit() needed. */
main_need_qrylog, /* toggle_qrylog() needed. */
main_need_debug, /* use_desired_debug() needed. */
@@ -190,6 +194,8 @@ typedef enum need {
#define OPTION_TREAT_CR_AS_SPACE 0x1000 /* Treat CR in zone files as space */
#define OPTION_USE_IXFR 0x2000 /* Use by delault ixfr in zone transfer */
#define OPTION_MAINTAIN_IXFR_BASE 0x4000 /* Part of IXFR file name logic. */
+#define OPTION_HITCOUNT 0x8000 /* Keep track of each time an RR gets
+ * hit in the database */
#define DEFAULT_OPTION_FLAGS (OPTION_NODIALUP|OPTION_NONAUTH_NXDOMAIN|\
OPTION_USE_ID_POOL|OPTION_NORFC2308_TYPE1)
@@ -671,8 +677,8 @@ struct nameser {
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 */
+#endif
};
enum transport { primary_trans, secondary_trans, response_trans, update_trans,
@@ -764,6 +770,7 @@ typedef struct options {
rrset_order_list ordering;
int heartbeat_interval;
u_int max_ncache_ttl;
+ u_int max_host_stats;
u_int lame_ttl;
int minroots;
} *options;
diff --git a/contrib/bind/bin/named/ns_forw.c b/contrib/bind/bin/named/ns_forw.c
index beb919c..dac6525 100644
--- a/contrib/bind/bin/named/ns_forw.c
+++ b/contrib/bind/bin/named/ns_forw.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_forw.c 4.32 (Berkeley) 3/3/91";
-static const char rcsid[] = "$Id: ns_forw.c,v 8.75 2000/05/09 07:12:58 vixie Exp $";
+static const char rcsid[] = "$Id: ns_forw.c,v 8.78 2000/12/23 08:14:37 vixie Exp $";
#endif /* not lint */
/*
@@ -375,6 +375,8 @@ nslookupComplain(const char *sysloginfo, const char *queryname,
ns_debug(ns_log_default, 2, "NS '%s' %s", dname, complaint);
if (sysloginfo && queryname && !haveComplained((u_long)queryname,
(u_long)complaint)) {
+ char nsbuf[20], abuf[20];
+
a = ns = (char *)NULL;
print_a = (a_rr->d_type == T_A);
a_type = p_type(a_rr->d_type);
@@ -389,25 +391,21 @@ nslookupComplain(const char *sysloginfo, const char *queryname,
break;
}
}
- if (NS_OPTION_P(OPTION_HOSTSTATS)) {
- char nsbuf[20], abuf[20];
-
- if (nsdp != NULL) {
- if (nsdp->d_ns != NULL) {
- strcpy(nsbuf,
- inet_ntoa(nsdp->d_ns->addr));
- ns = nsbuf;
- } else {
- ns = zones[nsdp->d_zone].z_origin;
- }
- }
- if (a_rr->d_ns != NULL) {
- strcpy(abuf, inet_ntoa(a_rr->d_ns->addr));
- a = abuf;
+ if (nsdp != NULL) {
+ if (nsdp->d_addr.s_addr != htonl(0)) {
+ strcpy(nsbuf,
+ inet_ntoa(nsdp->d_addr));
+ ns = nsbuf;
} else {
- a = zones[a_rr->d_zone].z_origin;
+ ns = zones[nsdp->d_zone].z_origin;
}
}
+ if (a_rr->d_addr.s_addr != htonl(0)) {
+ strcpy(abuf, inet_ntoa(a_rr->d_addr));
+ a = abuf;
+ } else {
+ a = zones[a_rr->d_zone].z_origin;
+ }
if (a != NULL || ns != NULL)
ns_info(ns_log_default,
"%s: query(%s) %s (%s:%s) learnt (%s=%s:NS=%s)",
@@ -677,7 +675,6 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
skipserver:
(void)NULL;
}
- out:
ns_debug(ns_log_default, 3, "nslookup: %d ns addrs total", n);
qp->q_naddr = n;
if (n == 0 && potential_ns == 0 && !NS_ZFWDTAB(qp->q_fzone)) {
@@ -766,14 +763,17 @@ int
qcomp(struct qserv *qs1, struct qserv *qs2) {
u_int rtt1, rtt2, rttr1, rttr2;
- if (qs1->nsdata == NULL || qs2->nsdata == NULL) {
+ if (qs1->nsdata == NULL) {
rtt1 = 0;
rttr1 = 0;
- rtt2 = 0;
- rttr2 = 0;
} else {
rtt1 = qs1->nsdata->d_nstime;
rttr1 = RTTROUND(rtt1);
+ }
+ if (qs2->nsdata == NULL) {
+ rtt2 = 0;
+ rttr2 = 0;
+ } else {
rtt2 = qs2->nsdata->d_nstime;
rttr2 = RTTROUND(rtt2);
}
@@ -979,7 +979,7 @@ retry(struct qinfo *qp) {
#ifdef DEBUG
if (debug >= 10)
res_pquery(&res, qp->q_msg, n,
- log_get_stream(packet_channel));
+ log_get_stream(packet_channel));
#endif
if (send_msg((u_char *)hp, n, qp)) {
ns_debug(ns_log_default, 1,
@@ -1013,7 +1013,7 @@ retry(struct qinfo *qp) {
#ifdef DEBUG
if (debug >= 10)
res_pquery(&res, qp->q_msg, qp->q_msglen,
- log_get_stream(packet_channel));
+ log_get_stream(packet_channel));
#endif
key = tsig_key_from_addr(nsa->sin_addr);
if (key != NULL) {
@@ -1258,13 +1258,13 @@ nsfwdadd(struct qinfo *qp, struct fwdinfo *fwd) {
nextfwd:
fwd = fwd->next;
}
- qp->q_naddr = n;
/* Update the refcounts before the sort. */
- for (i = 0; i < (u_int)n; i++) {
+ for (i = qp->q_naddr; i < (u_int)n; i++) {
DRCNTINC(qp->q_addr[i].nsdata);
DRCNTINC(qp->q_addr[i].ns);
}
+ qp->q_naddr = n;
if (n > 1) {
qsort((char *)qp->q_addr, n, sizeof(struct qserv),
(int (*)(const void *, const void *))qcomp);
diff --git a/contrib/bind/bin/named/ns_func.h b/contrib/bind/bin/named/ns_func.h
index 760266d..ca30823 100644
--- a/contrib/bind/bin/named/ns_func.h
+++ b/contrib/bind/bin/named/ns_func.h
@@ -90,42 +90,42 @@
/* ns_func.h - declarations for ns_*.c's externally visible functions
*
- * $Id: ns_func.h,v 8.96 2000/04/21 06:54:06 vixie Exp $
+ * $Id: ns_func.h,v 8.104 2001/01/25 05:50:54 marka Exp $
*/
/* ++from ns_glue.c++ */
-extern struct in_addr ina_get(const u_char *data);
-extern const char *sin_ntoa(struct sockaddr_in);
-extern int ns_wouldlog(int category, int level);
-extern void ns_debug(int, int, const char *, ...),
- ns_info(int, const char *, ...),
- ns_notice(int, const char *, ...),
- ns_warning(int, const char *, ...),
- ns_error(int, const char *, ...),
- ns_panic(int, int, const char *, ...),
- ns_assertion_failed(char *file, int line,
+struct in_addr ina_get(const u_char *data);
+const char * sin_ntoa(struct sockaddr_in);
+int ns_wouldlog(int category, int level);
+void ns_debug(int, int, const char *, ...);
+void ns_info(int, const char *, ...);
+void ns_notice(int, const char *, ...);
+void ns_warning(int, const char *, ...);
+void ns_error(int, const char *, ...);
+void ns_panic(int, int, const char *, ...);
+void ns_assertion_failed(char *file, int line,
assertion_type type, char *cond,
int print_errno);
-extern void panic(const char *, const void *),
- gettime(struct timeval *);
-extern int nlabels(const char *),
- my_close(int),
- my_fclose(FILE *);
-extern void __freestr(char *);
-extern char *__newstr(size_t, int),
- *__savestr(const char *, int),
- *checked_ctime(const time_t *t),
- *ctimel(long);
-extern void __freestr_record(char *, char *, int);
-extern char *__newstr_record(size_t, int, char *, int);
-extern char *__savestr_record(const char *, int, char *, int);
-extern u_char *ina_put(struct in_addr ina, u_char *data),
- *savebuf(const u_char *, size_t, int);
-extern void dprintf(int level, const char *format, ...);
+void panic(const char *, const void *);
+void gettime(struct timeval *);
+int nlabels(const char *);
+int my_close(int);
+int my_fclose(FILE *);
+void __freestr(char *);
+char * __newstr(size_t, int);
+char * __savestr(const char *, int);
+char * checked_ctime(const time_t *t);
+char * ctimel(long);
+void __freestr_record(char *, char *, int);
+char * __newstr_record(size_t, int, char *, int);
+char * __savestr_record(const char *, int, char *, int);
+u_char * ina_put(struct in_addr ina, u_char *data);
+u_char * savebuf(const u_char *, size_t, int);
+void dprintf(int level, const char *format, ...);
#ifdef DEBUG_STRINGS
-extern char *debug_newstr(size_t, int, const char *, int),
- *debug_savestr(const char *, int, const char *, int);
-extern void debug_freestr(char *, const char *, int);
+char * debug_newstr(size_t, int, const char *, int);
+char * debug_savestr(const char *, int, const char *, int);
+void debug_freestr(char *, const char *, int);
#define newstr(l, n) debug_newstr((l), (n), __FILE__, __LINE__)
#define savestr(s, n) debug_savestr((s), (n), __FILE__, __LINE__)
#define freestr(s) debug_freestr((s), __FILE__, __LINE__)
@@ -140,7 +140,6 @@ extern void debug_freestr(char *, const char *, int);
#define freestr(s) __freestr((s))
#endif
#endif /* DEBUG_STRINGS */
-int movefile(const char *, const char *);
/* --from ns_glue.c-- */
/* ++from ns_notify.c++ */
@@ -153,43 +152,43 @@ void ns_stopnotify(const char *, ns_class);
/* --from ns_notify.c-- */
/* ++from ns_resp.c++ */
-extern void ns_resp(u_char *, int, struct sockaddr_in,
- struct qstream *),
- prime_cache(void),
- delete_all(struct namebuf *, int, int);
-extern int delete_stale(struct namebuf *);
-extern struct qinfo *sysquery(const char *, int, int,
- struct in_addr *, int, u_int16_t, int);
-extern int doupdate(u_char *, u_char *, struct databuf **,
- int, int, int, u_int, struct sockaddr_in),
- send_msg(u_char *, int, struct qinfo *),
- findns(struct namebuf **, int,
- struct databuf **, int *, int),
- finddata(struct namebuf *, int, int, HEADER *,
- char **, int *, int *),
- add_data(struct namebuf *,
+void ns_resp(u_char *, int, struct sockaddr_in,
+ struct qstream *);
+void prime_cache(void);
+void delete_all(struct namebuf *, int, int);
+int delete_stale(struct namebuf *);
+struct qinfo * sysquery(const char *, int, int,
+ struct in_addr *, int, u_int16_t, int);
+int doupdate(u_char *, u_char *, struct databuf **,
+ int, int, int, u_int, struct sockaddr_in);
+int send_msg(u_char *, int, struct qinfo *);
+int findns(struct namebuf **, int,
+ struct databuf **, int *, int);
+int finddata(struct namebuf *, int, int, HEADER *,
+ char **, int *, int *);
+int add_data(struct namebuf *,
struct databuf **,
- u_char *, int, int *),
- trunc_adjust(u_char *, int, int);
+ u_char *, int, int *);
+int trunc_adjust(u_char *, int, int);
/* --from ns_resp.c-- */
/* ++from ns_req.c++ */
-extern void ns_req(u_char *, int, int,
+void ns_req(u_char *, int, int,
struct qstream *,
struct sockaddr_in,
- int),
- free_addinfo(void),
- free_nsp(struct databuf **);
-extern int stale(struct databuf *),
- make_rr(const char *, struct databuf *,
+ int);
+void free_addinfo(void);
+void free_nsp(struct databuf **);
+int stale(struct databuf *);
+int make_rr(const char *, struct databuf *,
u_char *, int, int,
- u_char **, u_char **, int),
- doaddinfo(HEADER *, u_char *, int),
- doaddauth(HEADER *, u_char *, int,
+ u_char **, u_char **, int);
+int doaddinfo(HEADER *, u_char *, int);
+int doaddauth(HEADER *, u_char *, int,
struct namebuf *,
struct databuf *);
#ifdef BIND_NOTIFY
-extern int findZonePri(const struct zoneinfo *,
+int findZonePri(const struct zoneinfo *,
const struct sockaddr_in);
#endif
/* --from ns_req.c-- */
@@ -198,12 +197,12 @@ extern int findZonePri(const struct zoneinfo *,
void ns_xfr(struct qstream *qsp, struct namebuf *znp,
int zone, int class, int type,
int id, int opcode, u_int32_t serial_ixfr,
- struct tsig_record *in_tsig),
- ns_stopxfrs(struct zoneinfo *),
- ns_freexfr(struct qstream *),
- sx_newmsg(struct qstream *qsp),
- sx_sendlev(struct qstream *qsp),
- sx_sendsoa(struct qstream *qsp);
+ struct tsig_record *in_tsig);
+void ns_stopxfrs(struct zoneinfo *);
+void ns_freexfr(struct qstream *);
+void sx_newmsg(struct qstream *qsp);
+void sx_sendlev(struct qstream *qsp);
+void sx_sendsoa(struct qstream *qsp);
/* --from ns_xfr.c-- */
/* ++from ns_ctl.c++ */
@@ -219,12 +218,13 @@ void ns_ctl_install(controls *);
/* --from ns_ctl.c-- */
/* ++from ns_ixfr.c++ */
-void sx_send_ixfr(struct qstream *qsp);
+void sx_send_ixfr(struct qstream *);
+int ixfr_log_maint(struct zoneinfo *);
/* --from ns_ixfr.c-- */
/* ++from ns_forw.c++ */
-extern time_t retrytime(struct qinfo *);
-extern int ns_forw(struct databuf *nsp[],
+time_t retrytime(struct qinfo *);
+int ns_forw(struct databuf *nsp[],
u_char *msg,
int msglen,
struct sockaddr_in from,
@@ -236,139 +236,142 @@ extern int ns_forw(struct databuf *nsp[],
int type,
struct namebuf *np,
int use_tcp,
- struct tsig_record *in_tsig),
- haveComplained(u_long, u_long),
- nslookup(struct databuf *nsp[],
+ struct tsig_record *in_tsig);
+int haveComplained(u_long, u_long);
+int nslookup(struct databuf *nsp[],
struct qinfo *qp,
const char *syslogdname,
- const char *sysloginfo),
- qcomp(struct qserv *, struct qserv *);
-extern void schedretry(struct qinfo *, time_t),
- unsched(struct qinfo *),
- reset_retrytimer(void),
- retrytimer(evContext ctx, void *uap,
- struct timespec due, struct timespec ival),
- retry(struct qinfo *),
- qflush(void),
- qremove(struct qinfo *),
- ns_freeqns(struct qinfo *, char *),
- ns_freeqry(struct qinfo *),
- freeComplaints(void),
- nsfwdadd(struct qinfo *, struct fwdinfo *);
-extern struct qinfo *qfindid(u_int16_t),
- *qnew(const char *, int, int, int);
+ const char *sysloginfo);
+int qcomp(struct qserv *, struct qserv *);
+void schedretry(struct qinfo *, time_t);
+void unsched(struct qinfo *);
+void reset_retrytimer(void);
+void retrytimer(evContext ctx, void *uap,
+ struct timespec due, struct timespec ival);
+void retry(struct qinfo *);
+void qflush(void);
+void qremove(struct qinfo *);
+void ns_freeqns(struct qinfo *, char *);
+void ns_freeqry(struct qinfo *);
+void freeComplaints(void);
+void nsfwdadd(struct qinfo *, struct fwdinfo *);
+struct qinfo * qfindid(u_int16_t);
+struct qinfo * qnew(const char *, int, int, int);
/* --from ns_forw.c-- */
/* ++from ns_main.c++ */
-extern struct in_addr net_mask(struct in_addr);
-extern void sq_remove(struct qstream *),
- sq_flushw(struct qstream *),
- sq_flush(struct qstream *allbut),
- dq_remove_gen(time_t gen),
- dq_remove_all(),
- sq_done(struct qstream *),
- ns_setproctitle(char *, int),
- getnetconf(int),
- nsid_init(void),
- ns_setoption(int option),
- writestream(struct qstream *, const u_char *, int),
- ns_need_unsafe(enum need),
- ns_need(enum need),
- opensocket_f(void),
- nsid_hash(u_char *, size_t);
-extern u_int16_t nsid_next(void);
-extern int sq_openw(struct qstream *, int),
- sq_writeh(struct qstream *, sq_closure),
- sq_write(struct qstream *, const u_char *, int),
- tcp_send(struct qinfo *),
- aIsUs(struct in_addr);
+void toggle_qrylog(void);
+struct in_addr net_mask(struct in_addr);
+void sq_remove(struct qstream *);
+void sq_flushw(struct qstream *);
+void sq_flush(struct qstream *allbut);
+void dq_remove_gen(time_t gen);
+void dq_remove_all();
+void sq_done(struct qstream *);
+void ns_setproctitle(char *, int);
+void getnetconf(int);
+void nsid_init(void);
+void ns_setoption(int option);
+void writestream(struct qstream *, const u_char *, int);
+void ns_need_unsafe(enum need);
+void ns_need(enum need);
+void opensocket_f(void);
+void nsid_hash(u_char *, size_t);
+u_int16_t nsid_next(void);
+int sq_openw(struct qstream *, int);
+int sq_writeh(struct qstream *, sq_closure);
+int sq_write(struct qstream *, const u_char *, int);
+int tcp_send(struct qinfo *);
+int aIsUs(struct in_addr);
/* --from ns_main.c-- */
/* ++from ns_maint.c++ */
-extern void zone_maint(struct zoneinfo *),
- sched_zone_maint(struct zoneinfo *),
- ns_cleancache(evContext ctx, void *uap,
+void zone_maint(struct zoneinfo *);
+void sched_zone_maint(struct zoneinfo *);
+void ns_cleancache(evContext ctx, void *uap,
struct timespec due,
- struct timespec inter),
- clean_cache_from(char *dname, struct hashbuf *htp),
- remove_zone(struct zoneinfo *, const char *),
- purge_zone(const char *, struct hashbuf *, int),
- loadxfer(void),
- qserial_retrytime(struct zoneinfo *, time_t),
- qserial_query(struct zoneinfo *),
- qserial_answer(struct qinfo *),
+ struct timespec inter);
+void clean_cache_from(char *dname, struct hashbuf *htp);
+void remove_zone(struct zoneinfo *, const char *);
+void purge_zone(const char *, struct hashbuf *, int);
+void loadxfer(void);
+void qserial_retrytime(struct zoneinfo *, time_t);
+void qserial_query(struct zoneinfo *);
+void qserial_answer(struct qinfo *);
#ifdef DEBUG
- printzoneinfo(int, int, int),
+void printzoneinfo(int, int, int);
#endif
- endxfer(void),
- addxfer(struct zoneinfo *),
- ns_zreload(void),
- ns_reload(void),
- ns_reconfig(void),
- ns_noexpired(void);
+void endxfer(void);
+void addxfer(struct zoneinfo *);
+void ns_zreload(void);
+void ns_reload(void);
+void ns_reconfig(void);
+void ns_noexpired(void);
#if 0
-extern int reload_all_unsafe(void);
+int reload_all_unsafe(void);
#endif
-extern int zonefile_changed_p(struct zoneinfo *);
+int zonefile_changed_p(struct zoneinfo *);
int reload_master(struct zoneinfo *);
-extern const char * deferred_reload_unsafe(struct zoneinfo *);
-extern struct namebuf * purge_node(struct hashbuf *htp, struct namebuf *np);
-extern int clean_cache(struct hashbuf *, int);
-extern void reapchild(void);
-extern const char * zoneTypeString(unsigned int);
-extern void ns_heartbeat(evContext ctx, void *uap,
+const char * deferred_reload_unsafe(struct zoneinfo *);
+struct namebuf * purge_node(struct hashbuf *htp, struct namebuf *np);
+int clean_cache(struct hashbuf *, int);
+void reapchild(void);
+const char * zoneTypeString(unsigned int);
+void ns_heartbeat(evContext ctx, void *uap,
struct timespec, struct timespec);
-extern void make_new_zones(void);
-extern void free_zone(struct zoneinfo *);
-extern struct zoneinfo *find_auth_zone(const char *, ns_class);
-extern int purge_nonglue(const char *dname, struct hashbuf *htp,
- int class);
+void make_new_zones(void);
+void free_zone(struct zoneinfo *);
+struct zoneinfo * find_auth_zone(const char *, ns_class);
+int purge_nonglue(const char *dname, struct hashbuf *htp,
+ int class, int log);
/* --from ns_maint.c-- */
/* ++from ns_sort.c++ */
-extern void sort_response(u_char *, u_char *, int,
+void sort_response(u_char *, u_char *, int,
struct sockaddr_in *);
/* --from ns_sort.c-- */
/* ++from ns_init.c++ */
-extern void ns_refreshtime(struct zoneinfo *, time_t);
-extern void ns_retrytime(struct zoneinfo *, time_t);
-extern void ns_init(const char *);
-extern void purgeandload(struct zoneinfo *zp);
-extern enum context ns_ptrcontext(const char *owner);
-extern enum context ns_ownercontext(int type, enum transport);
-extern int ns_nameok(const struct qinfo *qry, const char *name,
+void ns_refreshtime(struct zoneinfo *, time_t);
+void ns_retrytime(struct zoneinfo *, time_t);
+time_t ns_init(const char *);
+void purgeandload(struct zoneinfo *zp);
+enum context ns_ptrcontext(const char *owner);
+enum context ns_ownercontext(int type, enum transport);
+int ns_nameok(const struct qinfo *qry, const char *name,
int class, struct zoneinfo *zp,
enum transport, enum context,
const char *owner,
struct in_addr source);
-extern int ns_wildcard(const char *name);
-extern void zoneinit(struct zoneinfo *);
-extern void do_reload(const char *, int, int, int);
-extern void ns_shutdown(void);
+int ns_wildcard(const char *name);
+void zoneinit(struct zoneinfo *);
+void do_reload(const char *, int, int, int);
+void ns_shutdown(void);
/* --from ns_init.c-- */
/* ++from ns_ncache.c++ */
-extern void cache_n_resp(u_char *, int, struct sockaddr_in,
+void cache_n_resp(u_char *, int, struct sockaddr_in,
const char *, int, int);
/* --from ns_ncache.c-- */
/* ++from ns_udp.c++ */
-extern void ns_udp(void);
+void ns_udp(void);
/* --from ns_udp.c-- */
/* ++from ns_stats.c++ */
-extern void ns_stats(void),
- ns_freestats(void);
-extern void ns_logstats(evContext ctx, void *uap,
+void ns_stats(void);
+void ns_stats_dumpandclear(void);
+void ns_freestats(void);
+void ns_logstats(evContext ctx, void *uap,
struct timespec, struct timespec);
-extern void qtypeIncr(int qtype);
-extern struct nameser *nameserFind(struct in_addr addr, int flags);
+void qtypeIncr(int qtype);
+struct nameser * nameserFind(struct in_addr addr, int flags);
#define NS_F_INSERT 0x0001
#define nameserIncr(a,w) NS_INCRSTAT(a,w) /* XXX should change name. */
/* --from ns_stats.c-- */
/* ++from ns_update.c++ */
+struct databuf * findzonesoa(struct zoneinfo *);
void free_rrecp(ns_updque *, int rcode, struct sockaddr_in);
int findzone(const char *, int, int, int *, int);
u_char * findsoaserial(u_char *data);
@@ -389,6 +392,16 @@ void rdata_dump(struct databuf *dp, FILE *fp);
/* --from ns_update.c-- */
/* ++from ns_config.c++ */
+void add_to_rrset_order_list(rrset_order_list,
+ rrset_order_element);
+const char * p_order(int);
+int set_zone_ixfr_file(zone_config, char *);
+int set_zone_master_port(zone_config, u_short);
+int set_zone_max_log_size_ixfr(zone_config, int);
+int set_zone_dialup(zone_config, int);
+int set_trusted_key(const char *, const int,
+ const int, const int, const char *);
+int set_zone_ixfr_tmp(zone_config, char *);
void free_zone_timerinfo(struct zoneinfo *);
void free_zone_contents(struct zoneinfo *, int);
struct zoneinfo * find_zone(const char *, int);
@@ -485,17 +498,19 @@ void init_logging(void);
void shutdown_logging(void);
void init_configuration(void);
void shutdown_configuration(void);
-void load_configuration(const char *);
+time_t load_configuration(const char *);
/* --from ns_config.c-- */
+
/* ++from parser.y++ */
ip_match_list lookup_acl(char *);
void define_acl(char *, ip_match_list);
struct dst_key *lookup_key(char *);
void define_key(char *, struct dst_key *);
-void parse_configuration(const char *);
+time_t parse_configuration(const char *);
void parser_initialize(void);
void parser_shutdown(void);
/* --from parser.y-- */
+
/* ++from ns_signal.c++ */
void init_signals(void);
void block_signals(void);
diff --git a/contrib/bind/bin/named/ns_glob.h b/contrib/bind/bin/named/ns_glob.h
index e9f70e7..8f4628a 100644
--- a/contrib/bind/bin/named/ns_glob.h
+++ b/contrib/bind/bin/named/ns_glob.h
@@ -1,6 +1,6 @@
/*
* from ns.h 4.33 (Berkeley) 8/23/90
- * $Id: ns_glob.h,v 8.55 2000/07/20 22:50:38 vixie Exp $
+ * $Id: ns_glob.h,v 8.56 2000/12/02 18:39:25 vixie Exp $
*/
/*
@@ -125,9 +125,12 @@ DECL time_t resettime;
/* next query to retry */
DECL struct qinfo *retryqp;
- /* default configuration file */
+ /* configuration file name */
DECL char *conffile;
+ /* configuration file mtime */
+DECL time_t confmtime;
+
/* default debug output file */
DECL char *debugfile;
diff --git a/contrib/bind/bin/named/ns_glue.c b/contrib/bind/bin/named/ns_glue.c
index 8360ad5..c1f9be2 100644
--- a/contrib/bind/bin/named/ns_glue.c
+++ b/contrib/bind/bin/named/ns_glue.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ns_glue.c,v 8.17 2000/07/17 07:36:52 vixie Exp $";
+static const char rcsid[] = "$Id: ns_glue.c,v 8.18 2000/11/08 06:16:36 marka Exp $";
#endif /* not lint */
/*
@@ -435,17 +435,6 @@ ctimel(long l) {
return (checked_ctime(&t));
}
-/*
- * rename() is lame (can't overwrite an existing file) on some systems.
- * use movefile() instead, and let lame OS ports do what they need to.
- */
-#ifndef HAVE_MOVEFILE
-int
-movefile(const char *oldname, const char *newname) {
- return (rename(oldname, newname));
-}
-#endif
-
#ifdef ultrix
/*
* Some library routines in libc need to be able to see the res_send
diff --git a/contrib/bind/bin/named/ns_init.c b/contrib/bind/bin/named/ns_init.c
index 66242a4..c5842f6 100644
--- a/contrib/bind/bin/named/ns_init.c
+++ b/contrib/bind/bin/named/ns_init.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_init.c 4.38 (Berkeley) 3/21/91";
-static const char rcsid[] = "$Id: ns_init.c,v 8.68 2000/04/21 06:54:07 vixie Exp $";
+static const char rcsid[] = "$Id: ns_init.c,v 8.70 2000/12/23 08:14:38 vixie Exp $";
#endif /* not lint */
/*
@@ -132,10 +132,11 @@ ns_retrytime(struct zoneinfo *zp, time_t timebase) {
/*
* Read configuration file and save it as internal state.
*/
-void
+time_t
ns_init(const char *conffile) {
struct zoneinfo *zp;
static int loads = 0; /* number of times loaded */
+ time_t mtime;
ns_debug(ns_log_config, 1, "ns_init(%s)", conffile);
gettime(&tt);
@@ -181,7 +182,7 @@ ns_init(const char *conffile) {
}
#endif
- load_configuration(conffile);
+ mtime = load_configuration(conffile);
/* Erase all old zones that were not found. */
for (zp = &zones[0]; zp < &zones[nzones]; zp++) {
@@ -210,6 +211,7 @@ ns_init(const char *conffile) {
ns_debug(ns_log_config, 1, "exit ns_init()");
loads++;
+ return (mtime);
}
void
@@ -277,9 +279,9 @@ do_reload(const char *domain, int type, int class, int mark) {
*/
zp = find_zone(domain, class);
if (zp != NULL &&
- (type != z_master && zp->z_type == z_master) ||
- (type != z_slave && zp->z_type == z_slave && zp->z_serial != 0) ||
- (type != z_stub && zp->z_type == z_stub && zp->z_serial != 0))
+ ((type != z_master && zp->z_type == z_master) ||
+ (type != z_slave && zp->z_type == z_slave && zp->z_serial != 0) ||
+ (type != z_stub && zp->z_type == z_stub && zp->z_serial != 0)))
return;
/*
@@ -466,7 +468,7 @@ ns_nameok(const struct qinfo *qry, const char *name, int class,
else {
s = newstr(strlen(transport_strings[transport]) +
sizeof " from [000.000.000.000] for [000.000.000.000]", 0);
- if (s)
+ if (s != NULL) {
if ( (transport == response_trans) &&
(qry != NULL) ) {
@@ -496,6 +498,7 @@ ns_nameok(const struct qinfo *qry, const char *name, int class,
transport_strings[transport],
inet_ntoa(source));
}
+ }
}
if (ns_samename(owner, name) == 1)
o = savestr("", 0);
diff --git a/contrib/bind/bin/named/ns_ixfr.c b/contrib/bind/bin/named/ns_ixfr.c
index 693dc6f..5dd438b 100644
--- a/contrib/bind/bin/named/ns_ixfr.c
+++ b/contrib/bind/bin/named/ns_ixfr.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ns_ixfr.c,v 8.19 2000/04/18 20:47:27 vixie Exp $";
+static const char rcsid[] = "$Id: ns_ixfr.c,v 8.25 2000/12/27 06:56:03 vixie Exp $";
#endif /* not lint */
/*
@@ -46,6 +46,7 @@ static const char rcsid[] = "$Id: ns_ixfr.c,v 8.19 2000/04/18 20:47:27 vixie Exp
#include <isc/eventlib.h>
#include <isc/logging.h>
#include <isc/memcluster.h>
+#include <isc/misc.h>
#include "port_after.h"
@@ -85,10 +86,7 @@ sx_new_ixfrmsg(struct qstream *qsp) {
struct namebuf *np;
struct hashbuf *htp;
struct zoneinfo *zp;
- struct databuf *dp;
const char * fname;
- u_char ** edp = qsp->xfr.ptrs +
- sizeof qsp->xfr.ptrs / sizeof(u_char *);
qsp->xfr.ixfr_zone = qsp->xfr.zone;
zp = &zones[qsp->xfr.zone];
@@ -102,11 +100,6 @@ sx_new_ixfrmsg(struct qstream *qsp) {
htp = hashtab;
np = nlookup(zp->z_origin, &htp, &fname, 0);
buflen = XFER_BUFSIZE;
- foreach_rr(dp, np, T_SOA, qsp->xfr.class, qsp->xfr.zone) {
- n = make_rr(zp->z_origin, dp, qsp->xfr.cp, qsp->xfr.eom - qsp->xfr.cp, 0, qsp->xfr.ptrs, edp, 0);
- qsp->xfr.cp += n;
- hp->ancount = htons(ntohs(hp->ancount) + 1);
- }
}
}
@@ -194,13 +187,11 @@ sx_addrr(struct qstream *qsp, const char *dname, struct databuf *dp) {
void
sx_send_ixfr(struct qstream *qsp) {
char * cp;
- u_int32_t serial = 0;
struct zoneinfo *zp = NULL;
struct databuf *soa_dp;
struct databuf *old_soadp;
ns_delta *dp;
ns_updrec *rp;
- ns_updrec *trp;
int foundsoa;
zp = &zones[qsp->xfr.zone];
@@ -211,6 +202,8 @@ sx_send_ixfr(struct qstream *qsp) {
"sx_send_ixfr: unable to locate soa");
}
old_soadp = memget(DATASIZE(soa_dp->d_size));
+ if (old_soadp == NULL)
+ ns_panic(ns_log_update, 1, "sx_send_ixfr: out of memory");
memcpy(old_soadp, soa_dp, DATASIZE(soa_dp->d_size));
again:
@@ -218,13 +211,8 @@ sx_send_ixfr(struct qstream *qsp) {
case s_x_firstsoa:
ns_debug(ns_log_default, 3,
"IXFR: s_x_firstsoa (%s)", zp->z_origin);
- /*
- * The current SOA has been emited already.
- * It would be cleaner if the first one was emited here...
- *
- * if (sx_addrr(qsp, zp->z_origin, soa_dp) < 0)
- * goto cleanup;
- */
+ if (sx_addrr(qsp, zp->z_origin, soa_dp) < 0)
+ goto cleanup;
qsp->xfr.state = s_x_deletesoa;
/* FALLTHROUGH */
case s_x_deletesoa:
@@ -377,12 +365,13 @@ sx_send_ixfr(struct qstream *qsp) {
if (qsp->xfr.ixfr_zone != 0)
sx_addrr(qsp, zp->z_origin, soa_dp);
break;
+ default:
+ break;
}
ns_debug(ns_log_default, 3, "IXFR: flushing %s", zp->z_origin);
qsp->xfr.state = s_x_done;
sx_flush(qsp);
sq_writeh(qsp, sq_flushw);
- cleanup:
if (qsp->xfr.top.ixfr != NULL) {
if(!EMPTY(*qsp->xfr.top.ixfr)) {
while ((dp = HEAD(*qsp->xfr.top.ixfr)) != NULL) {
@@ -400,6 +389,7 @@ sx_send_ixfr(struct qstream *qsp) {
memput(qsp->xfr.top.ixfr, sizeof *qsp->xfr.top.ixfr);
qsp->xfr.top.ixfr = NULL;
}
+ cleanup:
memput(old_soadp, DATASIZE(old_soadp->d_size));
}
@@ -413,11 +403,9 @@ sx_send_ixfr(struct qstream *qsp) {
* int ixfr_log_maint(struct zoneinfo *zp, int fast_trim)
*
* zp - pointer to the zone information
- * fast_trim - is used to denote that this is not called on the regular
- * maintaince cycle.
- *
*/
-int ixfr_log_maint(struct zoneinfo *zp, int fast_trim) {
+int
+ixfr_log_maint(struct zoneinfo *zp) {
int fd, rcount, wcount;
int found = 0;
int error = 0;
@@ -466,32 +454,26 @@ int ixfr_log_maint(struct zoneinfo *zp, int fast_trim) {
zp->z_max_log_size_ixfr);
if (zp->z_max_log_size_ixfr) {
if (sb.st_size > zp->z_max_log_size_ixfr)
- seek = (signed)sb.st_size -
- (signed)(zp->z_max_log_size_ixfr +
- (zp->z_max_log_size_ixfr * .10) );
+ seek = sb.st_size -
+ (size_t)(zp->z_max_log_size_ixfr +
+ (zp->z_max_log_size_ixfr * 0.10) );
else
seek = 0;
} else {
- if (sb.st_size > (db_sb.st_size * .50))
- seek = (signed)sb.st_size - (signed)((db_sb.st_size * .50)
- + ((db_sb.st_size * zp->z_max_log_size_ixfr) *.10));
+ if (sb.st_size > (db_sb.st_size * 0.50))
+ seek = sb.st_size - (size_t)((db_sb.st_size * 0.50)
+ + ((db_sb.st_size * zp->z_max_log_size_ixfr) * 0.10));
else
seek = 0;
}
ns_debug(ns_log_default, 3, "seek: %d", seek);
- if (seek < 1)
- {
+ if (seek < 1) {
ns_debug(ns_log_default, 3, "%s does not need to be reduced",
zp->z_ixfr_base);
(void) my_fclose(from_fp);
return (-1);
}
- if ((fast_trim) && seek < (zp->z_max_log_size_ixfr + 100000)) {
- (void) my_fclose(from_fp);
- return (0);
- }
-
tmpname = memget(strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1);
if (!tmpname) {
ns_warning(ns_log_default, "memget failed");
@@ -570,7 +552,7 @@ int ixfr_log_maint(struct zoneinfo *zp, int fast_trim) {
(void) close(fd);
(void) my_fclose(from_fp);
if (error == 0) {
- if (rename(tmpname, zp->z_ixfr_base) == -1) {
+ if (isc_movefile(tmpname, zp->z_ixfr_base) == -1) {
ns_warning(ns_log_default, "can not rename %s to %s :%s",
tmpname, zp->z_ixfr_base, strerror(errno));
}
diff --git a/contrib/bind/bin/named/ns_lexer.c b/contrib/bind/bin/named/ns_lexer.c
index 7110fe4..bb2d11f 100644
--- a/contrib/bind/bin/named/ns_lexer.c
+++ b/contrib/bind/bin/named/ns_lexer.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ns_lexer.c,v 8.20 2000/04/21 06:54:07 vixie Exp $";
+static const char rcsid[] = "$Id: ns_lexer.c,v 8.22 2000/11/29 06:55:58 marka Exp $";
#endif /* not lint */
/*
@@ -260,7 +260,11 @@ static struct keyword keywords[] = {
{"has-old-clients", T_HAS_OLD_CLIENTS},
{"heartbeat-interval", T_HEARTBEAT},
{"hint", T_HINT},
+#ifdef HITCOUNTS
+ {"hit-count", T_HITCOUNT},
+#endif /* HITCOUNTS */
{"host-statistics", T_HOSTSTATS},
+ {"host-statistics-max", T_HOSTSTATSMAX},
{"if-no-answer", T_IF_NO_ANSWER},
{"if-no-domain", T_IF_NO_DOMAIN},
{"ignore", T_IGNORE},
diff --git a/contrib/bind/bin/named/ns_main.c b/contrib/bind/bin/named/ns_main.c
index 1461807..5caaae9 100644
--- a/contrib/bind/bin/named/ns_main.c
+++ b/contrib/bind/bin/named/ns_main.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91";
-static const char rcsid[] = "$Id: ns_main.c,v 8.126 2000/07/20 22:50:39 vixie Exp $";
+static const char rcsid[] = "$Id: ns_main.c,v 8.142 2001/01/15 20:06:25 vixie Exp $";
#endif /* not lint */
/*
@@ -112,6 +112,7 @@ char copyright[] =
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
+#include <irs.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
@@ -138,6 +139,17 @@ char copyright[] =
#include "named.h"
#undef MAIN_PROGRAM
+typedef void (*handler)(void);
+
+typedef struct _savedg {
+ struct sockaddr_in from;
+ int dfd;
+ interface * ifp;
+ time_t gen;
+ u_char * buf;
+ u_int16_t buflen;
+} savedg;
+
/* list of interfaces */
static LIST(struct _interface) iflist;
static int iflist_initialized = 0;
@@ -162,10 +174,13 @@ static u_int16_t nsid_c1, nsid_c2, nsid_c3;
static u_int16_t nsid_state2;
static int nsid_algorithm;
-typedef void (*handler)(void);
static int needs = 0, needs_exit = 0;
static handler handlers[main_need_num];
+static void savedg_waitfunc(evContext, void*, const void*);
static void need_waitfunc(evContext, void *, const void *);
+static int drain_rcvbuf(evContext, interface *, int,
+ int *, int *);
+static int drain_all_rcvbuf(evContext);
static struct qstream *sq_add(void);
static int opensocket_d(interface *),
@@ -178,8 +193,6 @@ static void stream_write(evContext, void *, int, int);
static interface * if_find(struct in_addr, u_int16_t port);
-static int sq_here(struct qstream *);
-
static void deallocate_everything(void),
stream_accept(evContext, void *, int,
const void *, int,
@@ -197,7 +210,8 @@ static void stream_send(evContext, void *, int,
static int only_digits(const char *);
static void init_needs(void),
- handle_needs(void);
+ handle_needs(void),
+ exit_handler(void);
#ifndef HAVE_CUSTOM
static void custom_init(void),
@@ -445,7 +459,7 @@ main(int argc, char *argv[], char *envp[]) {
#ifdef SYSLOG_42BSD
openlog("named", n);
#else
- openlog("named", n, LOG_DAEMON);
+ openlog("named", n, ISC_FACILITY);
#endif
init_logging();
@@ -461,7 +475,7 @@ main(int argc, char *argv[], char *envp[]) {
init_needs();
init_signals();
- ns_notice(ns_log_default, "starting. %s", Version);
+ ns_notice(ns_log_default, "starting (%s). %s", conffile, Version);
/*
* Initialize and load database.
@@ -469,7 +483,7 @@ main(int argc, char *argv[], char *envp[]) {
gettime(&tt);
buildservicelist();
buildprotolist();
- ns_init(conffile);
+ confmtime = ns_init(conffile);
time(&boottime);
resettime = boottime;
@@ -730,17 +744,14 @@ stream_accept(evContext lev, void *uap, int rfd,
INSIST_ERR(evRead(lev, rfd, &iov, 1, stream_getlen, sp, &sp->evID_r)
!= -1);
sp->flags |= STREAM_READ_EV;
-#ifdef DEBUG
- if (debug)
- ns_info(ns_log_default, "IP/TCP connection from %s (fd %d)",
- sin_ntoa(sp->s_from), rfd);
-#endif
+ ns_debug(ns_log_default, 1, "IP/TCP connection from %s (fd %d)",
+ sin_ntoa(sp->s_from), rfd);
}
int
tcp_send(struct qinfo *qp) {
struct qstream *sp;
- int on = 1;
+ int on = 1, n;
ns_debug(ns_log_default, 1, "tcp_send");
if ((sp = sq_add()) == NULL) {
@@ -754,10 +765,34 @@ tcp_send(struct qinfo *qp) {
sq_remove(sp);
return (SERVFAIL);
}
+ if (setsockopt(sp->s_rfd, SOL_SOCKET, SO_REUSEADDR,
+ (char*)&on, sizeof(on)) < 0)
+ ns_info(ns_log_default,
+ "tcp_send: setsockopt(SO_REUSEADDR): %s",
+ strerror(errno));
+#ifdef SO_REUSEPORT
+ if (setsockopt(sp->s_rfd, SOL_SOCKET, SO_REUSEPORT,
+ (char*)&on, sizeof(on)) < 0)
+ ns_info(ns_log_default,
+ "tcp_send: setsockopt(SO_REUSEPORT): %s",
+ strerror(errno));
+#endif
+ if (bind(sp->s_rfd, (struct sockaddr *)&server_options->query_source,
+ sizeof server_options->query_source) < 0)
+ ns_info(ns_log_default, "tcp_send: bind(query_source): %s",
+ strerror(errno));
if (fcntl(sp->s_rfd, F_SETFD, 1) < 0) {
sq_remove(sp);
return (SERVFAIL);
}
+ if ((n = fcntl(sp->s_rfd, F_GETFL, 0)) == -1) {
+ sq_remove(sp);
+ return (SERVFAIL);
+ }
+ if (fcntl(sp->s_rfd, F_SETFL, n|PORT_NONBLOCK) == -1) {
+ sq_remove(sp);
+ return (SERVFAIL);
+ }
if (sq_openw(sp, qp->q_msglen + INT16SZ) == -1) {
sq_remove(sp);
return (SERVFAIL);
@@ -768,10 +803,10 @@ tcp_send(struct qinfo *qp) {
}
if (setsockopt(sp->s_rfd, SOL_SOCKET, SO_KEEPALIVE,
- (char*)&on, sizeof(on)) < 0)
- ns_info(ns_log_default,
- "tcp_send: setsockopt(rfd, SO_KEEPALIVE): %s",
- strerror(errno));
+ (char*)&on, sizeof(on)) < 0)
+ ns_info(ns_log_default,
+ "tcp_send: setsockopt(SO_KEEPALIVE): %s",
+ strerror(errno));
gettime(&tt);
sp->s_size = -1;
sp->s_time = tt.tv_sec; /* last transaction time */
@@ -1023,6 +1058,21 @@ datagram_read(evContext lev, void *uap, int fd, int evmask) {
}
static void
+savedg_waitfunc(evContext ctx, void *uap, const void *tag) {
+ savedg *dg = (savedg *)uap;
+
+ if (!EMPTY(iflist) && HEAD(iflist)->gen == dg->gen) {
+ u_char buf[PACKETSZ];
+
+ memcpy(buf, dg->buf, dg->buflen);
+ dispatch_message(buf, dg->buflen, sizeof buf, NULL,
+ dg->from, dg->dfd, dg->ifp);
+ }
+ memput(dg->buf, dg->buflen);
+ memput(dg, sizeof *dg);
+}
+
+static void
dispatch_message(u_char *msg, int msglen, int buflen, struct qstream *qsp,
struct sockaddr_in from, int dfd, interface *ifp)
{
@@ -1252,6 +1302,7 @@ getnetconf(int periodic_scan) {
ns_panic(ns_log_default, 1,
"memget(interface)", NULL);
memset(ifp, 0, sizeof *ifp);
+ INIT_LINK(ifp, link);
APPEND(iflist, ifp, link);
ifp->addr = ina;
ifp->port = li->port;
@@ -1467,6 +1518,14 @@ opensocket_d(interface *ifp) {
/* XXX press on regardless, this is not too serious. */
}
#endif
+#ifdef SO_BSDCOMPAT
+ if (setsockopt(ifp->dfd, SOL_SOCKET, SO_BSDCOMPAT,
+ (char*)&on, sizeof on) < 0) {
+ ns_info(ns_log_default,
+ "setsockopt(dfd=%d, SO_BSDCOMPAT): %s",
+ ifp->dfd, strerror(errno));
+ }
+#endif
if (bind(ifp->dfd, (struct sockaddr *)&nsa, sizeof nsa)) {
ns_error(ns_log_default, "bind(dfd=%d, %s): %s",
ifp->dfd, sin_ntoa(nsa), strerror(errno));
@@ -1482,6 +1541,75 @@ opensocket_d(interface *ifp) {
return (0);
}
+static int
+drain_rcvbuf(evContext ctx, interface *ifp, int fd, int *mread, int *mstore) {
+ int drop = 0;
+
+ drop = 0;
+ for (; *mread > 0; (*mread)--) {
+ union {
+ HEADER h;
+ u_char buf[PACKETSZ+1];
+ } u;
+ struct sockaddr_in from;
+ int from_len = sizeof from;
+ savedg *dg;
+ int n;
+
+ n = recvfrom(fd, (char *)u.buf, sizeof u.buf, 0,
+ (struct sockaddr *)&from, &from_len);
+ if (n <= 0)
+ break; /* Socket buffer assumed empty. */
+ drop++; /* Pessimistic assumption. */
+ if (n > PACKETSZ)
+ continue; /* Oversize message - EDNS0 needed. */
+ if (from.sin_family != AF_INET)
+ continue; /* Not IPv4 - IPv6 needed. */
+ if (u.h.opcode == ns_o_query && u.h.qr == 0)
+ continue; /* Query - what we're here to axe. */
+ if (*mstore <= 0)
+ continue; /* Reached storage quota, ignore. */
+ if ((dg = memget(sizeof *dg)) == NULL)
+ continue; /* No memory - probably fatal. */
+ if ((dg->buf = memget(n)) == NULL) {
+ memput(dg, sizeof *dg);
+ continue; /* No memory - probably fatal. */
+ }
+ dg->from = from;
+ dg->dfd = fd;
+ dg->ifp = ifp;
+ dg->gen = ifp->gen;
+ dg->buflen = n;
+ memcpy(dg->buf, u.buf, n);
+ if (evWaitFor(ctx, (void *)drain_all_rcvbuf, savedg_waitfunc,
+ dg, NULL) < 0)
+ {
+ memput(dg->buf, dg->buflen);
+ memput(dg, sizeof *dg);
+ continue; /* No memory - probably fatal. */
+ }
+ drop--; /* Pessimism was inappropriate. */
+ (*mstore)--;
+ }
+ return (drop);
+}
+
+static int
+drain_all_rcvbuf(evContext ctx) {
+ interface *ifp;
+ int mread = MAX_SYNCDRAIN;
+ int mstore = MAX_SYNCSTORE;
+ int drop = 0;
+
+ for (ifp = HEAD(iflist); ifp != NULL; ifp = NEXT(ifp, link))
+ if (ifp->dfd != -1)
+ drop += drain_rcvbuf(ctx, ifp, ifp->dfd,
+ &mread, &mstore);
+ if (mstore < MAX_SYNCSTORE)
+ INSIST_ERR(evDo(ctx, (void *)drain_all_rcvbuf) != -1);
+ return (drop);
+}
+
/* opensocket_s(ifp)
* Open stream (listener) socket bound to interface address.
* Returns:
@@ -1640,6 +1768,14 @@ opensocket_f() {
strerror(errno));
/* XXX press on regardless, this is not too serious. */
}
+#ifdef SO_BSDCOMPAT
+ if (setsockopt(ds, SOL_SOCKET, SO_BSDCOMPAT,
+ (char *)&on, sizeof on) != 0) {
+ ns_notice(ns_log_default, "setsockopt(BSDCOMPAT): %s",
+ strerror(errno));
+ /* XXX press on regardless, this is not too serious. */
+ }
+#endif
if (bind(ds, (struct sockaddr *)&server_options->query_source,
sizeof server_options->query_source) < 0)
ns_panic(ns_log_default, 0, "opensocket_f: bind(%s): %s",
@@ -1923,22 +2059,6 @@ sq_write(struct qstream *qs, const u_char *buf, int len) {
return (0);
}
-/* int
- * sq_here(sp)
- * determine whether stream 'sp' is still on the streamq
- * return:
- * boolean: is it here?
- */
-static int
-sq_here(struct qstream *sp) {
- struct qstream *t;
-
- for (t = streamq; t != NULL; t = t->s_next)
- if (t == sp)
- return (1);
- return (0);
-}
-
/*
* Initiate query on stream;
* mark as referenced and stop selecting for input.
@@ -2630,7 +2750,8 @@ init_needs(void) {
handlers[main_need_zoneload] = loadxfer;
handlers[main_need_dump] = doadump;
handlers[main_need_statsdump] = ns_stats;
- handlers[main_need_exit] = wild;
+ handlers[main_need_statsdumpandclear] = ns_stats_dumpandclear;
+ handlers[main_need_exit] = exit_handler;
handlers[main_need_qrylog] = toggle_qrylog;
handlers[main_need_debug] = use_desired_debug;
handlers[main_need_restart] = ns_restart;
@@ -2646,15 +2767,17 @@ handle_needs(void) {
block_signals();
for (need = 0; need < main_need_num; need++)
if ((needs & (1 << need)) != 0) {
- INSIST_ERR(evWaitFor(ev, handle_needs, need_waitfunc,
- handlers[need], NULL) != -1);
+ INSIST_ERR(evWaitFor(ev, (void *)handle_needs,
+ need_waitfunc,
+ (void *)handlers[need],
+ NULL) != -1);
queued++;
}
needs = 0;
unblock_signals();
ns_debug(ns_log_default, 15, "handle_needs(): queued %d", queued);
if (queued != 0) {
- INSIST_ERR(evDo(ev, handle_needs) != -1);
+ INSIST_ERR(evDo(ev, (void *)handle_needs) != -1);
return;
}
ns_panic(ns_log_default, 1, "ns_handle_needs: queued == 0", NULL);
@@ -2663,8 +2786,16 @@ handle_needs(void) {
static void
need_waitfunc(evContext ctx, void *uap, const void *tag) {
handler hand = (handler) uap;
+ time_t begin;
+ long syncdelay;
+ begin = time(NULL);
(*hand)();
+ syncdelay = time(NULL) - begin;
+
+ if (syncdelay > MAX_SYNCDELAY)
+ ns_notice(ns_log_default, "drained %d queries (delay %ld sec)",
+ drain_all_rcvbuf(ctx), syncdelay);
}
void
@@ -2678,8 +2809,11 @@ ns_need(enum need need) {
void
ns_need_unsafe(enum need need) {
needs |= (1 << need);
- if (need == main_need_exit)
- needs_exit = 1;
+}
+
+static void
+exit_handler(void) {
+ needs_exit = 1;
}
void
diff --git a/contrib/bind/bin/named/ns_maint.c b/contrib/bind/bin/named/ns_maint.c
index 952774f..b5ed644 100644
--- a/contrib/bind/bin/named/ns_maint.c
+++ b/contrib/bind/bin/named/ns_maint.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_maint.c 4.39 (Berkeley) 3/2/91";
-static const char rcsid[] = "$Id: ns_maint.c,v 8.105 2000/07/17 07:25:00 vixie Exp $";
+static const char rcsid[] = "$Id: ns_maint.c,v 8.117 2001/01/25 05:50:55 marka Exp $";
#endif /* not lint */
/*
@@ -120,14 +120,14 @@ static const char rcsid[] = "$Id: ns_maint.c,v 8.105 2000/07/17 07:25:00 vixie E
#include <isc/eventlib.h>
#include <isc/logging.h>
#include <isc/memcluster.h>
-
#include <isc/dst.h>
+#include <isc/misc.h>
#include "port_after.h"
#include "named.h"
-static int nxfers(struct zoneinfo *, int),
+static int nxfers(struct zoneinfo *),
bottom_of_zone(struct databuf *, int);
static void startxfer(struct zoneinfo *),
@@ -135,19 +135,18 @@ static void startxfer(struct zoneinfo *),
tryxfer(void),
purge_z_2(struct hashbuf *, int);
static int purge_nonglue_2(const char *, struct hashbuf *,
- int, int);
+ int, int, int);
#ifndef HAVE_SPAWNXFER
static pid_t spawnxfer(char **, struct zoneinfo *);
#endif
-static time_t stats_time; /* Redundant ??? XXX ogud */
-
/* State of all running zone transfers */
static struct {
- pid_t xfer_pid;
- int xfer_state; /* see below */
- WAIT_T xfer_status;
+ pid_t xfer_pid;
+ int xfer_state; /* see below */
+ WAIT_T xfer_status;
+ struct in_addr xfer_addr;
} xferstatus[MAX_XFERS_RUNNING];
#define XFER_IDLE 0
@@ -642,41 +641,115 @@ qserial_answer(struct qinfo *qp) {
/*
* Writes TSIG key info for an address to a file, optionally opening it first.
+ * Returns:
+ * -1: Error.
+ * 0: No action taken.
+ * 1: Tsig info successfully written.
*/
static int
-write_tsig_info(struct in_addr addr, char *name, int *fd, int creat_failed) {
+write_tsig_info(struct in_addr addr, char *name, int *fd) {
server_info si;
DST_KEY *dst_key;
int tsig_fd = *fd;
char tsig_str[1024], secret_buf64[172];
u_char secret_buf[128];
- int secret_len;
+ int secret_len, len;
si = find_server(addr);
if (si == NULL || si->key_list == NULL || si->key_list->first == NULL)
return(0);
dst_key = si->key_list->first->key;
- if (tsig_fd < 0 && creat_failed == 0) {
- *fd = tsig_fd = creat(name, S_IRUSR);
+ if (tsig_fd == -1) {
+ *fd = tsig_fd = mkstemp(name);
if (tsig_fd < 0) {
ns_warning(ns_log_default,
- "write_tsig_info: creat(%s) for TSIG info failed",
+ "write_tsig_info: mkstemp(%s) for TSIG info failed",
name);
return(-1);
}
(void) fchown(tsig_fd, user_id, group_id);
}
- if (creat_failed != 0)
- return(-1);
+
memset(secret_buf, 0, sizeof(secret_buf));
secret_len = dst_key_to_buffer(dst_key, secret_buf, sizeof(secret_buf));
- b64_ntop(secret_buf, secret_len, secret_buf64, sizeof(secret_buf64));
+ if (secret_len == 0)
+ return (-1);
+ len = b64_ntop(secret_buf, secret_len, secret_buf64,
+ sizeof(secret_buf64));
+ if (len == -1)
+ return (-1);
+ /* We need snprintf! */
+ if (strlen(dst_key->dk_key_name) + len + sizeof("XXX.XXX.XXX.XXX"),
+ sizeof("123") + 5 > sizeof(tsig_str))
+ return (-1);
sprintf(tsig_str, "%s\n%s\n%d\n%s\n",
inet_ntoa(addr), dst_key->dk_key_name, dst_key->dk_alg,
secret_buf64);
- write(tsig_fd, tsig_str, strlen(tsig_str));
- return (0);
+ len = strlen(tsig_str);
+ if (write(tsig_fd, tsig_str, strlen(tsig_str)) != len)
+ return (-1);
+ return (1);
+}
+
+/*
+ * Returns number of tsigs written or -1.
+ */
+static int
+write_tsigs(struct zoneinfo *zp, char *tsig_name) {
+ struct in_addr a;
+ int tsig_ret;
+ int tsig_fd = -1;
+ int cnt;
+ int records = 0;
+
+ for (cnt = 0; cnt < zp->z_xaddrcnt; cnt++) {
+ a = zp->z_xaddr[cnt];
+ if (aIsUs(a) && ns_port == zp->z_port)
+ continue;
+
+ tsig_ret = write_tsig_info(a, tsig_name, &tsig_fd);
+ switch (tsig_ret) {
+ case -1:
+ goto error;
+ case 0:
+ break;
+ case 1:
+ records++;
+ break;
+ }
+ }
+
+ if (tsig_fd != -1)
+ close(tsig_fd);
+ return (records);
+
+ error:
+ if (tsig_fd != -1) {
+ unlink(tsig_name);
+ close(tsig_fd);
+ }
+ return (-1);
+}
+
+#ifdef BIND_IXFR
+static int
+supports_ixfr(struct zoneinfo *zp) {
+ int cnt = 0;
+ for (cnt = 0; cnt < zp->z_xaddrcnt; cnt++) {
+ struct in_addr a;
+ server_info si;
+
+ a = zp->z_xaddr[cnt];
+ if (aIsUs(a) && ns_port == zp->z_port)
+ continue;
+ si = find_server(a);
+
+ if (si != NULL && (si->flags & SERVER_INFO_SUPPORT_IXFR) != 0)
+ return(1);
+ }
+ return(0);
}
+#endif
/*
* Start an asynchronous zone transfer for a zone. Depends on current time
@@ -693,8 +766,7 @@ startxfer(struct zoneinfo *zp) {
char port_str[10];
char class_str[10];
char src_str[20];
- int tsig_fd = -1;
- char tsig_name[MAXPATHLEN+1], *s;
+ char tsig_name[MAXPATHLEN+1];
int tsig_ret = 0;
ns_debug(ns_log_default, 1, "startxfer() %s",
@@ -706,9 +778,9 @@ startxfer(struct zoneinfo *zp) {
argv[argc++] = "-f";
argv[argc++] = zp->z_source;
#ifdef BIND_IXFR
- if (zp->z_ixfr_tmp) {
- argv[argc++] = "-i";
- argv[argc++] = zp->z_ixfr_tmp;
+ if (supports_ixfr(zp) && zp->z_ixfr_tmp != NULL) {
+ argv[argc++] = "-i";
+ argv[argc++] = zp->z_ixfr_tmp;
}
#endif
if (zp->z_serial != 0) {
@@ -731,12 +803,6 @@ startxfer(struct zoneinfo *zp) {
argv[argc++] = "-P";
sprintf(port_str, "%d", ntohs(zp->z_port) != 0 ? zp->z_port : ns_port);
argv[argc++] = port_str;
- argv[argc++] = "-T";
- sprintf(tsig_name, "%s.%d", zp->z_origin, getpid());
- s = tsig_name;
- while ((s = strchr(s, '/')) != NULL)
- *s = '_';
- argv[argc++] = tsig_name;
#ifdef STUBS
if (zp->z_type == Z_STUB)
argv[argc++] = "-S";
@@ -762,6 +828,22 @@ startxfer(struct zoneinfo *zp) {
zp->z_xaddr[zp->z_xaddrcnt] =
zp->z_addr[zp->z_xaddrcnt];
}
+
+ /*
+ * Store TSIG keys if we have them.
+ */
+ strcpy(tsig_name, "tsigs.XXXXXX");
+ tsig_ret = write_tsigs(zp, tsig_name);
+ if (tsig_ret == -1) {
+ ns_error(ns_log_xfer_in, "unable to write tsig info: '%s'",
+ zp->z_origin);
+ return;
+ }
+ if (tsig_ret != 0) {
+ argv[argc++] = "-T";
+ argv[argc++] = tsig_name;
+ }
+
/*
* Copy the server ip addresses into argv, after converting
* to ascii and saving the static inet_ntoa result.
@@ -790,10 +872,7 @@ startxfer(struct zoneinfo *zp) {
argv[argc++] = "axfr";
}
#endif
- tsig_ret = write_tsig_info(a, tsig_name, &tsig_fd, tsig_ret);
}
- if (tsig_fd > 0)
- close(tsig_fd);
argv[argc] = NULL;
@@ -830,7 +909,6 @@ startxfer(struct zoneinfo *zp) {
ns_warning(ns_log_default,
"startxfer: too many xfers running");
zp->z_time = tt.tv_sec + 10;
- (void)nxfers(zp, -1);
return;
}
@@ -842,6 +920,7 @@ startxfer(struct zoneinfo *zp) {
xferstatus[i].xfer_state = XFER_RUNNING;
xferstatus[i].xfer_pid = pid; /* XXX - small race condition here if we
* can't hold signals */
+ xferstatus[i].xfer_addr = zp->z_xaddr[0];
ns_debug(ns_log_default, 1, "started xfer child %d", pid);
zp->z_flags &= ~Z_NEED_XFER;
zp->z_flags |= Z_XFER_RUNNING;
@@ -1102,11 +1181,12 @@ remove_zone(struct zoneinfo *zp, const char *verb) {
memset(zp, 0, sizeof(*zp));
zp->z_type = z_nil; /* Pedantic; memset() did it. */
INIT_LINK(zp, z_reloadlink);
+ INIT_LINK(zp, z_freelink);
free_zone(zp);
}
int
-purge_nonglue(const char *dname, struct hashbuf *htp, int class) {
+purge_nonglue(const char *dname, struct hashbuf *htp, int class, int log) {
const char *fname;
struct namebuf *np;
struct hashbuf *phtp = htp;
@@ -1127,7 +1207,7 @@ purge_nonglue(const char *dname, struct hashbuf *htp, int class) {
h = htp;
else
h = np->n_hash;
- errs += purge_nonglue_2(dname, h, class, 0);
+ errs += purge_nonglue_2(dname, h, class, 0, log);
if (h->h_cnt == 0 && !root_zone) {
rm_hash(np->n_hash);
np->n_hash = NULL;
@@ -1157,7 +1237,7 @@ valid_glue(struct databuf *dp, char *name, int belowcut) {
/* NOKEY is in parent zone otherwise child zone */
if (dp->d_type == T_KEY && dp->d_size == 4 &&
- (dp->d_data[0] & 0xc6) == 0xc2)
+ (dp->d_data[0] & 0xc3) == 0xc1)
return (1);
/* NXT & KEY records may be signed */
@@ -1169,7 +1249,7 @@ valid_glue(struct databuf *dp, char *name, int belowcut) {
static int
purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
- int belowcut)
+ int belowcut, int log)
{
struct databuf *dp, *pdp;
struct namebuf *np, *pnp, *npn;
@@ -1197,7 +1277,8 @@ purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
if (dp->d_class == class &&
zonecut &&
!valid_glue(dp, name, belowcut)) {
- ns_error(ns_log_db,
+ if (log)
+ ns_error(ns_log_db,
"zone: %s/%s: non-glue record %s bottom of zone: %s/%s",
*dname ? dname : ".",
p_class(dp->d_class),
@@ -1207,7 +1288,8 @@ purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
p_type(dp->d_type));
dp = rm_datum(dp, np, pdp,
NULL);
- errs++;
+ if (log)
+ errs++;
} else {
pdp = dp;
dp = dp->d_next;
@@ -1222,7 +1304,8 @@ purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
np->n_hash,
class,
zonecut ||
- belowcut);
+ belowcut,
+ log);
/* if now empty, free it */
if (np->n_hash->h_cnt == 0) {
@@ -1356,11 +1439,13 @@ bottom_of_zone(struct databuf *dp, int class) {
/*
* Handle XFER limit for a nameserver.
*/
+
+
static int
-nxfers(struct zoneinfo *zp, int delta) {
+nxfers(struct zoneinfo *zp) {
struct in_addr nsa;
- struct nameser *nsp;
int ret;
+ int i;
if (zp->z_xaddrcnt != 0)
nsa = zp->z_xaddr[0]; /* first ns holds zone's xfer limit */
@@ -1368,15 +1453,12 @@ nxfers(struct zoneinfo *zp, int delta) {
nsa = zp->z_addr[0]; /* first ns holds zone's xfer limit */
else
return (-1);
-
- if (!(nsp = nameserFind(nsa, NS_F_INSERT)))
- return (-1); /* probably ENOMEM */
-
- ret = nsp->xfers;
- if (delta < 0 && -delta > ret)
- return (-1); /* taking more than we have */
-
- nsp->xfers += delta;
+
+ ret = 0;
+ for (i = 0; i < MAX_XFERS_RUNNING; i++)
+ if (xferstatus[i].xfer_status == XFER_RUNNING &&
+ xferstatus[i].xfer_addr.s_addr == nsa.s_addr)
+ ret++;
return (ret);
}
@@ -1413,7 +1495,6 @@ pid %lu - forgetting, processes may accumulate",
zp->z_xferpid = 0;
xfers_running--;
- (void)nxfers(zp, -1);
zp->z_flags &= ~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE);
} else if (kill(zp->z_xferpid, SIGTERM) == -1) {
if (errno == ESRCH)
@@ -1479,7 +1560,6 @@ endxfer() {
if (zp->z_xferpid != pid)
continue;
xfers_running--;
- (void) nxfers(zp, -1);
zp->z_xferpid = 0;
zp->z_flags &=
~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE);
@@ -1509,7 +1589,9 @@ endxfer() {
if (exitstatus == XFER_SUCCESSAXFRIXFRFILE) {
zp->z_xferpid = XFER_ISAXFRIXFR;
}
- movefile(zp->z_ixfr_tmp, zp->z_source);
+ if (zp->z_ixfr_tmp != NULL)
+ isc_movefile(zp->z_ixfr_tmp,
+ zp->z_source);
/* XXX should incorporate loadxfer() */
zp->z_flags |= Z_NEED_RELOAD;
zp->z_flags &= ~Z_SYSLOGGED;
@@ -1529,19 +1611,24 @@ endxfer() {
(void)unlink(zp->z_updatelog);
(void)unlink(zp->z_ixfr_base);
- movefile(zp->z_ixfr_tmp,
- zp->z_ixfr_base);
+ isc_movefile(zp->z_ixfr_tmp,
+ zp->z_ixfr_base);
(void)unlink(zp->z_ixfr_tmp);
if (zonedump(zp, ISIXFR) < 0)
ns_warning(ns_log_db,
"error in write ixfr updates to zone file %s",
zp ->z_source);
- } else
+ ns_refreshtime(zp, tt.tv_sec);
+ sched_zone_maint(zp);
+ } else {
ns_notice(ns_log_default,
"IXFR Merge failed %s",
zp->z_ixfr_tmp);
zp->z_flags &=
~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE);
+ ns_retrytime(zp, tt.tv_sec);
+ sched_zone_maint(zp);
+ }
break;
case XFER_TIMEOUT:
@@ -1622,10 +1709,9 @@ tryxfer() {
xfers_running >= server_options->transfers_in)
break;
- if ((xfers = nxfers(zp, 0)) != -1 &&
+ if ((xfers = nxfers(zp)) != -1 &&
xfers < server_options->transfers_per_ns &&
(zp->z_flags & Z_NEED_XFER)) {
- nxfers(zp, 1);
xfers_deferred--;
startxfer(zp);
sched_zone_maint(zp);
@@ -1827,7 +1913,7 @@ ns_reload(void) {
qflush();
sq_flush(NULL);
reloading++; /* To force transfer if secondary and backing up. */
- ns_init(conffile);
+ confmtime = ns_init(conffile);
time(&resettime);
reloading--;
ns_notice(ns_log_default, "Ready to answer queries.");
@@ -1875,6 +1961,7 @@ make_new_zones(void) {
block_signals();
for (n = 0; n < NEWZONES; n++) {
INIT_LINK(&zones[nzones], z_reloadlink);
+ INIT_LINK(&zones[nzones], z_freelink);
if (nzones != 0)
free_zone(&zones[nzones]);
nzones++;
@@ -1906,7 +1993,6 @@ spawnxfer(char **argv, struct zoneinfo *zp) {
execv(server_options->named_xfer, argv);
ns_error(ns_log_default, "can't exec %s: %s",
server_options->named_xfer, strerror(errno));
- (void)nxfers(zp, -1);
_exit(XFER_FAIL); /* Avoid duplicate buffer flushes. */
}
return (pid);
diff --git a/contrib/bind/bin/named/ns_notify.c b/contrib/bind/bin/named/ns_notify.c
index 0cf1e0a..4523422 100644
--- a/contrib/bind/bin/named/ns_notify.c
+++ b/contrib/bind/bin/named/ns_notify.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ns_notify.c,v 8.10 2000/04/21 06:54:09 vixie Exp $";
+static const char rcsid[] = "$Id: ns_notify.c,v 8.12 2000/12/23 08:14:40 vixie Exp $";
#endif /* not lint */
/*
@@ -129,6 +129,7 @@ ns_notify(const char *dname, ns_class class, ns_type type) {
}
ni->class = class;
ni->type = type;
+ INIT_LINK(ni, link);
evInitID(&ni->timer);
if (loading != 0) {
@@ -215,7 +216,7 @@ ns_stopnotify(const char *dname, ns_class class) {
*/
static void
sysnotify(const char *dname, ns_class class, ns_type type) {
- const char *zname, *fname;
+ const char *zname;
u_int32_t zserial;
int nns, na, i;
struct zoneinfo *zp;
diff --git a/contrib/bind/bin/named/ns_parser.y b/contrib/bind/bin/named/ns_parser.y
index c987e2b..680a586 100644
--- a/contrib/bind/bin/named/ns_parser.y
+++ b/contrib/bind/bin/named/ns_parser.y
@@ -1,6 +1,6 @@
%{
#if !defined(lint) && !defined(SABER)
-static char rcsid[] = "$Id: ns_parser.y,v 8.55 2000/04/23 02:18:59 vixie Exp $";
+static char rcsid[] = "$Id: ns_parser.y,v 8.63 2000/12/23 08:14:41 vixie Exp $";
#endif /* not lint */
/*
@@ -25,6 +25,7 @@ static char rcsid[] = "$Id: ns_parser.y,v 8.55 2000/04/23 02:18:59 vixie Exp $";
#include "port_before.h"
#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -70,10 +71,10 @@ static int should_install;
static options current_options;
static int seen_options;
+static int logged_options_error;
static controls current_controls;
-static topology_config current_topology;
static int seen_topology;
static server_config current_server;
@@ -131,6 +132,7 @@ int yyparse();
%token T_DIRECTORY T_PIDFILE T_NAMED_XFER
%token T_DUMP_FILE T_STATS_FILE T_MEMSTATS_FILE
%token T_FAKE_IQUERY T_RECURSION T_FETCH_GLUE
+%token T_HITCOUNT
%token T_QUERY_SOURCE T_LISTEN_ON T_PORT T_ADDRESS
%token T_RRSET_ORDER T_ORDER T_NAME T_CLASS
%token T_CONTROLS T_INET T_UNIX T_PERM T_OWNER T_GROUP T_ALLOW
@@ -142,7 +144,7 @@ int yyparse();
%token T_DATASIZE T_STACKSIZE T_CORESIZE
%token T_DEFAULT T_UNLIMITED
%token T_FILES T_VERSION
-%token T_HOSTSTATS T_DEALLOC_ON_EXIT
+%token T_HOSTSTATS T_HOSTSTATSMAX T_DEALLOC_ON_EXIT
%token T_TRANSFERS_IN T_TRANSFERS_OUT T_TRANSFERS_PER_NS
%token T_TRANSFER_FORMAT T_MAX_TRANSFER_TIME_IN
%token T_SERIAL_QUERIES T_ONE_ANSWER T_MANY_ANSWERS
@@ -349,6 +351,11 @@ option: /* Empty */
set_global_boolean_option(current_options,
OPTION_NOFETCHGLUE, !$2);
}
+ | T_HITCOUNT yea_or_nay
+ {
+ set_global_boolean_option(current_options,
+ OPTION_HITCOUNT, $2);
+ }
| T_NOTIFY yea_or_nay
{
set_global_boolean_option(current_options,
@@ -529,7 +536,11 @@ option: /* Empty */
{
current_options->stats_interval = $2 * 60;
}
- | T_MAX_LOG_SIZE_IXFR L_NUMBER
+ | T_HOSTSTATSMAX L_NUMBER
+ {
+ current_options->max_host_stats = $2;
+ }
+ | T_MAX_LOG_SIZE_IXFR size_spec
{
current_options->max_log_size_ixfr = $2;
}
@@ -1124,7 +1135,6 @@ channel_name: any_string
channel: channel_name
{
log_channel channel;
- symbol_value value;
if (current_category >= 0) {
channel = lookup_channel($1);
@@ -1461,9 +1471,11 @@ zone_stmt: T_ZONE L_QSTRING optional_class
symbol_value value;
char *zone_name;
- if (!seen_options)
+ if (!seen_options && !logged_options_error) {
parser_error(0,
"no options statement before first zone; using previous/default");
+ logged_options_error = 1;
+ }
sym_type = SYM_ZONE | ($3 & 0xffff);
value.pointer = NULL;
zone_name = canonical_name($2);
@@ -1555,17 +1567,17 @@ zone_option: T_TYPE zone_type
"zone filename already set; skipping");
}
| T_FILE_IXFR L_QSTRING
- {
- if (!set_zone_ixfr_file(current_zone, $2))
- parser_warning(0,
- "zone ixfr data base already set; skipping");
- }
+ {
+ if (!set_zone_ixfr_file(current_zone, $2))
+ parser_warning(0,
+ "zone ixfr data base already set; skipping");
+ }
| T_IXFR_TMP L_QSTRING
- {
- if (!set_zone_ixfr_tmp(current_zone, $2))
- parser_warning(0,
- "zone ixfr temp filename already set; skipping");
- }
+ {
+ if (!set_zone_ixfr_tmp(current_zone, $2))
+ parser_warning(0,
+ "zone ixfr temp filename already set; skipping");
+ }
| T_MASTERS maybe_zero_port '{' master_in_addr_list '}'
{
set_zone_master_port(current_zone, $2);
@@ -1615,7 +1627,7 @@ zone_option: T_TYPE zone_type
parser_warning(0,
"zone max transfer time (in) already set; skipping");
}
- | T_MAX_LOG_SIZE_IXFR L_NUMBER
+ | T_MAX_LOG_SIZE_IXFR size_spec
{
set_zone_max_log_size_ixfr(current_zone, $2);
}
@@ -1872,6 +1884,7 @@ define_builtin_channels() {
static void
parser_setup() {
seen_options = 0;
+ logged_options_error = 0;
seen_topology = 0;
symtab = new_symbol_table(SYMBOL_TABLE_SIZE, NULL);
if (authtab != NULL)
@@ -1941,13 +1954,16 @@ define_key(char *name, struct dst_key *dst_key) {
dprint_key_info(dst_key);
}
-void
+time_t
parse_configuration(const char *filename) {
FILE *config_stream;
+ struct stat sb;
config_stream = fopen(filename, "r");
if (config_stream == NULL)
ns_panic(ns_log_parser, 0, "can't open '%s'", filename);
+ if (fstat(fileno(config_stream), &sb) == -1)
+ ns_panic(ns_log_parser, 0, "can't stat '%s'", filename);
lexer_setup();
parser_setup();
@@ -1955,6 +1971,7 @@ parse_configuration(const char *filename) {
(void)yyparse();
lexer_end_file();
parser_cleanup();
+ return (sb.st_mtime);
}
void
diff --git a/contrib/bind/bin/named/ns_req.c b/contrib/bind/bin/named/ns_req.c
index 75d688f..f103ad6 100644
--- a/contrib/bind/bin/named/ns_req.c
+++ b/contrib/bind/bin/named/ns_req.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_req.c 4.47 (Berkeley) 7/1/91";
-static const char rcsid[] = "$Id: ns_req.c,v 8.119 2000/08/21 05:57:09 vixie Exp $";
+static const char rcsid[] = "$Id: ns_req.c,v 8.129 2001/01/08 23:46:41 marka Exp $";
#endif /* not lint */
/*
@@ -174,11 +174,14 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
HEADER *hp = (HEADER *) msg;
u_char *cp, *eom;
enum req_action action;
- int n, ra, has_tsig, msglen_orig, tsig_size, siglen, sig2len;
+ int n, ra, has_tsig, tsig_size, sig2len;
u_char *tsigstart;
u_char sig[TSIG_SIG_SIZE], sig2[TSIG_SIG_SIZE];
struct tsig_record *in_tsig = NULL;
int error = NOERROR;
+ int msglen_orig = msglen;
+ int buflen_orig = buflen;
+ int siglen = sizeof sig;
DST_KEY *key;
time_t tsig_time;
@@ -188,8 +191,6 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
fp_nquery(msg, msglen, log_get_stream(packet_channel));
}
#endif
- msglen_orig = msglen;
- siglen = sizeof(sig);
tsigstart = ns_find_tsig(msg, msg + msglen);
if (tsigstart == NULL)
@@ -198,7 +199,7 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
char buf[MAXDNAME];
has_tsig = 1;
- n = dn_expand(msg, msg + msglen, tsigstart, buf, sizeof(buf));
+ n = dn_expand(msg, msg + msglen, tsigstart, buf, sizeof buf);
if (n < 0) {
ns_debug(ns_log_default, 1,
"ns_req: bad TSIG key name",
@@ -374,24 +375,31 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
* a TSIG error, build a new message with no data and a TSIG.
*/
if ((hp->tc || error != NOERROR) && has_tsig > 0) {
+ sign_again:
hp->ancount = htons(0);
hp->nscount = htons(0);
hp->arcount = htons(0);
cp = msg + HFIXEDSZ;
cp += ns_skiprr(cp, msg + msglen, ns_s_qd, ntohs(hp->qdcount));
- sig2len = sizeof(sig2);
- buflen += (msglen - (cp - msg));
+ sig2len = sizeof sig2;
msglen = cp - msg;
+ buflen = buflen_orig - msglen;
n = ns_sign(msg, &msglen, msglen + buflen, error, key,
sig, siglen, sig2, &sig2len, tsig_time);
- if (n != 0) {
- INSIST(0);
+ if (n == NS_TSIG_ERROR_NO_SPACE && ntohs(hp->qdcount) != 0) {
+ hp->qdcount = htons(0);
+ goto sign_again;
}
+ if (n != 0)
+ ns_info(ns_log_default,
+ "ns_req: unable to sign response");
cp = msg + msglen;
-
}
/* Either the message is not truncated or there was no TSIG */
else {
+ /*
+ * Reserve space for tsig if required.
+ */
if (has_tsig > 0)
buflen -= tsig_size;
n = doaddinfo(hp, cp, buflen);
@@ -399,7 +407,7 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
buflen -= n;
if (has_tsig > 0) {
buflen += tsig_size;
- sig2len = sizeof(sig2);
+ sig2len = sizeof sig2;
msglen = cp - msg;
n = ns_sign(msg, &msglen, msglen + buflen, error, key,
sig, siglen, sig2, &sig2len, tsig_time);
@@ -417,12 +425,12 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
ntohs(hp->id), cp - msg, hp->rcode);
if (debug >= 10)
res_pquery(&res, msg, cp - msg,
- log_get_stream(packet_channel));
+ log_get_stream(packet_channel));
#endif /*DEBUG*/
if (qsp == NULL) {
if (sendto(dfd, (char*)msg, cp - msg, 0,
(struct sockaddr *)&from,
- sizeof(from)) < 0) {
+ sizeof from) < 0) {
if (!haveComplained(ina_ulong(from.sin_addr),
(u_long)sendtoStr))
ns_info(ns_log_default,
@@ -460,7 +468,7 @@ static enum req_action
req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg,
struct sockaddr_in from)
{
- int n, type, class, zn;
+ int n, type, class;
char dnbuf[MAXDNAME];
struct zoneinfo *zp;
@@ -769,11 +777,6 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
np == NULL ? "missed" : "found",
dname, fname, cname);
-
- ns_debug(ns_log_default, 1, "req: %s '%s' as '%s' (cname=%d)",
- np == NULL ? "missed" : "found",
- dname, fname, cname);
-
#ifdef YPKLUDGE
/* Some braindamaged resolver software will not
recognize internet addresses in dot notation and
@@ -950,6 +953,10 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
p_type(type), sin_ntoa(from),
*dname ? dname : ".");
nameserIncr(from.sin_addr, nssRcvdUXFR);
+ if (type == ns_t_ixfr) {
+ hp->rcode = ns_r_refused;
+ return (Finish);
+ }
return (Refuse);
}
@@ -961,6 +968,10 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
p_type(type), sin_ntoa(from),
*dname ? dname : ".");
nameserIncr(from.sin_addr, nssRcvdUXFR);
+ if (type == ns_t_ixfr) {
+ hp->rcode = ns_r_refused;
+ return (Finish);
+ }
return (Refuse);
}
@@ -972,6 +983,10 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
p_type(type), sin_ntoa(from),
*dname ? dname : ".");
nameserIncr(from.sin_addr, nssRcvdUXFR);
+ if (type == ns_t_ixfr) {
+ hp->rcode = ns_r_refused;
+ return (Finish);
+ }
return (Refuse);
}
@@ -983,6 +998,10 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
p_type(type), sin_ntoa(from),
*dname ? dname : ".");
nameserIncr(from.sin_addr, nssRcvdUXFR);
+ if (type == ns_t_ixfr) {
+ hp->rcode = ns_r_refused;
+ return (Finish);
+ }
return (Refuse);
}
@@ -1389,15 +1408,20 @@ static enum req_action
req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp,
u_char *msg, struct sockaddr_in from)
{
- int dlen, alen, n, type, class, count;
- char dnbuf[MAXDNAME], anbuf[PACKETSZ], *data, *fname;
+ u_int rdata_offset;
+ size_t alen;
+ int dlen, n;
+ ns_type type;
+ ns_class class;
+ u_char anbuf[PACKETSZ], *anptr;
+ char dnbuf[MAXDNAME];
nameserIncr(from.sin_addr, nssRcvdIQ);
- if (ntohs(hp->ancount) != 1
- || ntohs(hp->qdcount) != 0
- || ntohs(hp->nscount) != 0
- || ntohs(hp->arcount) != 0) {
+ if (ntohs(hp->ancount) != 1 ||
+ ntohs(hp->qdcount) != 0 ||
+ ntohs(hp->nscount) != 0 ||
+ ntohs(hp->arcount) != 0) {
ns_debug(ns_log_default, 1,
"FORMERR IQuery header counts wrong");
hp->rcode = ns_r_formerr;
@@ -1407,7 +1431,9 @@ req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp,
/*
* Skip domain name, get class, and type.
*/
- if ((n = dn_skipname(*cpp, eom)) < 0) {
+ anptr = *cpp;
+ n = dn_skipname(*cpp, eom);
+ if (n < 0) {
ns_debug(ns_log_default, 1,
"FORMERR IQuery packet name problem");
hp->rcode = ns_r_formerr;
@@ -1430,43 +1456,41 @@ req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp,
hp->rcode = ns_r_formerr;
return (Finish);
}
+ rdata_offset = *cpp - anptr;
*cpp += dlen;
+ INSIST(*cpp == eom);
/*
- * not all inverse queries are handled.
+ * Not all inverse queries are handled.
*/
- switch (type) {
- case T_A:
- if (!NS_OPTION_P(OPTION_FAKE_IQUERY) || dlen != INT32SZ) {
- if (dlen != INT32SZ)
- ns_warning(ns_log_security,
- "bad iquery from %s",
- inet_ntoa(from.sin_addr));
- return (Refuse);
- }
- break;
- default:
+ if (type != ns_t_a) {
ns_warning(ns_log_security,
"unsupported iquery type from %s",
inet_ntoa(from.sin_addr));
return (Refuse);
}
+ if (dlen != INT32SZ) {
+ ns_warning(ns_log_security,
+ "bad iquery from %s",
+ inet_ntoa(from.sin_addr));
+ return (Refuse);
+ }
+ if (!NS_OPTION_P(OPTION_FAKE_IQUERY))
+ return (Refuse);
+
ns_debug(ns_log_default, 1,
"req: IQuery class %d type %d", class, type);
- fname = (char *)msg + HFIXEDSZ;
- alen = (char *)*cpp - fname;
- if ((size_t)alen > sizeof anbuf) {
+ alen = eom - anptr;
+ if (alen > sizeof anbuf) {
ns_warning(ns_log_security,
"bad iquery from %s",
inet_ntoa(from.sin_addr));
return (Refuse);
}
- memcpy(anbuf, fname, alen);
- data = anbuf + alen - dlen;
- *cpp = (u_char *)fname;
+ memcpy(anbuf, anptr, alen);
+ *cpp = anptr;
*buflenp -= HFIXEDSZ;
- count = 0;
#ifdef QRYLOG
if (qrylog) {
@@ -1474,7 +1498,7 @@ req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp,
strcpy(tmp, inet_ntoa(from.sin_addr));
ns_info(ns_log_queries, "XX /%s/%s/-%s",
- tmp, inet_ntoa(ina_get((u_char *)data)),
+ tmp, inet_ntoa(ina_get(&anbuf[rdata_offset])),
p_type(type));
}
#endif /*QRYLOG*/
@@ -1487,7 +1511,7 @@ req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp,
* A better strategy would be to turn this into a PTR query, but that
* would legitimize inverse queries in a way they do not deserve.
*/
- sprintf(dnbuf, "[%s]", inet_ntoa(ina_get((u_char *)data)));
+ sprintf(dnbuf, "[%s]", inet_ntoa(ina_get(&anbuf[rdata_offset])));
*buflenp -= QFIXEDSZ;
n = dn_comp(dnbuf, *cpp, *buflenp, NULL, NULL);
if (n < 0) {
@@ -1495,19 +1519,20 @@ req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp,
return (Finish);
}
*cpp += n;
+ *buflenp -= n;
PUTSHORT((u_int16_t)type, *cpp);
+ *buflenp -= INT16SZ;
PUTSHORT((u_int16_t)class, *cpp);
- *buflenp -= n;
- count++;
+ *buflenp -= INT16SZ;
- ns_debug(ns_log_default, 1, "req: IQuery %d records", count);
- hp->qdcount = htons((u_int16_t)count);
+ hp->qdcount = htons(1);
if (alen > *buflenp) {
hp->tc = 1;
return (Finish);
}
memcpy(*cpp, anbuf, alen);
*cpp += alen;
+ *buflenp -= alen;
return (Finish);
}
@@ -1540,7 +1565,7 @@ stale(struct databuf *dp) {
if ((int32_t)(tt.tv_sec - zp->z_lastupdate)
> (int32_t)zp->z_expire) {
ns_debug(ns_log_default, 1,
- "stale: secondary zone %s expired",
+ "stale: slave zone %s expired",
zp->z_origin);
if (!haveComplained((u_long)zp, (u_long)stale)) {
ns_notice(ns_log_default,
@@ -1775,7 +1800,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
/* Replacement */
ns_debug(ns_log_default, 1, "Replacement = %s", cp1);
- n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
+ n = dn_comp((char *)cp1, cp, buflen, NULL, NULL);
ns_debug(ns_log_default, 1, "dn_comp's n = %u", n);
if (n < 0)
goto cleanup;
diff --git a/contrib/bind/bin/named/ns_resp.c b/contrib/bind/bin/named/ns_resp.c
index 36e3626..2a56e11 100644
--- a/contrib/bind/bin/named/ns_resp.c
+++ b/contrib/bind/bin/named/ns_resp.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_resp.c 4.65 (Berkeley) 3/3/91";
-static const char rcsid[] = "$Id: ns_resp.c,v 8.144 2000/07/11 08:26:09 vixie Exp $";
+static const char rcsid[] = "$Id: ns_resp.c,v 8.149 2001/01/03 09:47:27 marka Exp $";
#endif /* not lint */
/*
@@ -201,6 +201,8 @@ learntFrom(struct qinfo *qp, struct sockaddr_in *server) {
char *a, *ns, *na;
struct databuf *db;
int i;
+ char nsbuf[20];
+ char abuf[20];
a = ns = na = "<Not Available>";
@@ -209,34 +211,22 @@ learntFrom(struct qinfo *qp, struct sockaddr_in *server) {
server->sin_addr)) {
db = qp->q_addr[i].ns;
if (db != NULL) {
- if (NS_OPTION_P(OPTION_HOSTSTATS)) {
- char nsbuf[20];
-
- if (db->d_ns != NULL) {
- strcpy(nsbuf,
- inet_ntoa(db->d_ns->addr));
- ns = nsbuf;
- } else {
- ns = zones[db->d_zone]
- .z_origin;
- }
+ if (db->d_addr.s_addr != htonl(0)) {
+ strcpy(nsbuf, inet_ntoa(db->d_addr));
+ ns = nsbuf;
+ } else {
+ ns = zones[db->d_zone].z_origin;
}
if (db->d_rcode == 0)
na = (char*)qp->q_addr[i].ns->d_data;
}
-
- if (NS_OPTION_P(OPTION_HOSTSTATS)) {
- char abuf[20];
-
- db = qp->q_addr[i].nsdata;
- if (db != NULL) {
- if (db->d_ns != NULL) {
- strcpy(abuf,
- inet_ntoa(db->d_ns->addr));
- a = abuf;
- } else {
- a = zones[db->d_zone].z_origin;
- }
+ db = qp->q_addr[i].nsdata;
+ if (db != NULL) {
+ if (db->d_addr.s_addr != htonl(0)) {
+ strcpy(abuf, inet_ntoa(db->d_addr));
+ a = abuf;
+ } else {
+ a = zones[db->d_zone].z_origin;
}
}
break;
@@ -467,7 +457,6 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
if (ina_equal(fwd->fwddata->fwdaddr.sin_addr, from.sin_addr))
break;
/*
- /*
* find the qinfo pointer and update
* the rtt and fact that we have called on this server before.
*/
@@ -714,7 +703,7 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
#ifdef DEBUG
if (debug > 0)
res_pquery(&res, msg, msglen,
- log_get_stream(packet_channel));
+ log_get_stream(packet_channel));
#endif
/*
* Since there is no answer section (ancount == 0),
@@ -1096,6 +1085,10 @@ tcp_retry:
: DB_C_ADDITIONAL;
}
}
+#ifdef HITCOUNTS
+ ++dp->d_hitcnt;
+ ++db_total_hits;
+#endif /* HITCOUNTS */
rrsetadd(flushset, name, dp);
}
free_related_additional();
@@ -1498,7 +1491,7 @@ tcp_retry:
#ifdef DEBUG
if (debug >= 10)
res_pquery(&res, qp->q_msg, qp->q_msglen,
- log_get_stream(packet_channel));
+ log_get_stream(packet_channel));
#endif
key = tsig_key_from_addr(nsa->sin_addr);
if (key != NULL) {
@@ -1535,7 +1528,7 @@ tcp_retry:
if (!haveComplained(ina_ulong(nsa->sin_addr),
(u_long)tcpsendStr))
ns_info(ns_log_default,
- "ns_forw: tcp_send(%s) failed: %s",
+ "ns_resp: tcp_send(%s) failed: %s",
sin_ntoa(*nsa), strerror(errno));
}
} else if (sendto(ds, (char*)qp->q_msg, qp->q_msglen, 0,
@@ -2474,7 +2467,7 @@ sysquery(const char *dname, int class, int type,
#ifdef DEBUG
if (debug >= 10)
res_pquery(&res, qp->q_msg, qp->q_msglen,
- log_get_stream(packet_channel));
+ log_get_stream(packet_channel));
#endif
key = tsig_key_from_addr(nsa->sin_addr);
@@ -2927,6 +2920,10 @@ finddata(struct namebuf *np, int class, int type,
goto done;
}
}
+#ifdef HITCOUNTS
+ ++dp->d_hitcnt;
+ ++db_total_hits;
+#endif /* HITCOUNTS */
/* Don't put anything but key or sig RR's in response to
requests for key or sig */
@@ -3021,7 +3018,8 @@ finddata(struct namebuf *np, int class, int type,
order = match_order(np, class, foundcname ? T_CNAME : type);
- /* shuffle the SIG records down to the bottom of the array
+ /*
+ * shuffle the SIG records down to the bottom of the array
* as we need to make sure they get packed last, no matter
* what the ordering is. We're sure to maintain the
* original ordering within the two sets of records (so
@@ -3037,10 +3035,11 @@ finddata(struct namebuf *np, int class, int type,
sig_count = found_count - jdx;
first_sig = jdx ;
- /* now shift the SIG records down to the end of the array
+ /*
+ * now shift the SIG records down to the end of the array
* and copy in the non-SIG records
*/
- for (i = idx = found_count - 1 ; idx >= 0 ; idx--) {
+ for (i = idx = found_count - 1 ; i >= 0 ; idx--) {
if (i < non_sig_count) {
found[i] = tmpfound[i];
i--;
diff --git a/contrib/bind/bin/named/ns_stats.c b/contrib/bind/bin/named/ns_stats.c
index f04790b..b823462 100644
--- a/contrib/bind/bin/named/ns_stats.c
+++ b/contrib/bind/bin/named/ns_stats.c
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_stats.c 4.10 (Berkeley) 6/27/90";
-static const char rcsid[] = "$Id: ns_stats.c,v 8.30 2000/04/23 02:18:59 vixie Exp $";
+static const char rcsid[] = "$Id: ns_stats.c,v 8.32 2000/11/29 06:56:05 marka Exp $";
#endif /* not lint */
/*
@@ -108,6 +108,27 @@ static const char rcsid[] = "$Id: ns_stats.c,v 8.30 2000/04/23 02:18:59 vixie Ex
static u_long typestats[T_ANY+1];
static void nameserStats(FILE *);
+static u_int32_t ns_stats_cnt = 0;
+static int ns_stats_disabled = 0;
+
+void
+ns_stats_dumpandclear() {
+ time_t timenow = time(NULL);
+ FILE *f;
+
+ ns_stats();
+ if (!(f = fopen(server_options->stats_filename, "a"))) {
+ ns_notice(ns_log_statistics, "cannot open stat file, \"%s\"",
+ server_options->stats_filename);
+ }
+ if (f != NULL) {
+ (void) fchown(fileno(f), user_id, group_id);
+ fprintf(f, "+++ Host Statistics Cleared +++ (%ld) %s",
+ (long)timenow, checked_ctime(&timenow));
+ (void) my_fclose(f);
+ }
+ ns_freestats();
+}
void
ns_stats() {
@@ -246,12 +267,23 @@ nameserFind(addr, flags)
if (!nameserInit) {
tree_init(&nameserTree);
nameserInit++;
+ ns_stats_cnt = 0;
+ ns_stats_disabled = 0;
}
dummy.addr = addr;
ns = (struct nameser *)tree_srch(&nameserTree, nameserCompar,
(tree_t)&dummy);
if (ns == NULL && (flags & NS_F_INSERT) != 0) {
+ if (server_options->max_host_stats != 0 &&
+ ns_stats_cnt > server_options->max_host_stats) {
+ if (!ns_stats_disabled)
+ ns_notice(ns_log_statistics,
+ "ns_stats_disabled: %s reached",
+ "host-statistics-max");
+ ns_stats_disabled = 1;
+ return (NULL);
+ }
ns = (struct nameser *)memget(sizeof(struct nameser));
if (ns == NULL) {
nomem: if (!haveComplained((u_long)nameserFind, 0))
@@ -268,6 +300,7 @@ nameserFind(addr, flags)
errno = save;
goto nomem;
}
+ ns_stats_cnt++;
}
return (ns);
}
@@ -324,8 +357,11 @@ nameserStats(f)
nameserStatsHdr(f);
fprintf(f, "(Global)\n");
nameserStatsOut(f, globalStats);
- if (NS_OPTION_P(OPTION_HOSTSTATS))
+ if (NS_OPTION_P(OPTION_HOSTSTATS)) {
tree_trav(&nameserTree, nameserStatsTravUAR);
+ if (ns_stats_disabled)
+ fprintf(f, "++ Host Statistics Incomplete ++\n");
+ }
fprintf(f, "-- Name Server Statistics --\n");
nameserStatsFile = NULL;
}
@@ -335,7 +371,7 @@ ns_logstats(evContext ctx, void *uap, struct timespec due,
struct timespec inter)
{
char buffer[1024];
- char buffer2[32], header[64];
+ char buffer2[32], header[128];
time_t timenow = time(NULL);
int i;
#ifdef HAVE_GETRUSAGE
@@ -348,11 +384,18 @@ ns_logstats(evContext ctx, void *uap, struct timespec due,
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));
- ns_info(ns_log_statistics, "USAGE %lu %lu %s", (u_long)timenow,
- (u_long)boottime, buffer);
+ /*
+ * Get around a stupid compiler bug in gcc on solaris.
+ * There is a problem if three or more doubles are passed to
+ * sprintf.
+ * <http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=337&database=gcc>
+ */
+ sprintf(buffer, "CPU=%gu/%gs CHILDCPU=", tv_float(usage.ru_utime),
+ tv_float(usage.ru_stime));
+ sprintf(header, "%gu/%gs", tv_float(childu.ru_utime),
+ tv_float(childu.ru_stime));
+ ns_info(ns_log_statistics, "USAGE %lu %lu %s%s", (u_long)timenow,
+ (u_long)boottime, buffer, header);
# undef tv_float
#endif /*HAVE_GETRUSAGE*/
@@ -399,4 +442,6 @@ ns_freestats(void) {
return;
tree_mung(&nameserTree, nameserFree);
nameserInit = 0;
+ ns_stats_cnt = 0;
+ ns_stats_disabled = 0;
}
diff --git a/contrib/bind/bin/named/ns_update.c b/contrib/bind/bin/named/ns_update.c
index da0c5a9..e20d258 100644
--- a/contrib/bind/bin/named/ns_update.c
+++ b/contrib/bind/bin/named/ns_update.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ns_update.c,v 8.81 2000/07/11 09:25:14 vixie Exp $";
+static const char rcsid[] = "$Id: ns_update.c,v 8.89 2001/01/14 09:46:20 marka Exp $";
#endif /* not lint */
/*
@@ -73,15 +73,13 @@ static const char rcsid[] = "$Id: ns_update.c,v 8.81 2000/07/11 09:25:14 vixie E
#include <isc/eventlib.h>
#include <isc/logging.h>
#include <isc/memcluster.h>
-
#include <isc/dst.h>
+#include <isc/misc.h>
#include "port_after.h"
#include "named.h"
-static ns_updque curupd;
-
#define WRITEABLE_MASK (S_IWUSR | S_IWGRP | S_IWOTH)
/* XXXRTH almost all funcs. in here should be static!
@@ -273,7 +271,6 @@ printupdatelog(struct sockaddr_in srcaddr,
u_int32_t old_serial)
{
struct databuf *dp;
- struct map *mp;
ns_updrec *rrecp;
int opcode;
char time[25];
@@ -313,9 +310,9 @@ printupdatelog(struct sockaddr_in srcaddr,
old_serial);
if (ifp)
fprintf(ifp,
- "zone:\torigin %s class %s serial %u\n",
+ "zone:\torigin %s class %s serial %lu\n",
zp->z_origin, p_class(zp->z_class),
- old_serial);
+ (u_long)old_serial);
break;
case S_PREREQ:
opcode = rrecp->r_opcode;
@@ -730,16 +727,14 @@ process_prereq(ns_updrec *ur, int *rcodep, u_int16_t zclass) {
static int
prescan_nameok(ns_updrec *ur, int *rcodep, u_int16_t zclass,
- struct zoneinfo *zp) {
- const char *dname = ur->r_dname;
+ struct zoneinfo *zp)
+{
const char *owner = ur->r_dname;
u_int16_t class = ur->r_class;
u_int16_t type = ur->r_type;
char *cp = (char *)ur->r_dp->d_data;
enum context context;
- int ret = 1;
-
/* We don't care about deletes */
if (ur->r_class != zclass)
return (1);
@@ -808,16 +803,17 @@ prescan_nameok(ns_updrec *ur, int *rcodep, u_int16_t zclass,
/*
* Order (2)
* Preference (2)
- * Flags (1)
*/
- cp += 5;
+ cp += 4;
+ /* Flags (txt) */
+ cp += (*cp&0xff) + 1;
/* Service (txt) */
- cp += strlen(cp) + 1;
+ cp += (*cp&0xff) + 1;
/* Pattern (txt) */
- cp += strlen(cp) + 1;
+ cp += (*cp&0xff) + 1;
context = domain_ctx;
- if (!ns_nameok(NULL, cp, class, zp, primary_trans, context, owner,
- inaddr_any))
+ if (!ns_nameok(NULL, cp, class, zp, primary_trans,
+ context, owner, inaddr_any))
goto refused;
break;
case ns_t_srv:
@@ -887,14 +883,10 @@ prescan_nameok(ns_updrec *ur, int *rcodep, u_int16_t zclass,
*/
static int
prescan_update(ns_updrec *ur, int *rcodep, u_int16_t zclass) {
- const char *dname = ur->r_dname;
u_int16_t class = ur->r_class;
u_int16_t type = ur->r_type;
u_int32_t ttl = ur->r_ttl;
struct databuf *rdp = ur->r_dp;
- const char *fname;
- struct hashbuf *htp;
- struct namebuf *np;
if (class == zclass) {
if (!ns_t_rr_p(type)) {
@@ -952,11 +944,10 @@ static int
process_updates(const ns_updque *updlist, int *rcodep,
struct sockaddr_in from)
{
- int i, j, n, dbflags, matches, zonenum;
+ int j, n, dbflags, matches, zonenum;
int numupdated = 0, soaupdated = 0, schedmaint = 0;
u_int16_t zclass;
ns_updrec *ur;
- const char *fname;
struct databuf *dp, *savedp;
struct zoneinfo *zp;
int zonelist[MAXDNAME];
@@ -1145,25 +1136,20 @@ class=%s, type=%s, ttl=%d, dp=0x%0x",
static enum req_action
req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg,
struct qstream *qsp, int dfd, struct sockaddr_in from,
- struct tsig_record *in_tsig)
+ struct tsig_record *in_tsig, ns_updque curupd)
{
char dnbuf[MAXDNAME], *dname;
u_int zocount, prcount, upcount, adcount, class, type, dlen;
u_int32_t ttl;
- int i, n, cnt, found, matches, zonenum, numupdated = 0;
+ int i, n, matches, zonenum, numupdated = 0;
int rcode = NOERROR;
- u_int c, section;
+ u_int section;
u_char rdata[MAXDATA];
- struct qinfo *qp;
struct databuf *dp, *nsp[NSMAX];
- struct databuf **nspp = &nsp[0];
struct zoneinfo *zp;
ns_updrec *rrecp;
int zonelist[MAXDNAME];
- int should_use_tcp;
u_int32_t old_serial;
- int unapproved_ip = 0;
- int tsig_len;
DST_KEY *in_key = (in_tsig != NULL) ? in_tsig->key : NULL;
nsp[0] = NULL;
@@ -1219,7 +1205,7 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg,
*/
if (!ip_addr_or_key_allowed(zp->z_update_acl, from.sin_addr, in_key)) {
- ns_notice(ns_log_security, "denied update from %s for %s",
+ ns_notice(ns_log_security, "denied update from %s for \"%s\"",
sin_ntoa(from), *dname ? dname : ".");
nameserIncr(from.sin_addr, nssRcvdUUpd);
return (Refuse);
@@ -1353,6 +1339,7 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg,
dp->d_secure = DB_S_INSECURE; /* should be UNCHECKED */
dp->d_clev = nlabels(zp->z_origin);
/* XXX - also record in dp->d_ns, which host this came from */
+ DRCNTINC(dp);
rrecp->r_dp = dp;
/* Append the current record to the end of list of records. */
APPEND(curupd, rrecp, r_link);
@@ -1408,8 +1395,11 @@ free_rrecp(ns_updque *updlist, int rcode, struct sockaddr_in from) {
else
next_rrecp = PREV(rrecp, r_link);
if (rrecp->r_section != S_UPDATE) {
- if (rrecp->r_dp)
- db_freedata(rrecp->r_dp);
+ if (rrecp->r_dp) {
+ DRCNTDEC(rrecp->r_dp);
+ if (rrecp->r_dp->d_rcnt == 0)
+ db_freedata(rrecp->r_dp);
+ }
res_freeupdrec(rrecp);
continue;
}
@@ -1447,19 +1437,26 @@ free_rrecp(ns_updque *updlist, int rcode, struct sockaddr_in from) {
*/
}
}
+ DRCNTDEC(dp);
+ if (dp->d_rcnt == 0)
+ db_freedata(dp);
} else {
/*
* Databuf's matching this were deleted by this
* update, or were never executed (because we bailed
* out early).
*/
- db_freedata(dp);
+ DRCNTDEC(dp);
+ if (dp->d_rcnt == 0)
+ db_freedata(dp);
}
/* Process deleted databuf's. */
dp = rrecp->r_deldp;
while (dp != NULL) {
tmpdp = dp;
+ DRCNTDEC(tmpdp);
+ tmpdp->d_next = NULL;
dp = dp->d_next;
if (rcode == NOERROR) {
if (tmpdp->d_rcnt)
@@ -1468,7 +1465,6 @@ free_rrecp(ns_updque *updlist, int rcode, struct sockaddr_in from) {
p_type(tmpdp->d_type),
tmpdp->d_rcnt);
else {
- tmpdp->d_next = NULL;
db_freedata(tmpdp);
}
} else {
@@ -1484,6 +1480,8 @@ free_rrecp(ns_updque *updlist, int rcode, struct sockaddr_in from) {
"free_rrecp: added back databuf 0x%0x",
tmpdp);
}
+ if (tmpdp->d_rcnt == 0)
+ db_freedata(tmpdp);
}
}
res_freeupdrec(rrecp);
@@ -1497,9 +1495,11 @@ req_update(HEADER *hp, u_char *cp, u_char *eom, u_char *msg,
struct tsig_record *in_tsig)
{
enum req_action ret;
+ ns_updque curupd;
INIT_LIST(curupd);
- ret = req_update_private(hp, cp, eom, msg, qsp, dfd, from, in_tsig);
+ ret = req_update_private(hp, cp, eom, msg, qsp, dfd, from,
+ in_tsig, curupd);
free_rrecp(&curupd, ret == Refuse ? ns_r_refused : hp->rcode, from);
if (ret == Finish) {
hp->qdcount = hp->ancount = hp->nscount = hp->arcount = 0;
@@ -1801,7 +1801,7 @@ rdata_dump(struct databuf *dp, FILE *fp) {
if ((n = *cp++) != '\0') {
for (j = n; j > 0 && cp < end; j--)
if ((*cp < ' ') || (*cp > '~')) {
- fprintf(fp, "\\%03.3d", *cp++);
+ fprintf(fp, "\\%03d", *cp++);
} else if (*cp == '\\' || *cp =='"') {
putc('\\', fp);
putc(*cp++, fp);
@@ -1944,7 +1944,7 @@ int
findzone(const char *dname, int class, int depth, int *zonelist, int maxzones){
char *tmpdname;
char tmpdnamebuf[MAXDNAME];
- char *zonename, *cp;
+ char *zonename;
int tmpdnamelen, zonenamelen, zonenum, i, j, c;
int matches = 0;
int escaped, found, done;
@@ -2076,7 +2076,7 @@ zonelist=0x%x, maxzones=%d)",
int
merge_logs(struct zoneinfo *zp, char *logname) {
char origin[MAXDNAME], data[MAXDATA], dnbuf[MAXDNAME], sclass[3];
- char buf[BUFSIZ], buf2[100];
+ char buf[BUFSIZ];
FILE *fp;
u_int32_t serial, ttl, old_serial, new_serial;
char *dname, *cp, *cp1;
@@ -2091,10 +2091,10 @@ merge_logs(struct zoneinfo *zp, char *logname) {
struct in_addr ina;
int zonelist[MAXDNAME];
struct stat st;
- u_char *serialp;
struct sockaddr_in empty_from;
int datasize;
unsigned long l;
+ ns_updque curupd;
empty_from.sin_family = AF_INET;
empty_from.sin_addr.s_addr = htonl(INADDR_ANY);
@@ -2124,7 +2124,7 @@ merge_logs(struct zoneinfo *zp, char *logname) {
/*
* See if we really have a log file -- it might be a zone dump
- * that was in the process of being movefiled, or it might
+ * that was in the process of being isc_movefiled, or it might
* be garbage!
*/
@@ -2135,13 +2135,14 @@ merge_logs(struct zoneinfo *zp, char *logname) {
return (-1);
}
if (strcmp(buf, DumpSignature) == 0) {
- /* It's a dump; finish movefile that was interrupted. */
+ /* It's a dump; finish isc_movefile that was interrupted. */
ns_info(ns_log_update,
- "completing interrupted dump movefile for %s",
+ "completing interrupted dump isc_movefile for %s",
zp->z_source);
fclose(fp);
- if (movefile(logname, zp->z_source) < 0) {
- ns_error(ns_log_update, "movefile(%s,%s) failed: %s :1",
+ if (isc_movefile(logname, zp->z_source) < 0) {
+ ns_error(ns_log_update,
+ "isc_movefile(%s,%s) failed: %s :1",
logname, zp->z_source,
strerror(errno));
fclose(fp);
@@ -2281,7 +2282,7 @@ merge_logs(struct zoneinfo *zp, char *logname) {
cp = fgets(buf, sizeof buf, fp);
if (!cp)
*buf = '\0';
- n = sscanf(cp, "origin %s class %s serial %ul",
+ n = sscanf(cp, "origin %s class %s serial %lu",
origin, sclass, &serial);
if (n != 3 || ns_samename(origin, zp->z_origin) != 1)
err++;
@@ -2339,7 +2340,7 @@ merge_logs(struct zoneinfo *zp, char *logname) {
break;
}
/* Owner's domain name. */
- if (!getword((char *)dnbuf, sizeof dnbuf, fp, 0)) {
+ if (!getword((char *)dnbuf, sizeof dnbuf, fp, 1)) {
err++;
break;
}
@@ -2454,14 +2455,15 @@ merge_logs(struct zoneinfo *zp, char *logname) {
err++;
break;
}
- c = getnonblank(fp, logname);
+ c = getnonblank(fp, logname, 1);
if (c == '(') {
multiline = 1;
} else {
multiline = 0;
ungetc(c, fp);
}
- n = getnum(fp, logname, GETNUM_SERIAL);
+ n = getnum(fp, logname, GETNUM_SERIAL,
+ &multiline);
if (getnum_error) {
err++;
break;
@@ -2476,12 +2478,14 @@ merge_logs(struct zoneinfo *zp, char *logname) {
}
PUTLONG(n, cp);
}
- if (multiline &&
- (getnonblank(fp, logname)
- != ')')) {
+ if (multiline) {
+ c = getnonblank(fp, logname, 1);
+ if (c != ')') {
+ ungetc(c, fp);
err++;
break;
}
+ }
n = cp - data;
endline(fp);
break;
@@ -2710,13 +2714,14 @@ merge_logs(struct zoneinfo *zp, char *logname) {
dp->d_cred = DB_C_ZONE;
dp->d_clev = nlabels(zp->z_origin);
dp->d_secure = DB_S_INSECURE; /* should be UNCHECKED */
+ DRCNTINC(dp);
rrecp->r_dp = dp;
} else {
rrecp->r_zone = zonenum;
}
APPEND(curupd, rrecp, r_link);
} /* for (;;) */
-
+ INSIST(EMPTY(curupd));
fclose(fp);
return (0);
}
@@ -2826,9 +2831,11 @@ zonedump(struct zoneinfo *zp, int mode) {
}
if (mode == ISIXFR) {
- if (movefile(tmp_name, zp->z_ixfr_tmp) < 0) {
- ns_error(ns_log_update, "movefile(%s,%s) failed: %s :2",
- tmp_name, zp->z_ixfr_tmp, strerror(errno));
+ if (isc_movefile(tmp_name, zp->z_ixfr_tmp) < 0) {
+ ns_error(ns_log_update,
+ "isc_movefile(%s,%s) failed: %s :2",
+ tmp_name, zp->z_ixfr_tmp,
+ strerror(errno));
return (-1);
}
if (chmod(zp->z_source, 0644) < 0)
@@ -2836,8 +2843,9 @@ zonedump(struct zoneinfo *zp, int mode) {
"chmod(%s,%o) failed, pressing on: %s",
zp->z_source, st.st_mode,
strerror(errno));
- if (movefile(zp->z_ixfr_tmp, zp->z_source) < 0) {
- ns_error(ns_log_update, "movefile(%s,%s) failed: %s :3",
+ if (isc_movefile(zp->z_ixfr_tmp, zp->z_source) < 0) {
+ ns_error(ns_log_update,
+ "isc_movefile(%s,%s) failed: %s :3",
zp->z_ixfr_tmp, zp->z_source,
strerror(errno));
return (-1);
@@ -2849,20 +2857,26 @@ zonedump(struct zoneinfo *zp, int mode) {
zp->z_source, st.st_mode,
strerror(errno));
} else if (mode == ISNOTIXFR) {
- if (movefile(tmp_name, zp->z_updatelog) < 0) {
- ns_error(ns_log_update, "movefile(%s,%s) failed: %s :4",
- tmp_name, zp->z_updatelog, strerror(errno));
+ if (isc_movefile(tmp_name, zp->z_updatelog) < 0) {
+ ns_error(ns_log_update,
+ "isc_movefile(%s,%s) failed: %s :4",
+ tmp_name, zp->z_updatelog,
+ strerror(errno));
return (-1);
}
- if (movefile(zp->z_updatelog, zp->z_source) < 0) {
- ns_error(ns_log_update, "movefile(%s,%s) failed: %s:5",
- zp->z_updatelog, zp->z_source,
- strerror(errno));
+ if (isc_movefile(zp->z_updatelog, zp->z_source) < 0) {
+ ns_error(ns_log_update,
+ "isc_movefile(%s,%s) failed: %s :5",
+ zp->z_updatelog, zp->z_source,
+ strerror(errno));
return (-1);
}
} else {
- if (movefile(tmp_name, zp->z_source) < 0) {
- ns_error(ns_log_update, "movefile(%s,%s) failed: % s :6", tmp_name, zp->z_source, strerror(errno));
+ if (isc_movefile(tmp_name, zp->z_source) < 0) {
+ ns_error(ns_log_update,
+ "isc_movefile(%s,%s) failed: %s :6",
+ tmp_name, zp->z_source,
+ strerror(errno));
return (-1);
}
}
diff --git a/contrib/bind/bin/named/ns_xfr.c b/contrib/bind/bin/named/ns_xfr.c
index f5cbdfa..5c05fe0 100644
--- a/contrib/bind/bin/named/ns_xfr.c
+++ b/contrib/bind/bin/named/ns_xfr.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ns_xfr.c,v 8.62 2000/04/24 05:20:51 vixie Exp $";
+static const char rcsid[] = "$Id: ns_xfr.c,v 8.63 2000/12/23 08:14:43 vixie Exp $";
#endif /* not lint */
/*
@@ -188,7 +188,7 @@ ns_xfr(struct qstream *qsp, struct namebuf *znp,
if (type == ns_t_ixfr) {
changes = ixfr_get_change_list(&zones[zone], serial_ixfr,
zones[zone].z_serial);
- ixfr_log_maint(&zones[zone], 1);
+ ixfr_log_maint(&zones[zone]);
if (changes != NULL) {
qsp->xfr.serial = serial_ixfr;
qsp->xfr.top.ixfr = changes;
@@ -314,7 +314,7 @@ sx_flush(struct qstream *qsp) {
#ifdef DEBUG
if (debug >= 10)
res_pquery(&res, qsp->xfr.msg, qsp->xfr.cp - qsp->xfr.msg,
- log_get_stream(packet_channel));
+ log_get_stream(packet_channel));
#endif
if (qsp->xfr.tsig_state != NULL && qsp->xfr.tsig_skip == 0) {
int msglen = qsp->xfr.cp - qsp->xfr.msg;
diff --git a/contrib/bind/bin/ndc/Makefile b/contrib/bind/bin/ndc/Makefile
index 332e3d6..2e31b0c 100644
--- a/contrib/bind/bin/ndc/Makefile
+++ b/contrib/bind/bin/ndc/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 1.16 2000/07/11 06:41:34 vixie Exp $
+# $Id: Makefile,v 1.17 2000/12/23 08:02:54 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/ndc/ndc.c b/contrib/bind/bin/ndc/ndc.c
index 7235586..bc3e2dc 100644
--- a/contrib/bind/bin/ndc/ndc.c
+++ b/contrib/bind/bin/ndc/ndc.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ndc.c,v 1.14 2000/02/04 08:28:32 vixie Exp $";
+static const char rcsid[] = "$Id: ndc.c,v 1.16 2000/12/23 08:14:45 vixie Exp $";
#endif /* not lint */
/*
@@ -31,6 +31,7 @@ static const char rcsid[] = "$Id: ndc.c,v 1.14 2000/02/04 08:28:32 vixie Exp $";
#include <arpa/nameser.h>
#include <arpa/inet.h>
+#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
@@ -296,8 +297,20 @@ builtincmd(void) {
static void
builtinhelp(void) {
- printf(helpfmt, "start", "start the server");
- printf(helpfmt, "restart", "stop server if any, start a new one");
+ const char *fmt;
+
+ switch (mode) {
+ case e_channel:
+ fmt = "(builtin) %s - %s\n";
+ break;
+ case e_signals:
+ fmt = helpfmt;
+ break;
+ default:
+ abort();
+ }
+ printf(fmt, "start", "start the server");
+ printf(fmt, "restart", "stop server if any, start a new one");
}
static void
@@ -371,8 +384,10 @@ command_channel(void) {
int helping = (strcasecmp(cmd, "help") == 0);
int save_quiet = quiet;
- if (helping)
+ if (helping) {
quiet = 0;
+ builtinhelp();
+ }
channel_loop(cmd, !quiet, NULL, NULL);
quiet = save_quiet;
}
@@ -496,7 +511,6 @@ static void
command_signals(void) {
struct cmdsig *cmdsig;
pid_t pid;
- int sig;
if (strcasecmp(cmd, "help") == 0) {
printf(helpfmt, "help", "this output");
diff --git a/contrib/bind/bin/nslookup/Makefile b/contrib/bind/bin/nslookup/Makefile
index 332b973..5c564f4 100644
--- a/contrib/bind/bin/nslookup/Makefile
+++ b/contrib/bind/bin/nslookup/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.25 2000/07/11 06:41:35 vixie Exp $
+# $Id: Makefile,v 8.26 2000/12/23 08:02:55 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/nslookup/list.c b/contrib/bind/bin/nslookup/list.c
index db46d7f..863d433 100644
--- a/contrib/bind/bin/nslookup/list.c
+++ b/contrib/bind/bin/nslookup/list.c
@@ -53,7 +53,7 @@
#ifndef lint
static const char sccsid[] = "@(#)list.c 5.23 (Berkeley) 3/21/91";
-static const char rcsid[] = "$Id: list.c,v 8.23 2000/03/30 23:25:34 vixie Exp $";
+static const char rcsid[] = "$Id: list.c,v 8.25 2000/12/23 08:14:46 vixie Exp $";
#endif /* not lint */
/*
@@ -72,6 +72,8 @@ static const char rcsid[] = "$Id: list.c,v 8.23 2000/03/30 23:25:34 vixie Exp $"
#include <sys/param.h>
#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/uio.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
@@ -258,7 +260,7 @@ ListSubr(int qtype, char *domain, char *cmd) {
querybuf buf;
struct sockaddr_in sin;
HEADER *headerPtr;
- int msglen, amtToRead, numRead, n, count, soacnt;
+ int msglen, amtToRead, numRead, soacnt;
u_int len;
int numAnswers = 0;
int numRecords = 0;
@@ -266,6 +268,7 @@ ListSubr(int qtype, char *domain, char *cmd) {
char soaname[2][NAME_LEN], file[PATH_MAX];
enum { NO_ERRORS, ERR_READING_LEN, ERR_READING_MSG, ERR_PRINTING }
error = NO_ERRORS;
+ struct iovec iov[2];
/*
* Create a query packet for the requested domain name.
@@ -321,8 +324,11 @@ ListSubr(int qtype, char *domain, char *cmd) {
* Send length & message for zone transfer
*/
ns_put16(msglen, tmp);
- if (write(sockFD, (char *)tmp, INT16SZ) != INT16SZ ||
- write(sockFD, (char *)buf.qb2, msglen) != msglen) {
+ iov[0].iov_base = (char *)tmp;
+ iov[0].iov_len = INT16SZ;
+ iov[1].iov_base = (char *)buf.qb2;
+ iov[1].iov_len = msglen;
+ if (writev(sockFD, iov, 2) != INT16SZ + msglen) {
perror("ls: write");
(void) close(sockFD);
sockFD = -1;
@@ -518,6 +524,7 @@ ListSubr(int qtype, char *domain, char *cmd) {
*******************************************************************************
*/
+int
Finger(string, putToFile)
char *string;
int putToFile;
@@ -641,8 +648,7 @@ Finger(string, putToFile)
}
void
-ListHost_close()
-{
+ListHost_close(void) {
if (sockFD != -1) {
(void) close(sockFD);
sockFD = -1;
diff --git a/contrib/bind/bin/nslookup/pathnames.h b/contrib/bind/bin/nslookup/pathnames.h
index bfeae4f..71f56cc 100644
--- a/contrib/bind/bin/nslookup/pathnames.h
+++ b/contrib/bind/bin/nslookup/pathnames.h
@@ -55,11 +55,13 @@
/*
* @(#)pathnames.h 5.1 (Berkeley) 5/28/90
- * $Id: pathnames.h,v 8.1 1994/12/15 06:24:31 vixie Exp $
+ * $Id: pathnames.h,v 8.2 2000/11/08 06:47:32 marka Exp $
*/
#define _PATH_NSLOOKUPRC "/.nslookuprc"
+#ifndef _PATH_PAGERCMD
#define _PATH_PAGERCMD "more"
+#endif
#ifndef _PATH_HELPFILE
#if defined(BSD) && BSD >= 198810
diff --git a/contrib/bind/bin/nslookup/res.h b/contrib/bind/bin/nslookup/res.h
index 5ffd6ce..2a07b17 100644
--- a/contrib/bind/bin/nslookup/res.h
+++ b/contrib/bind/bin/nslookup/res.h
@@ -55,7 +55,7 @@
/*
* @(#)res.h 5.10 (Berkeley) 6/1/90
- * $Id: res.h,v 8.5 1998/09/16 17:03:17 vixie Exp $
+ * $Id: res.h,v 8.7 2000/12/23 08:14:47 vixie Exp $
*/
/*
@@ -97,6 +97,10 @@ typedef int Boolean;
*
*/
+#ifdef ERROR
+#undef ERROR
+#endif
+
#define SUCCESS 0
#define TIME_OUT -1
#define NO_INFO -2
@@ -186,3 +190,21 @@ extern void ShowOptions();
extern void FreeHostInfoPtr();
extern FILE *OpenFile();
extern char *res_skip();
+extern int pickString(const char *, char *, size_t);
+extern int GetHostInfoByName();
+extern int GetHostInfoByAddr();
+extern int GetHostDomain();
+extern int matchString(const char *, const char *);
+extern int StringToType(char *, int, FILE *);
+extern int StringToClass(char *, int, FILE *);
+extern int SendRequest(struct in_addr *, const u_char *, int,
+ u_char *, u_int, int *);
+extern void SendRequest_close(void);
+extern int SetDefaultServer(char *, Boolean);
+extern int Finger(char *, int);
+void ListHostsByType(char *, int);
+void ListHosts(char *, int);
+void ListHost_close(void);
+int SetOption(char *);
+int LookupHost(char *, Boolean);
+int LookupHostWithServer(char *, Boolean);
diff --git a/contrib/bind/bin/nslookup/send.c b/contrib/bind/bin/nslookup/send.c
index 61a8751..6af8873 100644
--- a/contrib/bind/bin/nslookup/send.c
+++ b/contrib/bind/bin/nslookup/send.c
@@ -53,7 +53,7 @@
#ifndef lint
static const char sccsid[] = "@(#)send.c 5.18 (Berkeley) 3/2/91";
-static const char rcsid[] = "$Id: send.c,v 8.9 1999/10/13 16:39:19 vixie Exp $";
+static const char rcsid[] = "$Id: send.c,v 8.10 2000/12/23 08:14:47 vixie Exp $";
#endif /* not lint */
/*
@@ -87,6 +87,7 @@ static const char rcsid[] = "$Id: send.c,v 8.9 1999/10/13 16:39:19 vixie Exp $";
#include <errno.h>
#include <resolv.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include "port_after.h"
@@ -393,8 +394,8 @@ SendRequest(struct in_addr *nsAddrPtr, const u_char *buf, int buflen,
*
* Called from the interrupt handler.
*/
-void SendRequest_close()
-{
+void
+SendRequest_close(void) {
if (s != -1) {
(void) close(s);
s = -1;
diff --git a/contrib/bind/bin/nslookup/subr.c b/contrib/bind/bin/nslookup/subr.c
index a3b9f96..44708b3 100644
--- a/contrib/bind/bin/nslookup/subr.c
+++ b/contrib/bind/bin/nslookup/subr.c
@@ -53,7 +53,7 @@
#ifndef lint
static const char sccsid[] = "@(#)subr.c 5.24 (Berkeley) 3/2/91";
-static const char rcsid[] = "$Id: subr.c,v 8.13 1999/10/13 16:39:20 vixie Exp $";
+static const char rcsid[] = "$Id: subr.c,v 8.14 2000/12/23 08:14:48 vixie Exp $";
#endif /* not lint */
/*
@@ -82,6 +82,7 @@ static const char rcsid[] = "$Id: subr.c,v 8.13 1999/10/13 16:39:20 vixie Exp $"
#include <arpa/nameser.h>
#include <arpa/inet.h>
+#include <ctype.h>
#include <netdb.h>
#include <setjmp.h>
#include <signal.h>
diff --git a/contrib/bind/bin/nsupdate/Makefile b/contrib/bind/bin/nsupdate/Makefile
index d8bd2b1..16fcc04 100644
--- a/contrib/bind/bin/nsupdate/Makefile
+++ b/contrib/bind/bin/nsupdate/Makefile
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
-# $Id: Makefile,v 8.25 2000/07/11 06:41:35 vixie Exp $
+# $Id: Makefile,v 8.26 2000/12/23 08:02:55 vixie Exp $
DESTDIR=
CC= cc
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
#(net2 and its descendents)
-SYSTYPE = bsdos
+SYSTYPE = freebsd
TOP = ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/bin/nsupdate/nsupdate.c b/contrib/bind/bin/nsupdate/nsupdate.c
index d164bb1..3363654 100644
--- a/contrib/bind/bin/nsupdate/nsupdate.c
+++ b/contrib/bind/bin/nsupdate/nsupdate.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: nsupdate.c,v 8.24 2000/07/11 06:32:01 vixie Exp $";
+static const char rcsid[] = "$Id: nsupdate.c,v 8.26 2000/12/23 08:14:48 vixie Exp $";
#endif /* not lint */
/*
@@ -141,15 +141,10 @@ int dns_findprimary (res_state, char *, struct ns_tsig_key *, char *,
* zone to which a resource record belongs
*/
int
-main(argc, argv)
- int argc;
- char **argv;
-{
+main(int argc, char **argv) {
FILE *fp = NULL;
- char buf[BUFSIZ], buf2[BUFSIZ], hostbuf[100], filebuf[100];
+ char buf[BUFSIZ], buf2[BUFSIZ];
char dnbuf[MAXDNAME], data[MAXDATA];
- u_char packet[PACKETSZ], answer[PACKETSZ];
- char *host = hostbuf, *batchfile = filebuf;
char *r_dname, *cp, *startp, *endp, *svstartp;
char section[15], opcode[10];
int i, c, n, n1, inside, lineno = 0, vc = 0,
@@ -160,13 +155,11 @@ main(argc, argv)
struct map *mp;
ns_updrec *rrecp;
ns_updque listuprec;
- struct in_addr hostaddr;
extern int getopt();
extern char *optarg;
extern int optind, opterr, optopt;
ns_tsig_key key;
- char *keyfile=NULL, *keyname=NULL, *p, *pp;
- int file_major, file_minor, alg;
+ char *keyfile=NULL, *keyname=NULL;
progname = argv[0];
@@ -429,8 +422,8 @@ main(argc, argv)
switch (r_section) {
case S_PREREQ:
if (r_ttl) {
- fprintf(stderr, "nonzero ttl in prereq section: %ul\n",
- r_ttl);
+ fprintf(stderr, "nonzero ttl in prereq section: %lu\n",
+ (u_long)r_ttl);
r_ttl = 0;
}
switch (r_opcode) {
diff --git a/contrib/bind/include/Makefile b/contrib/bind/include/Makefile
index 168c0d2..6a61833 100644
--- a/contrib/bind/include/Makefile
+++ b/contrib/bind/include/Makefile
@@ -26,7 +26,7 @@ MARGS= DESTDIR="${DESTDIR}" DESTINC="${DESTINC}" INSTALL="${INSTALL}" \
all depend clean distclean install::
@for x in ${SUBDIRS}; do \
- (cd $$x; pwd; ${MAKE} ${MARGS} $@); \
+ (cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \
done
distclean:: clean
@@ -48,7 +48,7 @@ links:: FRC
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
$(MAKE) $(MARGS) links; \
- ); \
+ ) || exit 1; \
done
FRC:
diff --git a/contrib/bind/include/arpa/nameser.h b/contrib/bind/include/arpa/nameser.h
index 3de42fd..3129a10 100644
--- a/contrib/bind/include/arpa/nameser.h
+++ b/contrib/bind/include/arpa/nameser.h
@@ -49,7 +49,7 @@
*/
/*
- * $Id: nameser.h,v 8.37 2000/03/30 21:16:49 vixie Exp $
+ * $Id: nameser.h,v 8.41 2000/12/23 08:14:50 vixie Exp $
*/
#ifndef _ARPA_NAMESER_H_
@@ -127,10 +127,7 @@ struct _ns_flagdata { int mask, shift; };
extern struct _ns_flagdata _ns_flagdata[];
/* Accessor macros - this is part of the public interface. */
-#define ns_msg_getflag(handle, flag) ( \
- ((handle)._flags & _ns_flagdata[flag].mask) \
- >> _ns_flagdata[flag].shift \
- )
+
#define ns_msg_id(handle) ((handle)._id + 0)
#define ns_msg_base(handle) ((handle)._msg + 0)
#define ns_msg_end(handle) ((handle)._eom + 0)
@@ -295,6 +292,7 @@ typedef enum __ns_type {
ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
ns_t_sink = 40, /* Kitchen sink (experimentatl) */
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
+ ns_t_tkey = 249, /* Transaction key */
ns_t_tsig = 250, /* Transaction signature. */
ns_t_ixfr = 251, /* Incremental zone transfer. */
ns_t_axfr = 252, /* Transfer zone of authority. */
@@ -469,6 +467,7 @@ typedef enum __ns_cert_types {
/*
* ANSI C identifier hiding for bind's lib/nameser.
*/
+#define ns_msg_getflag __ns_msg_getflag
#define ns_get16 __ns_get16
#define ns_get32 __ns_get32
#define ns_put16 __ns_put16
@@ -503,6 +502,7 @@ typedef enum __ns_cert_types {
#define ns_samename __ns_samename
__BEGIN_DECLS
+int ns_msg_getflag __P((ns_msg, int));
u_int ns_get16 __P((const u_char *));
u_long ns_get32 __P((const u_char *));
void ns_put16 __P((u_int, u_char *));
diff --git a/contrib/bind/include/irs.h b/contrib/bind/include/irs.h
index 17d3f20..2cb3a1b 100644
--- a/contrib/bind/include/irs.h
+++ b/contrib/bind/include/irs.h
@@ -16,7 +16,7 @@
*/
/*
- * $Id: irs.h,v 8.4 1999/01/18 07:46:46 vixie Exp $
+ * $Id: irs.h,v 8.5 2000/12/23 08:14:49 vixie Exp $
*/
#ifndef _IRS_H_INCLUDED
@@ -207,6 +207,8 @@ extern struct irs_acc * irs_dns_acc __P((const char *options));
extern struct irs_acc * irs_nis_acc __P((const char *options));
extern struct irs_acc * irs_irp_acc __P((const char *options));
+extern void irs_destroy(void);
+
/*
* These forward declarations are for the semi-private functions in
* the get*.c files. Each of these funcs implements the real get*
diff --git a/contrib/bind/include/isc/list.h b/contrib/bind/include/isc/list.h
index febfbf8..21dd565 100644
--- a/contrib/bind/include/isc/list.h
+++ b/contrib/bind/include/isc/list.h
@@ -17,6 +17,7 @@
#ifndef LIST_H
#define LIST_H 1
+#include <isc/assertions.h>
#define LIST(type) struct { type *head, *tail; }
#define INIT_LIST(list) \
@@ -28,7 +29,7 @@
(elt)->link.prev = (void *)(-1); \
(elt)->link.next = (void *)(-1); \
} while (0)
-#define LINKED(elt, link) ((elt)->link.prev != (void *)(-1))
+#define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1))
#define HEAD(list) ((list).head)
#define TAIL(list) ((list).tail)
@@ -36,6 +37,7 @@
#define PREPEND(list, elt, link) \
do { \
+ INSIST(!LINKED(elt, link));\
if ((list).head != NULL) \
(list).head->link.prev = (elt); \
else \
@@ -47,6 +49,7 @@
#define APPEND(list, elt, link) \
do { \
+ INSIST(!LINKED(elt, link));\
if ((list).tail != NULL) \
(list).tail->link.next = (elt); \
else \
@@ -58,6 +61,7 @@
#define UNLINK(list, elt, link) \
do { \
+ INSIST(LINKED(elt, link));\
if ((elt)->link.next != NULL) \
(elt)->link.next->link.prev = (elt)->link.prev; \
else \
@@ -74,6 +78,7 @@
#define INSERT_BEFORE(list, before, elt, link) \
do { \
+ INSIST(!LINKED(elt, link));\
if ((before)->link.prev == NULL) \
PREPEND(list, elt, link); \
else { \
@@ -86,6 +91,7 @@
#define INSERT_AFTER(list, after, elt, link) \
do { \
+ INSIST(!LINKED(elt, link));\
if ((after)->link.next == NULL) \
APPEND(list, elt, link); \
else { \
diff --git a/contrib/bind/include/isc/misc.h b/contrib/bind/include/isc/misc.h
index d13e1d3..3a94d3f 100644
--- a/contrib/bind/include/isc/misc.h
+++ b/contrib/bind/include/isc/misc.h
@@ -16,14 +16,16 @@
*/
/*
- * $Id: misc.h,v 8.2 1999/01/08 19:23:10 vixie Exp $
+ * $Id: misc.h,v 8.4 2000/12/23 08:14:52 vixie Exp $
*/
#ifndef _ISC_MISC_H
#define _ISC_MISC_H
#define bitncmp __bitncmp
+/*#define isc_movefile __isc_movefile */
extern int bitncmp(const void *l, const void *r, int n);
+extern int isc_movefile(const char *, const char *);
#endif /*_ISC_MISC_H*/
diff --git a/contrib/bind/include/resolv.h b/contrib/bind/include/resolv.h
index 414fe08..600e98b 100644
--- a/contrib/bind/include/resolv.h
+++ b/contrib/bind/include/resolv.h
@@ -50,7 +50,7 @@
/*
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
- * $Id: resolv.h,v 8.31 2000/03/30 20:16:50 vixie Exp $
+ * $Id: resolv.h,v 8.32 2000/12/23 08:14:49 vixie Exp $
*/
#ifndef _RESOLV_H_
@@ -328,7 +328,7 @@ extern const struct res_sym __p_rcode_syms[];
#define res_nclose __res_nclose
#define res_ninit __res_ninit
#define res_nmkquery __res_nmkquery
-#define res_npquery __res_npquery
+#define res_pquery __res_pquery
#define res_nquery __res_nquery
#define res_nquerydomain __res_nquerydomain
#define res_nsearch __res_nsearch
@@ -383,7 +383,7 @@ int res_ninit __P((res_state));
int res_nisourserver __P((const res_state,
const struct sockaddr_in *));
void fp_resstat __P((const res_state, FILE *));
-void res_npquery __P((const res_state, const u_char *, int, FILE *));
+void res_pquery __P((const res_state, const u_char *, int, FILE *));
const char * res_hostalias __P((const res_state, const char *,
char *, size_t));
int res_nquery __P((res_state,
diff --git a/contrib/bind/lib/Makefile b/contrib/bind/lib/Makefile
index d06e543..1de1d01 100644
--- a/contrib/bind/lib/Makefile
+++ b/contrib/bind/lib/Makefile
@@ -13,14 +13,14 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 8.23 2000/07/11 06:41:36 vixie Exp $
+# $Id: Makefile,v 8.25 2000/12/23 08:02:56 vixie Exp $
SUBDIRS = resolv irs isc bsd inet nameser dst cylink dnssafe
-# these are only appropriate for BSD 4.4 or derivatives, and are used in
+# these are only appropriate for FreeBSD or similar, and are used in
# development. normal builds will be done in the top level directory and
# this Makefile will be invoked with a lot of overrides for the following:
-SYSTYPE= bsdos
+SYSTYPE= freebsd
SHELL= /bin/sh
O=o
A=a
@@ -62,7 +62,7 @@ LIBRTS = ${TOP}/lib/libbindr.ts
all depend clean install distclean::
@for x in ${SUBDIRS}; do \
- (cd $$x; pwd; ${MAKE} ${MARGS} $@); \
+ (cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \
done
all:: ${LIBTS} ${LIBRTS}
@@ -103,7 +103,7 @@ links:: FRC
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
${MAKE} ${MARGS} links; \
- ); \
+ ) || exit 1; \
done
FRC:
diff --git a/contrib/bind/lib/dst/Makefile b/contrib/bind/lib/dst/Makefile
index ffd9b17..a5518bd 100644
--- a/contrib/bind/lib/dst/Makefile
+++ b/contrib/bind/lib/dst/Makefile
@@ -13,12 +13,12 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 1.17 2000/07/11 06:41:39 vixie Exp $
+# $Id: Makefile,v 1.18 2000/12/23 08:02:58 vixie Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
# this Makefile will be invoked with a lot of overrides for the following:
-SYSTYPE= bsdos
+SYSTYPE= freebsd
DESTDIR =
DESTLIB = /usr/local/lib
O=o
@@ -26,7 +26,7 @@ A=a
CC= cc
LD= ld
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
TOP= ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/lib/dst/bsafe_link.c b/contrib/bind/lib/dst/bsafe_link.c
index 8b24d99..7d9345e 100644
--- a/contrib/bind/lib/dst/bsafe_link.c
+++ b/contrib/bind/lib/dst/bsafe_link.c
@@ -1,5 +1,5 @@
#if defined(BSAFE) || defined(DNSSAFE)
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/bsafe_link.c,v 1.11 1999/10/13 16:39:22 vixie Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/bsafe_link.c,v 1.11 1999/10/13 16:39:22 vixie Exp $";
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
diff --git a/contrib/bind/lib/dst/cylink_link.c b/contrib/bind/lib/dst/cylink_link.c
index c7cb276..0638ef1 100644
--- a/contrib/bind/lib/dst/cylink_link.c
+++ b/contrib/bind/lib/dst/cylink_link.c
@@ -1,5 +1,5 @@
#ifdef CYLINK_DSS
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/cylink_link.c,v 1.7 1999/10/13 16:39:22 vixie Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/cylink_link.c,v 1.7 1999/10/13 16:39:22 vixie Exp $";
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
diff --git a/contrib/bind/lib/dst/dst_api.c b/contrib/bind/lib/dst/dst_api.c
index f25438e..e32d075 100644
--- a/contrib/bind/lib/dst/dst_api.c
+++ b/contrib/bind/lib/dst/dst_api.c
@@ -1,5 +1,5 @@
#ifndef LINT
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/dst_api.c,v 1.14 2000/02/28 07:51:50 vixie Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/dst_api.c,v 1.16 2000/11/13 04:09:23 vixie Exp $";
#endif
/*
@@ -771,8 +771,7 @@ dst_buffer_to_key(const char *key_name, /* name of the key */
if (dkey == NULL)
return (NULL);
- if (dkey->dk_func != NULL &&
- dkey->dk_func->from_dns_key != NULL) {
+ if (dkey->dk_func != NULL && dkey->dk_func->from_dns_key != NULL) {
if (dkey->dk_func->from_dns_key(dkey, key_buf, key_len) < 0) {
EREPORT(("dst_buffer_to_key(): dst_buffer_to_hmac failed\n"));
return (dst_free_key(dkey));
@@ -787,9 +786,9 @@ dst_key_to_buffer(DST_KEY *key, u_char *out_buff, int buf_len)
{
int len;
/* this function will extrac the secret of HMAC into a buffer */
- if(key == NULL)
+ if (key == NULL)
return (0);
- if(key->dk_func != NULL && key->dk_func != NULL) {
+ if (key->dk_func != NULL && key->dk_func->to_dns_key != NULL) {
len = key->dk_func->to_dns_key(key, out_buff, buf_len);
if (len < 0)
return (0);
diff --git a/contrib/bind/lib/dst/eay_dss_link.c b/contrib/bind/lib/dst/eay_dss_link.c
index b060bf0..8542149 100644
--- a/contrib/bind/lib/dst/eay_dss_link.c
+++ b/contrib/bind/lib/dst/eay_dss_link.c
@@ -1,5 +1,5 @@
#ifdef EAY_DSS
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/eay_dss_link.c,v 1.4 1999/10/13 16:39:23 vixie Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/eay_dss_link.c,v 1.4 1999/10/13 16:39:23 vixie Exp $";
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
diff --git a/contrib/bind/lib/dst/hmac_link.c b/contrib/bind/lib/dst/hmac_link.c
index 1f96bca..1b93088 100644
--- a/contrib/bind/lib/dst/hmac_link.c
+++ b/contrib/bind/lib/dst/hmac_link.c
@@ -1,6 +1,6 @@
#ifdef HMAC_MD5
#ifndef LINT
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/hmac_link.c,v 1.8 1999/10/15 21:30:07 vixie Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/hmac_link.c,v 1.8 1999/10/15 21:30:07 vixie Exp $";
#endif
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
diff --git a/contrib/bind/lib/dst/prandom.c b/contrib/bind/lib/dst/prandom.c
index dcd53435..a17e071 100644
--- a/contrib/bind/lib/dst/prandom.c
+++ b/contrib/bind/lib/dst/prandom.c
@@ -1,5 +1,5 @@
#ifndef LINT
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/prandom.c,v 1.9 2000/07/17 07:36:53 vixie Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/prandom.c,v 1.9 2000/07/17 07:36:53 vixie Exp $";
#endif
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
diff --git a/contrib/bind/lib/dst/rsaref_link.c b/contrib/bind/lib/dst/rsaref_link.c
index 2ccd96e..52a49b4 100644
--- a/contrib/bind/lib/dst/rsaref_link.c
+++ b/contrib/bind/lib/dst/rsaref_link.c
@@ -1,5 +1,5 @@
#ifdef RSAREF
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/rsaref_link.c,v 1.7 2000/07/17 07:36:53 vixie Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/rsaref_link.c,v 1.7 2000/07/17 07:36:53 vixie Exp $";
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
diff --git a/contrib/bind/lib/dst/support.c b/contrib/bind/lib/dst/support.c
index d50aa07..d07df5a 100644
--- a/contrib/bind/lib/dst/support.c
+++ b/contrib/bind/lib/dst/support.c
@@ -1,4 +1,4 @@
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/support.c,v 1.8 1999/10/13 16:39:24 vixie Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/support.c,v 1.8 1999/10/13 16:39:24 vixie Exp $";
/*
diff --git a/contrib/bind/lib/inet/Makefile b/contrib/bind/lib/inet/Makefile
index 2be32bd..1876bb6 100644
--- a/contrib/bind/lib/inet/Makefile
+++ b/contrib/bind/lib/inet/Makefile
@@ -13,12 +13,12 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 8.20 2000/07/11 06:41:40 vixie Exp $
+# $Id: Makefile,v 8.21 2000/12/23 08:02:59 vixie Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
# this Makefile will be invoked with a lot of overrides for the following:
-SYSTYPE= bsdos
+SYSTYPE= freebsd
DESTDIR =
DESTLIB = /usr/local/lib
O=o
@@ -26,7 +26,7 @@ A=a
CC= cc
LD= ld
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
TOP= ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/lib/inet/inet_cidr_pton.c b/contrib/bind/lib/inet/inet_cidr_pton.c
index 4fae2c6..9ead90b 100644
--- a/contrib/bind/lib/inet/inet_cidr_pton.c
+++ b/contrib/bind/lib/inet/inet_cidr_pton.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_cidr_pton.c,v 8.3 1999/01/08 19:23:41 vixie Exp $";
+static const char rcsid[] = "$Id: inet_cidr_pton.c,v 8.4 2000/12/23 08:14:53 vixie Exp $";
#endif
#include "port_before.h"
@@ -122,11 +122,12 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, int *pbits) {
goto enoent;
/* Prefix length can default to /32 only if all four octets spec'd. */
- if (bits == -1)
+ if (bits == -1) {
if (dst - odst == 4)
bits = 32;
else
goto enoent;
+ }
/* If nothing was written to the destination, we found no address. */
if (dst == odst)
diff --git a/contrib/bind/lib/inet/inet_net_ntop.c b/contrib/bind/lib/inet/inet_net_ntop.c
index 4e2f91f..d8b8377 100644
--- a/contrib/bind/lib/inet/inet_net_ntop.c
+++ b/contrib/bind/lib/inet/inet_net_ntop.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.6 1999/01/08 19:23:42 vixie Exp $";
+static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.7 2001/01/25 19:55:59 vixie Exp $";
#endif
#include "port_before.h"
@@ -108,7 +108,7 @@ inet_net_ntop_ipv4(src, bits, dst, size)
/* Format whole octets. */
for (b = bits / 8; b > 0; b--) {
- if (size < sizeof "255.")
+ if (size <= sizeof "255.")
goto emsgsize;
t = dst;
dst += SPRINTF((dst, "%u", *src++));
@@ -122,7 +122,7 @@ inet_net_ntop_ipv4(src, bits, dst, size)
/* Format partial octet. */
b = bits % 8;
if (b > 0) {
- if (size < sizeof ".255")
+ if (size <= sizeof ".255")
goto emsgsize;
t = dst;
if (dst != odst)
@@ -133,7 +133,7 @@ inet_net_ntop_ipv4(src, bits, dst, size)
}
/* Format CIDR /width. */
- if (size < sizeof "/32")
+ if (size <= sizeof "/32")
goto emsgsize;
dst += SPRINTF((dst, "/%u", bits));
return (odst);
diff --git a/contrib/bind/lib/inet/inet_ntop.c b/contrib/bind/lib/inet/inet_ntop.c
index 0b85e70..d588e9f 100644
--- a/contrib/bind/lib/inet/inet_ntop.c
+++ b/contrib/bind/lib/inet/inet_ntop.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_ntop.c,v 1.8 1999/10/13 16:39:28 vixie Exp $";
+static const char rcsid[] = "$Id: inet_ntop.c,v 1.10 2001/01/25 20:21:10 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -96,7 +96,7 @@ inet_ntop4(src, dst, size)
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
- if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
+ if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) >= size) {
errno = ENOSPC;
return (NULL);
}
diff --git a/contrib/bind/lib/irs/Makefile b/contrib/bind/lib/irs/Makefile
index a17f252..4784ccf 100644
--- a/contrib/bind/lib/irs/Makefile
+++ b/contrib/bind/lib/irs/Makefile
@@ -13,12 +13,12 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 8.20 2000/07/11 06:41:40 vixie Exp $
+# $Id: Makefile,v 8.21 2000/12/23 08:02:59 vixie Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
# this Makefile will be invoked with a lot of overrides for the following:
-SYSTYPE= bsdos
+SYSTYPE= freebsd
DESTDIR =
DESTLIB = /usr/local/lib
O=o
@@ -26,7 +26,7 @@ A=a
CC= cc
LD= ld
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
TOP= ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/lib/irs/getnameinfo.c b/contrib/bind/lib/irs/getnameinfo.c
index 7bd30ae..9f186f3 100644
--- a/contrib/bind/lib/irs/getnameinfo.c
+++ b/contrib/bind/lib/irs/getnameinfo.c
@@ -165,14 +165,14 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
if (serv == NULL || servlen == 0) {
/* what we should do? */
} else if (flags & NI_NUMERICSERV) {
- snprintf(numserv, strlen(numserv), "%d", ntohs(port));
+ snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
if (strlen(numserv) > servlen)
return ENI_MEMORY;
strcpy(serv, numserv);
} else {
sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp");
if (sp) {
- if (strlen(sp->s_name) > servlen)
+ if (strlen(sp->s_name) + 1 > servlen)
return ENI_MEMORY;
strcpy(serv, sp->s_name);
} else
@@ -196,7 +196,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
== NULL)
return ENI_SYSTEM;
- if (strlen(numaddr) > hostlen)
+ if (strlen(numaddr) + 1 > hostlen)
return ENI_MEMORY;
strcpy(host, numaddr);
} else {
@@ -207,7 +207,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
p = strchr(hp->h_name, '.');
if (p) *p = '\0';
}
- if (strlen(hp->h_name) > hostlen)
+ if (strlen(hp->h_name) + 1 > hostlen)
return ENI_MEMORY;
strcpy(host, hp->h_name);
} else {
@@ -216,7 +216,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
== NULL)
return ENI_NOHOSTNAME;
- if (strlen(numaddr) > hostlen)
+ if (strlen(numaddr) + 1 > hostlen)
return ENI_MEMORY;
strcpy(host, numaddr);
}
diff --git a/contrib/bind/lib/irs/getnetent.c b/contrib/bind/lib/irs/getnetent.c
index b63ddaf..52aebe3 100644
--- a/contrib/bind/lib/irs/getnetent.c
+++ b/contrib/bind/lib/irs/getnetent.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: getnetent.c,v 1.17 1999/10/13 16:39:30 vixie Exp $";
+static const char rcsid[] = "$Id: getnetent.c,v 1.18 2000/12/23 08:14:53 vixie Exp $";
#endif
/* Imports */
@@ -175,14 +175,16 @@ getnetbyaddr_p(unsigned long net, int type, struct net_data *net_data) {
addr[3] = (0x000000FF & net);
/* reduce bits to as close to natural number as possible */
- if ((bits == 32) && (addr[0] < 224) && (addr[3] == 0))
- if ((addr[0] < 192) && (addr[2] == 0))
+ if ((bits == 32) && (addr[0] < 224) && (addr[3] == 0)) {
+ if ((addr[0] < 192) && (addr[2] == 0)) {
if ((addr[0] < 128) && (addr[1] == 0))
bits = 8;
else
bits = 16;
- else
+ } else {
bits = 24;
+ }
+ }
net_data->nww_last = (*nw->byaddr)(nw, addr, bits, AF_INET);
net_data->nw_last = nw_to_net(net_data->nww_last, net_data);
diff --git a/contrib/bind/lib/irs/irpmarshall.c b/contrib/bind/lib/irs/irpmarshall.c
index 8f7c330..240bb08 100644
--- a/contrib/bind/lib/irs/irpmarshall.c
+++ b/contrib/bind/lib/irs/irpmarshall.c
@@ -49,7 +49,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: irpmarshall.c,v 8.5 1999/10/13 17:11:19 vixie Exp $";
+static const char rcsid[] = "$Id: irpmarshall.c,v 8.6 2000/11/13 05:08:08 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#if 0
@@ -90,7 +90,10 @@ Double check memory allocations on unmarhsalling
#include "port_after.h"
+#ifndef HAVE_STRNDUP
static char *strndup(const char *str, size_t len);
+#endif
+
static char **splitarray(const char *buffer, const char *buffend, char delim);
static int joinarray(char * const * argv, char *buffer, char delim);
static char *getfield(char **res, size_t reslen, char **buffer, char delim);
@@ -1862,6 +1865,7 @@ getfield(char **res, size_t reslen, char **ptr, char delim) {
+#ifndef HAVE_STRNDUP
/*
* static char * strndup(const char *str, size_t len)
*
@@ -1886,6 +1890,7 @@ strndup(const char *str, size_t len) {
p[len] = 0x0;
return (p);
}
+#endif
#if WANT_MAIN
diff --git a/contrib/bind/lib/irs/irs_data.c b/contrib/bind/lib/irs/irs_data.c
index f31fe69..8446c6b 100644
--- a/contrib/bind/lib/irs/irs_data.c
+++ b/contrib/bind/lib/irs/irs_data.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: irs_data.c,v 1.14 1999/10/13 16:39:31 vixie Exp $";
+static const char rcsid[] = "$Id: irs_data.c,v 1.15 2000/12/23 08:14:54 vixie Exp $";
#endif
#include "port_before.h"
@@ -55,7 +55,7 @@ static struct net_data *net_data;
#endif
void
-irs_destroy() {
+irs_destroy(void) {
#ifndef DO_PTHREADS
if (net_data != NULL)
net_data_destroy(net_data);
@@ -67,7 +67,6 @@ void
net_data_destroy(void *p) {
struct net_data *net_data = p;
-
res_nclose(net_data->res);
if (net_data->gr != NULL) {
(*net_data->gr->close)(net_data->gr);
diff --git a/contrib/bind/lib/isc/Makefile b/contrib/bind/lib/isc/Makefile
index 5485ec7..7845365 100644
--- a/contrib/bind/lib/isc/Makefile
+++ b/contrib/bind/lib/isc/Makefile
@@ -13,12 +13,12 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 8.26 2000/07/11 06:41:41 vixie Exp $
+# $Id: Makefile,v 8.28 2000/12/23 08:03:00 vixie Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
# this Makefile will be invoked with a lot of overrides for the following:
-SYSTYPE= bsdos
+SYSTYPE= freebsd
DESTDIR =
DESTLIB = /usr/local/lib
O=o
@@ -26,7 +26,7 @@ A=a
CC= cc
LD= ld
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
TOP= ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
@@ -47,13 +47,15 @@ SRCS= tree.c base64.c bitncmp.c assertions.c \
memcluster.c logging.c heap.c \
ctl_p.c ctl_srvr.c ctl_clnt.c \
eventlib.c ev_connects.c ev_files.c \
- ev_timers.c ev_streams.c ev_waits.c
+ ev_timers.c ev_streams.c ev_waits.c \
+ movefile.c
OBJS= tree.${O} base64.${O} bitncmp.${O} assertions.${O} \
memcluster.${O} logging.${O} heap.${O} \
ctl_p.${O} ctl_srvr.${O} ctl_clnt.${O} \
eventlib.${O} ev_connects.${O} ev_files.${O} \
- ev_timers.${O} ev_streams.${O} ev_waits.${O}
+ ev_timers.${O} ev_streams.${O} ev_waits.${O} \
+ movefile.${O}
all: ${LIBBIND}
diff --git a/contrib/bind/lib/isc/ctl_clnt.c b/contrib/bind/lib/isc/ctl_clnt.c
index 66f32f8..4e19d2c 100644
--- a/contrib/bind/lib/isc/ctl_clnt.c
+++ b/contrib/bind/lib/isc/ctl_clnt.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ctl_clnt.c,v 8.14 1999/10/13 16:39:33 vixie Exp $";
+static const char rcsid[] = "$Id: ctl_clnt.c,v 8.15 2000/11/14 01:10:36 vixie Exp $";
#endif /* not lint */
/*
@@ -261,11 +261,11 @@ new_tran(struct ctl_cctx *ctx, ctl_clntdone donefunc, void *uap, int w) {
buffer_init(new->outbuf);
new->donefunc = donefunc;
new->uap = uap;
+ INIT_LINK(new, link);
+ INIT_LINK(new, wlink);
APPEND(ctx->tran, new, link);
if (w)
APPEND(ctx->wtran, new, wlink);
- else
- INIT_LINK(new, wlink);
return (new);
}
diff --git a/contrib/bind/lib/isc/ctl_srvr.c b/contrib/bind/lib/isc/ctl_srvr.c
index ff1fc82..9beea0d 100644
--- a/contrib/bind/lib/isc/ctl_srvr.c
+++ b/contrib/bind/lib/isc/ctl_srvr.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ctl_srvr.c,v 8.23 2000/02/04 08:28:33 vixie Exp $";
+static const char rcsid[] = "$Id: ctl_srvr.c,v 8.24 2000/11/14 01:10:37 vixie Exp $";
#endif /* not lint */
/*
@@ -422,6 +422,7 @@ ctl_accept(evContext lev, void *uap, int fd,
strerror(errno));
}
ctx->cur_sess++;
+ INIT_LINK(sess, link);
APPEND(ctx->sess, sess, link);
sess->ctx = ctx;
sess->sock = fd;
diff --git a/contrib/bind/lib/isc/ev_connects.c b/contrib/bind/lib/isc/ev_connects.c
index 1da5c10..5378665 100644
--- a/contrib/bind/lib/isc/ev_connects.c
+++ b/contrib/bind/lib/isc/ev_connects.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_connects.c,v 8.26 2000/02/04 08:28:34 vixie Exp $";
+static const char rcsid[] = "$Id: ev_connects.c,v 8.27 2000/11/14 01:10:37 vixie Exp $";
#endif
/* Import. */
@@ -256,6 +256,7 @@ evTryAccept(evContext opaqueCtx, evConnID id, int *sys_errno) {
return (-1);
}
}
+ INIT_LINK(new, link);
APPEND(ctx->accepts, new, link);
*sys_errno = new->ioErrno;
return (0);
diff --git a/contrib/bind/lib/isc/heap.mdoc b/contrib/bind/lib/isc/heap.mdoc
index 516490b..6e0384d 100644
--- a/contrib/bind/lib/isc/heap.mdoc
+++ b/contrib/bind/lib/isc/heap.mdoc
@@ -1,11 +1,11 @@
-.\" $Id: heap.mdoc,v 8.5 1999/01/08 19:25:38 vixie Exp $
+.\" $Id: heap.mdoc,v 8.6 2000/11/15 02:03:52 marka Exp $
.\"
.\"Copyright (c) 1997,1999 by Internet Software Consortium.
- *
+.\"
.\"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.
- *
+.\"
.\"THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
.\"ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
.\"OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
@@ -18,9 +18,8 @@
.Dd Jan 1, 1997
.\"Os OPERATING_SYSTEM [version/release]
.Os BSD 4
-.\" TODO--get correct section # below!!
.Dt HEAP @SYSCALL_EXT@
-.Sh DESCRIPTION
+.Sh NAME
.Nm heap_new ,
.Nm heap_free ,
.Nm heap_insert ,
diff --git a/contrib/bind/lib/isc/logging.c b/contrib/bind/lib/isc/logging.c
index 7d6964b..0d9037f 100644
--- a/contrib/bind/lib/isc/logging.c
+++ b/contrib/bind/lib/isc/logging.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: logging.c,v 8.26 2000/04/23 02:19:02 vixie Exp $";
+static const char rcsid[] = "$Id: logging.c,v 8.28 2000/12/23 08:14:54 vixie Exp $";
#endif /* not lint */
#include "port_before.h"
@@ -39,6 +39,7 @@ static const char rcsid[] = "$Id: logging.c,v 8.26 2000/04/23 02:19:02 vixie Exp
#include <isc/assertions.h>
#include <isc/logging.h>
#include <isc/memcluster.h>
+#include <isc/misc.h>
#include "port_after.h"
@@ -78,10 +79,10 @@ version_rename(log_channel chan) {
for (ver--; ver > 0; ver--) {
sprintf(old_name, "%s.%d", chan->out.file.name, ver-1);
sprintf(new_name, "%s.%d", chan->out.file.name, ver);
- (void)rename(old_name, new_name);
+ (void)isc_movefile(old_name, new_name);
}
sprintf(new_name, "%s.0", chan->out.file.name);
- (void)rename(chan->out.file.name, new_name);
+ (void)isc_movefile(chan->out.file.name, new_name);
}
FILE *
diff --git a/contrib/bind/lib/isc/movefile.c b/contrib/bind/lib/isc/movefile.c
new file mode 100644
index 0000000..1b64b6c
--- /dev/null
+++ b/contrib/bind/lib/isc/movefile.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2000 by Internet Software Consortium, Inc.
+ *
+ * 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM 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.
+ */
+
+
+#include <port_before.h>
+#include <stdio.h>
+#include <isc/misc.h>
+#include <port_after.h>
+#ifndef HAVE_MOVEFILE
+/*
+ * rename() is lame (can't overwrite an existing file) on some systems.
+ * use movefile() instead, and let lame OS ports do what they need to.
+ */
+
+int
+isc_movefile(const char *oldname, const char *newname) {
+ return (rename(oldname, newname));
+}
+#else
+ static int os_port_has_isc_movefile = 1;
+#endif
diff --git a/contrib/bind/lib/nameser/Makefile b/contrib/bind/lib/nameser/Makefile
index b221793..1ab67ef 100644
--- a/contrib/bind/lib/nameser/Makefile
+++ b/contrib/bind/lib/nameser/Makefile
@@ -15,12 +15,12 @@
# SOFTWARE.
#
-# $Id: Makefile,v 8.20 2000/07/11 06:41:42 vixie Exp $
+# $Id: Makefile,v 8.21 2000/12/23 08:03:02 vixie Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
# this Makefile will be invoked with a lot of overrides for the following:
-SYSTYPE= bsdos
+SYSTYPE= freebsd
DESTDIR =
DESTLIB = /usr/local/lib
O=o
@@ -28,7 +28,7 @@ A=a
CC= cc
LD= ld
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
TOP= ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/lib/nameser/ns_parse.c b/contrib/bind/lib/nameser/ns_parse.c
index 35f7f40..6858a91 100644
--- a/contrib/bind/lib/nameser/ns_parse.c
+++ b/contrib/bind/lib/nameser/ns_parse.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_parse.c,v 8.13 1999/10/13 16:39:35 vixie Exp $";
+static const char rcsid[] = "$Id: ns_parse.c,v 8.15 2000/12/23 08:14:55 vixie Exp $";
#endif
/* Import. */
@@ -64,6 +64,10 @@ struct _ns_flagdata _ns_flagdata[16] = {
{ 0x0000, 0 }, /* expansion (6/6). */
};
+int ns_msg_getflag(ns_msg handle, int flag) {
+ return(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
+}
+
int
ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
const u_char *optr = ptr;
diff --git a/contrib/bind/lib/nameser/ns_print.c b/contrib/bind/lib/nameser/ns_print.c
index 6c47882..41b4d65 100644
--- a/contrib/bind/lib/nameser/ns_print.c
+++ b/contrib/bind/lib/nameser/ns_print.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_print.c,v 8.18 2000/02/29 05:48:12 vixie Exp $";
+static const char rcsid[] = "$Id: ns_print.c,v 8.21 2000/12/09 00:15:38 marka Exp $";
#endif
/* Import. */
@@ -123,7 +123,9 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
T(addstr("\t\t\t", 3, &buf, &buflen));
} else {
len = prune_origin(name, origin);
- if (len == 0) {
+ if (*name == '\0') {
+ goto root;
+ } else if (len == 0) {
T(addstr("@\t\t\t", 4, &buf, &buflen));
} else {
T(addstr(name, len, &buf, &buflen));
@@ -131,6 +133,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
if (((origin == NULL || origin[0] == '\0') ||
(origin[0] != '.' && origin[1] != '\0' &&
name[len] == '\0')) && name[len - 1] != '.') {
+ root:
T(addstr(".", 1, &buf, &buflen));
len++;
}
@@ -145,6 +148,8 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
addlen(x, &buf, &buflen);
len = SPRINTF((tmp, " %s %s", p_class(class), p_type(type)));
T(addstr(tmp, len, &buf, &buflen));
+ if (rdlen == 0)
+ return (buf - obuf);
T(spaced = addtab(x + len, 16, spaced, &buf, &buflen));
/*
@@ -605,6 +610,36 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
break;
}
+ case ns_t_tkey: {
+ /* KJD - need to complete this */
+ u_long t;
+ int mode, err, keysize;
+
+ /* Algorithm name. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Inception. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s ", p_secstodate(t)));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Experation. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s ", p_secstodate(t)));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Mode , Error, Key Size. */
+ /* Priority, Weight, Port. */
+ mode = ns_get16(rdata); rdata += NS_INT16SZ;
+ err = ns_get16(rdata); rdata += NS_INT16SZ;
+ keysize = ns_get16(rdata); rdata += NS_INT16SZ;
+ len = SPRINTF((tmp, "%u %u %u ", mode, err, keysize));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* needs to dump key, print otherdata length & other data */
+ break;
+ }
case ns_t_tsig: {
/* BEW - need to complete this */
int n;
@@ -752,7 +787,9 @@ addname(const u_char *msg, size_t msglen,
if (n < 0)
goto enospc; /* Guess. */
newlen = prune_origin(*buf, origin);
- if (newlen == 0) {
+ if (**buf == '\0') {
+ goto root;
+ } else if (newlen == 0) {
/* Use "@" instead of name. */
if (newlen + 2 > *buflen)
goto enospc; /* No room for "@\0". */
@@ -763,6 +800,7 @@ addname(const u_char *msg, size_t msglen,
(origin[0] != '.' && origin[1] != '\0' &&
(*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') {
/* No trailing dot. */
+ root:
if (newlen + 2 > *buflen)
goto enospc; /* No room for ".\0". */
(*buf)[newlen++] = '.';
diff --git a/contrib/bind/lib/nameser/ns_sign.c b/contrib/bind/lib/nameser/ns_sign.c
index 75af894..05a038a 100644
--- a/contrib/bind/lib/nameser/ns_sign.c
+++ b/contrib/bind/lib/nameser/ns_sign.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_sign.c,v 8.8 1999/10/13 16:39:36 vixie Exp $";
+static const char rcsid[] = "$Id: ns_sign.c,v 8.9 2000/12/23 08:14:57 vixie Exp $";
#endif
/* Import. */
@@ -37,6 +37,7 @@ static const char rcsid[] = "$Id: ns_sign.c,v 8.8 1999/10/13 16:39:36 vixie Exp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <unistd.h>
#include <isc/dst.h>
diff --git a/contrib/bind/lib/resolv/Makefile b/contrib/bind/lib/resolv/Makefile
index c460b6e..bfb49ec 100644
--- a/contrib/bind/lib/resolv/Makefile
+++ b/contrib/bind/lib/resolv/Makefile
@@ -13,12 +13,12 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 8.34 2000/07/11 06:41:42 vixie Exp $
+# $Id: Makefile,v 8.35 2000/12/23 08:03:03 vixie Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
# this Makefile will be invoked with a lot of overrides for the following:
-SYSTYPE= bsdos
+SYSTYPE= freebsd
DESTDIR =
DESTLIB = /usr/local/lib
O=o
@@ -26,7 +26,7 @@ A=a
CC= cc
LD= ld
SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -g -Wall
TOP= ../..
INCL = ${TOP}/include
PORTINCL = ${TOP}/port/${SYSTYPE}/include
diff --git a/contrib/bind/lib/resolv/res_data.c b/contrib/bind/lib/resolv/res_data.c
index 7688637..559e860 100644
--- a/contrib/bind/lib/resolv/res_data.c
+++ b/contrib/bind/lib/resolv/res_data.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: res_data.c,v 8.17 1999/10/13 17:11:31 vixie Exp $";
+static const char rcsid[] = "$Id: res_data.c,v 8.18 2000/12/23 08:14:58 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -80,7 +80,6 @@ struct __res_state _res
/* Proto. */
int res_ourserver_p(const res_state, const struct sockaddr_in *);
-void res_pquery(const res_state, const u_char *, int, FILE *);
int
res_init(void) {
diff --git a/contrib/bind/lib/resolv/res_debug.c b/contrib/bind/lib/resolv/res_debug.c
index 180d67f..7f2453a 100644
--- a/contrib/bind/lib/resolv/res_debug.c
+++ b/contrib/bind/lib/resolv/res_debug.c
@@ -95,7 +95,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_debug.c,v 8.34 2000/02/29 05:30:55 vixie Exp $";
+static const char rcsid[] = "$Id: res_debug.c,v 8.37 2000/11/13 05:22:53 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -442,6 +442,7 @@ const struct res_sym __p_type_syms[] = {
{ns_t_nimloc, "NIMLOC", "NIMROD locator (unimplemented)"},
{ns_t_srv, "SRV", "server selection"},
{ns_t_atma, "ATMA", "ATM address (unimplemented)"},
+ {ns_t_tkey, "TKEY", "tkey"},
{ns_t_tsig, "TSIG", "transaction signature"},
{ns_t_ixfr, "IXFR", "incremental zone transfer"},
{ns_t_axfr, "AXFR", "zone transfer"},
@@ -629,7 +630,7 @@ precsize_ntoa(prec)
val = mantissa * poweroften[exponent];
- (void) sprintf(retbuf, "%ld.%.2ld", val/100, val%100);
+ (void) sprintf(retbuf, "%lu.%.2lu", val/100, val%100);
return (retbuf);
}
@@ -898,8 +899,8 @@ loc_ntoa(binary, ascii)
int latdeg, latmin, latsec, latsecfrac;
int longdeg, longmin, longsec, longsecfrac;
- char northsouth, eastwest;
- int altmeters, altfrac, altsign;
+ char northsouth, eastwest, *altsign;
+ int altmeters, altfrac;
const u_int32_t referencealt = 100000 * 100;
@@ -933,10 +934,10 @@ loc_ntoa(binary, ascii)
GETLONG(templ, cp);
if (templ < referencealt) { /* below WGS 84 spheroid */
altval = referencealt - templ;
- altsign = -1;
+ altsign = "-";
} else {
altval = templ - referencealt;
- altsign = 1;
+ altsign = "";
}
if (latval < 0) {
@@ -968,7 +969,7 @@ loc_ntoa(binary, ascii)
longdeg = longval;
altfrac = altval % 100;
- altmeters = (altval / 100) * altsign;
+ altmeters = (altval / 100);
if ((sizestr = strdup(precsize_ntoa(sizeval))) == NULL)
sizestr = error;
@@ -978,10 +979,10 @@ loc_ntoa(binary, ascii)
vpstr = error;
sprintf(ascii,
- "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm",
+ "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %s%d.%.2dm %sm %sm %sm",
latdeg, latmin, latsec, latsecfrac, northsouth,
longdeg, longmin, longsec, longsecfrac, eastwest,
- altmeters, altfrac, sizestr, hpstr, vpstr);
+ altsign, altmeters, altfrac, sizestr, hpstr, vpstr);
if (sizestr != error)
free(sizestr);
diff --git a/contrib/bind/lib/resolv/res_findzonecut.c b/contrib/bind/lib/resolv/res_findzonecut.c
index e65faa1..2e8df2c 100644
--- a/contrib/bind/lib/resolv/res_findzonecut.c
+++ b/contrib/bind/lib/resolv/res_findzonecut.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_findzonecut.c,v 8.9 1999/12/21 09:33:34 cyarnell Exp $";
+static const char rcsid[] = "$Id: res_findzonecut.c,v 8.12 2000/11/22 01:20:44 marka Exp $";
#endif /* not lint */
/*
@@ -128,8 +128,6 @@ static void dprintf(const char *, ...);
* match our dname (since that would have been returned in the answer
* section). an authority section SOA has to be "above" our dname.
*
- * we cannot fail to find an SOA in this way. ultimately we'll return
- * a zname indicating the root zone if that's the closest enclosing zone.
* however, since authority section SOA's were once optional, it's
* possible that we'll have to go hunting for the enclosing SOA by
* ripping labels off the front of our dname -- this is known as "doing
@@ -369,7 +367,7 @@ get_ns(res_state statp, const char *zname, ns_class class, rrset_ns *nsrrsp) {
/* Go and get the NS RRs for this zone. */
n = do_query(statp, zname, class, ns_t_ns, resp, &msg);
if (n != 0) {
- DPRINTF(("get_ns: do_query('zname', %s) failed (%d)",
+ DPRINTF(("get_ns: do_query('%s', %s) failed (%d)",
zname, p_class(class), n));
return (-1);
}
@@ -471,6 +469,7 @@ save_ns(res_state statp, ns_msg *msg, ns_sect sect,
free(nsrr);
return (-1);
}
+ INIT_LINK(nsrr, link);
INIT_LIST(nsrr->addrs);
APPEND(*nsrrsp, nsrr, link);
}
@@ -510,6 +509,7 @@ save_a(res_state statp, ns_msg *msg, ns_sect sect,
DPRINTF(("save_a: malloc failed"));
return (-1);
}
+ INIT_LINK(arr, link);
memcpy(&arr->addr, ns_rr_rdata(rr), NS_INADDRSZ);
APPEND(*arrsp, arr, link);
}
diff --git a/contrib/bind/lib/resolv/res_init.c b/contrib/bind/lib/resolv/res_init.c
index 12d9969..3ea9f02 100644
--- a/contrib/bind/lib/resolv/res_init.c
+++ b/contrib/bind/lib/resolv/res_init.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 8.16 2000/05/09 07:10:12 vixie Exp $";
+static const char rcsid[] = "$Id: res_init.c,v 8.17 2000/11/08 06:47:37 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -350,6 +350,15 @@ __res_vinit(res_state statp, int preinit) {
#endif
(void) fclose(fp);
}
+/*
+ * Last chance to get a nameserver. This should not normally
+ * be necessary
+ */
+#ifdef NO_RESOLV_CONF
+ if(nserv == 0)
+ nserv = get_nameservers(statp);
+#endif
+
if (statp->defdname[0] == 0 &&
gethostname(buf, sizeof(statp->defdname) - 1) == 0 &&
(cp = strchr(buf, '.')) != NULL)
diff --git a/contrib/bind/lib/resolv/res_mkupdate.c b/contrib/bind/lib/resolv/res_mkupdate.c
index 14e1a60..ecf66dd 100644
--- a/contrib/bind/lib/resolv/res_mkupdate.c
+++ b/contrib/bind/lib/resolv/res_mkupdate.c
@@ -21,7 +21,7 @@
*/
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_mkupdate.c,v 1.24 1999/10/13 17:11:32 vixie Exp $";
+static const char rcsid[] = "$Id: res_mkupdate.c,v 1.25 2000/11/22 01:20:46 marka Exp $";
#endif /* not lint */
#include "port_before.h"
@@ -861,6 +861,8 @@ res_mkupdrec(int section, const char *dname,
free((char *)rrecp);
return (NULL);
}
+ INIT_LINK(rrecp, r_link);
+ INIT_LINK(rrecp, r_glink);
rrecp->r_class = class;
rrecp->r_type = type;
rrecp->r_ttl = ttl;
diff --git a/contrib/bind/lib/resolv/res_send.c b/contrib/bind/lib/resolv/res_send.c
index af674a1..462d65d 100644
--- a/contrib/bind/lib/resolv/res_send.c
+++ b/contrib/bind/lib/resolv/res_send.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_send.c,v 8.38 2000/03/30 20:16:51 vixie Exp $";
+static const char rcsid[] = "$Id: res_send.c,v 8.41 2000/12/23 08:14:58 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -128,10 +128,6 @@ static int pselect(int, void *, void *, void *,
const sigset_t *);
#endif
-/* Reachover. */
-
-void res_pquery(const res_state, const u_char *, int, FILE *);
-
/* Public. */
/* int
@@ -284,8 +280,10 @@ res_nsend(res_state statp,
needclose++;
break;
}
- if (needclose)
+ if (needclose) {
res_nclose(statp);
+ EXT(statp).nscount = 0;
+ }
}
/*
@@ -308,11 +306,16 @@ res_nsend(res_state statp,
(statp->options & RES_BLAST) == 0) {
struct sockaddr_in ina;
int lastns = statp->nscount - 1;
+ int fd;
ina = statp->nsaddr_list[0];
- for (ns = 0; ns < lastns; ns++)
+ fd = EXT(statp).nssocks[0];
+ for (ns = 0; ns < lastns; ns++) {
statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1];
+ EXT(statp).nssocks[ns] = EXT(statp).nssocks[ns + 1];
+ }
statp->nsaddr_list[lastns] = ina;
+ EXT(statp).nssocks[lastns] = fd;
}
/*
@@ -347,7 +350,7 @@ res_nsend(res_state statp,
case res_error:
/*FALLTHROUGH*/
default:
- return (-1);
+ goto fail;
}
} while (!done);
}
@@ -362,7 +365,7 @@ res_nsend(res_state statp,
n = send_vc(statp, buf, buflen, ans, anssiz, &terrno,
ns);
if (n < 0)
- return (-1);
+ goto fail;
if (n == 0)
goto next_ns;
resplen = n;
@@ -371,7 +374,7 @@ res_nsend(res_state statp,
n = send_dg(statp, buf, buflen, ans, anssiz, &terrno,
ns, &v_circuit, &gotsomewhere);
if (n < 0)
- return (-1);
+ goto fail;
if (n == 0)
goto next_ns;
if (v_circuit)
@@ -394,7 +397,7 @@ res_nsend(res_state statp,
* or if we haven't been asked to keep a socket open,
* close the socket.
*/
- if (v_circuit && (statp->options & RES_USEVC) == 0 ||
+ if ((v_circuit && (statp->options & RES_USEVC) == 0) ||
(statp->options & RES_STAYOPEN) == 0) {
res_nclose(statp);
}
@@ -422,7 +425,7 @@ res_nsend(res_state statp,
case res_error:
/*FALLTHROUGH*/
default:
- return (-1);
+ goto fail;
}
} while (!done);
@@ -440,6 +443,9 @@ res_nsend(res_state statp,
} else
errno = terrno;
return (-1);
+ fail:
+ res_nclose(statp);
+ return (-1);
}
/* Private */
@@ -686,9 +692,16 @@ send_dg(res_state statp,
now = evNowTime();
timeout = evConsTime(seconds, 0);
finish = evAddTime(now, timeout);
+ goto nonow;
wait:
+ now = evNowTime();
+ nonow:
FD_ZERO(&dsmask);
FD_SET(s, &dsmask);
+ if (evCmpTime(finish, now) > 0)
+ timeout = evSubTime(finish, now);
+ else
+ timeout = evConsTime(0, 0);
n = pselect(s + 1, &dsmask, NULL, NULL, &timeout, NULL);
if (n == 0) {
Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
@@ -696,13 +709,8 @@ send_dg(res_state statp,
return (0);
}
if (n < 0) {
- if (errno == EINTR) {
- now = evNowTime();
- if (evCmpTime(finish, now) > 0) {
- timeout = evSubTime(finish, now);
- goto wait;
- }
- }
+ if (errno == EINTR)
+ goto wait;
Perror(statp, stderr, "select", errno);
res_nclose(statp);
return (0);
diff --git a/contrib/bind/lib/resolv/res_sendsigned.c b/contrib/bind/lib/resolv/res_sendsigned.c
index efa463c..b450926 100644
--- a/contrib/bind/lib/resolv/res_sendsigned.c
+++ b/contrib/bind/lib/resolv/res_sendsigned.c
@@ -78,6 +78,7 @@ res_nsendsigned(res_state statp, const u_char *msg, int msglen,
if (ret < 0) {
free (nstatp);
free (newmsg);
+ dst_free_key(dstkey);
if (ret == NS_TSIG_ERROR_NO_SPACE)
errno = EMSGSIZE;
else if (ret == -1)
@@ -98,6 +99,7 @@ retry:
if (ret < 0) {
free (nstatp);
free (newmsg);
+ dst_free_key(dstkey);
return (ret);
}
@@ -109,6 +111,7 @@ retry:
(stdout, ";; TSIG invalid (%s)\n", p_rcode(ret)));
free (nstatp);
free (newmsg);
+ dst_free_key(dstkey);
if (ret == -1)
errno = EINVAL;
else
@@ -126,5 +129,6 @@ retry:
free (nstatp);
free (newmsg);
+ dst_free_key(dstkey);
return (anslen);
}
diff --git a/contrib/bind/lib/resolv/res_update.c b/contrib/bind/lib/resolv/res_update.c
index bb2456e..685e467 100644
--- a/contrib/bind/lib/resolv/res_update.c
+++ b/contrib/bind/lib/resolv/res_update.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_update.c,v 1.24 1999/10/15 19:49:12 vixie Exp $";
+static const char rcsid[] = "$Id: res_update.c,v 1.25 2000/11/22 01:20:47 marka Exp $";
#endif /* not lint */
/*
@@ -129,6 +129,7 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
}
*zptr = tgrp;
zptr->z_flags = 0;
+ INIT_LINK(zptr, z_link);
INIT_LIST(zptr->z_rrlist);
APPEND(zgrps, zptr, z_link);
}
diff --git a/contrib/bind/port/Makefile b/contrib/bind/port/Makefile
index af7f797..1694f5c 100644
--- a/contrib/bind/port/Makefile
+++ b/contrib/bind/port/Makefile
@@ -13,7 +13,7 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 8.15 1999/08/08 17:13:24 vixie Exp $
+# $Id: Makefile,v 8.16 2000/11/21 12:54:42 marka Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
@@ -54,7 +54,7 @@ all depend install::
distclean:: clean
@set -e; for x in ${SUBDIRS}; do \
- (cd $$x; pwd; ${MAKE} ${MARGS} $@); \
+ (cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \
done
clean::
diff --git a/contrib/bind/port/freebsd/Makefile b/contrib/bind/port/freebsd/Makefile
index 2f5b121..d6c0cf0 100644
--- a/contrib/bind/port/freebsd/Makefile
+++ b/contrib/bind/port/freebsd/Makefile
@@ -13,7 +13,7 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 1.8 1999/02/22 02:48:01 vixie Exp $
+# $Id: Makefile,v 1.9 2000/11/21 12:55:03 marka Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
@@ -47,7 +47,7 @@ MARGS= DESTDIR="${DESTDIR}" DESTINC="${DESTINC}" INSTALL="${INSTALL}"
all depend clean distclean install::
@for x in ${SUBDIRS}; do \
- (cd $$x; pwd; ${MAKE} ${MARGS} $@); \
+ (cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \
done
all:: ${LIBBIND}
@@ -74,7 +74,7 @@ links: FRC
@set -e; for x in ${SUBDIRS}; do \
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
- ${MAKE} ${MARGS} links ); \
+ ${MAKE} ${MARGS} links ) || exit 1; \
done
install:: FRC
diff --git a/contrib/bind/port/freebsd/include/Makefile b/contrib/bind/port/freebsd/include/Makefile
index 40fe3f8..9176a2d 100644
--- a/contrib/bind/port/freebsd/include/Makefile
+++ b/contrib/bind/port/freebsd/include/Makefile
@@ -62,7 +62,7 @@ MARGS= DESTDIR="${DESTDIR}" DESTINC="${DESTINC}" INSTALL="${INSTALL}"
all depend clean distclean install::
@for x in ${SUBDIRS}; do \
- (cd $$x; pwd; ${MAKE} ${MARGS} $@); \
+ (cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \
done
all depend::
@@ -79,7 +79,7 @@ links: FRC
@set -e; for x in ${SUBDIRS}; do \
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
- ${MAKE} ${MARGS} links ); \
+ ${MAKE} ${MARGS} links ) || exit 1; \
done
install:: ${DESTDIR}${DESTINC}
diff --git a/contrib/bind/port/prand_conf/Makefile b/contrib/bind/port/prand_conf/Makefile
index d8a1fdc..efe36d7 100644
--- a/contrib/bind/port/prand_conf/Makefile
+++ b/contrib/bind/port/prand_conf/Makefile
@@ -64,7 +64,7 @@ MARGS= DESTDIR="${DESTDIR}" DESTINC="${DESTINC}" INSTALL="${INSTALL}"
all depend clean distclean install::
@for x in ${SUBDIRS}; do \
- (cd $$x; pwd; ${MAKE} ${MARGS} $@); \
+ (cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \
done
prand_conf.h: prand_conf.c
@@ -82,7 +82,7 @@ links: FRC
@set -e; for x in ${SUBDIRS}; do \
( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
cp SRC/Makefile Makefile; chmod +w Makefile; \
- ${MAKE} ${MARGS} links ); \
+ ${MAKE} ${MARGS} links ) || exit 1; \
done
install:: ${DESTDIR}${DESTINC}
OpenPOWER on IntegriCloud