Compare commits

..
270 Commits
Author SHA1 Message Date
Peter Wemm 3f6ab17207 MFC: rev 1.4: forward compatability with cvs-1.12 repository 2008-01-07 09:11:23 +00:00
Tor Egge 0b22bdff85 MFC: Don't set the COMPLETE flag in an inodedep structure before the
related inode has been written.
2005-08-26 20:40:31 +00:00
Bruce Evans 2d0a65fb58 MFC (1.405: quick fix for most of the pessimization in rev.1.194). 2003-12-02 06:18:37 +00:00
Bruce Evans 4214fd3688 Avoid depending on a gas bug, so that this file works when assembled
by current versions of gas that don't have the bug as well as by the
RELENG_3 version.  A 32-bit load of %esp in 16-bit mode was mangled.
The current version of gas still produces a different object file due
to related (but harmless) bugs involving bogus operand size prefixes
for segment registers.
2003-12-01 13:21:47 +00:00
Gregory Neil Shapiro 517121dc1f MFC: sendmail address parsing bug fix
Approved by:	so (nectar)
2003-09-17 20:22:03 +00:00
Jacques Vidrine 5282423a4a MFC 1.24: Validate the iBCS2 statfs(2) length parameter. 2003-08-10 23:35:21 +00:00
Bruce Evans 8daec3f7ea MFC: 1.94 and 1.125 (don't use hard newlines in string literals, and fix
some style bugs on the same lines).

This completes making some RELENG_3 kernels work when compiled by gcc-3.3.
2003-08-05 07:07:37 +00:00
Jacques Vidrine a9c8e89592 realpath(3) bug fix: There was an off-by-one error in computing the
size of the resulting canonical path.
2003-08-03 23:47:39 +00:00
Bruce Evans ad3dbee7a1 MFC locore.s 1.172-1.174 (don't hide the name of tmpstk, and clear the
bss properly) with adjustments for RELENG_3.  The adjustments are the
same as for RELENG_4.

This is part of some making RELENG_3 kernels work when compiled by gcc-3.3.
Fixing bss clearing and ATOMIC_ASM constrains are the only nontrivial parts.
2003-08-02 14:54:49 +00:00
Bruce Evans e81dc82731 MFC (1.24: pass in the constraints on the V parameter so that the char
versions can be given different, non-bogus constraints).

This is part of making some RELENG_3 kernels work when compiled by gcc-3.3.
I started out only wanting them to compile, but had to test them for
delicate changes like this.  This change makes no difference for LINT
compiled by the RELENG_3 compiler, except for vfs_cluster.o where it
gives some differences related to register selection near an
atomic_add_char().
2003-07-30 19:31:11 +00:00
Bruce Evans 23047d3472 MFC (1.15: missing FREE()). This was supposed to be MFC'ed in 1.3.2.5,
but FREE was misspelled so this file has just not compiled since 1.3.2.5.

This finishes making LINT compile in RELENG_3.
2003-07-29 20:44:35 +00:00
Bruce Evans f732d57b47 Commented out olpt devices so that LINT is almost compilable in RELENG_3.
olpt devices never worked in RELENG_3, if anywhere, since a driver's
namespace is not affected by changing only the driver's name.  LINT
apparently hasn't been buildable in RELENG_3 since rev.1.539.2.14
(between 3.1R and 3.2R).
2003-07-29 19:35:50 +00:00
Bruce Evans f417cb4888 MFoldC (a tiny part of 1.61: translate to C: don't use hard newlines in
a string literal).

This is part of making some RELENG_3 kernels compilable by gcc-3.3.
2003-07-29 10:38:14 +00:00
Bruce Evans ed4e49ffbd MFC (1.32: translate to C: don't use hard newlines in a string literal;
1.41: use the correct function name in the string literal).

This is part of making some RELENG_3 kernels compilable by gcc-3.3.
2003-07-26 12:09:58 +00:00
Gregory Neil Shapiro 905ce239fd sendmail parsing buffer overflow fix
Approved by:	so (nectar)
2003-03-29 20:09:48 +00:00
Gregory Neil Shapiro 0ad9dc59e9 FreeBSD-SA-03:04.sendmail: sendmail header parsing buffer overflow
Approved by:    security-officer (nectar)
2003-03-03 17:23:11 +00:00
Assar Westerlund 6f51866403 MFC kadm_ser_wrap.c:1.1.1.4: fix buffer overflow
MFC updating kerberosIV version

Obtained from:	kth-krb CVS
2002-10-24 02:49:08 +00:00
Juli Mallett 40095fd9d6 MFC: fortune(6) datfiles 2002-08-10 02:19:34 +00:00
Trevor Johnson 37e223c81c MFC: fix buffer overflows described in FreeBSD-SA-02:28.resolv.
Sergey A. Osokin and I tested this.

Approved by:	security-officer
2002-07-08 22:17:52 +00:00
Juli Mallett ad9279f647 MFRELENG_4:
Document traditional BSD behaviour for changecom with no arguments.

PR:	bin/17480
2002-06-17 04:05:07 +00:00
Bruce Evans 80190b3378 Fixed missing definitions of __dead2, __pure2 and __unused when parts
of RELENG_3 are compiled by gcc-3.  These macros are for cosmetic
purposes (optimization and error checking), so they should have been
defined away for all unknown compilers, including for versions of gcc
that were apparently not dreamt of when RELENG_3 was current or stable,
but the ifdefs are too backwards-looking and got this wrong.

RELENG_4 has the same bug for gcc-4.

The corresponding idefs in -current and most other ifdefs for gcc avoid
the bug by assuming that all future versions of gcc will be like gcc-3.
2002-05-27 12:52:58 +00:00
Yoshihiro Takahashi 0442bfcfbf MFi386: revision 1.129.2.7. 2002-05-19 13:13:22 +00:00
Bruce Evans 7080af00c2 MFC (1.133: "For what it's worth, idelayed is declared as a volatile in
the headers, and even though it's not used in this file make it a
volatile here too").

The worth of this is that it makes this file actually compilable by C
compilers like gcc-3.
2002-05-15 05:18:56 +00:00
Bruce Evans b6d5c5e83a MFC (1.12: renamed gdb's private strlen and strlcpy to avoid conflicts
with the public ones declared in a system header).  This helps unbreak
building RELENG_3 kernels with gcc-3.  gcc-2's special (broken) handling
of the corresponding builtins apparently prevented detection of the
conflicts even when the public functions are declared explicitly.
2002-05-15 05:00:24 +00:00
Jeroen Ruigrok van der Werven 3957ebe486 Work correctly when skips are given.
Add $FreeBSD$

PR:		18597
Submitted by:	Anatoly Vorobey <[email protected]>
2002-04-08 13:13:28 +00:00
Bruce Evans 0dcf528396 MFC (cy_pci.c 1.26: work around a PLX9050 bug). 2002-03-17 04:16:45 +00:00
Alfred Perlstein f0843112af Backport sed -E support (extended regex support).
Submitted by: Dan Nelson <[email protected]>
2002-01-30 20:21:18 +00:00
Greg Lehey 2e031e8eba MFC: remove extraneous setjmp, add a panic if we try to longjmp
without holding the config lock.
2002-01-30 01:44:14 +00:00
Jeroen Ruigrok van der Werven af862a47cb MFS: Add quirk entry for the Hitachi DK31* drives.
PR:		18793
Submitted by:	Paul Haddad <[email protected]>
2001-11-15 20:03:37 +00:00
Max Khon 9ae0b19614 forced commit (PR, Submitted by)
PR:             27922
Submitted by:   Eugene Grosbein <[email protected]>
2001-10-21 23:28:15 +00:00
Max Khon 95c67effed MFC: SA 01:62 fix
Submitted by:   Eugene Grosbein <[email protected]>
Approved by:	silence on -security
2001-10-21 23:18:09 +00:00
Max Khon ef935a1fae MFC rev 1.18: Protect the remaining instance of chdir() using
fts_safe_changedir().
2001-10-10 19:49:30 +00:00
Max Khon cc6aa31940 MFC rev. 1.60: Enable 8bit chars excepting high controls 2001-10-10 19:44:54 +00:00
Ruslan Ermilov fc1801e3e9 MFC: 1.18: Terminate the array of execv(3) pointers by a NULL pointer. 2001-10-04 09:12:35 +00:00
Peter Wemm 30a4159905 MFC: fowards compatability hack so that we can update the compat3x
libc.so.3.gz.uu file in -current.  This is the same as RELENG_4 1.7.2.3.
2001-09-26 01:48:56 +00:00
Robert Watson d16c4f3675 MFC/MFS per-user .login_conf disable + adjacent comment.
login.conf.5: 1.37
login_cap.c: 1.22, 1.23
2001-09-20 21:21:12 +00:00
Kris Kennaway 3b0158c4b4 MFC: Fix buffer overflow in queue file handling 2001-08-30 09:46:44 +00:00
Akinori MUSHA 44362a47a5 MFC: MASTER_SITES_* 2001-08-23 20:28:24 +00:00
Jesper Skriver 5af9273042 MFS
src/sys/netinet/ip_input.c      rev 1.130.2.22
src/sys/netinet6/frag6.c        rev 1.2.2.4
src/sys/netinet6/in6_proto.c    rev 1.6.2.4

  Prevent denial of service using bogus fragmented IPv4 packets.

  A attacker sending a lot of bogus fragmented packets to the target
  (with different IPv4 identification field - ip_id), may be able
  to put the target machine into mbuf starvation state.

  By setting a upper limit on the number of reassembly queues we
  prevent this situation.

  This upper limit is controlled by the new sysctl
  net.inet.ip.maxfragpackets which defaults to nmbclusters/4

  If you want old behaviour (no upper limit) set this sysctl
  to a negative value.

  If you don't want to accept any fragments (not recommended)
  set the sysctl to 0 (zero)

Obtained from:	NetBSD (partially)
2001-08-06 09:20:57 +00:00
Bruce A. Mah e6f2b760a4 MFC: SA-01:49. 2001-07-24 01:16:52 +00:00
Kris Kennaway fe21389f84 MFC: Correct semantics of output_data*() and netflush() to ensure
deterministic operation
2001-07-23 22:12:45 +00:00
Kris Kennaway 5ff1744f11 MFC^2: Correct semantics of output_data*() and netflush() to ensure
deterministic operation
2001-07-23 22:10:45 +00:00
Kris Kennaway 61d47fa866 MFC: Prevent remotely exploitable buffer overflow 2001-07-23 02:19:35 +00:00
Dima Dorfman 9f7a920119 MFC 1.134, 1.135: don't share sig handlers after an exec.
Approved by:	kris
2001-07-11 23:04:37 +00:00
Peter Wemm a87462cae3 MFC: rev 1.131: set P_SUGID before releasing ptrace and block opportunities 2001-06-16 23:41:58 +00:00
Peter Wemm 5fc8aceac5 MFC: rev 1.40: trivial fix for savecore on 2GB+ ram machines 2001-06-08 03:14:05 +00:00
Bruce A. Mah 4479ee219f MFC: SA-01:39. 2001-05-02 21:49:23 +00:00
Kris Kennaway 9f6334c28e MFC: Better TCP ISN randomization 2001-05-02 20:48:34 +00:00
Jens Schweikhardt 7dd514fcc6 MFC: fix grammar bogon and add $FreeBSD$. 2001-04-26 17:23:42 +00:00
Akinori MUSHA 6563052715 MFC: Correct and update Japanese holidays. 2001-04-20 14:14:21 +00:00
Jens Schweikhardt ca8af0754f Fixed typos.
Approved by:	jkh
2001-04-17 19:25:41 +00:00
Chris D. Faulhaber 68b25a6d3f MFC: Limit number of paths returned via glob() for authorized users 2001-04-17 18:04:09 +00:00
Chris D. Faulhaber 6b480559c6 MFC 1.74: globbing limits for ftpd 2001-04-17 02:47:36 +00:00
Bruce A. Mah 78c1e541bf MFC: ntpd(8) vulnerability fix cross-references SA-01:31. 2001-04-14 16:20:34 +00:00
Bruce A. Mah 47d96a5edd MFC: glob(3) limits, ftpd(8) usage of same, ntpd(8) vulnerability closed. 2001-04-10 04:48:58 +00:00
Chris D. Faulhaber 2ecb30bb11 MFC: globbing limits for ftpd 2001-04-08 00:15:00 +00:00
Chris D. Faulhaber cdd8f71174 MFC: Fix potential remote exploit 2001-04-06 18:21:00 +00:00
Bruce Evans 43a20f2a6e MFC (rev.1.14: don't follow the null pointer went the server sends an
unparseable timestamp).

PR:		25243
2001-04-06 11:37:50 +00:00
Peter Wemm c15cd85a81 MFC rev 1.17 2001-03-29 01:46:57 +00:00
Peter Wemm 583eed4bf5 MFC: sync all the way up to glob.c rev 1.16 and glob.h rev 1.4 2001-03-28 16:40:11 +00:00
Bruce A. Mah c75888b9ac MFC: timed(8) security fix (FreeBSD-SA-01:28), rwhod(8) security
fix (FreeBSD-SA-01:29), FFS/EXT2FS security fixes (FreeBSD-SA-01:30).
2001-03-26 18:10:58 +00:00
Satoshi Asami 85751d7570 MFC (science and ukrainian categories). 2001-03-24 22:11:07 +00:00
Jeroen Ruigrok van der Werven cf8b419033 MFC: 3.5-STABLE has lpt and olpt, not nlpt. Reflect docs to reality. 2001-03-14 13:43:23 +00:00
Kris Kennaway eeea1b0c51 MFC: 1.6 and 1.7, which was forgotten until now. 2001-03-11 10:47:03 +00:00
Gary Jennejohn 1d37635da5 Add support for the Am79C973/Am79C975. The Am79C973 was already
in there, but I reworked it to match the patch in the PR.

PR:		i386/19365
Submitted by:	Koichi Soraku <[email protected]>
2001-03-04 12:17:48 +00:00
Bruce A. Mah ac211335f0 MFC: ICMP bugfix. 2001-03-01 22:29:02 +00:00
Jeroen Ruigrok van der Werven 8ab6bf4096 MFC: BIND 8.2.3-REL documentation. 2001-02-27 10:01:41 +00:00
Jesper Skriver b94ef44e04 MFC:
src/sys/netinet/in_pcb.c     rev 1.78
src/sys/netinet/in_pcb.h     rev 1.36
src/sys/netinet/tcp_subr.c   rev 1.91
src/sys/netinet/udp_usrreq.c rev 1.86

Without this a attacker sending ICMP messages, where the attached
IP header (+ 8 bytes) has the address and port numbers == 0, would
have the ICMP message applied to all sessions.

Approved by:    kris
Inspired by:    NetBSD
2001-02-24 20:09:22 +00:00
Jeroen Ruigrok van der Werven 9b2f8a07a4 MFC: Do not try to install dns-setup. 2001-02-18 10:32:25 +00:00
Jeroen Ruigrok van der Werven 4935b85a43 MFC: Remove old dns-setup document. We don't use BIND 4 anymore. 2001-02-18 10:30:50 +00:00
Bruce A. Mah 72221ba51b MFC: Prevent "pkg_version -c | sh" abuse.
pkg_version.pl: 1.15 -> 1.16
2001-02-16 17:53:02 +00:00
Will Andrews c6f2ece715 MFC: Bugfixes. Small ANSI cleanup. Style changes avoided. Committed on
a RELENG_3 machine (which will become RELENG_4 soon enough..).
2001-02-13 03:55:52 +00:00
Jeroen Ruigrok van der Werven 9040025f22 MFC: Add list.h to the to be installed header files. 2001-02-07 21:11:35 +00:00
Jeroen Ruigrok van der Werven 01925b4434 Fix typo left in the past:
NONBINMODE -> NOBINMODE
2001-02-07 19:46:19 +00:00
Jeroen Ruigrok van der Werven 85f40256b0 MFC: INC* variables and the ability to install headerfiles through
INCS.
2001-02-07 19:38:21 +00:00
Chris D. Faulhaber 99fb4351b9 MFC 1.12:
use more secure temporary files
2001-02-05 14:02:14 +00:00
Bruce A. Mah 89f275c96c BIND update now has security advisory number. 2001-02-02 17:08:05 +00:00
Julian Elischer 90543df1cc MF4: Don't dereference pointers we haven't checked to be valid. 2001-02-02 13:36:39 +00:00
Jeroen Ruigrok van der Werven 3d0dc90c12 Add the isc directory to the mtree description. 2001-01-30 21:39:42 +00:00
Jeroen Ruigrok van der Werven 24908d1a87 Also add libisc to the top Makefile. 2001-01-30 21:32:10 +00:00
Jeroen Ruigrok van der Werven f9fa0f4c91 *sigh*
No idea how these files got mangled

Submitted by:	Pekka Savola <[email protected]>
2001-01-30 21:26:18 +00:00
Bruce A. Mah bb679d538b Update for security advisories: 01:11, 01:13, BIND update. 2001-01-30 15:47:25 +00:00
Jeroen Ruigrok van der Werven a8fcd30033 *sigh*
Fix another merge slippage.
2001-01-30 15:36:06 +00:00
Jeroen Ruigrok van der Werven 3c2b09f594 Fix MFC mistake of double definition of PORT_AFTER_H. 2001-01-30 14:37:45 +00:00
Jeroen Ruigrok van der Werven bb7e4c77e6 Fix port_after.h so that it will work on 3-STABLE because it doesn't
have IPv6 by default.

Submitted by:	des
2001-01-30 11:59:17 +00:00
Jeroen Ruigrok van der Werven 5098034fd5 MFC: 8.2.3 2001-01-30 11:55:43 +00:00
cvs2svn 4ccec34df9 This commit was manufactured by cvs2svn to create branch 'RELENG_3'. 2001-01-28 23:14:17 +00:00
Jeroen Ruigrok van der Werven 97ab32dac1 MFC: Security fix: correctly set groups according to the user.
Don't allow blocking on the opening of ~/.fakeid.
2001-01-26 23:36:57 +00:00
Bruce A. Mah 2eda977282 Catch release notes up with security advisories: 00:58, 00:61, 00:62,
00:70, 00:78, 00:77, 01:08, 01:09, 01:10.
2001-01-26 20:27:50 +00:00
Kris Kennaway 2c45c79901 MFC: manpage change corresponding to crontab fix described in SA-01:09 2001-01-23 21:19:04 +00:00
Josef Karthauser 6298d851d3 MF4: Merge in recent changes from -releng_4, and thereby bring the
code into sync with -current.
2001-01-21 21:21:37 +00:00
Maxim Sobolev 9c6b822e58 MFC:
- Fix a nasty bug where pkg_create doesn't gzip package if lengh of package
  name is less than 5;
- style cleanups.
2001-01-19 11:08:57 +00:00
Maxim Sobolev 2a57ca6d81 MFC:
Fix a bug where pkg_create does not make an md5 entry for the last item in
the packing list. Also use switch() instead of zillion "else if ()" and for()
loop instead of while() loop for traversing through linked list.
2001-01-15 14:13:18 +00:00
Chris D. Faulhaber 805e3c58a4 MFC: ECN flag handling fixes in IPFW 2001-01-13 02:44:21 +00:00
Julian Elischer f680fa7756 Missing FREE() 2001-01-09 00:55:55 +00:00
Matthew Dillon 6f6f350f6c MFC 1.163 to 3.x. 2001-01-06 19:46:42 +00:00
Chris D. Faulhaber aee624e313 MFC: limit utrace 2001-01-06 18:59:30 +00:00
Chris D. Faulhaber 5d3369eca2 MFC: Use secure temporary files 2001-01-01 13:35:21 +00:00
Josef Karthauser c3625c0a28 MF4: Improve support for shadow object directories by adding the -o and -p
flags.
MF4: Add support for customising the make flags on a per-program basis from
     within a crunch.conf file.
MF4: A number of security fixes:
	o check strdup() return values
	o strcpy() -> strlcpy()
	o sprintf() -> snprintf()
	o mktemp() -> mkstemp()
	o use err() instead of errx() in out_of_memory() function since
	  errno will probably be set
2000-12-23 18:56:06 +00:00
Ian Dowse 0a4c298e78 MFC: 1.15
Don't crash with a SIGBUS when short packets are received, include
source IP in log messages for bad packets.

Requested by: kris
2000-12-23 15:32:16 +00:00
Matthew Dillon b204ec7e0d MFC ufs_readwrite.c 1.72, ext2_readwrite.c 1.20. Fix a data-consistency
race between write() and mmap().
2000-12-22 18:54:26 +00:00
Robert Watson 3395269086 o MFC of an appropriate adaptation of 1.22, tighten restrictions on
the use of /proc/pid/ctl.  This is a backport of the -CURRENT patch
  to use the procdfs CHECKIO() interface rather than the p_can
  interface available in -CURRENT.  sef reviewed the patch for -CURRENT,
  and had proposed a less fascist version of the patch for -STABLE.

Submitted by:	jedgar
Reviewed by:	security-officer, alfred
2000-12-18 20:56:05 +00:00
Kris Kennaway 762707e35e MFC: Prevent local user denial of service. Untested, but
I need to release the advisory and the keepers of the 3.x
branch have had over a month to fix this.
2000-12-18 15:21:18 +00:00
Assar Westerlund 4b6daf15b5 MFC: (kdc_reply_cipher): fix buffer over-run 2000-12-15 03:02:19 +00:00
Assar Westerlund 7bb4f0b3c2 MFC: (tf_create): remove the overwriting of the old ticket file 2000-12-15 03:01:31 +00:00
Assar Westerlund 894f8eaab2 MFC: remove (obsolete) support for environment variables. 2000-12-15 03:01:04 +00:00
Assar Westerlund 1a3e48bcc2 MFC: 1.9->1.10
(scrub_env): change to only accept a listed set of variables,
including only non-filename contents for TERMCAP
2000-12-15 03:00:11 +00:00
Assar Westerlund 28c2b96fbf MFC: 1.27->1.28
(scrub_env): change to only accept a listed set of variables,
including only non-filename contents for TERMCAP
2000-12-15 02:59:15 +00:00
Alexander Langer 03a58c9ad6 Don't fix the delay option in the wrong branch.
Pointy hat:		alex
2000-12-08 12:28:37 +00:00
Bruce A. Mah 6df9d82334 MFC: "origin patch", -L option, other small bugfixes to sync up to HEAD.
pkg_version.pl:	1.9->1.15
pkg_version.1:	1.7->1.10

Requested by:	sobomax
2000-12-05 22:30:36 +00:00
Maxim Sobolev 1b67774ac5 MFS4:
- Add "-o" option to pkg_create(1) and pkg_info(1). This option intended to
  record a path of the port from which package has been created within FreeBSD
  Ports Collection and will be used to improve pkg_version(1) and similar tools;
- add "-s" option to check size of installed package(s);
- add several missed references to pkg_version(1).

Prompted by:	asami (`origin' option)
2000-12-05 16:59:01 +00:00
Matt Jacob 085843c335 MFC: Far too many changes to list singly- but cause 3.X to benefit from
the rewrites that up through this date's -current && RELENG_4 have had.
(this is probably the last RELENG_3 update).
2000-12-05 07:57:58 +00:00
Julian Elischer a91a55f3b7 MFC: 1.26 block a race with splhigh() 2000-12-04 22:11:01 +00:00
Alexander Langer 410481b89d MFC: Fix -d option.
Add $FreeBSD$
2000-12-04 10:42:15 +00:00
Jeroen Ruigrok van der Werven fa348e998b MFC: Overflow checking.
Submitted by:	eivind with some 3-STABLE fixes from yours truly
2000-11-29 10:15:00 +00:00
Jeroen Ruigrok van der Werven 352e2af88f Update to BIND 8.2.2-P7 which fixes some bugs as well as some security
problems.

This fixes the ZXFR DoS attack.
2000-11-27 14:47:06 +00:00
Jeroen Ruigrok van der Werven 042ec36bb0 MFC: - mdoc fixes. 2000-11-24 10:48:52 +00:00
Jeroen Ruigrok van der Werven b8b006b78d MFC: Update to reflect that softupdates is no longer in sys/contrib.
Also update copyright notice.
2000-11-22 11:19:36 +00:00
Julian Elischer a45a9ba106 MFC: fix copyright 2000-11-20 13:47:38 +00:00
Kris Kennaway b2a70efccb MFC: Don't allow users to read other crontab files 2000-11-20 06:04:03 +00:00
Kris Kennaway b1204c7722 MFC^2: Correct problem with previous security patch 2000-11-20 03:09:37 +00:00
Bruce Evans 536c173e6b MFC (1.6: quick fix for not writing group descriptor group, inode
bitmaps or block bitmaps before unmount() completes).

PR:		22726
2000-11-11 13:14:15 +00:00
Jeroen Ruigrok van der Werven 04b3babe41 Fix temporary file creation.
Obtained from:	NetBSD dol.c r1.15
2000-11-05 21:34:27 +00:00
Jeroen Ruigrok van der Werven abeee2d84b MFC: Format string fix. 2000-11-05 13:38:11 +00:00
Julian Elischer 06d64764cf MFC: 1.31 2000-11-04 08:26:18 +00:00
Jeroen Ruigrok van der Werven a34ab13130 MFC: - Filter out some more magic environment variables used by
libraries linked with telnetd.

	- Buffer-safety cleanups.
2000-11-01 16:20:28 +00:00
Brian Somers 2557ed5792 MFC: Mention that ``nat deny_incoming'' drops unrecognised IP packets.
Requested by: kris
2000-10-31 02:26:48 +00:00
Brian Somers d80de9383a MFC: Drop PKT_ALIAS_IGNORED packets if ``nat deny_incoming yes'' is in effect.
Requested by: kris
2000-10-30 18:13:31 +00:00
Matt Jacob 80c44d6606 MFC: Add 3 SCSI-3 bits for Sequential Access Device Congifuration Page.
Add Data Compression Page (SCSI-3). Add some clarifying comments
at the top of the file that say what the syntax is.
2000-10-28 22:49:16 +00:00
Kenneth D. Merry 951a9af99f MFC, rev 1.40: Add a quirk entry for Nakamichi MJ-* changers. The
changer in question is a <NAKAMICH MJ-5.16S 1.06>.

Submitted by:	Kevin Van Maren <[email protected]>
2000-10-28 17:49:27 +00:00
Bruce Evans 1bef4f8117 MFC (1.25 fixed overruns of cookie buffer and directory buffer in
ext2_readdir()).
2000-10-27 10:14:08 +00:00
Bruce Evans 98aed1a6dc MFC (bpb.h rev.1.8, msdosfsmount.h rev.1.22: quick fix for sign extension
and alignment bugs that broke at least msdosfs_write() on alphas).
2000-10-27 09:50:24 +00:00
Julian Elischer a6965426dc MFC: update email addresses of authors 2000-10-24 22:45:12 +00:00
Julian Elischer 213b73b232 MFC: update email addresses for archie and me 2000-10-24 22:35:27 +00:00
Akinori MUSHA 577399f82c MFC: revision 1.125, 1.126 of src/etc/defaults/make.conf 2000-10-24 12:50:23 +00:00
Josef Karthauser d057ead78d MFC: When warning that a log file can't be compressed, tell the
reader which log file it was (revision 1.29).
2000-10-20 00:51:16 +00:00
Will Andrews a44cd86b15 MFC: :C, :U, and :L variable modifiers. 2000-10-19 04:42:28 +00:00
Yoshihiro Takahashi ca25bea39a Merged from sys/i386/isa/wd.c revision 1.186.2.6. 2000-10-15 02:42:13 +00:00
Peter Wemm 3057afeb83 MFC: rev 1.218: limit cyls in CHS mode to 65536 (33.8G). LBA-safe
crashdumps were already MFC'ed.
2000-10-13 23:09:27 +00:00
Warner Losh 1ac666cde5 Tell people that you should read /usr/src/UPDATING after the sources
have been upgraded when moving to 4.x-stable.
2000-10-09 04:13:41 +00:00
Jeroen Ruigrok van der Werven 3488937384 MFC: Format string paranoia. 2000-10-08 12:12:21 +00:00
Jeroen Ruigrok van der Werven 88c51c8cf8 MFC: - Format string paranoia
- Add $FreeBSD$
2000-10-08 11:23:29 +00:00
Bruce A. Mah 92edc2247e MFC: Stronger randomness in TCP initial sequence numbers. 2000-10-06 22:19:01 +00:00
Jeroen Ruigrok van der Werven 374024264e MFC: security fixes and string function cleanups 2000-10-05 13:41:11 +00:00
Warner Losh bd10a1696d MFC: kill command fix and sprintf/snprintf paranoia 2000-10-04 23:43:28 +00:00
Bruce A. Mah a9ed468b67 MFC: fingerd(8), rlogind(8), rshd(8) disabled by default on new installs. 2000-10-04 20:26:17 +00:00
Bruce A. Mah 47cf83bf85 MFC: Turn fingerd(8) off by default.
Approved by:	kris
2000-10-04 20:22:53 +00:00
Kris Kennaway 45402e2f7b MFC: Disable rsh and rlogin by default 2000-10-04 07:59:38 +00:00
Jeroen Ruigrok van der Werven 5da05772e4 Fix typo introduced in last commit. 2000-10-04 05:52:34 +00:00
Peter Wemm eee00636ec MFC: printf-style format fix. warn(string) -> warn("%s", string) 2000-10-04 05:44:33 +00:00
Jeroen Ruigrok van der Werven 008d64e328 MFC: - Pentium 4 recognition code 2000-10-02 13:49:32 +00:00
Jeroen Ruigrok van der Werven cf8d37e700 MFC: - Pentium 4 recognition code
- Descriptions of some features
2000-10-02 13:49:25 +00:00
Jeroen Ruigrok van der Werven 14b527752e MFC: - Remove superfluous tab
- Fix unsafe temporary file creation
	- Conditionalise $MAIL_AGENT
	- Disable request for a submitter-id
	- Disable setting of confidential
2000-10-02 13:17:00 +00:00
Yoshihiro Takahashi b08d3dea28 Merged from sys/i386/conf/files.i386 revision 1.220.2.18. 2000-09-30 15:52:47 +00:00
Kris Kennaway 31227abe86 Add arc4random.c. This should hopefully fix kernel compiles. 2000-09-29 22:07:29 +00:00
Kris Kennaway 1b4f9c99b8 MFC: Use stronger randomness for TCP_ISSINCR and tcp_iss 2000-09-29 08:49:56 +00:00
Jeroen Ruigrok van der Werven 386576ccf2 MFC: Add a ton of features which will now be recognised. Add documentation
comments.  Add sysctl descriptions.
2000-09-27 11:20:02 +00:00
Jeroen Ruigrok van der Werven ca42e99ff6 MFC: Recognize new Pentium III Xeon (stepping A0). 2000-09-26 15:06:08 +00:00
Jeroen Ruigrok van der Werven 785d8e27bc MFC: Update to the latest IANA list and document divert is homebrewn. 2000-09-24 11:43:00 +00:00
Alfred Perlstein 1e9811928d MFC:
1.32 of res_send.c, don't get stuck in an infinite loop if a signal
       interrupts the poll operation
  1.65 of syslogd.c which begins a clusterf**k of commits that span over
       versions 1.65, 1.66, 1.69 to provide an option for syslogd not
       to perform dns lookups.
  1.23, 1.24, 1.25 of syslogd.8 document changes to syslogd.c

Submitted and tested by: Reinier Bezuidenhout <[email protected]>
2000-09-23 22:48:45 +00:00
Jordan K. Hubbard f3252ed8ac MFC: merge to this branch also just for the benefit of the Japanese
"triple" release CD ISO image.
2000-09-22 08:22:44 +00:00
Maxim Sobolev d10155f3f7 "zope language" --> "zope platform".
Requested by:	asami
2000-09-22 06:53:44 +00:00
Satoshi Asami ac81696208 MFC (french, zope). 2000-09-22 06:34:01 +00:00
Satoshi Asami 3ecd503cb5 MFC (ports-french). 2000-09-22 06:31:43 +00:00
Maxim Sobolev 9c28966aaa MFC: Fix handling of symlinks pointing to a directory. 2000-09-20 13:42:00 +00:00
Andrey A. Chernov ab55e32c48 nonexistant _fcntl -> fcntl 2000-09-17 19:31:49 +00:00
Bruce A. Mah 967e0c1ec3 MFC: PORTREVISION/PORTEPOCH support, update URL for on-line INDEX
example, update MAINTAINER address, bugfixes.
	Makefile:	1.5->1.6
	pkg_version.pl:	1.3->1.9
	pkg_version.1:	1.5->1.7

Requested by:	"Oleg V. Volkov" <[email protected]>
2000-09-14 21:02:17 +00:00
cvs2svn 55f552c679 This commit was manufactured by cvs2svn to create branch 'RELENG_3'. 2000-09-11 19:34:06 +00:00
Kenneth D. Merry b6a64a9b63 MFC, Add quirk entries from Andre Albsmeier to disable the sync cache
command for the Quantum "MAVERICK 540S" and "LPS525S".

Also, add common string variables, since we seem to have a few Quantum and
Micropolis drives in here.

Fix the 'quantum' variable usage in scsi_all.c that likely got broken when
someone staticized things in cam_xpt.c.  (That particular problem would
cause Quantum Fireball ST drives to not get spun up if they were not
already spinning.)

Submitted by:	Andre Albsmeier <[email protected]>
2000-09-11 05:54:50 +00:00
Kenneth D. Merry 4d24857f83 MFC, Change the "Duplicate Wired Device entry" printout in camperiphnextunit
to also mention the peripheral name, bus, target and lun of the device we
attempted to put in that slot.  This gives the user a little more
information about what is going on.

Tested by:	Andre Albsmeier <[email protected]>
Discussed with:	gibbs
2000-09-11 05:47:25 +00:00
Andrey A. Chernov 9fcb144aa5 MFC: controls handling bugfix 2000-09-09 14:15:08 +00:00
Andrey A. Chernov 5384bbafdb MFC: prevent buffer overflow 2000-09-08 11:45:14 +00:00
Kris Kennaway 0062e8f05f MFC: Disallow '/' in LC_* environment variables 2000-09-08 07:32:43 +00:00
Andrey A. Chernov 247748fd3b MFC: more checks, rewritting, SUSv2 conformance 2000-09-07 16:57:01 +00:00
Alexey Zelkin e06d902096 MFC: rev 1.4, bring manual page into reality
MFC: rev 1.5, remove hard sentence breaks
2000-08-29 15:49:24 +00:00
Satoshi Asami 9dbc60e90a Merge 1.235 (BSD.x11-4.dist). 2000-08-28 20:26:15 +00:00
Satoshi Asami cd5fa44d8d Add BSD.x11-4.dist to RELENG_3. 2000-08-25 10:09:13 +00:00
cvs2svn b6939634e7 This commit was manufactured by cvs2svn to create branch 'RELENG_3'. 2000-08-25 10:07:22 +00:00
Sheldon Hearn f8f30ca044 MFC rev 1.6: add a missing semi-colon. 2000-08-25 09:05:55 +00:00
KATO Takenori 52d50e6996 - MFC: Fixed freeing wrong address (rev. 1.13).
- Added $FreeBSD$.
2000-08-24 14:39:46 +00:00
Marcel Moolenaar c773d46e1c MFC: Add bounds checking to stackgap_alloc.
Requested by: kris
2000-08-24 04:30:01 +00:00
SADA Kenji c0c42d159c MFC: 1.26, 1.27 Fix inhelitance of file flags when files are moved
across devices.
2000-08-20 19:47:27 +00:00
Bruce Evans c833c5858d MFC (rev.1.46: fixed a missing splx() in if_addmulti()). 2000-08-19 22:16:13 +00:00
Kris Kennaway 8c71d9778b MFC: Fix missing format string bugs. 2000-08-13 04:50:21 +00:00
Kris Kennaway b8e66d4b37 MFC: Fix setproctitle() vulnerability in non-compiled code. 2000-08-13 04:38:01 +00:00
Sheldon Hearn d7689e24e7 MFC rev 1.22: explain naming of tmp files for -r and -R. 2000-08-11 10:43:08 +00:00
Sheldon Hearn 9935bf2b60 Fix a bug in rev 1.147.2.12: if NO_BIND was defined, nslookup was
added to SUBDIR, which it shouldn't have been.  If NO_BIND was not
defined, nslookup was added to SUBDIR twice instead of once.

PR:		20511
Reported by:	[email protected] (Sean C. Farley)
2000-08-10 11:54:57 +00:00
Ruslan Ermilov 6f2a6bd48e MFC: (rev 1.36) Make natd(8) "compatible" with firewall_type="simple". 2000-08-08 08:40:13 +00:00
Kenneth D. Merry b00f52f7c4 MFC: The Yamaha CDR100 doesn't seem to like multi-LUN probing.
PR:		kern/20347
Submitted by:	Andre Albsmeier <[email protected]>
2000-08-08 06:52:37 +00:00
Paul Saab 238c21ecf0 MFC: [rev 1.69] Print uptime at shutdown.
PR:	16838
2000-08-07 19:26:33 +00:00
Alexander Langer da584b6ad0 MFC: crypto export changes 2000-08-05 14:03:19 +00:00
Alexander Langer 016b0d9185 MFC: Export control changes 2000-08-05 13:41:32 +00:00
John Polstra e6e0b69de1 MFC: Remove (non-)"comments" from "refuse". 2000-08-04 21:37:50 +00:00
cvs2svn 4710767ba3 This commit was manufactured by cvs2svn to create branch 'RELENG_3'. 2000-08-04 21:32:53 +00:00
Andrey A. Chernov baf94a42d4 MFC: #ports/hebrew and comment about comments 2000-07-31 04:27:06 +00:00
Satoshi Asami e983ab0f81 MFC (hebrew). 2000-07-31 00:18:17 +00:00
MIHIRA Sanpei Yoshiro cebe5cfede MFC 1.14 -> 1.15: Update the description of available channel for Japan. 2000-07-30 14:52:43 +00:00
Toshihiko ARAI 2c8fbb0477 MFC: rev.1.43 -> rev.1.44.
Whoops - really make the "fix" I did to the dmenuToggleVariable logic work.
2000-07-29 13:33:22 +00:00
Brian Feldman e17d7c773b MFC: rev. 1.62, fix races 2000-07-27 04:04:12 +00:00
Alexey Zelkin 6a525bf06b MFC: correct default value for -s option 2000-07-20 13:29:48 +00:00
Assar Westerlund 8481bddda6 MFC: merge in syslog fixes, do not call syslog with variabel as format string 2000-07-20 05:47:32 +00:00
David Nugent 59df840700 MFC: Allow -D -g with empty group to reset default group to none
PR:		bin/5717
2000-07-20 04:42:23 +00:00
Brian Feldman 394662f4b5 MFC: make ktrgenio() use a uio 2000-07-20 01:42:45 +00:00
David Nugent 6352da48bd MFC Make usermod -h - work
PR:		bin/19999
2000-07-20 00:36:01 +00:00
SADA Kenji acb76b73d3 MFC: Fixed with alias missing. 2000-07-19 15:30:28 +00:00
Matt Jacob 2965a644dc MFC (for the last time likely for 3.x): Far too many changes to
report- this is major rewrite of mailbox handling code and 'fixed'
target mode support, different firmware, etc.
2000-07-18 18:01:46 +00:00
Sheldon Hearn a155f1fa7f MFC rev 1.60: fix comment for TCPCTL_KEEPINIT . 2000-07-18 16:50:10 +00:00
Marcel Moolenaar 29f7a06934 MFC: change default FPU control word.
PR: 17984
2000-07-18 04:12:18 +00:00
Murray Stokely 3220c6403f MFC: Refresh the aout ldconfig hints
Approved by:	jkh
2000-07-17 22:17:47 +00:00
Kenneth D. Merry f7619e05fc MFC: Get rid of non-existent CAM 'scan' device.
PR:		19961
Submitted by:	Cyrille Lefevre <[email protected]>
2000-07-16 02:52:24 +00:00
Dag-Erling Smørgrav 03350ffa71 Back out MFC to wrong branch 2000-07-16 01:55:24 +00:00
Dag-Erling Smørgrav 825e05b5c7 MFC: use libfetch 2000-07-16 01:46:38 +00:00
David Malone 8853c55c38 MFC: 1.18 Ensure devices, fifos, etc have length 0. 2000-07-15 22:47:07 +00:00
David Nugent 2e5fed4c0b MFC: Allow useradd -d <dir> to work without other changes.
PR:             bin/19649
2000-07-14 22:11:04 +00:00
David Malone eb07a7bb71 MCF: 1.28 Fix sorting by time. Fix rounding of cputime, remove dead code.
PR:		18951
2000-07-14 20:04:05 +00:00
David Malone 07ff1172af MFC: 1.25 Fix moving symlinks across partitions. 2000-07-14 19:26:11 +00:00
Yoshihiro Takahashi 9225bee105 Disabled serial console. 2000-07-14 12:26:11 +00:00
David Nugent 20c7958a07 MFC: Fixes for comments in passwd and group files; sync with RELENG_[45].
PR:		misc/19538
Submitted by:	Andre Albsmeier <[email protected]>
2000-07-13 23:14:37 +00:00
Daniel Harris 18ba1b3e29 MFC: 1.10: Add some missing articles (as in a, an, the). 2000-07-13 21:22:50 +00:00
Daniel Harris 05d78408ca MFC: 1.7: Spelling (embedd to embed) fix and change a comma to a semicolon. 2000-07-12 20:41:11 +00:00
Satoshi Asami f690bef0e4 Belatedly bump __FreeBSD_version -- we are in 3.5-stable now. 2000-07-12 20:37:04 +00:00
Guy Helmer 327865f1cc MFC: crontab.5 [revs 1.12-1.14]
Clarify quoting in name=value pairs; describe @ shortcuts.
2000-07-12 19:22:23 +00:00
Guy Helmer 079670196b MFC:
entry.c [revs 1.10, 1.11] Fix parsing of @ shortcuts; catch and report
memory allocation failures.

env.c [revs 1.8, 1.9] Fix a situation where a pointer which should
point to dynamically allocated memory was instead pointed to a static
string.  Use consistent types in sizeof for malloc calls.

misc.c [rev 1.9] Catch and report memory allocation failures.
2000-07-12 19:13:43 +00:00
Guy Helmer a9919d9814 MFC: [rev 1.16] Catch and report fdopen failures. 2000-07-12 19:09:41 +00:00
Assar Westerlund a5feda71b3 MFC: make sure we do not write out non-printable characters in file
names and symbolic links (by default)

PR:		bin/19354
2000-07-12 16:53:22 +00:00
David Nugent 82f7b1a143 MFC: Handle comments in master.passwd.
PR:		bin/19664
2000-07-12 11:10:29 +00:00
MIHIRA Sanpei Yoshiro a6fcf10f33 MFC: 1.11 Correct typo in description string: CANNOT' -> CAN'. 2000-07-11 14:07:10 +00:00
Mark Murray d4481665eb MFC: New World Order in the way cvsup distributes crypto sources. 2000-07-09 16:25:04 +00:00
Daniel Harris 05c5bde8e4 MFC: 1.14, first appeared in 2.9BSD. 2000-07-08 18:26:58 +00:00
Will Andrews 57537ab414 MFC: Fix exit code if process does not exist. 2000-07-08 05:15:33 +00:00
Alfred Perlstein c858243d6b MFC: don't clash with C++ reserved words
ns_parse.c: 1.2
nameser.h: 1.13
2000-07-08 02:10:49 +00:00
Assar Westerlund d89e638700 (INCLUDES): add ktypes.h (also required by krb.h) 2000-07-07 05:05:44 +00:00
Assar Westerlund 23e0146886 (beforeinstall): install header files here so that they can be used by
other libraries (libfetch)
2000-07-07 04:55:07 +00:00
Assar Westerlund dbfa7528af this file no longer exists 2000-07-06 21:56:04 +00:00
Assar Westerlund 49633d2d73 remove the remaining RCSIDs 2000-07-05 05:29:25 +00:00
Assar Westerlund 6da01a99ee merge the (still missing) part from -current 2000-07-05 05:04:14 +00:00
Assar Westerlund f7f84723ad fix RCSID 2000-07-05 04:58:45 +00:00
Assar Westerlund 1066becb59 remove extra roken.h 2000-07-05 01:34:59 +00:00
Assar Westerlund 6340d83f0d merge in the missing files from -current 2000-07-05 01:31:30 +00:00
Assar Westerlund 51581eb132 merge krb version of com_err from -current 2000-07-04 15:32:29 +00:00
Assar Westerlund f5664d314e remove ifdef TERMCAP to make this build 2000-07-04 15:26:31 +00:00
Assar Westerlund 5637da09ef update build infrastructure to work with the krb4-1.0 now in crypto
Reviewed by:	kris, markm
2000-07-04 15:23:05 +00:00
Assar Westerlund f968e30a36 merge differences from -current and build this from ../../contrib/com_err
Reviewed by:	kris, markm
2000-07-04 15:15:12 +00:00
Assar Westerlund 3068b6569b merge differences from -current to bring this up to krb4 1.0
Reviewed by:	kris, markm
2000-07-04 15:04:40 +00:00
Roger Hardiman d2f2776304 MFC. remove old rc and login.conf files prior to the gzip -d (extract)
to prevent overwrite yes/no warning messages
2000-07-03 22:33:37 +00:00
Paul Saab 32c546268e MFC: [rev 1.15] Doubling the size of MAXSIZE. 2000-07-03 09:21:04 +00:00
Doug White c83cfb7c17 Reverse rest of patch: -f isn't a valid option in minigzip.
Boot to the head applied to: dwhite, [email protected]
2000-07-01 21:31:01 +00:00
Roger Hardiman b8bf635283 MFC: add .image.list to the files to be deleted 2000-07-01 14:09:23 +00:00
Roger Hardiman e4080f8234 MFC: Add a missing 'fi' 2000-07-01 12:05:13 +00:00
Roger Hardiman dbf14a4897 MFC: Add 'bridge' so we can clean up the bridge files 2000-07-01 04:41:44 +00:00
Doug White 305e2c9e92 Revert part of previous patch: still copy ${MFS}/root to /root in case
there's some shell files in there we actually want.
2000-07-01 04:22:19 +00:00
Doug White d12ca8dcac Quiet gunzip of /etc files.
Submitted by:	Dennis Cartier <[email protected]>
2000-07-01 04:20:07 +00:00
Doug White dfe85a01db Make sure proper init is included .. in some cases the regular init may not
get in the crunch binary (!)

Submitted by:	Dennis Cartier <[email protected]>
2000-07-01 04:19:43 +00:00
Andrey A. Chernov 25679047ff MFC: alt_month assigning 2000-06-29 17:24:37 +00:00
Dag-Erling Smørgrav 4325f05937 MF4: prettify, add $FreeBSD$ and claim maintainership 2000-06-29 09:29:37 +00:00
Satoshi Asami 730e6d0da7 MFC: extra directories (excluding perl5.006 changes). 2000-06-29 07:39:52 +00:00
Andrey A. Chernov 62356fbbfc MFC: localization 2000-06-28 22:48:15 +00:00
David Nugent 98731b5a18 MFC: Fix change detection when editing takes < 1 second.
Add $FreeBSD$

PR:		bin/4238
2000-06-28 00:34:17 +00:00
Alexander Langer c3c0d2aa15 Sheldonification of last commit. 2000-06-27 11:26:50 +00:00
David E. O'Brien fc2059465c Ugrade to version 2.0 PL 1. 2000-06-27 10:30:58 +00:00
Alexander Langer f8a46b4c5a In 3.x, rfork() with RFMEM does not work on SMP kernels.
PR:		15890
Submitted by:	Scott Hess <[email protected]>
2000-06-27 09:59:11 +00:00
Archie Cobbs 89cfb74b29 MFC: token returned by NgSendMsg() and NgSendAsciiMsg() 2000-06-26 19:49:47 +00:00
Archie Cobbs fbc0333b64 MFC: add MLINKS for the functions defined in netgraph(3) 2000-06-26 19:49:09 +00:00
cvs2svn b6ee15397a This commit was manufactured by cvs2svn to create branch 'RELENG_3'. 2000-06-26 08:06:24 +00:00
David Nugent 9069282b9e MFC: don't dereference NULL in userdel case. 2000-06-26 01:22:15 +00:00
Jordan K. Hubbard 59819812ec Commit the "real release notes" for 3.5. I finally had time to go read
through all those %$#@*&! diffs.
2000-06-25 00:20:48 +00:00
Ruslan Ermilov ac9e9923ee MFC: (rev 1.17) Get rid of segfault in a `site %s\' case. 2000-06-23 14:46:54 +00:00
Peter Wemm 31867324b7 MFC: delete; repo copied to src/sys/ufs/ffs directly. 2000-06-23 00:12:51 +00:00
Peter Wemm 74cac63514 MFC: new bsd-style unrestricted license text. 2000-06-22 19:32:07 +00:00
Sheldon Hearn c2693d5148 MFC rev 1.14 and rev 1.15: Fix -i and remove an unused variable. 2000-06-22 12:58:19 +00:00
1152 changed files with 92850 additions and 61679 deletions

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ bin System/User commands.
contrib Packages contributed by 3rd parties.
crypto Export controlled stuff (see crypto/README).
crypto Cryptography stuff (see crypto/README).
etc Template files for /etc
+3
View File
@@ -1,3 +1,6 @@
Updating Information for FreeBSD Stable users
When updating to 4.x-stable from 3.x-stable, please read src/UPDATING
after updating to the new sources for important information.
$FreeBSD$
+13 -5
View File
@@ -40,6 +40,7 @@ static const char rcsid[] =
#endif
#endif /* not lint */
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
@@ -850,13 +851,20 @@ heredoc(term)
Char **vp;
bool quoted;
char *tmp;
struct timeval tv;
if (creat(tmp = short2str(shtemp), 0600) < 0)
stderror(ERR_SYSTEM, tmp, strerror(errno));
(void) close(0);
if (open(tmp, O_RDWR) < 0) {
again:
tmp = short2str(shtemp);
if (open(tmp, O_RDWR|O_CREAT|O_TRUNC|O_EXCL, 0600) < 0) {
int oerrno = errno;
if (errno == EEXIST) {
if (unlink(tmp) == -1) {
(void) gettimeofday(&tv, NULL);
shtemp = Strspl(STRtmpsh, putn((((int)tv.tv_sec) ^
((int)tv.tv_usec) ^ ((int)getpid())) & 0x00ffffff));
}
goto again;
}
(void) unlink(tmp);
errno = oerrno;
stderror(ERR_SYSTEM, tmp, strerror(errno));
+3 -3
View File
@@ -44,10 +44,10 @@ int statcmp __P((const FTSENT *, const FTSENT *));
int revstatcmp __P((const FTSENT *, const FTSENT *));
char *flags_to_string __P((u_long, char *));
void prcopy __P((char *, char *, int));
void printcol __P((DISPLAY *));
void printlong __P((DISPLAY *));
void printscol __P((DISPLAY *));
void usage __P((void));
int len_octal __P((char *, int));
int prn_octal __P((char *));
int len_octal __P((const char *, int));
int prn_octal __P((const char *));
int prn_printable __P((const char *));
-2
View File
@@ -491,8 +491,6 @@ display(p, list)
continue;
}
}
if (f_nonprint)
prcopy(cur->fts_name, cur->fts_name, cur->fts_namelen);
if (cur->fts_namelen > maxlen)
maxlen = cur->fts_namelen;
if (f_octal || f_octal_escape) {
+1
View File
@@ -48,6 +48,7 @@ extern int f_inode; /* print inode */
extern int f_longform; /* long listing format */
extern int f_octal; /* print unprintables in octal */
extern int f_octal_escape; /* like f_octal but use C escapes if possible */
extern int f_nonprint; /* show unprintables as ? */
extern int f_sectime; /* print the real time for all files */
extern int f_size; /* list size in short listing */
extern int f_statustime; /* use time of last mode change */
+19 -9
View File
@@ -81,6 +81,21 @@ printscol(dp)
}
}
/*
* print name in current style
*/
static int
printname(name)
const char *name;
{
if (f_octal || f_octal_escape)
return prn_octal(name);
else if (f_nonprint)
return prn_printable(name);
else
return printf("%s", name);
}
void
printlong(dp)
DISPLAY *dp;
@@ -127,8 +142,7 @@ printlong(dp)
printtime(sp->st_ctime);
else
printtime(sp->st_mtime);
if (f_octal || f_octal_escape) (void)prn_octal(p->fts_name);
else (void)printf("%s", p->fts_name);
(void)printname(p->fts_name);
if (f_type)
(void)printtype(sp->st_mode);
if (S_ISLNK(sp->st_mode))
@@ -228,8 +242,7 @@ printaname(p, inodefield, sizefield)
if (f_size)
chcnt += printf("%*qd ",
(int)sizefield, howmany(sp->st_blocks, blocksize));
chcnt += (f_octal || f_octal_escape) ? prn_octal(p->fts_name)
: printf("%s", p->fts_name);
chcnt += printname(p->fts_name);
if (f_type)
chcnt += printtype(sp->st_mode);
return (chcnt);
@@ -310,9 +323,6 @@ printlink(p)
return;
}
path[lnklen] = '\0';
if (f_octal || f_octal_escape) {
(void)printf(" -> ");
(void)prn_octal(path);
}
else (void)printf(" -> %s", path);
(void)printf(" -> ");
printname(path);
}
+13 -11
View File
@@ -56,17 +56,19 @@ static const char rcsid[] =
#include "ls.h"
#include "extern.h"
void
prcopy(src, dest, len)
char *src, *dest;
int len;
int
prn_printable(s)
const char *s;
{
unsigned char ch;
unsigned char c;
int n;
while (len--) {
ch = *src++;
*dest++ = isprint(ch) ? ch : '?';
}
for (n = 0; (c = *s) != '\0'; ++s, ++n)
if (isprint(c))
putchar(c);
else
putchar('?');
return n;
}
/*
@@ -84,7 +86,7 @@ prcopy(src, dest, len)
int
len_octal(s, len)
char *s;
const char *s;
int len;
{
int r = 0;
@@ -96,7 +98,7 @@ len_octal(s, len)
int
prn_octal(s)
char *s;
const char *s;
{
unsigned char ch;
int len = 0;
+12 -1
View File
@@ -221,7 +221,7 @@ do_move(from, to)
* it's a regular file, do the copy internally; otherwise, use
* cp and rm.
*/
if (stat(from, &sb)) {
if (lstat(from, &sb)) {
warn("%s", from);
return (1);
}
@@ -290,6 +290,17 @@ err: if (unlink(to))
}
if (fchmod(to_fd, sbp->st_mode))
warn("%s: set mode (was: 0%03o)", to, oldmode);
/*
* XXX
* NFS doesn't support chflags; ignore errors unless there's reason
* to believe we're losing bits. (Note, this still won't be right
* if the server supports flags and we were trying to *remove* flags
* on a file that we copied, i.e., that we didn't create.)
*/
errno = 0;
if (fchflags(to_fd, sbp->st_flags))
if (errno != EOPNOTSUPP || sbp->st_flags != 0)
warn("%s: set flags (was: 0%07o)", to, sbp->st_flags);
tval[0].tv_sec = sbp->st_atime;
tval[1].tv_sec = sbp->st_mtime;
+1 -1
View File
@@ -358,7 +358,7 @@ main(argc, argv)
*/
printheader();
if (nentries == 0)
exit(0);
exit(1);
/*
* sort proc list
*/
+1
View File
@@ -109,6 +109,7 @@ setalias(name, val)
ap->val[len+1] = '\0';
}
#endif
ap->flag = 0;
ap->next = *app;
*app = ap;
INTON;
+610
View File
@@ -1,3 +1,613 @@
--- 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 [email protected]).
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().
1028. [protocol] unrecognized TSIG was returning NOERROR (now NOTAUTH).
1027. [support] INSIST(), ENSURE(), et al, now always have sideeffects.
1026. [port] some kernels bogusly return tv_usec>1000000 from
gettimeofday(). panic and dump core when this happens.
1025. [proto] NOTIFY messages should have AA.
1024. [bug] we were unwilling to use the last 10 octets of a
response buffer in certain transaction types.
1023. [port] HP-UX 10.20 was looping inside contrib/dnssigner.
1022. [port] ensure that all handled signals are unblocked.
1021. [bug] the "host" command wasn't properly printing SRV RR's.
1020. [contrib] new "updatehosts" (V1.1.0) contributed by author.
1019. [port] separate CFLAGS and CPPFLAGS for unusual builds.
1018. [bug] When maintain_ixfr_base is set to "no" a zones IXFR
file was still being written too.
1017. [doc] resolver(3) was out of date with respect to recent API
changes.
1016. [bug] nslookup wasn't properly printing SIG RR's.
1015. [bug] when merging group information gr_name and gr_passwd
could be left pointing at freed memory.
1014. [bug] iquery: DoS (potential), information leak.
1013. [bug] mangled hostent structures returned by
gethostbyname_r() and friends.
1012. [doc] add named-bootconf example to INSTALL.
1011. [bug] if spawnxfer() fails we should return immediately.
1010. [bug] bad responses to the initial IXFR/SOA query could
result in using an uninitalised variable.
1009. [port] Add support for darwin / Mac OS X
1008. [doc] specify allow-query default in named.conf.
1007. [bug] only set STREAM_AXFRIXFR if the original query is
an IXFR.
--- 8.2.3-T5B (RC3) released ---
1006. [port] Windows/NT does not have fchown().
1005. [bug] RD was sometimes left set, inappropriately.
1004. [bug] cached NXT's were corrupted.
1003. [bug] correction to #997.
1002. [bug] file descriptor leak in res_nclose().
1001. [port] some builds were too fast.
--- 8.2.3-T4B (RC2) released ---
1000. [bug] #996 was wrongly implemented; replacement fix.
--- 8.2.3-T3B released ---
999. [support] named now makes an effort to create its files with
ownership as specified by -u and -g command options.
998. [support] show version number in NOTIFY log messages.
997. [support] forwarders are now used in order by measured RTT.
996. [protocol] if answering ixfr with full zone, used qtype axfr.
995. [bug] "dig -b" was broken due to missing switch "break;"
994. [bug] named-xfer did not handle empty question sections.
993. [bug] TSIG AXFR was completely broken in DiG.
992. [bug] OPTION_USE_IXFR and OPTION_MAINTAIN_IXFR_BASE had
non-single-bit flag values in src/bin/named/ns_defs.h.
991. [protocol] send A6 glue records in xfr.
990. [bug] we could loose track of a bottom of zone cut if the
write buffer filled up at just the correct moment.
989. [bug] apply to "fetch-glue no;" to notify processing. need
to add A records that would be found this way w/
also-notify.
988. [support] report expired zones when detected in maintainence
pass.
987. [feature] "ndc reconfig -noexpired" skip attempts to load
expired zoned when reconfiguring.
986. [bug] pushlev only needs to be called for axfr/zxfr not ixfr.
--- 8.2.3-T2B released ---
985. [support] remove "view" command from nslookup (it used mktemp()).
984. [bug] always restart processing query from scratch if we
have chased a CNAME as we might still have the answer
in the cache once the CNAME has been resolved.
983. [support] "notify from non-master server" is now debug, not info.
982. [bug] rollback the compression pointers array when a
RRset/RR does not fit.
981. [port] decunix: typedef (u_)int#m_t
980. [bug] mishandled memget failure w/ TCP connections.
979. [bug] we were failing to call ns_stopxfrs() before calling
purge_zone() in some cases.
978. [port] sco50: setsockopt(SO_REUSEADDR) fails on unix domain
sockets
977. [bug] we should be returning notimpl for update forwarding
rather than refused. a client receiving refused
should terminate the update attempt. notimpl should
just cause the client to skip to the next server.
976. [bug] some stats weren't getting incremented, & added a few.
975. [support] SLAVE_FORWARD is now redundant and has been removed.
974. [port] ultrix with vendor's y2k patch explicitly desupported.
973. [bug] some field names added in #935 conflicted with macros.
972. [support] restore heartbeat notifies.
971. [bug] out of order updates in log.
970. [port] solaris: add ipv6 interface scanning support.
969. [bug] post process a zone load to remove any non-glue at
or below bottom of zone.
968. [bug] TSIGs failed to verify if the key name was compressed.
967. [bug] zones signed by the BIND 9 signer failed to load.
--- 8.2.3-T1A released ---
966. [bug] nslookup and dig misprinted root zone in $ORIGIN.
965. [feature] dig's command line input buffer was rather small.
964. [bug] make res_nsearch() behave like res_search() of olde.
963. [bug] res_debug::do_section() can no longer spin all VM.
962. [bug] another almost-complete rewrite of IXFR from kjd (462)
961. [bug] acl "none" now fails to match but doesn't end search.
960. [bug] more hesiod library fixes from danny.
959. [doc] christos fixed several man page typos and brainos.
958. [bug] getnameinfo() should accept experimental/multicast.
957. [port] ultrix again. "cd" now presumed to be silent again.
956. [bug] multiline was not being cleared correctly.
955. [bug] explicit TTL on SOA records were being replaced with
soa minimum.
954. [bug] cannot load a signed root zone.
953. [bug] memory overrun in set_zone_ixfr_file().
952. [bug] errs was not being correctly adjusted if the included
master file did not exist in db_load().
951. [bug] contrib/dns_signer/signer: write_trim_name
array bounds write error.
950. [bug] hesiod: ctx->res was not being initalised.
949. [port] aix32: add prand_conf.h and define WCOREDUMP
948. [bug] fixed logic error in a number of expressions causing
res_ninit() not to be called when it should be.
947. [bug] sanity check in dst_read_key() wasn't.
946. [port] freebsd: threaded library support.
945. [bug] wrong file name logged in ixfr_have_log().
944. [doc] add forwarders to zone types master/slave/stub in
named.conf man page.
943. [bug] raise CNAME and OTHER / multiple CNAME logging to
warning.
942. [bug] bad referrals logged for forwarders.
941. [bug] lame server detection wasn't checking for SOA record.
940. [clarity] unapproved -> denied in log messages.
939. [bug] reload_master and purgeandload should write the zone
if it has been updated.
938. [bug] update and ixfr logs could get corrupted. fseek()
before ftell() on fopen(, "a+") file.
937. [support] allow parallel makes to work.
936. [protocol] add preliminary A6 glue recognition in ns_req.
935. [cleanup] res_nsend() segmented into multiple functions for
readability. also fixed two file descriptor leaks.
CAN_RECONNECT is gone, keep one socket per nameserver.
934. [bug] Perror and Aerror where incorrect if DEBUG is not
defined.
933. [port] cygwin port added
932. [port] sco42 does not have unix domain sockets or gethostid.
931. [bug] eventlib was not handling unix domain sockets
correctly.
930. [bug] we wern't using all the potential compression pointers
in the question section.
929. [bug] we were accepting updates (adds) with illegal ttls.
928. [bug] if we manage to get a illegal ttl stored, print it
unsigened.
927. [port] hpux: (11.* 10.30) Makefile.set.gcc
926. [port] hpux10: gcc needs -D_HPUX_SOURCE and -fPIC
925. [protocol] when a slave loads it should notify others (RFC 1996).
924. [port] sunos solaris: #define NEED_SECURE_DIRECTORY to
secure the directory containing unix domain socket
rather than the socket itself.
923. [support] shutup "make clean" about missing threaded directories.
922. [bug] removing an cached zone file then performing a
"ndc reload zone" should force a zone transfer.
921. [bug] nsupdate: listuprec was not being initalised.
920. [port] aix4: Makefile.set.gcc
aix4: __P was being defined by <net/radix.h>
919 [port] linux: remove one level of symbolic linkage when
performing make links on port/linux/include
918. [bug] update prerequisite could match w/ wildcard.
917. [port] irix: make the current IRIX release (6.5) work by
not patching res_debug.c. see INSTALL if you have
problems with 6.3.
916. [bug] removing / changing a zone type could result in
Z_NOTIFY being cleared / tested against the wrong zone.
915. [bug] evNewWaitList() was not maintaining the prev chain.
914. [bug] signal EWOULDBLOCK if EV_POLL'ing with no timers.
913. [bug] input could get lost on the server side of a ctl sock.
912. [bug] nsupdate now allows explicit 0 TTL's on added RR's.
911. [bug] gethostbyname() should not return duplicate addresses.
910. [bug] address-sorting logic was exiting early.
909. [bug] dig wasn't respecting the +ti and +ret arguments.
908. [contrib] Tony Stoneley sent us an updated misc/makezones.
907. [port] winnt fixes from Larry at Nortel.
906. [bug] res_findzonecut() failed if the NS referred to a CNAME.
905. [doc] Minor fix to doc/man/Makefile for getnameinfo
904. [bug] bin/host wasn't looking up MX records if no
-t flags were passed to it.
--- 8.2.2-P6 released ---
903. [bug] divide by zero bug when querying for SIG records from
a secure zone.
902. [support] don't attempt to set q_fzone if we won't be using it.
901. [support] delay notify timer setting until all zones have been
loaded.
900. [port] hpux10 fix call to bison; sco call bison consistenly.
899. [bug] dynamically allocate buffer used to display RR rather
than uses a fixed sized one. grow as needed.
898. [bug] if truncation caused no RR's to appear in the answer we
mis-classified the answer on a NODATA.
897. [support] descriptors used by named should not be inherited by
named-xfer.
896. [contrib] add contrib/adm/adm-nxt, an exploit for the NXT bug
in 8.2 and 8.2.1. as before, we do not recommend its
use, and we do recommend that you run the latest BIND.
--- 8.2.2-P5 released ---
895. [port] minor NT build and documentation improvements.
+17 -5
View File
@@ -1,23 +1,26 @@
Systems it is known to compile and run on:
BSD/OS 3.1, 4.0.1
FreeBSD 3.1, 3.2, 3.3
FreeBSD 3.3, 3.4
RH Linux 5.2 (don't use "make links" when building, though)
Debian GNU/Linux 2.2.9 ("unreleased")
Digital UNIX 3.2C, 4.0, 5.0
NetBSD/i386 1.3.2, 1.4
Darwin 1.x (Mac OS X)
SunOS 5.6 (Solaris 2.6), SunOS 5.7 (Solaris 7)
SCO UnixWare 7.0, 7.0.1, 7.1
IRIX 6.5
Systems it has been known in the past to compile and run on:
AIX 4.x
A/UX 3.1.1
Digital ULTRIX 4.5
Digital ULTRIX 4.5 (without Compaq's Y2K kit installed)
HP MPE
HP-UX 9.x, 10.20
IRIX 5.3, 6.2, 6.4
LynxOS
FreeBSD 3.1, 3.2
NetBSD 1.2, 1.3
OpenBSD 2.1
QNX
@@ -139,6 +142,12 @@ Operating System Notes
The kit should compile even if you have intalled the KAME
IPv6 kit.
IRIX
build problems have been reported w/ IRIX 6.3, res_debug.c
and #include <stdlib.h>. You may need to comment out
the #include <stdlib.h> and declare
"void *malloc(size_t size)" to get named to compile on 6.3.
Linux
"make links" and "make stdlinks" cause problems on
@@ -166,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.
@@ -257,8 +266,11 @@ Using the Server
there are lots of {curly braces} and it takes some getting used to.
You may get a lot more help from the example file (which is
bin/named/named.conf) than from the documentation (see ../doc/html).
You can convert your named.boot file to a named.conf file if you have
Perl; see bin/named/named-bootconf.pl.
You can convert your named.boot file to a named.conf file using
bin/named-bootconf/named-bootconf.
e.g.
named-bootconf < /etc/named.boot > /etc/named.conf
All the files that used to be created in /var/tmp, e.g. named.run,
will now be created in the directory specified in the options
+2 -2
View File
@@ -1,4 +1,4 @@
## Copyright (c) 1993-1999 by Internet Software Consortium.
## Copyright (c) 1993-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
@@ -19,4 +19,4 @@
Tel: 1-888-868-1001 (toll free in U.S.)
Tel: 1-650-779-7091
Fax: 1-650-779-7055
Email: [email protected]
Email: <[email protected]>
+3 -3
View File
@@ -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
+17 -20
View File
@@ -1,5 +1,5 @@
This is the source portion of BIND version 8.2.2, Patchlevel 5. 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:[email protected]> bug reports
To Support the Effort
Note that BIND is supported by the Internet Software Consortium, and
@@ -208,6 +205,6 @@ To Support the Effort
The Internet Software Consortium has also commissioned a DHCP server
implementation, has taken over official support/release of the INN
system, and supports the Kerberos Version 5 effort at MIT. You can
learn more about the ISC's goals and accomplishments from the web page
at <URL:http://www.isc.org/>.
system, and has supported the Kerberos Version 5 effort at MIT. You
can learn more about the ISC's goals and accomplishments from the web
page at <URL:http://www.isc.org/>.
+9 -10
View File
@@ -1,10 +1,9 @@
> The Internet Software Consortium now offers support agreements for ISC
> software. Under these programs, organizations using BIND, DHCP or INN
> from ISC can obtain a range of on call assistance, bug fixes, training and
> consultation services. These programs are documented on our web page at:
>
> http://www.isc.org/support.html
>
> Discussion about programs to meet your needs is welcome at
> [email protected]. Please forward your questions there or call us at
> +1 650 779-7018 to speak with the Director of Client Services.
The Internet Software Consortium offers, through certified providers, support,
training, and consulting for BIND and DHCP. These programs are documented on
our web page at:
http://www.isc.org/support.html
Discussion about programs to meet your needs is welcome at [email protected].
Please forward your questions there or call us at +1 650 779-7018 to speak
with the Director of Client Services.
+1 -1
View File
@@ -1 +1 @@
8.2.2-P5-NOESW
8.2.3-REL
+9 -8
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.27 1999/08/08 17:13:24 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
@@ -54,11 +54,12 @@ MARGS = "SYSTYPE=${SYSTYPE}" "SHELL=${SHELL}" "A=${A}" "O=${O}" \
"RANLIB=${RANLIB}" "AR=${AR}" "ARPREF=${ARPREF}" "ARSUFF=${ARSUFF}" \
"INCL=../${INCL}" "PORTINCL=../${PORTINCL}" "EXE=${EXE}" \
"LIBBIND=../${LIBBIND}" "LIBPORT=../${LIBPORT}" \
"INSTALL=${INSTALL}" "CPPFLAGS=${CPPFLAGS}" "TOP=../${TOP}" \
"INSTALL=${INSTALL}" "TOP=../${TOP}" \
"VER=${VER}" "STRIP=${STRIP}" "PS=${PS}" "INSTALL_LIB=${INSTALL_LIB}" \
"INSTALL_EXEC=${INSTALL_EXEC}" "BOUNDS=${BOUNDS}"
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
SUBDIRS = addr nslookup dig dnsquery host named named-xfer ndc nsupdate \
mkservdb irpd dnskeygen named-bootconf
@@ -66,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
@@ -84,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:
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.25 1999/08/08 17:51:00 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
@@ -42,7 +42,8 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
PROG= addr
SRCS= ${PROG}.c
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.25 1999/08/08 17:51:01 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
@@ -42,7 +42,8 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
NSLOOKUP_OBJS= \
../nslookup/subr.${O} ../nslookup/send.${O} \
+88 -52
View File
@@ -1,5 +1,5 @@
#ifndef lint
static const char rcsid[] = "$Id: dig.c,v 8.36 1999/11/05 05:05:14 vixie Exp $";
static const char rcsid[] = "$Id: dig.c,v 8.44 2000/12/23 08:14:31 vixie Exp $";
#endif
/*
@@ -167,6 +167,7 @@ static const char rcsid[] = "$Id: dig.c,v 8.36 1999/11/05 05:05:14 vixie Exp $";
#include <isc/dst.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -184,8 +185,8 @@ static const char rcsid[] = "$Id: dig.c,v 8.36 1999/11/05 05:05:14 vixie Exp $";
/* Global. */
#define VERSION 82
#define VSTRING "8.2"
#define VERSION 83
#define VSTRING "8.3"
#define PRF_DEF 0x2ff9
#define PRF_MIN 0xA930
@@ -200,7 +201,6 @@ static const char rcsid[] = "$Id: dig.c,v 8.36 1999/11/05 05:05:14 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];
@@ -227,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 *,
@@ -270,19 +270,17 @@ main(int argc, char **argv) {
ns_type xfr = ns_t_invalid;
int bytes_out, bytes_in;
char cmd[256];
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 */
char fileq[100];
char fileq[384];
int fp;
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;
@@ -348,6 +346,7 @@ main(int argc, char **argv) {
res.id = 1;
gettimeofday(&tv1, NULL);
assert(tv1.tv_usec >= 0 && tv1.tv_usec < 1000000);
/*
* Main section: once if cmd-line query
@@ -357,8 +356,10 @@ main(int argc, char **argv) {
while ((dofile && fgets(fileq, sizeof fileq, qfp) != NULL) ||
(!dofile && once--))
{
if (*fileq == '\n' || *fileq == '#' || *fileq==';')
continue; /* ignore blank lines & comments */
if (*fileq == '\n' || *fileq == '#' || *fileq==';') {
printf("%s", fileq); /* echo but otherwise ignore */
continue; /* blank lines and comments */
}
/*
* "Sticky" requests that before current parsing args
@@ -398,7 +399,7 @@ main(int argc, char **argv) {
if (**argv == '%')
continue;
if (**argv == '+') {
SetOption(*argv+1);
setopt(*argv+1);
continue;
}
if (**argv == '=') {
@@ -422,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)
@@ -439,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++;
@@ -452,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);
@@ -480,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')
@@ -492,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 =
@@ -512,14 +525,18 @@ main(int argc, char **argv) {
";; bad -b addr\n");
exit(1);
}
}
}
break;
case 'k':
/* -k keydir:keyname */
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) {
@@ -845,6 +862,7 @@ main(int argc, char **argv) {
if (res.pfcode & RES_PRF_HEAD1)
fp_resstat(&res, stdout);
(void) gettimeofday(&start_time, NULL);
assert(start_time.tv_usec >= 0 && start_time.tv_usec < 1000000);
if (keyfile)
n = res_nsendsigned(&res, packet, n, &key, answer, sizeof answer);
else
@@ -869,10 +887,9 @@ main(int argc, char **argv) {
}
}
(void) gettimeofday(&end_time, NULL);
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);
@@ -902,6 +919,7 @@ main(int argc, char **argv) {
* batches started at different sites somewhat synchronized.
*/
gettimeofday(&tv2, NULL);
assert(tv2.tv_usec >= 0 && tv2.tv_usec < 1000000);
delay = (int)(tv2.tv_sec - tv1.tv_sec);
if (delay < wait) {
sleep(wait - delay);
@@ -946,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.36 1999/11/05 05:05:14 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);
@@ -1104,6 +1122,7 @@ res_re_init() {
static char localdomain[] = "LOCALDOMAIN";
u_long pfcode = res.pfcode, options = res.options;
unsigned ndots = res.ndots;
int retrans = res.retrans, retry = res.retry;
char *buf;
/*
@@ -1116,6 +1135,8 @@ res_re_init() {
res.pfcode = pfcode;
res.options = options;
res.ndots = ndots;
res.retrans = retrans;
res.retry = retry;
}
/*
@@ -1173,19 +1194,18 @@ 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;
u_char *newmsg;
int newmsglen;
ns_tcp_tsig_state tsig_state;
int tsig_ret;
int tsig_ret, tsig_required, tsig_present;
switch (xfr) {
case ns_t_axfr:
@@ -1403,18 +1423,6 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
break;
}
/*
* Verify the TSIG
*/
if (key) {
tsig_ret = ns_verify_tcp(answer, &len, &tsig_state, 1);
if (tsig_ret == 0)
printf("; TSIG ok\n");
else
printf("; TSIG invalid\n");
}
result = print_axfr(stdout, answer, len);
if (result != 0) {
error = ERR_PRINTING;
@@ -1475,6 +1483,30 @@ printZone(ns_type xfr, const char *zone, const struct sockaddr_in *sin,
break;
}
}
/*
* Verify the TSIG
*/
if (key) {
if (ns_find_tsig(answer, answer + len) != NULL)
tsig_present = 1;
else
tsig_present = 0;
if (numAnswers == 1 || soacnt > 1)
tsig_required = 1;
else
tsig_required = 0;
tsig_ret = ns_verify_tcp(answer, &len, &tsig_state,
tsig_required);
if (tsig_ret == 0) {
if (tsig_present)
printf("; TSIG ok\n");
}
else
printf("; TSIG invalid\n");
}
}
printf(";; Received %d answer%s (%d record%s).\n",
@@ -1504,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');
}
@@ -1570,8 +1602,12 @@ print_axfr(FILE *file, const u_char *msg, size_t msglen) {
}
name = ns_rr_name(rr);
if (origin[0] == '\0' && name[0] != '\0') {
fprintf(file, "$ORIGIN %s.\n", name);
strcpy(origin, name);
if (strcmp(name, ".") != 0)
strcpy(origin, name);
fprintf(file, "$ORIGIN %s.\n", origin);
if (strcmp(name, ".") == 0)
strcpy(origin, name);
strcpy(name_ctx, "@");
}
if (ns_sprintrr(&handle, &rr, name_ctx, origin,
buf, sizeof buf) < 0) {
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.5 1999/08/08 17:51:01 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
@@ -44,7 +44,8 @@ INSTALL_LIB=-o bin -g bin
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
PROG= dnskeygen
SRCS= dnskeygen.c
+4 -3
View File
@@ -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);
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.24 1999/08/08 17:51:01 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
@@ -42,7 +42,8 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
PROG= dnsquery
SRCS= ${PROG}.c
+16 -5
View File
@@ -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);
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.24 1999/08/08 17:51:01 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
@@ -42,7 +42,8 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
PROG= host
SRCS= ${PROG}.c
+94 -57
View File
@@ -1,5 +1,5 @@
#ifndef lint
static const char rcsid[] = "$Id: host.c,v 8.34 1999/11/11 19:39:10 cyarnell 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;
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) {
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;
@@ -1043,7 +1053,7 @@ pr_rr(const u_char *cp, const u_char *msg, FILE *file, int filter) {
cp += sizeof(u_short);
cp = (u_char *)pr_cdname(cp, msg, name, sizeof(name));
if (doprint)
fprintf(file,"%s",name);
fprintf(file, " %s", name);
break;
case ns_t_naptr:
@@ -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;
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;
}
if (error != NO_ERRORS)
break;
}
cp += n;
if (cp + INT16SZ > buf.qb2 + len) {
error = ERR_PRINTING;
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;
+8 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.3 1999/02/22 02:47:55 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
@@ -46,7 +46,8 @@ STRIP=-s
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL} -I${TOP}/lib/irs ${DEFS}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL} -I${TOP}/lib/irs ${DEFS}
VER= LOCAL-`date +%y%m%d.%H%M%S`
HOSTNAMECMD= hostname || uname -n
@@ -61,6 +62,8 @@ all: ${PROG}${EXE}
${PROG}${EXE}: irpd.${O} tmp_version.${O} ${LIBBIND}
${CC} ${CDEBUG} ${LDFLAGS} -o ${PROG}${EXE} ${OBJS} tmp_version.${O} \
${LIBBIND} ${SYSLIBS}
.c.${O}:
${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} -c $*.c
tmp_version.${O}: tmp_version.c
@@ -68,7 +71,7 @@ tmp_version.c: version.c Makefile ../Makefile ${SRCS} ${HDRS}
(u=$${USER-root} d=`pwd` h=`${HOSTNAMECMD}` t=`date`; \
sed -e "s|%WHEN%|$${t}|" -e "s|%VERSION%|"${VER}"|" \
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
< version.c > tmp_version.c)
< version.c > tmp_version.c); sleep 1
distclean: clean
+16 -138
View File
@@ -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.7 1999/10/13 16:26:23 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, ...);
@@ -329,9 +326,10 @@ int
main(int argc, char **argv) {
struct ctl_sctx *ctx;
struct sockaddr *addr;
#ifndef NO_SOCKADDR_UN
struct sockaddr_un uaddr;
#endif
struct sockaddr_in iaddr;
log_channel chan;
short port = IRPD_PORT;
char *prog = argv[0];
char *sockname = IRPD_PATH;
@@ -342,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':
@@ -358,11 +356,13 @@ main(int argc, char **argv) {
}
break;
#ifndef NO_SOCKADDR_UN
case 'u':
sockname = optarg;
addr = (struct sockaddr *)&uaddr;
socksize = sizeof uaddr;
break;
#endif
case 'h':
case '?':
@@ -374,7 +374,6 @@ main(int argc, char **argv) {
argc -= optind;
argv += optind;
memset(&uaddr, 0, sizeof uaddr);
memset(&iaddr, 0, sizeof iaddr);
#ifdef HAVE_SA_LEN
@@ -384,17 +383,21 @@ main(int argc, char **argv) {
iaddr.sin_port = htons(IRPD_PORT);
iaddr.sin_addr.s_addr = htonl(INADDR_ANY);
uaddr.sun_family = AF_UNIX;
strncpy(uaddr.sun_path, sockname, sizeof uaddr.sun_path);
#ifndef NO_SOCKADDR_UN
memset(&uaddr, 0, sizeof uaddr);
if (addr == (struct sockaddr *)&uaddr) {
uaddr.sun_family = AF_UNIX;
strncpy(uaddr.sun_path, sockname, sizeof uaddr.sun_path);
#ifdef HAVE_SA_LEN
uaddr.sun_len = SUN_LEN(&uaddr);
uaddr.sun_len = SUN_LEN(&uaddr);
#endif
if (addr == (struct sockaddr *)&uaddr)
socksize = SUN_LEN(&uaddr);
/* XXX what if this file is not currently a socket? */
unlink(sockname);
/* XXX what if this file is not currently a socket? */
unlink(sockname);
}
#endif
evCreate(&ev);
@@ -441,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) {
@@ -493,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);
@@ -532,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);
@@ -584,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);
@@ -650,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);
@@ -676,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);
@@ -735,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);
@@ -779,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);
@@ -840,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);
@@ -865,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);
@@ -908,34 +889,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,
@@ -952,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);
@@ -1008,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;
@@ -1098,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);
@@ -1129,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);
@@ -1188,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);
@@ -1232,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);
@@ -1293,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);
@@ -1318,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);
@@ -1365,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);
@@ -1418,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);
@@ -1487,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);
@@ -1512,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);
@@ -1570,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);
@@ -1614,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);
@@ -1675,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);
@@ -1700,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);
@@ -1750,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);
@@ -1787,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;
@@ -1830,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);
}
@@ -1863,7 +1766,6 @@ irpd_setnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
"setnetgrent ok");
}
untimely:
free_args(args);
}
@@ -1879,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);
@@ -1896,20 +1797,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,
@@ -2232,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);
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.6 1999/08/08 17:51:01 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
@@ -41,7 +41,8 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
PROG= mkservdb
SRCS= ${PROG}.c
+17 -10
View File
@@ -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);
}
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.1 1999/01/07 02:09:37 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
@@ -41,7 +41,8 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
PROG= named-bootconf
@@ -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;"
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.29 1999/08/08 17:51:02 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
@@ -45,7 +45,8 @@ INSTALL_LIB=-o bin -g bin
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
NAMED_OBJS= \
../named/db_glue.${O} ../named/ns_glue.${O} ../named/tmp_version.${O}
File diff suppressed because it is too large. Load diff
+7 -6
View File
@@ -1,4 +1,4 @@
## Copyright (c) 1996-1999 by Internet Software Consortium
## Copyright (c) 1996-2000 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
@@ -13,17 +13,17 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.47 1999/08/26 18:42:31 vixie Exp $
# $Id: Makefile,v 8.51 2000/12/23 08:02:53 vixie Exp $
# $FreeBSD$
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
@@ -48,7 +48,8 @@ INSTALL_LIB=-o bin -g bin
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL} ${DEFS}
VER= LOCAL-`date +%Y%m%d.%H%M%S`
HOSTNAMECMD= hostname || uname -n
@@ -87,7 +88,7 @@ tmp_version.c: version.c Makefile ../Makefile ${SRCS} ${HDRS}
(u=$${USER-root} d=`pwd` h=`${HOSTNAMECMD}` t=`date`; \
sed -e "s|%WHEN%|$${t}|" -e "s|%VERSION%|"${VER}"|" \
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
< version.c > tmp_version.c)
< version.c > tmp_version.c); sleep 1
pathnames.h: ${TOP}/.settings Makefile pathtemplate.h
rm -f pathnames.h
+22 -3
View File
@@ -1,6 +1,6 @@
/*
* from db.h 4.16 (Berkeley) 6/1/90
* $Id: db_defs.h,v 8.36 1999/08/26 18:42:32 vixie Exp $
* $Id: db_defs.h,v 8.40 2000/11/29 06:55:46 marka Exp $
*/
/*
@@ -57,7 +57,7 @@
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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
@@ -307,3 +322,7 @@ struct db_rrset {
if (((x)->d_rcnt)-- == 0) \
ns_panic(ns_log_db, 1, "d_rcnt-- == 0"); \
} while (0)
#define ISVALIDGLUE(xdp) ((xdp)->d_type == T_NS || (xdp)->d_type == T_A \
|| (xdp)->d_type == T_AAAA || (xdp)->d_type == ns_t_a6)
+51 -21
View File
@@ -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.40 1999/10/13 16:39: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 */
/*
@@ -82,7 +82,7 @@ static const char rcsid[] = "$Id: db_dump.c,v 8.40 1999/10/13 16:39:01 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -125,15 +125,20 @@ static const char rcsid[] = "$Id: db_dump.c,v 8.40 1999/10/13 16:39: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,9 +146,15 @@ 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);
if (fwddata != NULL && fwddata_count != 0)
fwd_dump(fp);
fputs(
"; Note: Cr=(auth,answer,addtnl,cache) tag only shown for non-auth RR's\n",
fp);
@@ -203,6 +214,19 @@ zt_dump(FILE *fp) {
return (0);
}
static int
fwd_dump(FILE *fp) {
int i;
fprintf(fp, ";; ++forwarders table++\n");
for (i=0;i<fwddata_count;i++) {
fprintf(fp,"; %s rtt=%d\n",
inet_ntoa(fwddata[i]->fwdaddr.sin_addr),
fwddata[i]->nsdata->d_nstime);
}
fprintf(fp, ";; --forwarders table--\n");
return (0);
}
int
db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) {
struct databuf *dp = NULL;
@@ -276,9 +300,9 @@ db_dump(struct hashbuf *htp, FILE *fp, int zone, char *origin) {
fprintf(fp, "%d\t",
(int)(dp->d_ttl - tt.tv_sec));
} else if (dp->d_ttl != USE_MINIMUM)
fprintf(fp, "%d\t", (int)dp->d_ttl);
fprintf(fp, "%u\t", dp->d_ttl);
else
fprintf(fp, "%d\t",
fprintf(fp, "%u\t",
zones[dp->d_zone].z_minimum);
fprintf(fp, "%s\t%s\t",
p_class(dp->d_class),
@@ -457,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;
@@ -613,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);
}
}
+54 -56
View File
@@ -52,7 +52,7 @@
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -90,53 +90,53 @@
/* db_proc.h - prototypes for functions in db_*.c
*
* $Id: db_func.h,v 8.40 1999/10/07 08:24:06 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++ */
struct ns_updrec * 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);
+3 -2
View File
@@ -1,6 +1,6 @@
/*
* from db.h 4.16 (Berkeley) 6/1/90
* $Id: db_glob.h,v 8.12 1999/08/08 21:10:01 vixie Exp $
* $Id: db_glob.h,v 8.14 2000/04/21 06:54:02 vixie Exp $
*/
/*
@@ -57,7 +57,7 @@
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -95,6 +95,7 @@ DECL struct hashbuf *fcachetab INIT(NULL);
/* state of ns_reload() and ns_reconfig(). */
DECL int reloading INIT(0);
DECL int reconfiging INIT(0);
DECL int noexpired INIT(0);
DECL const int hashsizes[]
#ifdef MAIN_PROGRAM
+4 -13
View File
@@ -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.39 1999/10/15 19:48:57 vixie Exp $";
static const char rcsid[] = "$Id: db_glue.c,v 8.42 2000/12/23 08:14:35 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_glue.c,v 8.39 1999/10/15 19:48:57 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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;
}
+151 -88
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static char rcsid[] = "$Id: db_ixfr.c,v 8.18 1999/10/15 19:48:57 vixie Exp $";
#endif /* not lint */
static char rcsid[] = "$Id: db_ixfr.c,v 8.23 2000/12/23 08:14:35 vixie Exp $";
#endif
/*
* Portions Copyright (c) 1999 by Check Point Software Technologies, Inc.
@@ -51,81 +51,137 @@ static char rcsid[] = "$Id: db_ixfr.c,v 8.18 1999/10/15 19:48:57 vixie Exp $
#include <isc/eventlib.h>
#include <isc/logging.h>
#include <isc/memcluster.h>
#include "port_after.h"
#include "named.h"
#define DBIXFR_ERROR -1
#define DBIXFR_FOUND_RR 2
#define DBIXFR_END 3
#define DBIXFR_ERROR (-1)
#define DBIXFR_FOUND_RR 2
#define DBIXFR_END 3
static int ixfr_getrr(struct zoneinfo *, FILE *, const char *, char *,
ns_updrec **, u_int32_t *, u_int32_t *);
static int ixfr_getdelta(struct zoneinfo *, FILE *, const char *, char *,
ns_updque *, u_int32_t *, u_int32_t *);
ns_updrec *
ns_deltalist *
ixfr_get_change_list(struct zoneinfo *zp,
u_int32_t from_serial, u_int32_t to_serial)
{
FILE * fp;
FILE * fp = NULL;
u_int32_t old_serial, new_serial;
char origin[MAXDNAME];
struct namebuf *np, *listnp, *finlistnp;
LIST(ns_updrec) listuprec;
int ret, mode;
ns_deltalist *dlhead = NULL;
int ret;
ns_updrec *uprec;
ns_delta *dl;
if (SEQ_GT(from_serial, to_serial))
return (NULL);
listnp = finlistnp = NULL;
INIT_LIST(listuprec);
dlhead = memget(sizeof(*dlhead));
if (dlhead == NULL)
return (NULL);
INIT_LIST(*dlhead);
if ((fp = fopen(zp->z_ixfr_base, "r")) == NULL) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
return (NULL);
goto cleanup;
}
strcpy(origin, zp->z_origin);
lineno = 1;
np = NULL;
mode = 0;
old_serial = new_serial = 0;
for (;;) {
ret = ixfr_getrr(zp, fp, zp->z_ixfr_base, origin, &uprec,
&old_serial, &new_serial);
dl = memget(sizeof *dl);
if (dl == NULL) {
ns_warning(ns_log_db,
"ixfr_get_change_list: out of memory");
goto cleanup;
}
INIT_LINK(dl, d_link);
INIT_LIST(dl->d_changes);
ret = ixfr_getdelta(zp, fp, zp->z_ixfr_base, origin, &dl->d_changes,
&old_serial, &new_serial);
switch (ret) {
case DBIXFR_ERROR:
(void) my_fclose(fp);
ns_warning(ns_log_db, "Logical error in %s line %d",
zp->z_ixfr_base, lineno);
return (NULL);
ns_warning(ns_log_db, "Logical error in %s: unlinking",
zp->z_ixfr_base);
unlink(zp->z_ixfr_base);
goto cleanup;
case DBIXFR_FOUND_RR:
if (EMPTY(listuprec)) {
ns_debug(ns_log_default, 4, "ixfr_getdelta DBIXFR_FOUND_RR (%s)",
zp->z_origin);
if (EMPTY(*dlhead)) {
/* skip updates prior to the one we want */
if (uprec->r_zone != from_serial) {
while (uprec != NULL) {
ns_updrec *prev;
uprec = HEAD(dl->d_changes);
INSIST(uprec != NULL);
if ((uprec->r_zone < from_serial) ||
(uprec->r_zone > to_serial))
{
while ((uprec = HEAD(dl->d_changes)) != NULL) {
UNLINK(dl->d_changes, uprec, r_link);
if (uprec->r_dp != NULL)
db_freedata(uprec->r_dp);
db_freedata(uprec->r_dp);
uprec->r_dp = NULL;
prev = PREV(uprec, r_link);
res_freeupdrec(uprec);
uprec = prev;
}
memput(dl, sizeof *dl);
break;
}
else if (uprec->r_zone > from_serial) {
/* missed the boat */
ns_debug(ns_log_default, 3,
"ixfr_getdelta first SOA is %d, asked for %d (%s)",
uprec->r_zone,
from_serial,
zp->z_origin);
goto cleanup;
}
}
APPEND(listuprec, uprec, r_link);
/* continue; */
ns_debug(ns_log_default, 4,
"adding to change list (%s)",
zp->z_origin);
APPEND(*dlhead, dl, d_link);
break;
case DBIXFR_END:
ns_debug(ns_log_default, 4,
"ixfr_getdelta DBIXFR_END (%s)",
zp->z_origin);
(void) my_fclose(fp);
return (HEAD(listuprec));
memput(dl, sizeof *dl);
return (dlhead);
default:
(void) my_fclose(fp);
if (dl != NULL)
memput(dl, sizeof *dl);
return (NULL);
}
}
cleanup:
if (fp != NULL)
(void) my_fclose(fp);
while ((dl = HEAD(*dlhead)) != NULL) {
UNLINK(*dlhead, dl, d_link);
while ((uprec = HEAD(dl->d_changes)) != NULL) {
UNLINK(dl->d_changes, uprec, r_link);
if (uprec->r_dp != NULL)
db_freedata(uprec->r_dp);
uprec->r_dp = NULL;
res_freeupdrec(uprec);
}
memput(dl, sizeof *dl);
}
memput(dlhead, sizeof *dlhead);
return (NULL);
}
/*
@@ -137,7 +193,7 @@ ixfr_get_change_list(struct zoneinfo *zp,
*
* returns:
* 0 = serial number is up to date
* 1 = transision is possible
* 1 = transmission is possible
* -1 = error while opening the ixfr transaction log
* -2 = error in parameters
* -3 = logical error in the history file
@@ -147,14 +203,17 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
{
FILE *fp;
u_int32_t old_serial = 0, new_serial = 0;
u_int32_t last_serial = 0;
u_int32_t first_serial = 0;
char buf[BUFSIZ];
char *cp;
struct stat st;
int nonempty_lineno = -1, prev_pktdone = 0, cont = 0,
inside_next = 0;
int err;
int first = 0;
int rval = 0;
int id, rcode = NOERROR;
if (SEQ_GT(from_serial, to_serial))
return (-2);
if (from_serial == to_serial)
@@ -162,6 +221,10 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
/* If there is no log file, just return. */
if (zp->z_ixfr_base == NULL || zp->z_updatelog == NULL)
return (-1);
if (zp->z_serial_ixfr_start > 0) {
if (from_serial >= zp->z_serial_ixfr_start)
return (1);
}
if (stat(zp->z_ixfr_base, &st) < 0) {
if (errno != ENOENT)
ns_error(ns_log_db,
@@ -176,17 +239,18 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
}
if (fgets(buf, sizeof(buf), fp) == NULL) {
ns_error(ns_log_update, "fgets() from %s failed: %s",
zp->z_updatelog, strerror(errno));
zp->z_ixfr_base, strerror(errno));
fclose(fp);
return (-1);
}
if (strcmp(buf, LogSignature) != 0) {
ns_error(ns_log_update, "invalid log file %s",
zp->z_updatelog);
zp->z_ixfr_base);
fclose(fp);
return (-3);
}
lineno = 1;
first = 1;
for (;;) {
if (getword(buf, sizeof buf, fp, 0)) {
nonempty_lineno = lineno;
@@ -214,12 +278,13 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
if (cp != NULL)
lineno++;
if (sscanf((char *) cp, "%u", &old_serial)) {
if (first == 1) {
first = 0;
first_serial = old_serial;
}
last_serial = old_serial;
if (from_serial >= old_serial) {
fclose(fp);
return (1);
} else {
fclose(fp);
return (-1);
rval = 1;
}
}
prev_pktdone = 1;
@@ -232,14 +297,16 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
if (cp == NULL ||
sscanf((char *) cp, "from %u to %u",
&old_serial, &new_serial) != 2) {
fclose(fp);
return (-3);
rval = -3;
break;
} else if (from_serial >= old_serial) {
fclose(fp);
return (1);
if (first == 1) {
first = 0;
first_serial = old_serial;
}
last_serial = old_serial;
rval = 1;
}
fclose(fp);
return (-1);
}
if (prev_pktdone) {
prev_pktdone = 0;
@@ -248,7 +315,19 @@ ixfr_have_log(struct zoneinfo *zp, u_int32_t from_serial, u_int32_t to_serial)
}
}
fclose(fp);
return (0);
if (last_serial +1 < zp->z_serial) {
ns_warning(ns_log_db,
"%s: File Deleted. Found gap between serial:"
" %d and current serial: %d",
zp->z_ixfr_base, last_serial, zp->z_serial);
(void) unlink(zp->z_ixfr_base);
rval = -3;
}
if (from_serial < first_serial || from_serial > last_serial)
rval = -3;
if (rval == 1)
zp->z_serial_ixfr_start = first_serial;
return (rval);
}
/* from db_load.c */
@@ -278,12 +357,7 @@ static struct map m_opcode[] = {
#define M_TYPE_CNT m_type_cnt
/*
* int
* ixfr_getrr(struct zoneinfo *zp, FILE *fp,
* const char *filename, char *origin, struct namebuf **np,
* u_int32_t *old_serial, u_int32_t *new_serial)
*
* read a line from the historic of a zone.
* read a line from the history of a zone.
*
* returns:
*
@@ -292,20 +366,17 @@ static struct map m_opcode[] = {
* DBIXFR_END = end of file
*/
static int
ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
ns_updrec **uprec, u_int32_t *old_serial,
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;
int nonempty_lineno = -1, prev_pktdone = 0, cont = 0,
inside_next = 0;
int id, rcode = NOERROR;
int id;
int i, c, section, opcode, matches, zonenum, err, multiline;
int type, class;
u_int32_t n;
@@ -314,9 +385,7 @@ ixfr_getrr(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_updque listuprec;
ns_updrec * rrecp;
u_long l;
@@ -325,7 +394,6 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
err = 0;
transport = primary_trans;
lineno = 1;
INIT_LIST(listuprec);
for (;;) {
if (!getword(buf, sizeof buf, fp, 0)) {
if (lineno == (nonempty_lineno + 1) && !(feof(fp))) {
@@ -337,11 +405,10 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
}
/*
* Empty line or EOF.
*
* Marks completion of current update packet.
*/
if (feof(fp))
break;
inside_next = 0;
prev_pktdone = 1;
cont = 1;
} else {
nonempty_lineno = lineno;
@@ -349,15 +416,12 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
if (!strcasecmp(buf, "[DYNAMIC_UPDATE]") ||
!strcasecmp(buf, "[IXFR_UPDATE]")) {
err = 0;
rcode = NOERROR;
cp = fgets(buf, sizeof buf, fp);
if (cp != NULL)
lineno++;
if (cp == NULL || !sscanf((char *) cp, "id %d", &id))
id = -1;
inside_next = 1;
prev_pktdone = 1;
cont = 1;
} else if (!strcasecmp(buf, "[INCR_SERIAL]")) {
/* XXXRTH not enough error checking here */
@@ -380,14 +444,11 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
lineno++;
}
if (prev_pktdone) {
if (!EMPTY(listuprec)) {
if (!EMPTY(*listuprec)) {
n++;
*uprec = TAIL(listuprec);
return (DBIXFR_FOUND_RR);
}
prev_pktdone = 0;
if (feof(fp))
break;
}
if (cont) {
cont = 0;
@@ -418,7 +479,7 @@ ixfr_getrr(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++;
@@ -573,14 +634,15 @@ ixfr_getrr(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;
@@ -600,11 +662,13 @@ ixfr_getrr(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;
@@ -800,9 +864,7 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
ns_debug(ns_log_update, 1,
"merge of update id %d failed due to error at line %d",
id, lineno);
memset(&empty_from, 0, sizeof empty_from);
free_rrecp(&listuprec, rcode, empty_from);
continue;
return (DBIXFR_ERROR);
}
rrecp = res_mkupdrec(section, dname, class, type, ttl);
if (section != S_ZONE) {
@@ -822,7 +884,7 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
ns_updrec *arp;
int foundmatch;
arp = TAIL(listuprec);
arp = TAIL(*listuprec);
foundmatch = 0;
while (arp) {
if (arp->r_section == S_UPDATE &&
@@ -837,7 +899,7 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
db_cmp(arp->r_dp, dp) == 0) {
db_freedata(dp);
db_freedata(arp->r_dp);
UNLINK(listuprec, arp, r_link);
UNLINK(*listuprec, arp, r_link);
res_freeupdrec(arp);
res_freeupdrec(rrecp);
foundmatch = 1;
@@ -849,7 +911,7 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
continue;
}
APPEND(listuprec, rrecp, r_link);
APPEND(*listuprec, rrecp, r_link);
/* Override zone number with current zone serial number */
rrecp->r_zone = serial;
}
@@ -859,3 +921,4 @@ ixfr_getrr(struct zoneinfo *zp, FILE *fp, const char *filename, char *origin,
return (DBIXFR_END);
}
+107 -33
View File
@@ -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.97 1999/10/30 03:21:35 vixie Exp $";
static const char rcsid[] = "$Id: db_load.c,v 8.110 2001/01/25 05:50:53 marka Exp $";
#endif /* not lint */
/*
@@ -82,7 +82,7 @@ static const char rcsid[] = "$Id: db_load.c,v 8.97 1999/10/30 03:21:35 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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);
@@ -267,7 +268,16 @@ db_load(const char *filename, const char *in_origin,
switch (zp->z_type) {
case Z_PRIMARY:
/* 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:
@@ -292,6 +302,7 @@ db_load(const char *filename, const char *in_origin,
default_warn = 1;
clev = nlabels(in_origin);
filenames = NULL;
zp->z_minimum = USE_MINIMUM;
}
ttl = default_ttl;
@@ -311,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;
@@ -358,7 +372,8 @@ db_load(const char *filename, const char *in_origin,
endline(fp);
}
didinclude = 1;
errs += db_load(buf, tmporigin, zp, domain, ISNOTIXFR);
i = db_load(buf, tmporigin, zp, domain, ISNOTIXFR);
errs += (i == -1) ? 1 : i;
continue;
case ORIGIN:
@@ -410,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)) {
@@ -526,7 +552,7 @@ db_load(const char *filename, const char *in_origin,
ns_warning(ns_log_load,
"Zone \"%s\" (file %s): %s",
zp->z_origin, filename,
"No default TTL set using SOA minimum instead");
"No default TTL ($TTL <value>) set, using SOA minimum instead");
default_warn = 0;
}
ttl = (u_int32_t)default_ttl;
@@ -664,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 {
@@ -673,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;
@@ -742,14 +769,15 @@ db_load(const char *filename, const char *in_origin,
zp->z_minimum = 0;
} else
zp->z_minimum = n;
if (default_ttl == USE_MINIMUM)
if (ttl == USE_MINIMUM)
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 \")\"");
multiline = 0;
endline(fp);
}
read_soa++;
@@ -802,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);
@@ -869,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);
@@ -971,7 +1002,10 @@ db_load(const char *filename, const char *in_origin,
case ns_t_cert:
case ns_t_sig: {
char *errmsg = NULL;
int ret = parse_sec_rdata(buf, sizeof(buf), 0,
int ret;
if (ttl == USE_MINIMUM) /* no ttl set */
ttl = 0;
ret = parse_sec_rdata(buf, sizeof(buf), 0,
data, sizeof(data),
fp, zp, domain, ttl,
type, domain_ctx,
@@ -1022,6 +1056,8 @@ db_load(const char *filename, const char *in_origin,
zp->z_origin);
continue;
}
if (ttl == USE_MINIMUM) /* no ttl set */
ttl = 0;
dp = savedata(class, type, (u_int32_t)ttl,
(u_char *)data, (int)n);
dp->d_zone = zp - zones;
@@ -1083,18 +1119,29 @@ db_load(const char *filename, const char *in_origin,
zp->z_origin, filename, msg);
}
}
errs += purge_nonglue(zp->z_origin,
(dataflags & DB_F_HINT) ? fcachetab :
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,
@@ -1115,8 +1162,8 @@ db_load(const char *filename, const char *in_origin,
void
db_err(int err, char *domain, int type, const char *filename, int lineno) {
if (filename != NULL && err == CNAMEANDOTHER)
ns_notice(ns_log_load, "%s:%d:%s: CNAME and OTHER data error",
filename, lineno, domain);
ns_warning(ns_log_load, "%s:%d:%s: CNAME and OTHER data error",
filename, lineno, domain);
if (err != DATAEXISTS)
ns_debug(ns_log_load, 1, "update failed %s %d",
domain, type);
@@ -1353,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 == ';')
@@ -1434,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;
@@ -1448,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;
@@ -1457,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;
@@ -1528,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);
}
/*
@@ -2078,7 +2151,8 @@ parse_sig_rr(char *buf, int buf_len, u_char *data, int data_size,
if (!getmlword(buf, my_buf_size, fp, 0))
ERRTO("Missing label count");
la = wordtouint32(buf);
if (0 == la || wordtouint32_error || 255 <= la)
if (wordtouint32_error || 255 <= la ||
(0 == la && *domain != '\0'))
ERRTO("Bad label count number");
data[i] = (u_char) la;
i++;
@@ -2104,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];
+14 -4
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)db_lookup.c 4.18 (Berkeley) 3/21/91";
static const char rcsid[] = "$Id: db_lookup.c,v 8.24 1999/10/15 19:48:58 vixie Exp $";
static const char rcsid[] = "$Id: db_lookup.c,v 8.26 2000/04/21 06:54:03 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_lookup.c,v 8.24 1999/10/15 19:48:58 vixie E
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -291,8 +291,18 @@ nxtlower(const char *name, struct databuf *dp) {
int
nxtmatch(const char *name, struct databuf *dp1, struct databuf *dp2) {
int dp1_lower, dp2_lower;
if (dp1->d_type != ns_t_nxt || dp2->d_type != ns_t_nxt)
int type1, type2;
if (dp1->d_type == ns_t_sig)
type1 = SIG_COVERS(dp1);
else
type1 = dp1->d_type;
if (dp2->d_type == ns_t_sig)
type2 = SIG_COVERS(dp2);
else
type2 = dp2->d_type;
if (type1 != ns_t_nxt || type2 != ns_t_nxt)
return (0);
dp1_lower = nxtlower(name, dp1);
dp2_lower = nxtlower(name, dp2);
+3 -3
View File
@@ -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.26 1999/10/13 16:39:02 vixie Exp $";
static const char rcsid[] = "$Id: db_save.c,v 8.28 2000/11/29 06:55:48 marka Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_save.c,v 8.26 1999/10/13 16:39:02 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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);
+3 -3
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: db_sec.c,v 8.30 1999/10/15 21:06:49 vixie Exp $";
static const char rcsid[] = "$Id: db_sec.c,v 8.32 2000/12/23 08:14:36 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_sec.c,v 8.30 1999/10/15 21:06:49 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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;
/*
+2 -2
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: db_tsig.c,v 8.5 1999/10/15 19:48:59 vixie Exp $";
static const char rcsid[] = "$Id: db_tsig.c,v 8.6 2000/04/21 06:54:04 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_tsig.c,v 8.5 1999/10/15 19:48:59 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
+9 -15
View File
@@ -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.39 1999/10/15 19:48:59 vixie Exp $";
static const char rcsid[] = "$Id: db_update.c,v 8.45 2000/12/23 08:14:36 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: db_update.c,v 8.39 1999/10/15 19:48:59 vixie E
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -169,10 +169,6 @@ findMyZone(struct namebuf *np, int class) {
return (DB_Z_CACHE);
}
#define ISVALIDGLUE(xdp) ((xdp)->d_type == T_NS || (xdp)->d_type == T_A \
|| (xdp)->d_type == T_AAAA)
/* int
* db_update(name, odp, newdp, savedpp, flags, htp, from)
* update data base node at `name'. `flags' controls the action.
@@ -587,16 +583,17 @@ 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) {
ns_info(ns_log_db,
ns_warning(ns_log_db,
"%s has multiple CNAMES",
name);
name);
return (CNAMEANDOTHER);
} else
goto delete;
}
#if 0
/* BEW - this _seriously_ breaks DNSSEC. Is it necessary for dynamic update? */
#ifdef BIND_UPDATE
@@ -755,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;
@@ -941,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);
+2 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
@@ -16,7 +16,7 @@
*/
/*
* $Id: named.h,v 8.25 1999/10/13 18:00:19 vixie Exp $
* $Id: named.h,v 8.27 2000/04/21 06:54:04 vixie Exp $
*/
/* Options. Change them at your peril. */
@@ -30,7 +30,6 @@
#define QRYLOG
#define YPKLUDGE
#define RENICE
#define SLAVE_FORWARD
#define BIND_IXFR
#define BIND_NOTIFY
#define BIND_UPDATE
+112 -40
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_config.c,v 8.104 1999/11/08 23:09:42 vixie Exp $";
static const char rcsid[] = "$Id: ns_config.c,v 8.118 2000/12/23 08:14:37 vixie Exp $";
#endif /* not lint */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
@@ -431,7 +431,6 @@ begin_zone(char *name, int class) {
zp->z_origin = name;
zp->z_class = class;
zp->z_checknames = not_set;
zp->z_log_size_ixfr = 0;
if (server_options->flags & OPTION_MAINTAIN_IXFR_BASE)
zp->z_maintain_ixfr_base = 1;
else
@@ -478,7 +477,6 @@ update_zone_info(struct zoneinfo *zp, struct zoneinfo *new_zp) {
new_zp->z_origin = NULL;
zp->z_maintain_ixfr_base = new_zp->z_maintain_ixfr_base;
zp->z_max_log_size_ixfr = new_zp->z_max_log_size_ixfr;
zp->z_log_size_ixfr = new_zp->z_log_size_ixfr;
zp->z_class = new_zp->z_class;
zp->z_type = new_zp->z_type;
zp->z_checknames = new_zp->z_checknames;
@@ -557,6 +555,7 @@ update_zone_info(struct zoneinfo *zp, struct zoneinfo *new_zp) {
/* File has changed, or hasn't been loaded yet. */
if (zp->z_source) {
freestr(zp->z_source);
ns_stopxfrs(zp);
purge_zone(zp->z_origin, fcachetab, zp->z_class);
}
zp->z_source = new_zp->z_source;
@@ -684,7 +683,8 @@ update_zone_info(struct zoneinfo *zp, struct zoneinfo *new_zp) {
zp->z_ixfr_tmp = new_zp->z_ixfr_tmp;
new_zp->z_ixfr_tmp = NULL;
if ((zp->z_flags & Z_AUTH) == 0)
if ((!noexpired || ((zp->z_flags & Z_EXPIRED) == 0)) &&
((zp->z_flags & Z_AUTH) == 0))
zoneinit(zp);
else {
/*
@@ -833,7 +833,7 @@ set_zone_ixfr_file(zone_config zh, char *filename) {
return (0);
zp->z_ixfr_base = filename;
if (zp->z_ixfr_tmp == NULL) {
int len = strlen(zp->z_ixfr_base) + (sizeof ".tmp" - 1);
int len = strlen(zp->z_ixfr_base) + (sizeof ".tmp");
char *str = (char *) memget(len);
sprintf(str, "%s.tmp", zp->z_ixfr_base);
@@ -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:
@@ -1450,6 +1454,7 @@ write_open(char *filename) {
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
if (fd < 0)
return (NULL);
(void) fchown(fd, user_id, group_id);
stream = fdopen(fd, "w");
if (stream == NULL)
(void)close(fd);
@@ -1742,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);
@@ -2067,7 +2071,7 @@ ip_match_addr_or_key(ip_match_list iml, struct in_addr address,
if (indirect) {
ret = ip_match_addr_or_key(ime->u.indirect.list,
address, key);
if (ret >= 0) {
if (ret > 0) {
if (ime->flags & IP_MATCH_NEGATE)
ret = (ret) ? 0 : 1;
return (ret);
@@ -2246,7 +2250,79 @@ ip_match_is_none(ip_match_list iml) {
return (0);
}
/*
* find_forwarder finds the fwddata structure for an address,
* allocating one if we can't find one already existing.
*/
static struct fwddata *
find_forwarder(struct in_addr address)
{
struct fwddata *fdp;
struct databuf *ns, *nsdata;
register int i;
for (i=0;i<fwddata_count; i++) {
fdp=fwddata[i];
if (memcmp(&fdp->fwdaddr.sin_addr,&address,sizeof(address))==0) {
fdp->ref_count++;
return fdp;
}
}
fdp = (struct fwddata *)memget(sizeof(struct fwddata));
if (!fdp)
panic("memget failed in find_forwarder", NULL);
fdp->fwdaddr.sin_family = AF_INET;
fdp->fwdaddr.sin_addr = address;
fdp->fwdaddr.sin_port = ns_port;
ns = fdp->ns = (struct databuf *)memget(sizeof(*ns));
if (!ns)
panic("memget failed in find_forwarder", NULL);
memset(ns,0,sizeof(*ns));
nsdata = fdp->nsdata = (struct databuf *)memget(sizeof(*nsdata));
if (!nsdata)
panic("memget failed in find_forwarder", NULL);
memset(nsdata,0,sizeof(*nsdata));
ns->d_type = T_NS;
ns->d_class = C_IN;
ns->d_rcnt=1;
nsdata->d_type = T_A;
nsdata->d_class = C_IN;
nsdata->d_nstime = 1 + (int)(25.0*rand()/(RAND_MAX + 1.0));
nsdata->d_rcnt=1;
fdp->ref_count=1;
i=0;
if (fwddata == NULL) {
fwddata = memget(sizeof *fwddata);
if (fwddata == NULL)
i = 1;
} else {
register size_t size;
register struct fwddata **an_tmp;
size = fwddata_count * sizeof *fwddata;
an_tmp = memget(size + sizeof *fwddata);
if (an_tmp == NULL) {
i = 1;
} else {
memcpy(an_tmp, fwddata, size);
memput(fwddata, size);
fwddata = an_tmp;
}
}
if (i == 0) {
fwddata[fwddata_count] = fdp;
fwddata_count++;
} else {
ns_warning(ns_log_config,
"forwarder add failed (memget) [%s]",
inet_ntoa(address));
}
return fdp;
}
/*
* Forwarder glue
*
@@ -2257,25 +2333,25 @@ ip_match_is_none(ip_match_list iml) {
static void
add_forwarder(struct fwdinfo **fipp, struct in_addr address) {
struct fwdinfo *fip = *fipp, *ftp = NULL;
struct fwddata *fdp;
#ifdef FWD_LOOP
if (aIsUs(address)) {
ns_error(ns_log_config, "forwarder '%s' ignored, my address",
inet_ntoa(address));
return;
}
#endif /* FWD_LOOP */
/* On multiple forwarder lines, move to end of the list. */
while (fip != NULL && fip->next != NULL)
fip = fip->next;
fdp = find_forwarder(address);
ftp = (struct fwdinfo *)memget(sizeof(struct fwdinfo));
if (!ftp)
panic("memget failed in add_forwarder", NULL);
ftp->fwdaddr.sin_family = AF_INET;
ftp->fwdaddr.sin_addr = address;
ftp->fwdaddr.sin_port = ns_port;
#ifdef FWD_LOOP
if (aIsUs(ftp->fwdaddr.sin_addr)) {
ns_error(ns_log_config, "forwarder '%s' ignored, my address",
inet_ntoa(address));
memput(ftp, sizeof *ftp);
return;
}
#endif /* FWD_LOOP */
ftp->fwddata = fdp;
ftp->next = NULL;
if (fip == NULL)
*fipp = ftp; /* First time only */
@@ -2346,10 +2422,6 @@ add_global_also_notify(options op, struct in_addr address) {
void
add_global_forwarder(options op, struct in_addr address) {
#ifdef SLAVE_FORWARD
struct fwdinfo *fip;
int forward_count;
#endif
INSIST(op != NULL);
@@ -2357,20 +2429,6 @@ add_global_forwarder(options op, struct in_addr address) {
inet_ntoa(address));
add_forwarder(&op->fwdtab, address);
#ifdef SLAVE_FORWARD
/*
** Set the slave retry time to 60 seconds total divided
** between each forwarder
*/
for (forward_count = 0, fip = op->fwdtab; fip != NULL; fip = fip->next)
forward_count++;
if (forward_count != 0) {
slave_retry = (int) (60 / forward_count);
if(slave_retry <= 0)
slave_retry = 1;
}
#endif
}
void
@@ -2405,6 +2463,12 @@ free_forwarders(struct fwdinfo *fwdtab) {
for (ftp = fwdtab; ftp != NULL; ftp = fnext) {
fnext = ftp->next;
if (!--ftp->fwddata->ref_count) {
memput(ftp->fwddata->ns, sizeof *ftp->fwddata->ns);
memput(ftp->fwddata->nsdata,
sizeof *ftp->fwddata->nsdata);
memput(ftp->fwddata,sizeof *ftp->fwddata);
}
memput(ftp, sizeof *ftp);
}
fwdtab = NULL;
@@ -2895,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");
@@ -2911,16 +2975,19 @@ init_default_log_channels() {
0, ULONG_MAX);
if (debug_channel == NULL || log_inc_references(debug_channel) < 0)
ns_panic(ns_log_config, 0, "couldn't create debug_channel");
log_set_file_owner(debug_channel, user_id, group_id);
stderr_channel = log_new_file_channel(0, log_info, NULL, stderr,
0, ULONG_MAX);
if (stderr_channel == NULL || log_inc_references(stderr_channel) < 0)
ns_panic(ns_log_config, 0, "couldn't create stderr_channel");
log_set_file_owner(stderr_channel, user_id, group_id);
null_channel = log_new_file_channel(LOG_CHANNEL_OFF, log_info,
_PATH_DEVNULL, NULL, 0, ULONG_MAX);
if (null_channel == NULL || log_inc_references(null_channel) < 0)
ns_panic(ns_log_config, 0, "couldn't create null_channel");
log_set_file_owner(null_channel, user_id, group_id);
}
static void
@@ -3006,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);
@@ -3025,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
@@ -3057,4 +3126,7 @@ load_configuration(const char *filename) {
initial_configuration = 0;
loading = 0;
/* release queued notifies */
notify_afterload();
return (mtime);
}
+100 -20
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_ctl.c,v 8.28 1999/10/13 16:39:04 vixie Exp $";
static const char rcsid[] = "$Id: ns_ctl.c,v 8.39 2000/12/19 23:31:38 marka Exp $";
#endif /* not lint */
/*
* Copyright (c) 1997-1999 by Internet Software Consortium.
* Copyright (c) 1997-2000 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
@@ -68,12 +68,14 @@ struct control {
struct sockaddr_in in;
ip_match_list allow;
} v_inet;
#ifndef NO_SOCKADDR_UN
struct {
struct sockaddr_un un;
mode_t mode;
uid_t owner;
gid_t group;
} v_unix;
#endif
} var;
};
@@ -150,9 +152,9 @@ static struct ctl_verb verbs[] = {
{ "stop", verb_stop, "stop"},
{ "exec", verb_exec, "exec"},
{ "reload", verb_reload, "reload [zone] ..."},
{ "reconfig", verb_reconfig, "reconfig (just sees new/gone zones)"},
{ "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"},
@@ -177,7 +179,29 @@ ns_ctl_shutdown(void) {
void
ns_ctl_defaults(controls *list) {
#ifdef NO_SOCKADDR_UN
struct in_addr saddr;
ip_match_list iml;
ip_match_element ime;
/*
* If the operating system does not support local domain sockets,
* connect with ndc on 127.0.0.1, port 101, and only allow
* connections from 127.0.0.1.
*/
saddr.s_addr = htonl (INADDR_LOOPBACK);
iml = new_ip_match_list();
ime = new_ip_match_pattern(saddr, 32);
add_to_ip_match_list(iml, ime);
ns_ctl_add(list, ns_ctl_new_inet(saddr, htons (101), iml));
#else
#ifdef NEED_SECURE_DIRECTORY
ns_ctl_add(list, ns_ctl_new_unix(_PATH_NDCSOCK, 0700, 0, 0));
#else
ns_ctl_add(list, ns_ctl_new_unix(_PATH_NDCSOCK, 0600, 0, 0));
#endif
#endif /*NO_SOCKADDR_UN*/
}
void
@@ -200,6 +224,7 @@ ns_ctl_new_inet(struct in_addr saddr, u_int sport, ip_match_list allow) {
return (new);
}
#ifndef NO_SOCKADDR_UN
control
ns_ctl_new_unix(char *path, mode_t mode, uid_t owner, gid_t group) {
control new = new_control();
@@ -215,6 +240,7 @@ ns_ctl_new_unix(char *path, mode_t mode, uid_t owner, gid_t group) {
new->var.v_unix.group = group;
return (new);
}
#endif
void
ns_ctl_install(controls *new) {
@@ -245,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)
@@ -288,6 +315,7 @@ free_control(controls *list, control this) {
this->var.v_inet.allow = NULL;
}
break;
#ifndef NO_SOCKADDR_UN
case t_unix:
/* XXX Race condition. */
if (was_live &&
@@ -297,6 +325,7 @@ free_control(controls *list, control this) {
unlink(this->var.v_unix.un.sun_path);
}
break;
#endif
default:
panic("impossible type in free_control", NULL);
/* NOTREACHED */
@@ -333,6 +362,7 @@ match_control(control l, control r) {
r->var.v_inet.in.sin_addr.s_addr)
match = 0;
break;
#ifndef NO_SOCKADDR_UN
case t_unix:
if (l->var.v_unix.un.sun_family !=
r->var.v_unix.un.sun_family ||
@@ -340,6 +370,7 @@ match_control(control l, control r) {
r->var.v_unix.un.sun_path) != 0)
match = 0;
break;
#endif
default:
panic("impossible type in match_control", NULL);
/* NOTREACHED */
@@ -370,6 +401,7 @@ propagate_changes(const control diff, control base) {
diff->var.v_inet.allow = NULL;
need_install++;
break;
#ifndef NO_SOCKADDR_UN
case t_unix:
if (base->var.v_unix.mode != diff->var.v_unix.mode) {
base->var.v_unix.mode = diff->var.v_unix.mode;
@@ -384,6 +416,7 @@ propagate_changes(const control diff, control base) {
need_install++;
}
break;
#endif
default:
panic("impossible type in ns_ctl::propagate_changes", NULL);
/* NOTREACHED */
@@ -398,9 +431,11 @@ install(control ctl) {
case t_inet:
install_inet(ctl);
break;
#ifndef NO_SOCKADDR_UN
case t_unix:
install_unix(ctl);
break;
#endif
default:
panic("impossible type in ns_ctl::install", NULL);
/* NOTREACHED */
@@ -416,6 +451,7 @@ install_inet(control ctl) {
}
}
#ifndef NO_SOCKADDR_UN
/*
* Unattach an old unix domain socket if it exists.
*/
@@ -478,6 +514,35 @@ unattach(control ctl) {
static void
install_unix(control ctl) {
char *path;
#ifdef NEED_SECURE_DIRECTORY
char *slash;
path = savestr(ctl->var.v_unix.un.sun_path, 1);
slash = strrchr(path, '/');
if (slash != NULL) {
if (slash != path)
*slash = '\0';
else {
freestr(path);
path = savestr("/", 1);
}
} else {
freestr(path);
path = savestr(".", 1);
}
if (mkdir(path, ctl->var.v_unix.mode) < 0) {
if (errno != EEXIST) {
ns_warning(ns_log_config,
"unix control \"%s\" mkdir failed: %s",
path, strerror(errno));
}
}
#else
path = ctl->var.v_unix.un.sun_path;
#endif
if (ctl->sctx == NULL) {
unattach(ctl);
ctl->sctx = mksrvr(ctl,
@@ -486,15 +551,13 @@ install_unix(control ctl) {
}
if (ctl->sctx != NULL) {
/* XXX Race condition. */
if (chmod(ctl->var.v_unix.un.sun_path,
ctl->var.v_unix.mode) < 0) {
if (chmod(path, ctl->var.v_unix.mode) < 0) {
ns_warning(ns_log_config, "chmod(\"%s\", 0%03o): %s",
ctl->var.v_unix.un.sun_path,
ctl->var.v_unix.mode,
strerror(errno));
}
if (chown(ctl->var.v_unix.un.sun_path,
ctl->var.v_unix.owner,
if (chown(path, ctl->var.v_unix.owner,
ctl->var.v_unix.group) < 0) {
ns_warning(ns_log_config, "chown(\"%s\", %d, %d): %s",
ctl->var.v_unix.un.sun_path,
@@ -503,7 +566,11 @@ install_unix(control ctl) {
strerror(errno));
}
}
#ifdef NEED_SECURE_DIRECTORY
freestr(path);
#endif
}
#endif
static void
logger(enum ctl_severity ctlsev, const char *format, ...) {
@@ -570,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,
@@ -577,7 +645,6 @@ enum state {
e_qserials,
e_qrylog,
e_priming,
e_loading,
e_finito
};
@@ -600,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++) {
@@ -608,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;
@@ -629,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;
@@ -747,6 +816,8 @@ verb_reload(struct ctl_sctx *ctl, struct ctl_sess *sess,
case z_slave:
case z_stub:
ns_stopxfrs(zp);
if (zonefile_changed_p(zp))
zp->z_serial = 0; /* force xfer */
addxfer(zp);
code = 251;
msg = "Slave transfer queued.";
@@ -770,7 +841,10 @@ verb_reconfig(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_reconfig);
if (strcmp(rest, "-noexpired") != 0)
ns_need(main_need_reconfig);
else
ns_need(main_need_noexpired);
ctl_response(sess, 250, "Reconfig initiated.",
0, NULL, NULL, NULL, NULL, 0);
}
@@ -790,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
+44 -14
View File
@@ -1,6 +1,6 @@
/*
* from ns.h 4.33 (Berkeley) 8/23/90
* $Id: ns_defs.h,v 8.89 1999/10/07 08:24:08 vixie Exp $
* $Id: ns_defs.h,v 8.102 2000/12/01 05:35:48 vixie Exp $
*/
/*
@@ -57,7 +57,7 @@
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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,12 +163,15 @@ 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. */
main_need_restart, /* exec() needed. */
main_need_reap, /* need to reap dead children */
main_need_num /* number of needs, used for array bound. */
main_need_noexpired, /* ns_reconfig() needed w/ noexpired set */
main_need_num, /* number of needs, used for array bound. */
main_need_tick /* tick every second to poll for cleanup (NT)*/
} main_need;
/* What global options are set? */
@@ -181,13 +187,15 @@ typedef enum need {
* CNAME RRs */
#define OPTION_HOSTSTATS 0x0080 /* Maintain per-host statistics? */
#define OPTION_DEALLOC_ON_EXIT 0x0100 /* Deallocate everything on exit? */
#define OPTION_USE_IXFR 0x0110 /* Use by delault ixfr in zone transfer */
#define OPTION_MAINTAIN_IXFR_BASE 0x0120
#define OPTION_NODIALUP 0x0200 /* Turn off dialup support */
#define OPTION_NORFC2308_TYPE1 0x0400 /* Prevent type1 respones (RFC 2308)
* to cached negative respones */
#define OPTION_USE_ID_POOL 0x0800 /* Use the memory hogging query ID */
#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)
@@ -306,7 +314,8 @@ typedef struct ztimer_info {
int type;
} *ztimer_info;
/* these fields are ordered to maintain word-alignment;
/*
* These fields are ordered to maintain word-alignment;
* be careful about changing them.
*/
struct zoneinfo {
@@ -359,9 +368,9 @@ struct zoneinfo {
enum zdialup z_dialup; /* secondaries over a dialup link */
char *z_ixfr_base; /* where to find the history of the zone */
char *z_ixfr_tmp; /* tmp file for the ixfr */
int z_maintain_ixfr_base;
int z_log_size_ixfr;
int z_max_log_size_ixfr;
int z_maintain_ixfr_base;
long z_max_log_size_ixfr;
u_int32_t z_serial_ixfr_start;
evTimerID z_timer; /* maintenance timer */
ztimer_info z_timerinfo; /* UAP associated with timer */
time_t z_nextmaint; /* time of next maintenance */
@@ -410,6 +419,7 @@ enum zonetype { z_nil, z_master, z_slave, z_hint, z_stub, z_forward,
#define Z_NEED_QSERIAL 0x00020000 /* we need to re-call qserial() */
#define Z_PARENT_RELOAD 0x00040000 /* we need to reload this as parent */
#define Z_FORWARD_SET 0x00080000 /* has forwarders been set */
#define Z_EXPIRED 0x00100000 /* expire timer has gone off */
/* named_xfer exit codes */
#define XFER_UPTODATE 0 /* zone is up-to-date */
@@ -507,6 +517,14 @@ struct fdlist {
};
#endif
typedef struct ns_delta {
LINK(struct ns_delta) d_link;
ns_updque d_changes;
} ns_delta;
typedef LIST(ns_delta) ns_deltalist;
typedef struct _interface {
int dfd, /* Datagram file descriptor */
sfd; /* Stream file descriptor. */
@@ -570,7 +588,7 @@ struct qstream {
u_int zone; /* zone being XFR'd. */
union {
struct namebuf *axfr; /* top np of an AXFR. */
struct ns_updrec *ixfr; /* top udp of an IXFR. */
ns_deltalist *ixfr; /* top udp of an IXFR. */
} top;
int ixfr_zone;
u_int32_t serial; /* serial number requested in IXFR */
@@ -602,16 +620,23 @@ struct qstream {
#define STREAM_CONNECT_EV 0x08
#define STREAM_DONE_CLOSE 0x10
#define STREAM_AXFR 0x20
#define STREAM_AXFRIXFR 0x22
#define STREAM_AXFRIXFR 0x40
#define ALLOW_NETS 0x0001
#define ALLOW_HOSTS 0x0002
#define ALLOW_ALL (ALLOW_NETS | ALLOW_HOSTS)
struct fwddata {
struct sockaddr_in
fwdaddr; /* address of NS */
struct databuf *ns; /* databuf for NS record */
struct databuf *nsdata; /* databuf for server address */
int ref_count; /* how many users of this */
};
struct fwdinfo {
struct fwdinfo *next;
struct sockaddr_in
fwdaddr;
struct fwddata *fwddata;
};
enum nameserStats { nssRcvdR, /* sent us an answer */
@@ -639,6 +664,10 @@ enum nameserStats { nssRcvdR, /* sent us an answer */
nssSentFErr, /* sent them a FORMERR */
nssSentNaAns, /* sent them a non autoritative answer */
nssSentNXD, /* sent them a negative response */
nssRcvdUQ, /* sent us an unapproved query */
nssRcvdURQ, /* sent us an unapproved recursive query */
nssRcvdUXFR, /* sent us an unapproved AXFR or IXFR */
nssRcvdUUpd, /* sent us an unapproved update */
nssLast };
struct nameser {
@@ -648,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,
@@ -741,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;
+70 -67
View File
@@ -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.68 1999/10/13 16:39:07 vixie Exp $";
static const char rcsid[] = "$Id: ns_forw.c,v 8.78 2000/12/23 08:14:37 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: ns_forw.c,v 8.68 1999/10/13 16:39:07 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -160,7 +160,7 @@ ns_forw(struct databuf *nsp[], u_char *msg, int msglen,
}
}
qp = qnew(dname, class, type);
qp = qnew(dname, class, type, 1);
getname(np, tmpdomain, sizeof tmpdomain);
qp->q_domain = savestr(tmpdomain, 1);
qp->q_from = from; /* nslookup wants to know this */
@@ -208,11 +208,6 @@ ns_forw(struct databuf *nsp[], u_char *msg, int msglen,
hp->rd = (qp->q_addr[0].forwarder ? 1 : 0);
qp->q_addr[0].stime = tt;
#ifdef SLAVE_FORWARD
if (NS_ZOPTION_P(qp->q_fzone, OPTION_FORWARD_ONLY))
schedretry(qp, (time_t)slave_retry);
else
#endif /* SLAVE_FORWARD */
schedretry(qp, retrytime(qp));
nsa = Q_NEXTADDR(qp, 0);
@@ -288,8 +283,7 @@ ns_forw(struct databuf *nsp[], u_char *msg, int msglen,
hp = (HEADER *) qp->q_msg;
}
if (NS_OPTION_P(OPTION_HOSTSTATS))
nameserIncr(from.sin_addr, nssRcvdFwdQ);
nameserIncr(from.sin_addr, nssRcvdFwdQ);
nameserIncr(nsa->sin_addr, nssSentFwdQ);
if (qpp)
*qpp = qp;
@@ -381,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);
@@ -395,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)",
@@ -470,7 +462,7 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
lame_ns = potential_ns = 0;
naddr = n = qp->q_naddr;
curtime = (u_long) tt.tv_sec;
while ((nsdp = *nsp++) != NULL) {
while ((nsdp = *nsp++) != NULL && n < NSMAX) {
class = nsdp->d_class;
dname = (char *)nsdp->d_data;
ns_debug(ns_log_default, 3,
@@ -668,7 +660,7 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
n++;
if (n >= NSMAX)
goto out;
break;
skipaddr:
(void)NULL;
}
@@ -683,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)) {
@@ -703,8 +694,11 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
DRCNTINC(qp->q_addr[i].nsdata);
DRCNTINC(qp->q_addr[i].ns);
}
if (n > 1) {
qsort((char *)qp->q_addr, n, sizeof(struct qserv),
/* Just sort the NS RR's we added, since the forwarders may
* be ahead of us (naddr > 0)
*/
if (n > naddr) {
qsort((char *)(qp->q_addr+naddr), n-naddr, sizeof(struct qserv),
(int (*)(const void *, const void *))qcomp);
}
return (n - naddr);
@@ -761,51 +755,54 @@ nslookup(struct databuf *nsp[], struct qinfo *qp,
* RTT delta deemed to be significant, in milliseconds. With the current
* definition of RTTROUND it must be a power of 2.
*/
#define NOISE 128 /* milliseconds; 0.128 seconds */
#define NOISE 64
#define sign(x) (((x) < 0) ? -1 : ((x) > 0) ? 1 : 0)
#define RTTROUND(rtt) (((rtt) + (NOISE >> 1)) & ~(NOISE - 1))
int
qcomp(struct qserv *qs1, struct qserv *qs2) {
int pos1, pos2, pdiff;
u_long rtt1, rtt2;
long tdiff;
u_int rtt1, rtt2, rttr1, rttr2;
if ((!qs1->nsdata) || (!qs2->nsdata))
return 0;
rtt1 = qs1->nsdata->d_nstime;
rtt2 = qs2->nsdata->d_nstime;
if (qs1->nsdata == NULL) {
rtt1 = 0;
rttr1 = 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);
}
#ifdef DEBUG
if (debug >= 10) {
char a1[sizeof "255.255.255.255"],
a2[sizeof "255.255.255.255"];
char t[sizeof "255.255.255.255"];
strcpy(a1, inet_ntoa(qs1->ns_addr.sin_addr));
strcpy(a2, inet_ntoa(qs2->ns_addr.sin_addr));
strcpy(t, inet_ntoa(qs1->ns_addr.sin_addr));
ns_debug(ns_log_default, 10,
"qcomp(%s, %s) %lu (%lu) - %lu (%lu) = %lu",
a1, a2,
rtt1, RTTROUND(rtt1),
rtt2, RTTROUND(rtt2),
rtt1 - rtt2);
t, inet_ntoa(qs2->ns_addr.sin_addr),
rtt1, rttr1, rtt2, rttr2, rtt1 - rtt2);
}
#endif
if (RTTROUND(rtt1) == RTTROUND(rtt2)) {
if (rttr1 == rttr2) {
int pos1, pos2, pdiff;
pos1 = distance_of_address(server_options->topology,
qs1->ns_addr.sin_addr);
pos2 = distance_of_address(server_options->topology,
qs2->ns_addr.sin_addr);
pdiff = pos1 - pos2;
ns_debug(ns_log_default, 10, "\tpos1=%d, pos2=%d", pos1, pos2);
if (pdiff)
if (pdiff != 0)
return (pdiff);
}
tdiff = rtt1 - rtt2;
return (sign(tdiff));
return (rtt1 - rtt2);
}
#undef sign
#undef RTTROUND
/*
@@ -982,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,
@@ -1016,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) {
@@ -1076,11 +1073,6 @@ retry(struct qinfo *qp) {
schedretry(qp, (time_t) 0);
return;
}
#ifdef SLAVE_FORWARD
if (NS_ZOPTION_P(qp->q_fzone, OPTION_FORWARD_ONLY))
schedretry(qp, (time_t)slave_retry);
else
#endif /* SLAVE_FORWARD */
schedretry(qp, retrytime(qp));
}
@@ -1140,7 +1132,7 @@ qfindid(u_int16_t id) {
}
struct qinfo *
qnew(const char *name, int class, int type) {
qnew(const char *name, int class, int type, int forward) {
struct qinfo *qp;
const char *s;
int escape = 0;
@@ -1160,7 +1152,8 @@ qnew(const char *name, int class, int type) {
qp->q_type = (u_int16_t)type;
qp->q_flags = 0;
s = name;
for (;;) { /* find forwarding zone, if any */
qp->q_fzone = NULL;
for (;forward;) { /* find forwarding zone, if any */
if ((qp->q_fzone = find_zone(s, class)) != NULL &&
(qp->q_fzone->z_flags & Z_FORWARD_SET) != 0)
break;
@@ -1250,20 +1243,30 @@ nsfwdadd(struct qinfo *qp, struct fwdinfo *fwd) {
struct qserv *qs;
n = qp->q_naddr;
while (fwd != NULL && n < MAXNS) {
while (fwd != NULL && n < NSMAX) {
qs = qp->q_addr;
for (i = 0; i < (u_int)n; i++, qs++)
if (ina_equal(qs->ns_addr.sin_addr,
fwd->fwdaddr.sin_addr))
fwd->fwddata->fwdaddr.sin_addr))
goto nextfwd;
qs->ns_addr = fwd->fwdaddr;
qs->ns = NULL;
qs->nsdata = NULL;
qs->ns_addr = fwd->fwddata->fwdaddr;
qs->ns = fwd->fwddata->ns;
qs->nsdata = fwd->fwddata->nsdata;
qs->forwarder = 1;
qs->nretry = 0;
n++;
nextfwd:
fwd = fwd->next;
}
/* Update the refcounts before the sort. */
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);
}
}
+179 -158
View File
@@ -52,7 +52,7 @@
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -90,42 +90,42 @@
/* ns_func.h - declarations for ns_*.c's externally visible functions
*
* $Id: ns_func.h,v 8.90 1999/10/11 18:22:20 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__)
@@ -146,48 +146,50 @@ int movefile(const char *, const char *);
/* ++from ns_notify.c++ */
#ifdef BIND_NOTIFY
void ns_notify(const char *, ns_class, ns_type);
void notify_afterload(void);
void ns_unnotify(void);
void ns_stopnotify(const char *, ns_class);
#endif
/* --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-- */
@@ -196,12 +198,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++ */
@@ -217,12 +219,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,
@@ -234,136 +237,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);
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);
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);
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);
@@ -384,6 +393,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);
@@ -416,7 +435,7 @@ void free_rrset_order_list(rrset_order_list);
void set_global_boolean_option(options, int, int);
listen_info_list new_listen_info_list(void);
void free_listen_info_list(listen_info_list);
void add_listen_on(options, u_int16_t, ip_match_list);
void add_listen_on(options, u_short, ip_match_list);
FILE * write_open(char *filename);
void update_pid_file(void);
void set_options(options, int);
@@ -480,17 +499,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);
+11 -9
View File
@@ -1,6 +1,6 @@
/*
* from ns.h 4.33 (Berkeley) 8/23/90
* $Id: ns_glob.h,v 8.51 1999/10/15 21:53:32 vixie Exp $
* $Id: ns_glob.h,v 8.56 2000/12/02 18:39:25 vixie Exp $
*/
/*
@@ -57,7 +57,7 @@
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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;
@@ -156,17 +159,17 @@ DECL u_char *dnptrs[40];
DECL u_char **dnptrs_end
INIT(dnptrs + sizeof dnptrs / sizeof(u_char*));
/* data about all forwarders */
DECL struct fwddata **fwddata;
/* how many forwarders are there in fwddata? */
DECL int fwddata_count;
/* number of names in addinfo */
DECL int addcount;
/* name of cache file */
DECL const char *cache_file;
#ifdef SLAVE_FORWARD
/* retry time when a slave */
DECL int slave_retry INIT(4);
#endif
#ifdef BIND_UPDATE
DECL const char * LogSignature INIT(";BIND LOG V8\n");
DECL const char * DumpSignature INIT(";BIND DUMP V8\n");
@@ -209,7 +212,6 @@ DECL options server_options INIT(NULL);
DECL server_info nameserver_info INIT(NULL);
DECL key_info_list secretkey_info INIT(NULL);
DECL int main_needs_exit INIT(0);
DECL ip_match_list bogus_nameservers INIT(NULL);
DECL log_context log_ctx;
+21 -18
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_glue.c,v 8.14 1999/10/19 02:06:26 gson Exp $";
static const char rcsid[] = "$Id: ns_glue.c,v 8.18 2000/11/08 06:16:36 marka Exp $";
#endif /* not lint */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-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
@@ -73,15 +73,13 @@ ina_put(struct in_addr ina, u_char *data) {
}
/*
* XXX: sin_ntoa() should probably be in libc.
* IP address to presentation format.
*/
const char *
sin_ntoa(struct sockaddr_in sin) {
static char ret[sizeof "[111.222.333.444].55555"];
sprintf(ret, "[%s].%u",
inet_ntoa(sin.sin_addr),
ntohs(sin.sin_port));
sprintf(ret, "[%s].%u", inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
return (ret);
}
@@ -180,7 +178,7 @@ ns_assertion_failed(char *file, int line, assertion_type type, char *cond,
}
/*
* XXX This is for compatibility and will eventually be removed.
* XXX This is for compatibility and should eventually be removed.
*/
void
panic(const char *msg, const void *arg) {
@@ -192,7 +190,7 @@ panic(const char *msg, const void *arg) {
* Note: the root label is not included in the count.
*/
int
nlabels (const char *dname) {
nlabels(const char *dname) {
int count, i, found, escaped;
const char *tmpdname, *end_tmpdname;
int tmpdnamelen, c;
@@ -215,9 +213,8 @@ nlabels (const char *dname) {
escaped = 0;
else
escaped = 1;
} else {
} else
break;
}
if (!escaped)
tmpdnamelen--;
}
@@ -244,8 +241,7 @@ nlabels (const char *dname) {
}
}
ns_debug(ns_log_default, 12, "nlabels of \"%s\" -> %d", dname,
count);
ns_debug(ns_log_default, 12, "nlabels of \"%s\" -> %d", dname, count);
return (count);
}
@@ -256,6 +252,7 @@ void
gettime(struct timeval *ttp) {
if (gettimeofday(ttp, NULL) < 0)
ns_error(ns_log_default, "gettimeofday: %s", strerror(errno));
INSIST(ttp->tv_usec >= 0 && ttp->tv_usec < 1000000);
}
/*
@@ -438,13 +435,19 @@ ctimel(long l) {
return (checked_ctime(&t));
}
#ifdef ultrix
/*
* 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.
* Some library routines in libc need to be able to see the res_send
* and res_close symbols with out __ prefix otherwise we get multiply
* defined symbol errors when linking named.
*/
#ifndef HAVE_MOVEFILE
int
movefile(const char *oldname, const char *newname) {
return (rename(oldname, newname));
#undef res_send
int res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) {
return __res_send(buf, buflen, ans, anssiz);
}
#undef _res_close
void _res_close(void) {
__res_close();
}
#endif
+27 -9
View File
@@ -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.63 1999/10/15 19:49:04 vixie Exp $";
static const char rcsid[] = "$Id: ns_init.c,v 8.70 2000/12/23 08:14:38 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: ns_init.c,v 8.63 1999/10/15 19:49:04 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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
@@ -245,7 +247,7 @@ zoneinit(struct zoneinfo *zp) {
}
} else {
zp->z_flags |= Z_AUTH;
zp->z_flags &= ~Z_NEED_RELOAD;
zp->z_flags &= ~(Z_NEED_RELOAD|Z_EXPIRED);
ns_refreshtime(zp, tt.tv_sec);
sched_zone_maint(zp);
}
@@ -277,14 +279,15 @@ 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;
/*
* Clean up any leftover data.
*/
ns_stopxfrs(zp);
purge_zone(domain, hashtab, class);
/*
@@ -328,6 +331,20 @@ do_reload(const char *domain, int type, int class, int mark) {
void
purgeandload(struct zoneinfo *zp) {
#ifdef BIND_UPDATE
/*
* A dynamic zone might have changed, so we
* need to dump it before removing it.
*/
if (zp->z_type == Z_PRIMARY &&
(zp->z_flags & Z_DYNAMIC) != 0 &&
((zp->z_flags & Z_NEED_SOAUPDATE) != 0 ||
(zp->z_flags & Z_NEED_DUMP) != 0))
(void) zonedump(zp, ISNOTIXFR);
#endif
ns_stopxfrs(zp);
if (zp->z_type == Z_HINT)
purge_zone(zp->z_origin, fcachetab, zp->z_class);
else
@@ -451,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) ) {
@@ -481,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);
+235 -204
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_ixfr.c,v 8.17 1999/11/05 04:48:28 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.17 1999/11/05 04:48:28 vixie Exp
#include <isc/eventlib.h>
#include <isc/logging.h>
#include <isc/memcluster.h>
#include <isc/misc.h>
#include "port_after.h"
@@ -58,7 +59,6 @@ static int sx_flush(struct qstream * qsp),
sx_addrr(struct qstream * qsp,
const char *dname,
struct databuf * dp);
extern void sx_sendsoa(struct qstream * qsp);
/*
* u_char * sx_new_ixfrmsg(msg) init the header of a message, reset the
@@ -68,7 +68,6 @@ extern void sx_sendsoa(struct qstream * qsp);
static void
sx_new_ixfrmsg(struct qstream *qsp) {
HEADER * hp = (HEADER *) qsp->xfr.msg;
ns_updrec * up;
memset(hp, 0, HFIXEDSZ);
hp->id = htons(qsp->xfr.id);
@@ -87,14 +86,10 @@ 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];
up = qsp->xfr.top.ixfr;
n = dn_comp(zp->z_origin, qsp->xfr.cp,
XFER_BUFSIZE - (qsp->xfr.cp - qsp->xfr.msg), NULL, NULL);
qsp->xfr.cp += n;
@@ -105,17 +100,15 @@ 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);
}
}
}
/*
* int sx_flush(qsp) flush the intermediate buffer out to the stream IO
* system. return: passed through from sq_write().
* int
* sx_flush(qsp)
* flush the intermediate buffer out to the stream IO system.
* return:
* passed through from sq_write().
*/
static int
sx_flush(struct qstream *qsp) {
@@ -126,12 +119,34 @@ sx_flush(struct qstream *qsp) {
fp_nquery(qsp->xfr.msg, qsp->xfr.cp - qsp->xfr.msg,
log_get_stream(packet_channel));
#endif
ret = sq_write(qsp, qsp->xfr.msg, qsp->xfr.cp - qsp->xfr.msg);
if (ret >= 0)
if (qsp->xfr.tsig_state != NULL && qsp->xfr.tsig_skip == 0) {
int msglen = qsp->xfr.cp - qsp->xfr.msg;
ns_sign_tcp(qsp->xfr.msg, &msglen, qsp->xfr.eom - qsp->xfr.msg,
NOERROR, qsp->xfr.tsig_state,
qsp->xfr.state == s_x_done);
if (qsp->xfr.state == s_x_done) {
memput(qsp->xfr.tsig_state, sizeof(ns_tcp_tsig_state));
qsp->xfr.tsig_state = NULL;
}
qsp->xfr.cp = qsp->xfr.msg + msglen;
}
if (qsp->xfr.cp - qsp->xfr.msg > 0)
ret = sq_write(qsp, qsp->xfr.msg, qsp->xfr.cp - qsp->xfr.msg);
else {
ns_debug(ns_log_default, 3, " Flush negative number *********");
ret = -1;
}
if (ret >= 0) {
qsp->xfr.cp = NULL;
qsp->xfr.tsig_skip = 0;
}
else
qsp->xfr.tsig_skip = 1;
return (ret);
}
/*
* int sx_addrr(qsp, name, dp) add name/dp's RR to the current assembly
* message. if it won't fit, write current message out, renew the message,
@@ -172,12 +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_updrec * rp;
ns_updrec * trp;
ns_delta *dp;
ns_updrec *rp;
int foundsoa;
zp = &zones[qsp->xfr.zone];
@@ -188,26 +202,29 @@ 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:
switch (qsp->xfr.state) {
case s_x_firstsoa:
/*
* 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;
*/
ns_debug(ns_log_default, 3,
"IXFR: s_x_firstsoa (%s)", zp->z_origin);
if (sx_addrr(qsp, zp->z_origin, soa_dp) < 0)
goto cleanup;
qsp->xfr.state = s_x_deletesoa;
/* FALLTHROUGH */
case s_x_deletesoa:
if (qsp->xfr.top.ixfr) {
ns_debug(ns_log_default, 3,
"IXFR: s_x_deletesoa (%s)", zp->z_origin);
dp = NULL;
if (qsp->xfr.top.ixfr != NULL && !EMPTY(*qsp->xfr.top.ixfr))
dp = HEAD(*qsp->xfr.top.ixfr);
if (dp != NULL) {
foundsoa = 0;
rp = qsp->xfr.top.ixfr;
while (PREV(rp, r_link) != NULL)
rp = PREV(rp, r_link);
rp = HEAD(dp->d_changes);
while (rp != NULL) {
if (rp->r_opcode == DELETE &&
rp->r_dp != NULL &&
@@ -220,13 +237,12 @@ sx_send_ixfr(struct qstream *qsp) {
foundsoa = 1;
break;
}
trp = rp;
rp = NEXT(rp, r_link);
}
if (!foundsoa) {
cp = (char *)findsoaserial(old_soadp->d_data);
PUTLONG(qsp->xfr.top.ixfr->r_zone, cp);
PUTLONG(HEAD(dp->d_changes)->r_zone, cp);
if (sx_addrr(qsp, zp->z_origin, old_soadp) < 0)
goto cleanup;
@@ -235,15 +251,13 @@ sx_send_ixfr(struct qstream *qsp) {
qsp->xfr.state = s_x_deleting;
/* FALLTHROUGH */
case s_x_deleting:
if (qsp->xfr.top.ixfr) {
/*
* The order s important here.
* Go to start of this update via PREV(r_link)
* then extract all deletions.
*/
rp = qsp->xfr.top.ixfr;
while (PREV(rp, r_link) != NULL)
rp = PREV(rp, r_link);
ns_debug(ns_log_default, 3,
"IXFR: s_x_deleting (%s)", zp->z_origin);
dp = NULL;
if (qsp->xfr.top.ixfr != NULL && !EMPTY(*qsp->xfr.top.ixfr))
dp = HEAD(*qsp->xfr.top.ixfr);
if (dp != NULL) {
rp = HEAD(dp->d_changes);
while (rp != NULL) {
if (rp->r_opcode == DELETE &&
rp->r_dp != NULL) {
@@ -257,18 +271,20 @@ sx_send_ixfr(struct qstream *qsp) {
db_freedata(rp->r_dp);
rp->r_dp = NULL;
}
trp = rp;
rp = NEXT(rp, r_link);
}
}
qsp->xfr.state = s_x_addsoa;
/* FALLTHROUGH */
case s_x_addsoa:
if (qsp->xfr.top.ixfr) {
ns_debug(ns_log_default, 3,
"IXFR: s_x_addsoa (%s)", zp->z_origin);
dp = NULL;
if (qsp->xfr.top.ixfr != NULL && !EMPTY(*qsp->xfr.top.ixfr))
dp = HEAD(*qsp->xfr.top.ixfr);
if (dp != NULL) {
foundsoa = 0;
rp = qsp->xfr.top.ixfr;
while (PREV(rp, r_link) != NULL)
rp = PREV(rp, r_link);
rp = HEAD(dp->d_changes);
while (rp != NULL) {
if (rp->r_opcode == ADD &&
rp->r_dp != NULL &&
@@ -281,15 +297,13 @@ sx_send_ixfr(struct qstream *qsp) {
foundsoa = 1;
break;
}
trp = rp;
rp = NEXT(rp, r_link);
}
if (!foundsoa) {
cp = (char *)findsoaserial(old_soadp->d_data);
if (NEXT(qsp->xfr.top.ixfr, r_link) != NULL) {
trp = qsp->xfr.top.ixfr;
PUTLONG(NEXT(trp, r_link)->r_zone, cp);
if (NEXT(dp, d_link) != NULL) {
PUTLONG(HEAD(dp->d_changes)->r_zone, cp);
if (sx_addrr(qsp, zp->z_origin,
old_soadp) < 0)
goto cleanup;
@@ -303,51 +317,78 @@ sx_send_ixfr(struct qstream *qsp) {
qsp->xfr.state = s_x_adding;
/* FALLTHROUGH */
case s_x_adding:
if (qsp->xfr.top.ixfr) {
/* see s_x_deleting */
rp = qsp->xfr.top.ixfr;
while (PREV(rp, r_link) != NULL)
rp = PREV(rp, r_link);
while (rp != NULL) {
if (rp->r_opcode == ADD &&
rp->r_dp != NULL &&
rp->r_dp->d_type != T_SOA) {
if (sx_addrr(qsp, rp->r_dname,
rp->r_dp) < 0)
goto cleanup;
db_freedata(rp->r_dp);
rp->r_dp = NULL;
ns_debug(ns_log_default, 3,
"IXFR: s_x_adding (%s)", zp->z_origin);
dp = NULL;
if (qsp->xfr.top.ixfr != NULL && !EMPTY(*qsp->xfr.top.ixfr)) {
dp = HEAD(*qsp->xfr.top.ixfr);
if (dp != NULL) {
/* see s_x_deleting */
rp = HEAD(dp->d_changes);
while (rp != NULL) {
if (rp->r_opcode == ADD &&
rp->r_dp != NULL &&
rp->r_dp->d_type != T_SOA) {
if (sx_addrr(qsp, rp->r_dname,
rp->r_dp) < 0)
goto cleanup;
db_freedata(rp->r_dp);
rp->r_dp = NULL;
}
rp = NEXT(rp, r_link);
}
trp = rp;
rp = NEXT(rp, r_link);
}
/* move to next update */
rp = qsp->xfr.top.ixfr;
qsp->xfr.top.ixfr = NEXT(rp, r_link);
PREV(rp, r_link) = NULL;
/* clean up old update */
while (rp != NULL) {
trp = PREV(rp, r_link);
if (rp->r_dp != NULL) {
db_freedata(rp->r_dp);
rp->r_dp = NULL;
/* move to next update */
UNLINK(*qsp->xfr.top.ixfr, dp, d_link);
/* clean up old update */
while ((rp = HEAD(dp->d_changes)) != NULL) {
UNLINK(dp->d_changes, rp, r_link);
if (rp->r_dp != NULL) {
db_freedata(rp->r_dp);
rp->r_dp = NULL;
}
res_freeupdrec(rp);
}
memput(dp, sizeof (*dp));
if (HEAD(*qsp->xfr.top.ixfr) != NULL) {
qsp->xfr.state = s_x_deletesoa;
goto again;
}
res_freeupdrec(rp);
rp = trp;
}
}
qsp->xfr.state = s_x_lastsoa;
/* FALLTHROUGH */
case s_x_lastsoa:
if (qsp->xfr.ixfr_zone != 0) {
ns_debug(ns_log_default, 3,
"IXFR: s_x_lastsoa (%s)", zp->z_origin);
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);
if (qsp->xfr.top.ixfr != NULL) {
if(!EMPTY(*qsp->xfr.top.ixfr)) {
while ((dp = HEAD(*qsp->xfr.top.ixfr)) != NULL) {
UNLINK(*qsp->xfr.top.ixfr, dp, d_link);
while ((rp = HEAD(dp->d_changes)) != NULL) {
UNLINK(dp->d_changes, rp, r_link);
if (rp->r_dp != NULL)
db_freedata(rp->r_dp);
rp->r_dp = NULL;
res_freeupdrec(rp);
}
memput(dp, sizeof *dp);
}
}
memput(qsp->xfr.top.ixfr, sizeof *qsp->xfr.top.ixfr);
qsp->xfr.top.ixfr = NULL;
}
cleanup:
memput(old_soadp, DATASIZE(old_soadp->d_size));
}
@@ -358,9 +399,17 @@ sx_send_ixfr(struct qstream *qsp) {
#endif
int ixfr_log_maint(struct zoneinfo *zp) {
int fd, rcount, wcount, rval;
int found = 0, seek = 0;
/*
* int ixfr_log_maint(struct zoneinfo *zp, int fast_trim)
*
* zp - pointer to the zone information
*/
int
ixfr_log_maint(struct zoneinfo *zp) {
int fd, rcount, wcount;
int found = 0;
int error = 0;
long seek = 0;
FILE *to_fp, *from_fp, *db_fp;
static char *tmpname;
struct stat db_sb;
@@ -369,6 +418,62 @@ int ixfr_log_maint(struct zoneinfo *zp) {
ns_debug(ns_log_default, 3, "ixfr_log_maint(%s)", zp->z_origin);
/* find out how big the zone db file is */
if ((db_fp = fopen(zp->z_source, "r")) == NULL) {
ns_warning(ns_log_db, "%s: %s",
zp->z_source, strerror(errno));
return (-1);
}
if (fstat(fileno(db_fp), &db_sb) < 0) {
ns_warning(ns_log_db, "%s: %s",
zp->z_source, strerror(errno));
(void) my_fclose(db_fp);
return (-1);
}
(void) my_fclose(db_fp);
ns_debug(ns_log_default, 3, "%s, size %d blk %d",
zp->z_source, db_sb.st_size,
db_sb.st_size);
/* open up the zone ixfr log */
if ((from_fp = fopen(zp->z_ixfr_base, "r")) == NULL) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
return (-1);
}
if (fstat(fileno(from_fp), &sb) < 0) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
(void) my_fclose(from_fp);
return (-1);
}
ns_debug(ns_log_default, 3, "%s, size %d max %d\n",
zp->z_ixfr_base,
sb.st_size,
zp->z_max_log_size_ixfr);
if (zp->z_max_log_size_ixfr) {
if (sb.st_size > zp->z_max_log_size_ixfr)
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 * 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) {
ns_debug(ns_log_default, 3, "%s does not need to be reduced",
zp->z_ixfr_base);
(void) my_fclose(from_fp);
return (-1);
}
tmpname = memget(strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1);
if (!tmpname) {
ns_warning(ns_log_default, "memget failed");
@@ -395,111 +500,23 @@ int ixfr_log_maint(struct zoneinfo *zp) {
(void) close(fd);
return (-1);
}
/* find out how big the zone db file is */
if ((db_fp = fopen(zp->z_source, "r")) == NULL) {
ns_warning(ns_log_db, "%s: %s",
zp->z_source, strerror(errno));
(void) unlink(tmpname);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
(void) my_fclose(to_fp);
(void) close(fd);
return (-1);
}
if (fstat(fileno(db_fp), &db_sb) < 0) {
ns_warning(ns_log_db, "%s: %s",
zp->z_source, strerror(errno));
(void) my_fclose(to_fp);
(void) my_fclose(db_fp);
(void) close(fd);
(void) unlink(tmpname);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
return (-1);
}
(void) my_fclose(db_fp);
ns_debug(ns_log_default, 3, "%s, size %d blk %d",
zp->z_source, db_sb.st_size,
db_sb.st_size);
/* open up the zone ixfr log */
if ((from_fp = fopen(zp->z_ixfr_base, "r")) == NULL) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
(void) my_fclose(to_fp);
(void) close(fd);
(void) unlink(tmpname);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
return (-1);
}
if (fstat(fileno(from_fp), &sb) < 0) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
(void) my_fclose(to_fp);
(void) close(fd);
(void) unlink(tmpname);
(void) my_fclose(from_fp);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
return (-1);
}
ns_debug(ns_log_default, 3, "%s, size %d log_s %d max %d\n",
zp->z_ixfr_base,
sb.st_size,
zp->z_log_size_ixfr,
zp->z_max_log_size_ixfr);
if (zp->z_max_log_size_ixfr) {
if (sb.st_size > zp->z_max_log_size_ixfr)
seek = sb.st_size - (zp->z_max_log_size_ixfr + (zp->z_max_log_size_ixfr *.10));
else
seek = 0;
} else {
if (sb.st_size > (db_sb.st_size * .50))
seek = sb.st_size - ((db_sb.st_size * .50)
+ ((db_sb.st_size * zp->z_max_log_size_ixfr) *.10));
else
seek = 0;
}
ns_debug(ns_log_default, 3, "seek: %d", seek);
if (seek < 1)
{
ns_debug(ns_log_default, 3, "%s does not need to be reduced",
zp->z_ixfr_base);
(void) my_fclose(to_fp);
(void) close(fd);
(void) unlink(tmpname);
(void) my_fclose(from_fp);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
return (-1);
}
if (fgets(buf, sizeof(buf), from_fp) == NULL) {
ns_error(ns_log_update, "fgets() from %s failed: %s",
zp->z_ixfr_base, strerror(errno));
(void) my_fclose(from_fp);
(void) my_fclose(to_fp);
(void) close(fd);
(void) unlink(tmpname);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
return (-1);
error++;
goto clean_up;
}
if (strcmp(buf, LogSignature) != 0) {
ns_error(ns_log_update, "invalid log file %s",
zp->z_ixfr_base);
(void) my_fclose(from_fp);
(void) my_fclose(to_fp);
(void) close(fd);
(void) unlink(tmpname);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
return (-3);
error++;
goto clean_up;
}
if (fseek( from_fp, seek, 0) < 0) {
(void) my_fclose(from_fp);
(void) my_fclose(to_fp);
(void) close(fd);
(void) unlink(tmpname);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
return (-1);
if (fseek( from_fp, seek, 0) < 0) {
error++;
goto clean_up;
}
found = 0;
@@ -517,47 +534,61 @@ int ixfr_log_maint(struct zoneinfo *zp) {
if (found) {
ns_debug(ns_log_default, 1, "ixfr_log_maint(): found [END_DELTA]");
fprintf(to_fp, "%s", LogSignature);
while ((rcount = fread(buf, sizeof(char), MAXBSIZE, from_fp)) > 0) {
wcount = fwrite(buf, sizeof(char), rcount, to_fp);
if (rcount != wcount || wcount == -1) {
ns_warning(ns_log_default, "ixfr_log_maint: error in writting copy");
rval = 1;
break;
}
}
if (rcount < 0) {
ns_warning(ns_log_default, "ixfr_log_maint: error in reading copy");
rval = 1;
}
if (rcount < 0)
ns_warning(ns_log_default,
"ixfr_log_maint: error in reading copy");
}
clean_up:
(void) my_fclose(to_fp);
(void) close(fd);
(void) my_fclose(from_fp);
if (rename(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));
if (error == 0) {
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));
}
if ((from_fp = fopen(zp->z_ixfr_base, "r")) == NULL) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
return (-1);
}
if (fstat(fileno(from_fp), &sb) < 0) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
(void) my_fclose(from_fp);
return (-1);
}
if (sb.st_size <= 0)
(void) unlink(zp->z_ixfr_base);
else if (chmod(zp->z_ixfr_base, 0644) < 0)
ns_error(ns_log_update,
"chmod(%s,%o) failed, pressing on: %s",
zp->z_source, sb.st_mode,
strerror(errno));
}
(void) unlink(tmpname);
memput(tmpname, (strlen(zp->z_ixfr_base) + sizeof(".XXXXXX") + 1));
if ((from_fp = fopen(zp->z_ixfr_base, "r")) == NULL) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
return (-1);
}
if (fstat(fileno(from_fp), &sb) < 0) {
ns_warning(ns_log_db, "%s: %s",
zp->z_ixfr_base, strerror(errno));
(void) my_fclose(from_fp);
return (-1);
}
if (sb.st_size <= 0)
(void) unlink(zp->z_ixfr_base);
(void) my_fclose(from_fp);
ns_debug(ns_log_default, 3, "%s, size %d log_s %d max %d\n",
zp->z_serial_ixfr_start = 0; /* signal to read for lowest serial number */
ns_debug(ns_log_default, 3, "%s, size %d max %d\n",
zp->z_ixfr_base,
sb.st_size,
zp->z_log_size_ixfr,
zp->z_max_log_size_ixfr);
return (0);
if (error)
return(-1);
else
return (0);
}
+6 -2
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_lexer.c,v 8.19 1999/10/13 16:39:08 vixie Exp $";
static const char rcsid[] = "$Id: ns_lexer.c,v 8.22 2000/11/29 06:55:58 marka Exp $";
#endif /* not lint */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
@@ -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},
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
+245 -84
View File
@@ -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.117 1999/11/08 23:01:38 vixie Exp $";
static const char rcsid[] = "$Id: ns_main.c,v 8.142 2001/01/15 20:06:25 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: ns_main.c,v 8.117 1999/11/08 23:01:38 vixie Ex
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -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;
@@ -146,7 +158,11 @@ static int iflist_dont_rescan = 0;
static const int drbufsize = 32 * 1024, /* UDP rcv buf size */
dsbufsize = 48 * 1024, /* UDP snd buf size */
sbufsize = 16 * 1024, /* TCP snd buf size */
#ifdef BROKEN_RECVFROM
nudptrans = 1,
#else
nudptrans = 20, /* #/udps per select */
#endif
listenmax = 50;
static u_int16_t nsid_state;
@@ -158,9 +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;
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 *),
@@ -173,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,
@@ -192,7 +210,8 @@ static void stream_send(evContext, void *, int,
static int only_digits(const char *);
static void init_needs(void),
handle_need(void);
handle_needs(void),
exit_handler(void);
#ifndef HAVE_CUSTOM
static void custom_init(void),
@@ -318,8 +337,8 @@ main(int argc, char *argv[], char *envp[]) {
break;
case 'v':
fprintf(stderr, "%s\n", Version);
exit(1);
fprintf(stdout, "%s\n", Version);
exit(0);
#ifdef CAN_CHANGE_ID
case 'u':
@@ -440,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();
@@ -456,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.
@@ -464,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;
@@ -521,21 +540,16 @@ main(int argc, char *argv[], char *envp[]) {
ns_notice(ns_log_default, "Ready to answer queries.");
gettime(&tt);
prime_cache();
while (!main_needs_exit) {
while (!needs_exit) {
evEvent event;
ns_debug(ns_log_default, 15, "main loop");
if (needs != 0) {
/* Drain outstanding events; handlers ~block~. */
while (evGetNext(ev, &event, EV_POLL) != -1)
INSIST_ERR(evDispatch(ev, event) != -1);
INSIST_ERR(errno == EINTR || errno == EWOULDBLOCK);
handle_need();
} else if (evGetNext(ev, &event, EV_WAIT) != -1) {
if (needs != 0)
handle_needs();
else if (evGetNext(ev, &event, EV_WAIT) != -1)
INSIST_ERR(evDispatch(ev, event) != -1);
} else {
else
INSIST_ERR(errno == EINTR);
}
}
ns_info(ns_log_default, "named shutting down");
#ifdef BIND_UPDATE
@@ -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,6 +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);
@@ -764,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 */
@@ -785,7 +824,7 @@ tcp_send(struct qinfo *qp) {
static void
stream_send(evContext lev, void *uap, int fd, const void *la, int lalen,
const void *ra, int ralen) {
const void *ra, int ralen) {
struct qstream *sp = uap;
ns_debug(ns_log_default, 1, "stream_send");
@@ -890,7 +929,8 @@ stream_getlen(evContext lev, void *uap, int fd, int bytes) {
}
}
iov = evConsIovec(sp->s_buf, sp->s_size);
iov = evConsIovec(sp->s_buf, (sp->s_size <= sp->s_bufsize) ?
sp->s_size : sp->s_bufsize);
if (evRead(lev, sp->s_rfd, &iov, 1, stream_getmsg, sp, &sp->evID_r)
== -1)
ns_panic(ns_log_default, 1, "evRead(fd %d): %s",
@@ -1017,6 +1057,21 @@ datagram_read(evContext lev, void *uap, int fd, int evmask) {
goto more;
}
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)
@@ -1127,13 +1182,13 @@ getnetconf(int periodic_scan) {
ifc.ifc_len = bufsiz;
ifc.ifc_buf = buf;
#ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF
/*
* This is a fix for IRIX OS in which the call to ioctl with
* the flag SIOCGIFCONF may not return an entry for all the
* interfaces like most flavors of Unix.
*/
if (emul_ioctl(&ifc) >= 0)
break;
/*
* This is a fix for IRIX OS in which the call to ioctl with
* the flag SIOCGIFCONF may not return an entry for all the
* interfaces like most flavors of Unix.
*/
if (emul_ioctl(&ifc) >= 0)
break;
#else
if ((n = ioctl(s, SIOCGIFCONF, (char *)&ifc)) != -1) {
/*
@@ -1247,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;
@@ -1431,6 +1487,11 @@ opensocket_d(interface *ifp) {
ns_notice(ns_log_default, "fcntl(dfd, F_DUPFD, 20): %s",
strerror(errno));
#endif
if (fcntl(ifp->dfd, F_SETFD, 1) < 0) {
ns_error(ns_log_default, "F_SETFD: %s", strerror(errno));
close(ifp->dfd);
return (-1);
}
ns_debug(ns_log_default, 1, "ifp->addr %s d_dfd %d",
sin_ntoa(nsa), ifp->dfd);
if (setsockopt(ifp->dfd, SOL_SOCKET, SO_REUSEADDR,
@@ -1456,6 +1517,14 @@ opensocket_d(interface *ifp) {
ifp->dfd, dsbufsize, strerror(errno));
/* 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",
@@ -1472,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:
@@ -1516,6 +1654,11 @@ opensocket_s(interface *ifp) {
ns_notice(ns_log_default, "fcntl(sfd, F_DUPFD, 20): %s",
strerror(errno));
#endif
if (fcntl(ifp->sfd, F_SETFD, 1) < 0) {
ns_error(ns_log_default, "F_SETFD: %s", strerror(errno));
close(ifp->sfd);
return (-1);
}
if (setsockopt(ifp->sfd, SOL_SOCKET, SO_REUSEADDR,
(char *)&on, sizeof on) != 0) {
ns_notice(ns_log_default, "setsockopt(REUSEADDR): %s",
@@ -1617,12 +1760,22 @@ opensocket_f() {
strerror(errno));
if (ds > evHighestFD(ev))
ns_panic(ns_log_default, 1, "socket too high: %d", ds);
if (fcntl(ds, F_SETFD, 1) < 0)
ns_panic(ns_log_default, 1, "F_SETFD: %s", strerror(errno));
if (setsockopt(ds, SOL_SOCKET, SO_REUSEADDR,
(char *)&on, sizeof on) != 0) {
ns_notice(ns_log_default, "setsockopt(REUSEADDR): %s",
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",
@@ -1719,7 +1872,7 @@ sq_remove(struct qstream *qp) {
INSIST_ERR(evDeselectFD(ev, qp->evID_w) != -1);
if (qp->flags & STREAM_CONNECT_EV)
INSIST_ERR(evCancelConn(ev, qp->evID_c) != -1);
if (qp->flags & STREAM_AXFR)
if (qp->flags & STREAM_AXFR || qp->flags & STREAM_AXFRIXFR)
ns_freexfr(qp);
(void) close(qp->s_rfd);
if (qp == streamq)
@@ -1906,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.
@@ -1945,7 +2082,7 @@ sq_done(struct qstream *sp) {
sp->s_wbuf_send = sp->s_wbuf_free = NULL;
sp->s_wbuf_end = sp->s_wbuf = NULL;
}
if (sp->flags & STREAM_AXFR)
if (sp->flags & STREAM_AXFR || sp->flags & STREAM_AXFRIXFR)
ns_freexfr(sp);
sp->s_refcnt = 0;
sp->s_time = tt.tv_sec;
@@ -2340,7 +2477,7 @@ static const u_int16_t nsid_multiplier_table[] = {
10853, 1453, 18069, 21693, 30573, 36261, 37421, 42533
};
#define NSID_MULT_TABLE_SIZE \
((sizeof nsid_multiplier_table)/(sizeof nsid_multiplier_table[0]))
((sizeof nsid_multiplier_table)/(sizeof nsid_multiplier_table[0]))
void
nsid_init(void) {
@@ -2529,11 +2666,6 @@ deallocate_everything(void) {
}
}
static void
ns_exit(void) {
main_needs_exit++;
}
static void
ns_restart(void) {
ns_info(ns_log_default, "named restarting");
@@ -2618,28 +2750,52 @@ init_needs(void) {
handlers[main_need_zoneload] = loadxfer;
handlers[main_need_dump] = doadump;
handlers[main_need_statsdump] = ns_stats;
handlers[main_need_exit] = ns_exit;
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;
handlers[main_need_reap] = reapchild;
handlers[main_need_noexpired] = ns_noexpired;
}
static void
handle_need(void) {
int need;
handle_needs(void) {
int need, queued = 0;
ns_debug(ns_log_default, 15, "handle_need()");
ns_debug(ns_log_default, 15, "handle_needs()");
block_signals();
for (need = 0; need < main_need_num; need++)
if ((needs & (1 << need)) != 0) {
/* Turn off flag first, handlers ~turn~ it back on. */
block_signals();
needs &= ~(1 << need);
unblock_signals();
(handlers[need])();
return;
INSIST_ERR(evWaitFor(ev, (void *)handle_needs,
need_waitfunc,
(void *)handlers[need],
NULL) != -1);
queued++;
}
ns_panic(ns_log_default, 1, "handle_need() found no needs", NULL);
needs = 0;
unblock_signals();
ns_debug(ns_log_default, 15, "handle_needs(): queued %d", queued);
if (queued != 0) {
INSIST_ERR(evDo(ev, (void *)handle_needs) != -1);
return;
}
ns_panic(ns_log_default, 1, "ns_handle_needs: queued == 0", NULL);
}
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
@@ -2655,6 +2811,11 @@ ns_need_unsafe(enum need need) {
needs |= (1 << need);
}
static void
exit_handler(void) {
needs_exit = 1;
}
void
ns_setoption(int option) {
ns_warning(ns_log_default, "used obsolete ns_setoption(%d)", option);
@@ -2703,18 +2864,18 @@ meminit(size_t init_max_size, size_t target_size) {
void *
memget_debug(size_t size, const char *file, int line) {
void *ptr;
ptr = __memget(size);
fprintf(stderr, "%s:%d: memget(%lu) -> %p\n", file, line,
(u_long)size, ptr);
return (ptr);
void *ptr;
ptr = __memget(size);
fprintf(stderr, "%s:%d: memget(%lu) -> %p\n", file, line,
(u_long)size, ptr);
return (ptr);
}
void
memput_debug(void *ptr, size_t size, const char *file, int line) {
fprintf(stderr, "%s:%d: memput(%p, %lu)\n", file, line, ptr,
(u_long)size);
__memput(ptr, size);
fprintf(stderr, "%s:%d: memput(%p, %lu)\n", file, line, ptr,
(u_long)size);
__memput(ptr, size);
}
void
+359 -80
View File
@@ -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.95 1999/10/13 16:39:09 vixie Exp $";
static const char rcsid[] = "$Id: ns_maint.c,v 8.117 2001/01/25 05:50:55 marka Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: ns_maint.c,v 8.95 1999/10/13 16:39:09 vixie Ex
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -120,32 +120,33 @@ static const char rcsid[] = "$Id: ns_maint.c,v 8.95 1999/10/13 16:39:09 vixie Ex
#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 *),
abortxfer(struct zoneinfo *),
tryxfer(void),
purge_z_2(struct hashbuf *, int);
static int purge_nonglue_2(const char *, struct hashbuf *,
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
@@ -178,10 +179,19 @@ zone_maint(struct zoneinfo *zp) {
#endif
if (zp->z_serial != 0 &&
((zp->z_lastupdate+zp->z_expire) < (u_int32_t)tt.tv_sec)) {
if ((zp->z_flags & Z_NOTIFY) != 0)
ns_stopnotify(zp->z_origin, zp->z_class);
/* calls purge_zone */
do_reload(zp->z_origin, zp->z_type, zp->z_class, 0);
/* reset zone state */
if (!haveComplained((u_long)zp, (u_long)stale)) {
ns_notice(ns_log_default,
"%s zone \"%s\" expired",
zoneTypeString(zp->z_type),
zp->z_origin);
}
zp->z_flags &= ~Z_AUTH;
zp->z_flags |= Z_EXPIRED;
zp->z_refresh = INIT_REFRESH;
zp->z_retry = INIT_REFRESH;
zp->z_serial = 0;
@@ -247,9 +257,9 @@ zone_maint(struct zoneinfo *zp) {
zp->z_dumptime = 0;
(void)schedule_dump(zp);
}
if (zp->z_maintain_ixfr_base)
ixfr_log_maint(zp);
}
if (zp->z_maintain_ixfr_base)
ixfr_log_maint(zp);
break;
#endif /* BIND_UPDATE */
@@ -402,7 +412,7 @@ ns_cleancache(evContext ctx, void *uap,
void
ns_heartbeat(evContext ctx, void *uap, struct timespec due,
struct timespec inter)
struct timespec inter)
{
struct zoneinfo *zp;
@@ -417,12 +427,9 @@ ns_heartbeat(evContext ctx, void *uap, struct timespec due,
(zp->z_dialup == zdialup_use_default &&
NS_OPTION_P(OPTION_NODIALUP)))
continue;
#ifdef BIND_NOTIFY
if ((zp->z_notify == znotify_no) ||
((zp->z_notify == znotify_use_default) &&
NS_OPTION_P(OPTION_NONOTIFY)))
continue;
#endif
/*
* Perform the refresh query that was suppressed.
*/
if ((zt == z_slave || zt == z_stub) &&
(zp->z_flags &
(Z_NEED_RELOAD|Z_NEED_XFER|Z_QSERIAL|Z_XFER_RUNNING)
@@ -432,6 +439,18 @@ ns_heartbeat(evContext ctx, void *uap, struct timespec due,
*(zp->z_origin) ? zp->z_origin : ".");
qserial_query(zp);
}
#ifdef BIND_NOTIFY
/*
* Trigger a refresh query while the link is up by
* sending a notify.
*/
if (((zp->z_notify == znotify_yes) ||
((zp->z_notify == znotify_use_default) &&
!NS_OPTION_P(OPTION_NONOTIFY))) &&
(zt == z_master || zt == z_slave) && !loading &&
((zp->z_flags & Z_AUTH) != 0))
ns_notify(zp->z_origin, zp->z_class, ns_t_soa);
#endif
}
}
@@ -453,8 +472,10 @@ markUpToDate(struct zoneinfo *zp) {
* but only if there were no errors
* in the zone file.
*/
if ((zp->z_flags & Z_DB_BAD) == 0)
if ((zp->z_flags & Z_DB_BAD) == 0) {
zp->z_flags |= Z_AUTH;
zp->z_flags &= ~Z_EXPIRED;
}
if (zp->z_source) {
struct timeval t[2];
@@ -564,12 +585,12 @@ qserial_answer(struct qinfo *qp) {
if (qs->serial != zp->z_serial)
ns_notice(ns_log_xfer_in,
"Zone \"%s\" (%s) SOA serial# (%lu) rcvd from [%s] is < ours (%lu)%s",
"Zone \"%s\" (%s) SOA serial# (%lu) rcvd from [%s] is < ours (%lu)%s",
zp->z_origin, p_class(zp->z_class),
qs->serial,
(u_long) qs->serial,
inet_ntoa(qs->ns_addr.sin_addr),
zp->z_serial, qp->q_naddr != 1 ?
": skipping" : "");
(u_long) zp->z_serial,
qp->q_naddr!=1 ? ": skipping" : "");
qs->serial = 0;
continue;
}
@@ -620,41 +641,116 @@ 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
* being in tt. Caller must do a sched_zone_maint(zp) after we return.
@@ -670,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",
@@ -683,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) {
@@ -708,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";
@@ -739,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.
@@ -767,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;
@@ -796,7 +898,7 @@ startxfer(struct zoneinfo *zp) {
}
*curr = '\0';
ns_debug(ns_log_xfer_in, 1, buffer);
}
}
#endif /* DEBUG */
gettime(&tt);
@@ -807,16 +909,18 @@ 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;
}
if ((pid = spawnxfer(argv, zp)) == -1)
if ((pid = spawnxfer(argv, zp)) == -1) {
unlink(tsig_name);
return;
}
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;
@@ -1066,6 +1170,8 @@ remove_zone(struct zoneinfo *zp, const char *verb) {
(zp->z_flags & Z_NEED_DUMP) != 0))
(void) zonedump(zp, ISNOTIXFR);
#endif
if ((zp->z_flags & Z_NOTIFY) != 0)
ns_stopnotify(zp->z_origin, zp->z_class);
ns_stopxfrs(zp);
do_reload(zp->z_origin, zp->z_type, zp->z_class, 1);
ns_notice(ns_log_config, "%s zone \"%s\" (%s) %s",
@@ -1075,9 +1181,152 @@ 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, int log) {
const char *fname;
struct namebuf *np;
struct hashbuf *phtp = htp;
int root_zone = 0;
int errs = 0;
ns_debug(ns_log_default, 1, "purge_zone(%s,%d)", dname, class);
if ((np = nlookup(dname, &phtp, &fname, 0)) && dname == fname &&
!ns_wildcard(NAME(*np))) {
if (*dname == '\0')
root_zone = 1;
if (np->n_hash != NULL || root_zone) {
struct hashbuf *h;
if (root_zone)
h = htp;
else
h = np->n_hash;
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;
}
}
}
return (errs);
}
static int
valid_glue(struct databuf *dp, char *name, int belowcut) {
/* NS records are only valid glue at the zone cut */
if (belowcut && dp->d_type == T_NS)
return(0);
if (ISVALIDGLUE(dp)) /* T_NS/T_A/T_AAAA/T_A6 */
return (1);
if (belowcut)
return (0);
/* Parent NXT record? */
if (dp->d_type == T_NXT && !ns_samedomain((char*)dp->d_data, name) &&
ns_samedomain((char*)dp->d_data, zones[dp->d_zone].z_origin))
return (1);
/* NOKEY is in parent zone otherwise child zone */
if (dp->d_type == T_KEY && dp->d_size == 4 &&
(dp->d_data[0] & 0xc3) == 0xc1)
return (1);
/* NXT & KEY records may be signed */
if (!belowcut && dp->d_type == T_SIG &&
(SIG_COVERS(dp) == T_NXT || SIG_COVERS(dp) == T_KEY))
return (1);
return (0);
}
static int
purge_nonglue_2(const char *dname, struct hashbuf *htp, int class,
int belowcut, int log)
{
struct databuf *dp, *pdp;
struct namebuf *np, *pnp, *npn;
struct namebuf **npp, **nppend;
int errs = 0;
int zonecut;
char name[MAXDNAME];
nppend = htp->h_tab + htp->h_size;
for (npp = htp->h_tab; npp < nppend; npp++) {
for (pnp = NULL, np = *npp; np != NULL; np = npn) {
if (!bottom_of_zone(np->n_data, class)) {
zonecut = belowcut;
for (dp = np->n_data; dp != NULL;
dp = dp->d_next) {
if (match(dp, class, ns_t_ns)) {
zonecut = 1;
break;
}
}
getname(np, name, sizeof name);
for (pdp = NULL, dp = np->n_data;
dp != NULL;
(void)NULL) {
if (dp->d_class == class &&
zonecut &&
!valid_glue(dp, name, belowcut)) {
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),
belowcut ? "below" :
"at",
*name ? name : ".",
p_type(dp->d_type));
dp = rm_datum(dp, np, pdp,
NULL);
if (log)
errs++;
} else {
pdp = dp;
dp = dp->d_next;
}
}
if (np->n_hash) {
/*
* call recursively to clean
* subdomains
*/
errs += purge_nonglue_2(dname,
np->n_hash,
class,
zonecut ||
belowcut,
log);
/* if now empty, free it */
if (np->n_hash->h_cnt == 0) {
rm_hash(np->n_hash);
np->n_hash = NULL;
}
}
}
if (np->n_hash == NULL && np->n_data == NULL) {
npn = rm_name(np, npp, pnp);
htp->h_cnt--;
} else {
npn = np->n_next;
pnp = np;
}
}
}
return (errs);
}
void
purge_zone(const char *dname, struct hashbuf *htp, int class) {
const char *fname;
@@ -1186,15 +1435,17 @@ bottom_of_zone(struct databuf *dp, int class) {
ns_debug(ns_log_default, 3, "bottom_of_zone() == %d", ret);
return (ret);
}
/*
* 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 */
@@ -1202,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);
}
@@ -1247,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)
@@ -1295,7 +1542,7 @@ reapchild(void) {
*/
void
endxfer() {
struct zoneinfo *zp;
struct zoneinfo *zp;
int exitstatus, i;
pid_t pid;
WAIT_T status;
@@ -1313,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);
@@ -1324,8 +1570,8 @@ endxfer() {
if (WIFSIGNALED(status)) {
if (WTERMSIG(status) != SIGKILL) {
ns_notice(ns_log_default,
"named-xfer \"%s\" exited with signal %d",
zp->z_origin[0]?zp->z_origin:".",
"named-xfer \"%s\" exited with signal %d",
zp->z_origin[0]?zp->z_origin:".",
WTERMSIG(status));
}
ns_retrytime(zp, tt.tv_sec);
@@ -1343,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;
@@ -1351,8 +1599,8 @@ endxfer() {
break;
case XFER_SUCCESSIXFR:
zp->z_flags |= Z_XFER_RUNNING;
zp->z_xferpid = XFER_ISIXFR;
zp->z_log_size_ixfr++;
ns_notice(ns_log_default,
"IXFR Success %s",
zp->z_ixfr_tmp);
@@ -1363,17 +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:
@@ -1436,7 +1691,7 @@ tryxfer() {
zp = zones;
}
lastnzones = nzones;
if (zp == zones)
stopzp = &zones[nzones-1];
else
@@ -1454,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);
@@ -1482,7 +1736,7 @@ tryxfer() {
*/
void
loadxfer(void) {
struct zoneinfo *zp;
struct zoneinfo *zp;
u_int32_t old_serial,new_serial;
char *tmpnom;
int isixfr;
@@ -1512,11 +1766,12 @@ loadxfer(void) {
if (!db_load(tmpnom, zp->z_origin, zp, NULL, isixfr)) {
zp->z_flags |= Z_AUTH;
zp->z_flags &= ~Z_EXPIRED;
if (isixfr == ISIXFR) {
new_serial= zp ->z_serial;
ns_warning(ns_log_db, "ISIXFR");
ns_warning(ns_log_db, "error in updating ixfr data base file %s from %s", zp -> z_ixfr_base, zp ->z_ixfr_tmp);
if (zonedump(zp,ISIXFR)<0)
if (zonedump(zp,ISIXFR)<0)
ns_warning(ns_log_db, "error in write ixfr updates to zone file %s", zp ->z_source);
}
@@ -1578,6 +1833,16 @@ reload_master(struct zoneinfo *zp) {
zp->z_flags &= ~Z_AUTH;
ns_stopxfrs(zp);
/* XXX what about parent zones? */
#ifdef BIND_UPDATE
/*
* A dynamic zone might have changed, so we
* need to dump it before reloading it.
*/
if ((zp->z_flags & Z_DYNAMIC) != 0 &&
((zp->z_flags & Z_NEED_SOAUPDATE) != 0 ||
(zp->z_flags & Z_NEED_DUMP) != 0))
(void) zonedump(zp, ISNOTIXFR);
#endif
purge_zone(zp->z_origin, hashtab, zp->z_class);
ns_debug(ns_log_config, 1, "reloading zone");
#ifdef BIND_UPDATE
@@ -1640,18 +1905,32 @@ ns_zreload(void) {
*/
void
ns_reload(void) {
ns_notice(ns_log_default, "reloading nameserver");
ns_notice(ns_log_default, "%s %snameserver",
(reconfiging != 0) ? "reconfiguring" : "reloading",
(noexpired == 1) ? "(-noexpired) " : "");
INSIST(reloading == 0);
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.");
}
/*
* Reload configuration, look for new or deleted zones, not changed ones
* also ignore expired zones.
*/
void
ns_noexpired(void) {
INSIST(noexpired == 0);
noexpired++; /* To ignore zones which are expired */
ns_reconfig();
noexpired--;
}
/*
* Reload configuration, look for new or deleted zones, not changed ones.
*/
@@ -1682,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++;
@@ -1713,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);
+2 -2
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_ncache.c,v 8.26 1999/10/13 16:39:10 vixie Exp $";
static const char rcsid[] = "$Id: ns_ncache.c,v 8.27 2000/04/21 06:54:09 vixie Exp $";
#endif /* not lint */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
+56 -10
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_notify.c,v 8.4 1999/10/15 19:49:04 vixie Exp $";
static const char rcsid[] = "$Id: ns_notify.c,v 8.12 2000/12/23 08:14:40 vixie Exp $";
#endif /* not lint */
/*
* Copyright (c) 1994-1999 by Internet Software Consortium.
* Copyright (c) 1994-2000 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
@@ -78,6 +78,7 @@ static void notify_timer(evContext, void *,
/* Local. */
static LIST(struct notify) pending_notifies;
static LIST(struct notify) loading_notifies;
/* Public. */
@@ -100,6 +101,13 @@ ns_notify(const char *dname, ns_class class, ns_type type) {
p_class(class), p_type(type));
return;
}
if (ns_samename(dname, zp->z_origin) != 1) {
ns_warning(ns_log_notify,
"notify not called with top of zone (\"%s\" %s %s)",
(dname && *dname) ? dname : ".",
p_class(class), p_type(type));
return;
}
if ((zp->z_flags & Z_NOTIFY) != 0) {
ns_info(ns_log_notify,
"suppressing duplicate notify (\"%s\" %s %s)",
@@ -121,8 +129,14 @@ 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) {
APPEND(loading_notifies, ni, link);
return;
}
/* Delay notification for from five seconds up to fifteen minutes. */
max_delay = MIN(nzones/5, 895);
max_delay = MAX(max_delay, 25);
@@ -146,6 +160,19 @@ ns_notify(const char *dname, ns_class class, ns_type type) {
ni, zp, delay);
}
void
notify_afterload() {
struct notify *ni;
INSIST(loading == 0);
while ((ni = HEAD(loading_notifies)) != NULL) {
UNLINK(loading_notifies, ni, link);
ns_notify(ni->name, ni->class, ni->type);
freestr(ni->name);
memput(ni, sizeof *ni);
}
}
/*
* ns_unnotify()
* call this when all pending notifies are now considered junque.
@@ -161,6 +188,25 @@ ns_unnotify(void) {
}
}
/*
* ns_stopnotify(const char *dname, ns_class class)
* stop notifies for this particular zone.
*/
void
ns_stopnotify(const char *dname, ns_class class) {
struct notify *ni;
ni = HEAD(pending_notifies);
while (ni != NULL &&
(ni->class != class || ns_samename(ni->name, dname) != 1))
ni = NEXT(ni, link);
if (ni != NULL) {
UNLINK(pending_notifies, ni, link);
free_notify(ni);
}
}
/* Private. */
/*
@@ -170,7 +216,8 @@ ns_unnotify(void) {
*/
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;
struct in_addr *also_addr;
@@ -198,10 +245,9 @@ sysnotify(const char *dname, ns_class class, ns_type type) {
return;
}
zname = zp->z_origin;
zserial = zp->z_serial;
nns = na = 0;
if (zp->z_type == z_master)
sysnotify_slaves(dname, zname, class, type,
zp - zones, &nns, &na);
sysnotify_slaves(dname, zname, class, type, zp - zones, &nns, &na);
/*
* Handle any global or zone-specific also-notify clauses
@@ -239,8 +285,8 @@ sysnotify(const char *dname, ns_class class, ns_type type) {
if (nns != 0 || na != 0)
ns_info(ns_log_notify,
"Sent NOTIFY for \"%s %s %s\" (%s); %d NS, %d A",
dname, p_class(class), p_type(type), zname, nns, na);
"Sent NOTIFY for \"%s %s %s %u\" (%s); %d NS, %d A",
dname, p_class(class), p_type(type), zserial, zname, nns, na);
}
static void
@@ -328,7 +374,7 @@ sysnotify_ns(const char *dname, const char *aname,
nss[nsc++] = ina;
} /*next A*/
if (nsc == 0) {
if (!is_us) {
if (!is_us && !NS_OPTION_P(OPTION_NOFETCHGLUE)) {
struct qinfo *qp;
qp = sysquery(aname, class, ns_t_a, 0, 0, ns_port,
@@ -349,7 +395,7 @@ free_notify(struct notify *ni) {
INSIST(!LINKED(ni, link));
zp = find_auth_zone(ni->name, ni->class);
if (zp != NULL) {
if (zp != NULL && ns_samename(ni->name, zp->z_origin) == 1) {
INSIST((zp->z_flags & Z_NOTIFY) != 0);
zp->z_flags &= ~Z_NOTIFY;
}
+40 -21
View File
@@ -1,10 +1,10 @@
%{
#if !defined(lint) && !defined(SABER)
static char rcsid[] = "$Id: ns_parser.y,v 8.51 1999/11/12 05:29:18 vixie Exp $";
static char rcsid[] = "$Id: ns_parser.y,v 8.63 2000/12/23 08:14:41 vixie Exp $";
#endif /* not lint */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
@@ -25,6 +25,7 @@ static char rcsid[] = "$Id: ns_parser.y,v 8.51 1999/11/12 05:29:18 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,
@@ -375,8 +382,6 @@ option: /* Empty */
}
| T_HAS_OLD_CLIENTS yea_or_nay
{
set_global_boolean_option(current_options,
OPTION_MAINTAIN_IXFR_BASE, $2);
set_global_boolean_option(current_options,
OPTION_NORFC2308_TYPE1, $2);
set_global_boolean_option(current_options,
@@ -531,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;
}
@@ -589,7 +598,9 @@ control: /* Empty */
}
| T_UNIX L_QSTRING T_PERM L_NUMBER T_OWNER L_NUMBER T_GROUP L_NUMBER
{
#ifndef NO_SOCKADDR_UN
ns_ctl_add(&current_controls, ns_ctl_new_unix($2, $4, $6, $8));
#endif
}
| error
;
@@ -960,6 +971,8 @@ logging_opt: T_CATEGORY category
chan_name, NULL,
chan_versions,
chan_max_size);
log_set_file_owner(current_channel,
user_id, group_id);
freestr(chan_name);
chan_name = NULL;
break;
@@ -1122,7 +1135,6 @@ channel_name: any_string
channel: channel_name
{
log_channel channel;
symbol_value value;
if (current_category >= 0) {
channel = lookup_channel($1);
@@ -1459,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);
@@ -1553,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);
@@ -1613,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);
}
@@ -1870,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)
@@ -1939,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();
@@ -1953,6 +1971,7 @@ parse_configuration(const char *filename) {
(void)yyparse();
lexer_end_file();
parser_cleanup();
return (sb.st_mtime);
}
void
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
+194 -108
View File
@@ -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.104 1999/10/15 19:49:04 vixie Exp $";
static const char rcsid[] = "$Id: ns_req.c,v 8.129 2001/01/08 23:46:41 marka Exp $";
#endif /* not lint */
/*
@@ -82,7 +82,7 @@ static const char rcsid[] = "$Id: ns_req.c,v 8.104 1999/10/15 19:49:04 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -138,6 +138,7 @@ struct addinfo {
u_int16_t a_class; /* class for data */
};
#ifndef BIND_UPDATE
enum req_action { Finish, Refuse, Return };
#endif
@@ -173,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;
@@ -187,8 +191,6 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
res_pquery(&res, msg, msglen, log_get_stream(packet_channel));
}
#endif
msglen_orig = msglen;
siglen = sizeof(sig);
tsigstart = ns_find_tsig(msg, msg + msglen);
if (tsigstart == NULL)
@@ -197,10 +199,17 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
char buf[MAXDNAME];
has_tsig = 1;
ns_name_ntop(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",
buf);
key = NULL;
}
key = find_key(buf, NULL);
if (key == NULL) {
error = ns_r_badkey;
hp->rcode = ns_r_notauth;
ns_debug(ns_log_default, 1,
"ns_req: TSIG verify failed - unknown key %s",
buf);
@@ -263,7 +272,11 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
* safely assume these are always 0 when a query
* comes in.
*/
hp->aa = hp->ra = 0;
#ifdef BIND_NOTIFY
if (hp->opcode != ns_o_notify)
#endif
hp->aa = 0;
hp->ra = 0;
ra = (NS_OPTION_P(OPTION_NORECURSE) == 0);
if (error == NOERROR)
@@ -354,6 +367,7 @@ ns_req(u_char *msg, int msglen, int buflen, struct qstream *qsp,
hp->ancount = htons(0);
hp->nscount = htons(0);
hp->arcount = htons(0);
cp = msg + HFIXEDSZ;
}
/*
@@ -361,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);
@@ -386,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);
@@ -404,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,
@@ -447,10 +468,21 @@ 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;
/* valid notify's are authoritative */
if (!hp->aa) {
ns_debug(ns_log_notify, 1,
"FORMERR Notify request without AA");
#ifdef not_yet
hp->rcode = ns_r_formerr;
return (Finish);
#endif
}
hp->aa = 0;
/* valid notify's have one question */
if (ntohs(hp->qdcount) != 1) {
ns_debug(ns_log_notify, 1,
@@ -515,7 +547,7 @@ req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg,
goto refuse;
}
if (findZonePri(zp, from) == -1) {
ns_info(ns_log_notify,
ns_debug(ns_log_notify, 1,
"NOTIFY(SOA) from non-master server (zone %s), from %s",
zp->z_origin, sin_ntoa(from));
goto refuse;
@@ -549,6 +581,7 @@ req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg,
}
noerror:
hp->rcode = ns_r_noerror;
hp->aa = 1;
return (Finish);
refuse:
hp->rcode = ns_r_refused;
@@ -556,6 +589,7 @@ req_notify(HEADER *hp, u_char **cpp, u_char *eom, u_char *msg,
}
#endif /*BIND_NOTIFY*/
static enum req_action
req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
int *buflenp, int *msglenp, u_char *msg, int dfd, int *ra,
@@ -633,7 +667,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
}
if (((ntohs(hp->nscount) != 0) && (type != ns_t_ixfr)) ||
((ntohs(hp->nscount) != 1) && (type == ns_t_ixfr)))
((ntohs(hp->nscount) != 1) && (type == ns_t_ixfr)))
{
ns_debug(ns_log_default, 1, "FORMERR Query nscount wrong");
hp->rcode = ns_r_formerr;
@@ -647,6 +681,8 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
* Process query.
*/
if (type == ns_t_ixfr) {
ns_info(ns_log_security, "Request %s from %s",
p_type(type), sin_ntoa(from));
hp->nscount = htons(0);
hp->rd = 0; /* Force IXFR queries to be non recursive. */
n = dn_expand(msg, eom, *cpp, dnbuf2, sizeof dnbuf2);
@@ -714,7 +750,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
nameserIncr(from.sin_addr, nssRcvdAXFR);
hp->rd = 0; /* Recursion not possible. */
}
*buflenp -= *msglenp;
*buflenp -= (*msglenp - HFIXEDSZ);
count = 0;
founddata = 0;
dname = dnbuf;
@@ -803,17 +839,21 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
if (SEQ_GT(serial_ixfr, zp->z_serial))
ixfr_found = 0;
else {
ixfr_error = ixfr_have_log(zp, serial_ixfr, zp->z_serial);
if (ixfr_error < 0) {
ns_debug(ns_log_default,
1, "ixfr_have_log(%d %d) failed %d",
serial_ixfr, zp->z_serial, ixfr_error);
ixfr_found = 0;
/* Refuse IXFR and send AXFR */
type = ns_t_axfr;
} else
ixfr_found = 1;
}
ixfr_error = ixfr_have_log(zp, serial_ixfr,
zp->z_serial);
if (ixfr_error < 0) {
ns_info(ns_log_security, "No %s log from %d for \"%s\"",
p_type(type), serial_ixfr, *dname ? dname : ".");
ns_debug(ns_log_default,
1, "ixfr_have_log(%d %d) failed %d",
serial_ixfr, zp->z_serial, ixfr_error);
ixfr_found = 0; /* Refuse IXFR and send AXFR */
} else if (ixfr_error == 1) {
ixfr_found = 1;
}
}
ns_debug(ns_log_default, 1, "IXFR log lowest serial: %d",
zp->z_serial_ixfr_start);
}
/*
* If recursion is turned on, we need to check recursion ACL
@@ -889,8 +929,9 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
}
}
ns_notice(ns_log_security,
"unapproved query from %s for \"%s\"",
"denied query from %s for \"%s\"",
sin_ntoa(from), *dname ? dname : ".");
nameserIncr(from.sin_addr, nssRcvdUQ);
return (Refuse);
}
} else {
@@ -908,9 +949,14 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
in_key))
{
ns_notice(ns_log_security,
"unapproved %s from %s for \"%s\" (acl)",
"denied %s from %s for \"%s\" (acl)",
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);
}
@@ -918,9 +964,14 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
if (zp->z_type != z_master && zp->z_type != z_slave) {
ns_notice(ns_log_security,
"unapproved %s from %s for \"%s\" (not master/slave)",
"denied %s from %s for \"%s\" (not master/slave)",
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);
}
@@ -928,9 +979,14 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
if ((zp->z_flags & Z_AUTH) == 0) {
ns_notice(ns_log_security,
"unapproved %s from %s for \"%s\" (not authoritative)",
"denied %s from %s for \"%s\" (not authoritative)",
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);
}
@@ -938,14 +994,24 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
if (ns_samename(zp->z_origin, dname) != 1) {
ns_notice(ns_log_security,
"unapproved %s from %s for \"%s\" (not zone top)",
"denied %s from %s for \"%s\" (not zone top)",
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);
}
ns_info(ns_log_security, "approved %s from %s for \"%s\"",
p_type(type), sin_ntoa(from), *dname ? dname : ".");
if (type == ns_t_ixfr) {
ns_info(ns_log_security, "approved %s from %s for \"%s\"",
(ixfr_found) ? p_type(type) : "IXFR/AXFR",
sin_ntoa(from), *dname ? dname : ".");
} else
ns_info(ns_log_security, "approved %s from %s for \"%s\"",
p_type(type), sin_ntoa(from), *dname ? dname : ".");
}
/*
@@ -1102,8 +1168,9 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
if (type == ns_t_ixfr) {
hp->aa = 1;
if ((SEQ_GT(serial_ixfr, zp->z_serial) ||
serial_ixfr == zp->z_serial))
serial_ixfr == zp->z_serial)) {
return (Finish);
}
}
/*
@@ -1113,7 +1180,7 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
if (qsp == NULL)
return (Finish);
else {
if (!ixfr_found) {
if (!ixfr_found && type == ns_t_ixfr) {
qsp->flags |= STREAM_AXFRIXFR;
hp->qdcount = htons(1);
}
@@ -1204,8 +1271,9 @@ req_query(HEADER *hp, u_char **cpp, u_char *eom, struct qstream *qsp,
if (!founddata && hp->rd && recursion_blocked_by_acl) {
ns_notice(ns_log_security,
"unapproved recursive query from %s for %s",
"denied recursion for query from %s for %s",
sin_ntoa(from), *dname ? dname : ".");
nameserIncr(from.sin_addr, nssRcvdURQ);
}
/*
@@ -1340,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;
@@ -1358,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;
@@ -1375,49 +1450,47 @@ req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp,
GETSHORT(class, *cpp);
*cpp += INT32SZ; /* ttl */
GETSHORT(dlen, *cpp);
*cpp += dlen;
if (*cpp != eom) {
if (*cpp + dlen != eom) {
ns_debug(ns_log_default, 1,
"FORMERR IQuery message length off");
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);
}
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) {
if (dlen != INT32SZ) {
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;
if (!NS_OPTION_P(OPTION_FAKE_IQUERY))
return (Refuse);
ns_debug(ns_log_default, 1,
"req: IQuery class %d type %d", class, type);
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, anptr, alen);
*cpp = anptr;
*buflenp -= HFIXEDSZ;
count = 0;
#ifdef QRYLOG
if (qrylog) {
@@ -1425,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*/
@@ -1438,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) {
@@ -1446,19 +1519,20 @@ req_iquery(HEADER *hp, u_char **cpp, u_char *eom, int *buflenp,
return (Finish);
}
*cpp += n;
PUTSHORT((u_int16_t)type, *cpp);
PUTSHORT((u_int16_t)class, *cpp);
*buflenp -= n;
count++;
PUTSHORT((u_int16_t)type, *cpp);
*buflenp -= INT16SZ;
PUTSHORT((u_int16_t)class, *cpp);
*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);
}
@@ -1491,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,
@@ -1591,11 +1665,11 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
}
#endif
if ((n = dn_comp(name, buf, buflen, comp_ptrs, edp)) < 0)
return (-1);
goto cleanup;
cp = buf + n;
buflen -= n;
if (buflen < 0)
return (-1);
goto cleanup;
PUTSHORT((u_int16_t)type, cp);
PUTSHORT((u_int16_t)dp->d_class, cp);
PUTLONG(ttl, cp);
@@ -1608,7 +1682,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
case T_PTR:
n = dn_comp((char *)dp->d_data, cp, buflen, comp_ptrs, edp);
if (n < 0)
return (-1);
goto cleanup;
PUTSHORT((u_int16_t)n, sp);
cp += n;
break;
@@ -1618,7 +1692,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
/* Store domain name in answer */
n = dn_comp((char *)dp->d_data, cp, buflen, comp_ptrs, edp);
if (n < 0)
return (-1);
goto cleanup;
PUTSHORT((u_int16_t)n, sp);
cp += n;
if (doadd) {
@@ -1634,15 +1708,15 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
cp1 = dp->d_data;
n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
if (n < 0)
return (-1);
goto cleanup;
cp += n;
buflen -= type == T_SOA ? n + 5 * INT32SZ : n;
if (buflen < 0)
return (-1);
goto cleanup;
cp1 += strlen((char *)cp1) + 1;
n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
if (n < 0)
return (-1);
goto cleanup;
cp += n;
if (type == T_SOA) {
cp1 += strlen((char *)cp1) + 1;
@@ -1670,7 +1744,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
/* copy order */
buflen -= INT16SZ;
if (buflen < 0)
return (-1);
goto cleanup;
memcpy(cp, cp1, INT16SZ);
cp += INT16SZ;
cp1 += INT16SZ;
@@ -1680,7 +1754,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
/* copy preference */
buflen -= INT16SZ;
if (buflen < 0)
return (-1);
goto cleanup;
memcpy(cp, cp1, INT16SZ);
cp += INT16SZ;
cp1 += INT16SZ;
@@ -1692,7 +1766,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
ns_debug(ns_log_default, 1, "size of n at flags = %d", n);
buflen -= n + 1;
if (buflen < 0)
return (-1);
goto cleanup;
*cp++ = n;
memcpy(cp, cp1, n);
cp += n;
@@ -1704,7 +1778,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
n = *cp1++;
buflen -= n + 1;
if (buflen < 0)
return (-1);
goto cleanup;
*cp++ = n;
memcpy(cp, cp1, n);
cp += n;
@@ -1716,7 +1790,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
n = *cp1++;
buflen -= n + 1;
if (buflen < 0)
return (-1);
goto cleanup;
*cp++ = n;
memcpy(cp, cp1, n);
cp += n;
@@ -1726,10 +1800,10 @@ 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, dnptrs, 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)
return (-1);
goto cleanup;
cp += n;
/* save data length */
@@ -1747,7 +1821,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
cp1 = dp->d_data;
if ((buflen -= INT16SZ) < 0)
return (-1);
goto cleanup;
/* copy preference */
memcpy(cp, cp1, INT16SZ);
@@ -1757,7 +1831,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
if (type == T_SRV) {
buflen -= INT16SZ*2;
if (buflen < 0)
return (-1);
goto cleanup;
memcpy(cp, cp1, INT16SZ*2);
cp += INT16SZ*2;
cp1 += INT16SZ*2;
@@ -1767,7 +1841,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
(type == ns_t_mx) ? comp_ptrs : NULL,
(type == ns_t_mx) ? edp : NULL);
if (n < 0)
return (-1);
goto cleanup;
cp += n;
/* save data length */
@@ -1781,7 +1855,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
cp1 = dp->d_data;
if ((buflen -= INT16SZ) < 0)
return (-1);
goto cleanup;
/* copy preference */
memcpy(cp, cp1, INT16SZ);
@@ -1790,13 +1864,13 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
if (n < 0)
return (-1);
goto cleanup;
cp += n;
buflen -= n;
cp1 += strlen((char *)cp1) + 1;
n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
if (n < 0)
return (-1);
goto cleanup;
cp += n;
/* save data length */
@@ -1811,7 +1885,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
/* first just copy over the type_covered, algorithm, */
/* labels, orig ttl, two timestamps, and the footprint */
if ((dp->d_size - 18) > buflen)
return (-1); /* out of room! */
goto cleanup; /* out of room! */
memcpy(cp, cp1, 18);
cp += 18;
cp1 += 18;
@@ -1820,7 +1894,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
/* then the signer's name */
n = dn_comp((char *)cp1, cp, buflen, NULL, NULL);
if (n < 0)
return (-1);
goto cleanup;
cp += n;
buflen -= n;
cp1 += strlen((char*)cp1)+1;
@@ -1828,20 +1902,20 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
/* finally, we copy over the variable-length signature */
n = dp->d_size - (u_int16_t)((cp1 - dp->d_data));
if (n > buflen)
return (-1); /* out of room! */
goto cleanup; /* out of room! */
memcpy(cp, cp1, n);
cp += n;
/* save data length & return */
/* save data length & return */
n = (u_int16_t)((cp - sp) - INT16SZ);
PUTSHORT((u_int16_t)n, sp);
PUTSHORT((u_int16_t)n, sp);
break;
case T_NXT:
cp1 = dp->d_data;
n = dn_comp((char *)cp1, cp, buflen, NULL, NULL);
if (n < 0)
return (-1);
goto cleanup;
cp += n;
buflen -=n;
@@ -1850,7 +1924,7 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
/* copy nxt bit map */
n = dp->d_size - (u_int16_t)((cp1 - dp->d_data));
if (n > buflen)
return (-1); /* out of room! */
goto cleanup; /* out of room! */
memcpy(cp, cp1, n);
cp += n;
buflen -= n;
@@ -1864,12 +1938,18 @@ make_rr(const char *name, struct databuf *dp, u_char *buf,
if ((type == T_A || type == T_AAAA) && doadd)
addname(name, name, type, T_KEY, dp->d_class);
if (dp->d_size > buflen)
return (-1);
goto cleanup;
memcpy(cp, dp->d_data, dp->d_size);
PUTSHORT((u_int16_t)dp->d_size, sp);
cp += dp->d_size;
}
return (cp - buf);
cleanup:
/* Rollback RR. */
ns_name_rollback(buf, (const u_char **)comp_ptrs,
(const u_char **)edp);
return (-1);
}
static void
@@ -1965,7 +2045,9 @@ loop:
!match(dp, (int)ap->a_class, T_A) &&
!match(dp, C_IN, T_A) &&
!match(dp, (int)ap->a_class, T_AAAA) &&
!match(dp, C_IN, T_AAAA)) {
!match(dp, C_IN, T_AAAA) &&
!match(dp, (int)ap->a_class, ns_t_a6) &&
!match(dp, C_IN, ns_t_a6)) {
continue;
}
if (ap->a_type == T_KEY &&
@@ -1993,6 +2075,10 @@ loop:
ns_debug(ns_log_default, 5,
"addinfo: not enough room, remaining msglen = %d",
save_msglen);
/* Rollback RRset. */
ns_name_rollback(save_cp,
(const u_char **)dnptrs,
(const u_char **)dnptrs_end);
cp = save_cp;
msglen = save_msglen;
count = save_count;
+114 -85
View File
@@ -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.133 1999/11/05 04:40:57 vixie Exp $";
static const char rcsid[] = "$Id: ns_resp.c,v 8.149 2001/01/03 09:47:27 marka Exp $";
#endif /* not lint */
/*
@@ -82,7 +82,7 @@ static const char rcsid[] = "$Id: ns_resp.c,v 8.133 1999/11/05 04:40:57 vixie Ex
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -148,7 +148,8 @@ static const char skipnameFailedAnswer[] = "skipname failed in answer",
outofDataAFinal[] = "out of data after final pass",
badNameFound[] = "found an invalid domain name",
wrongQuestion[] = "answer to wrong question",
danglingCname[] = "dangling CNAME pointer";
danglingCname[] = "dangling CNAME pointer",
nonRecursiveForwarder[]= "non-recursive forwarder";
struct db_list {
struct db_list *db_next;
@@ -200,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>";
@@ -208,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;
@@ -463,20 +454,13 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
* XXX - should put this in STATS somewhere.
*/
for (fwd = NS_ZFWDTAB(qp->q_fzone); fwd; fwd = fwd->next)
if (ina_equal(fwd->fwdaddr.sin_addr, from.sin_addr))
if (ina_equal(fwd->fwddata->fwdaddr.sin_addr, from.sin_addr))
break;
/*
* XXX: note bad ambiguity here. if one of our forwarders is also
* a delegated server for some domain, then we will not update
* the RTT information on any replies we get from those servers.
* Workaround: disable recursion on authoritative servers so that
* the ambiguity does not arise.
*/
/*
* If we weren't using a forwarder, find the qinfo pointer and update
* find the qinfo pointer and update
* the rtt and fact that we have called on this server before.
*/
if (fwd == NULL) {
{
struct timeval *stp;
for (n = 0, qs = qp->q_addr; (u_int)n < qp->q_naddr; n++, qs++)
@@ -619,7 +603,8 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
*/
if (hp->opcode == NS_NOTIFY_OP) {
ns_info(ns_log_notify,
"Received NOTIFY answer from %s for \"%s %s %s\"",
"Received NOTIFY answer (%sAA) from %s for \"%s %s %s\"",
hp->aa ? "" : "!",
inet_ntoa(from.sin_addr),
*(qp->q_name) ? qp->q_name : ".",
p_class(qp->q_class), p_type(qp->q_type));
@@ -706,40 +691,59 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
/*
* Non-authoritative, no answer, no error, with referral.
*/
if (hp->rcode == NOERROR && !hp->aa && ancount == 0 && aucount > 0
if (hp->rcode == NOERROR && !hp->tc && !hp->aa &&
ancount == 0 && aucount > 0
#ifdef BIND_NOTIFY
&& hp->opcode != NS_NOTIFY_OP
#endif
) {
u_char *tp;
int type, class;
int type, class, dlen;
int foundns, foundsoa;
#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),
* we must be pointing at the authority section (aucount > 0).
*/
tp = cp;
n = dn_expand(msg, eom, tp, name, sizeof name);
if (n < 0) {
formerrmsg = expandFailedAuth;
goto formerr;
}
tp += n;
if (tp + 2 * INT16SZ > eom) {
formerrmsg = outofDataAuth;
goto formerr;
}
GETSHORT(type, tp);
GETSHORT(class, tp);
if (!ns_nameok(qp, name, class, NULL, response_trans,
ns_ownercontext(type, response_trans),
name, from.sin_addr)) {
formerrmsg = badNameFound;
goto refused;
foundns = foundsoa = 0;
for (i = 0 ; i < aucount ; i++) {
n = dn_expand(msg, eom, tp, name, sizeof name);
if (n < 0) {
formerrmsg = expandFailedAuth;
goto formerr;
}
tp += n;
if (tp + 3 * INT16SZ + INT32SZ > eom) {
formerrmsg = outofDataAuth;
goto formerr;
}
GETSHORT(type, tp);
GETSHORT(class, tp);
tp += INT32SZ; /* ttl */
GETSHORT(dlen, tp);
if (!ns_nameok(qp, name, class, NULL, response_trans,
ns_ownercontext(type, response_trans),
name, from.sin_addr)) {
formerrmsg = badNameFound;
goto refused;
}
/* skip rest of record */
if (tp + dlen > eom) {
formerrmsg = outofDataAuth;
goto formerr;
}
tp += dlen;
if (type == T_NS) {
strcpy(aname, name);
foundns = 1;
}
if (type == T_SOA)
foundsoa = 1;
}
/*
@@ -751,11 +755,14 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
* classes tend to not have good strong delegation graphs).
*/
if (type == T_NS && ns_samedomain(qp->q_domain, name)) {
nameserIncr(from.sin_addr, nssRcvdLDel);
mark_lame(qp, from);
if (foundns && !foundsoa &&
ns_samedomain(qp->q_domain, aname)) {
if (fwd == NULL) {
nameserIncr(from.sin_addr, nssRcvdLDel);
mark_lame(qp, from);
}
mark_bad(qp, from);
if (class == C_IN &&
if (class == C_IN && fwd == NULL &&
!haveComplained(ina_ulong(from.sin_addr),
nhash(qp->q_domain))) {
char *learnt_from = learntFrom(qp, &from);
@@ -768,6 +775,12 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
learnt_from);
if (learnt_from != NULL)
freestr(learnt_from);
} else if (fwd != NULL) {
if (!haveComplained(ina_ulong(from.sin_addr),
(u_long)nonRecursiveForwarder))
ns_warning(ns_log_default, "%s: %s",
nonRecursiveForwarder,
sin_ntoa(from));
}
fast_retry(qp, from);
@@ -788,7 +801,7 @@ ns_resp(u_char *msg, int msglen, struct sockaddr_in from, struct qstream *qsp)
/* -ve $ing non-existence of record, must handle non-authoritative
* NOERRORs with c == 0.
*/
if (!hp->aa && hp->rcode == NOERROR && c == 0)
if (!hp->aa && !hp->tc && hp->rcode == NOERROR && c == 0)
goto return_msg;
if (qp->q_flags & Q_SYSTEM)
@@ -979,19 +992,22 @@ tcp_retry:
case T_SOA:
if (!ns_samedomain(aname, name)) {
ns_info(ns_log_resp_checks,
"bad referral (%s !< %s)",
"bad referral (%s !< %s) from %s",
aname[0] ? aname : ".",
name[0] ? name : ".");
name[0] ? name : ".",
sin_ntoa(from));
db_freedata(dp);
continue;
} else if (!ns_samedomain(name,
} else if (fwd == NULL &&
!ns_samedomain(name,
qp->q_domain)) {
if (!externalcname)
ns_info(ns_log_resp_checks,
"bad referral (%s !< %s)",
"bad referral (%s !< %s) from %s",
name[0] ? name : ".",
qp->q_domain[0] ?
qp->q_domain : ".");
qp->q_domain : ".",
sin_ntoa(from));
db_freedata(dp);
continue;
}
@@ -1069,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();
@@ -1182,17 +1202,11 @@ tcp_retry:
founddata = 0;
dname = name;
/*
* If restart==0 and ancount > 0, we should
* have some valid data because because the data in the answer
* section is owned by the query name and that passes the
* validation test by definition
*
* XXX - the restart stuff doesn't work if any of the answer RRs
* is not cacheable (TTL==0 or unknown RR type), since all of the
* answer must pass through the cache and be re-assembled.
*/
if ((forcecmsg && qp->q_cmsglen) ||
((!restart || !cname) && qp->q_cmsglen && ancount)) {
if (qp->q_cmsglen != 0) {
ns_debug(ns_log_default, 1, "Cname second pass");
newmsglen = MIN(PACKETSZ, qp->q_cmsglen);
memcpy(newmsg, qp->q_cmsg, newmsglen);
@@ -1461,8 +1475,7 @@ tcp_retry:
} else
hp = (HEADER *) qp->q_msg;
hp->id = qp->q_nsid = htons(nsid_next());
if (qp->q_addr[0].forwarder)
hp->rd = 1;
hp->rd = (qp->q_addr[0].forwarder ? 1 : 0);
unsched(qp);
schedretry(qp, retrytime(qp));
nsa = Q_NEXTADDR(qp, 0);
@@ -1478,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) {
@@ -1515,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,
@@ -1560,6 +1573,11 @@ tcp_retry:
return_msg:
nameserIncr(from.sin_addr, nssRcvdFwdR);
nameserIncr(qp->q_from.sin_addr, nssSentFwdR);
nameserIncr(qp->q_from.sin_addr, nssSentAns);
if (!hp->aa)
nameserIncr(qp->q_from.sin_addr, nssSentNaAns);
if (hp->rcode == NXDOMAIN)
nameserIncr(qp->q_from.sin_addr, nssSentNXD);
/* The "standard" return code */
hp->qr = 1;
hp->id = qp->q_id;
@@ -2093,6 +2111,7 @@ rrextract(u_char *msg, int msglen, u_char *rrp, struct databuf **dpp,
}
memcpy(cp1, cp, n2);
cp += n2;
cp1 += n2;
/* compute size of data */
n = cp1 - (u_char *)data;
@@ -2279,7 +2298,7 @@ sysquery(const char *dname, int class, int type,
nsp[0] = NULL;
ns_debug(ns_log_default, 3, "sysquery(%s, %d, %d, %#x, %d, %d)",
dname, class, type, nss, nsc, ntohs(port));
qp = qnew(dname, class, type);
qp = qnew(dname, class, type, (nss != NULL && nsc != 0) ? 0 : 1);
if (nss != NULL && nsc != 0)
np = NULL;
@@ -2342,6 +2361,7 @@ sysquery(const char *dname, int class, int type,
hp = (HEADER *) qp->q_msg;
hp->id = qp->q_nsid = htons(nsid_next());
hp->rd = (qp->q_addr[qp->q_curaddr].forwarder ? 1 : 0);
hp->aa = (opcode == NS_NOTIFY_OP);
/* First check for an already pending query for this data. */
for (oqp = nsqhead; oqp != NULL; oqp = oqp->q_link) {
@@ -2447,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);
@@ -2900,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 */
@@ -2994,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
@@ -3010,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--;
@@ -3106,7 +3132,10 @@ finddata(struct namebuf *np, int class, int type,
case cyclic_order:
/* first we do the non-SIG records */
choice = ((u_int)rand()>>3) % non_sig_count;
if (non_sig_count > 0)
choice = ((u_int)rand()>>3) % non_sig_count;
else
choice = 0;
for (i = 0; i < non_sig_count ; i++) {
dp = found[(i + choice) % non_sig_count];
if (foundcname != 0 && dp->d_type == T_CNAME)
+5 -2
View File
@@ -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_signal.c,v 8.11 1999/10/13 16:39:12 vixie Exp $";
static const char rcsid[] = "$Id: ns_signal.c,v 8.13 2000/07/11 07:10:12 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: ns_signal.c,v 8.11 1999/10/13 16:39:12 vixie E
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -245,6 +245,9 @@ init_signals(void) {
"sigaction failed in set_signal_handler(%d): %s",
sighandlers[sh].sig, strerror(errno));
}
/* Unblock all signals that we expect to handle. */
if (sigprocmask(SIG_UNBLOCK, &mask, NULL) < 0)
ns_panic(ns_log_os, 1, "sigblock failed: %s", strerror(errno));
}
void
+2 -2
View File
@@ -1,6 +1,6 @@
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_sort.c 4.10 (Berkeley) 3/3/91";
static const char rcsid[] = "$Id: ns_sort.c,v 8.5 1999/10/13 16:39:12 vixie Exp $";
static const char rcsid[] = "$Id: ns_sort.c,v 8.6 2000/04/21 06:54:13 vixie Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: ns_sort.c,v 8.5 1999/10/13 16:39:12 vixie Exp
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
+61 -10
View File
@@ -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.27 1999/10/13 16:39:12 vixie Exp $";
static const char rcsid[] = "$Id: ns_stats.c,v 8.32 2000/11/29 06:56:05 marka Exp $";
#endif /* not lint */
/*
@@ -57,7 +57,7 @@ static const char rcsid[] = "$Id: ns_stats.c,v 8.27 1999/10/13 16:39:12 vixie Ex
*/
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
* Portions Copyright (c) 1996-2000 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
@@ -108,6 +108,27 @@ static const char rcsid[] = "$Id: ns_stats.c,v 8.27 1999/10/13 16:39:12 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() {
@@ -122,6 +143,7 @@ ns_stats() {
server_options->stats_filename);
return;
}
(void) fchown(fileno(f), user_id, group_id);
fprintf(f, "+++ Statistics Dump +++ (%ld) %s",
(long)timenow, checked_ctime(&timenow));
@@ -144,10 +166,11 @@ ns_stats() {
/* Now do the memory statistics file */
if (!(f = fopen(server_options->memstats_filename, "a"))) {
ns_notice(ns_log_statistics, "cannot open memstat file, \"%s\"",
ns_notice(ns_log_statistics, "cannot open memstat file, \"%s\"",
server_options->memstats_filename);
return;
}
(void) fchown(fileno(f), user_id, group_id);
fprintf(f, "+++ Memory Statistics Dump +++ (%ld) %s",
(long)timenow, checked_ctime(&timenow));
@@ -207,6 +230,10 @@ static const char *statNames[nssLast] = {
"SFErr", /* sent them a FORMERR */
"SNaAns", /* sent them a non autoritative answer */
"SNXD", /* sent them a negative response */
"RUQ", /* sent us an unapproved query */
"RURQ", /* sent us an unapproved recursive query */
"RUXFR", /* sent us an unapproved AXFR or IXFR */
"RUUpd", /* sent us an unapproved update */
};
/*
@@ -240,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))
@@ -262,6 +300,7 @@ nameserFind(addr, flags)
errno = save;
goto nomem;
}
ns_stats_cnt++;
}
return (ns);
}
@@ -318,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;
}
@@ -329,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
@@ -342,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*/
@@ -393,4 +442,6 @@ ns_freestats(void) {
return;
tree_mung(&nameserTree, nameserFree);
nameserInit = 0;
ns_stats_cnt = 0;
ns_stats_disabled = 0;
}
+2 -2
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_udp.c,v 8.8 1999/10/13 16:39:13 vixie Exp $";
static const char rcsid[] = "$Id: ns_udp.c,v 8.9 2000/04/21 06:54:13 vixie Exp $";
#endif /* not lint */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
+225 -171
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_update.c,v 8.68 1999/11/05 04:40:58 vixie Exp $";
static const char rcsid[] = "$Id: ns_update.c,v 8.89 2001/01/14 09:46:20 marka Exp $";
#endif /* not lint */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
@@ -73,8 +73,8 @@ static const char rcsid[] = "$Id: ns_update.c,v 8.68 1999/11/05 04:40:58 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"
@@ -140,30 +140,45 @@ static int rdata_expand(const u_char *, const u_char *, const u_char *,
static FILE *
open_transaction_log(struct zoneinfo *zp) {
FILE *fp;
fp = fopen(zp->z_updatelog, "a+");
FILE *fp = fopen(zp->z_updatelog, "a+");
if (fp == NULL) {
ns_error(ns_log_update, "can't open %s: %s", zp->z_updatelog,
strerror(errno));
return (NULL);
}
(void) fchown(fileno(fp), user_id, group_id);
if (fseek(fp, 0L, SEEK_END) != 0) {
ns_error(ns_log_update, "can't fseek(%s, 0, SEEK_END)",
zp->z_updatelog);
fclose(fp);
return (NULL);
}
if (ftell(fp) == 0L) {
fprintf(fp, "%s", LogSignature);
zp->z_serial_ixfr_start = get_serial(zp);
}
else
zp->z_serial_ixfr_start = 0;
return (fp);
}
static FILE *
open_ixfr_log(struct zoneinfo *zp) {
FILE *fp;
fp = fopen(zp->z_ixfr_base, "a+");
FILE *fp = fopen(zp->z_ixfr_base, "a+");
if (fp == NULL) {
ns_error(ns_log_update, "can't open %s: %s", zp->z_ixfr_base,
strerror(errno));
return (NULL);
}
(void) fchown(fileno(fp), user_id, group_id);
if (fseek(fp, 0L, SEEK_END) != 0) {
ns_error(ns_log_update, "can't fseek(%s, 0, SEEK_END)",
zp->z_ixfr_base);
fclose(fp);
return (NULL);
}
if (ftell(fp) == 0L) {
fprintf(fp, "%s", LogSignature);
}
@@ -258,7 +273,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];
@@ -271,16 +285,24 @@ printupdatelog(struct sockaddr_in srcaddr,
if (fp == NULL)
return;
ifp = open_ixfr_log(zp);
if (ifp == NULL) {
(void) close_transaction_log(zp, fp);
return;
if (zp->z_maintain_ixfr_base == 1) {
ifp = open_ixfr_log(zp);
if (ifp == NULL) {
(void) close_transaction_log(zp, fp);
return;
}
}
else
ifp = NULL;
sprintf(time, "at %lu", (u_long)tt.tv_sec);
fprintf(fp, "[DYNAMIC_UPDATE] id %u from %s %s (named pid %ld):\n",
ntohs(hp->id), sin_ntoa(srcaddr), time, (long)getpid());
fprintf(ifp, "[DYNAMIC_UPDATE] id %u from %s %s (named pid %ld):\n",
ntohs(hp->id), sin_ntoa(srcaddr), time, (long)getpid());
if (ifp)
fprintf(ifp,
"[DYNAMIC_UPDATE] id %u from %s %s (named pid %ld):\n",
ntohs(hp->id), sin_ntoa(srcaddr), time,
(long)getpid());
for (rrecp = HEAD(*updlist); rrecp != NULL; rrecp = NEXT(rrecp, r_link)) {
INSIST(zp == &zones[rrecp->r_zone]);
switch (rrecp->r_section) {
@@ -288,9 +310,11 @@ printupdatelog(struct sockaddr_in srcaddr,
fprintf(fp, "zone:\torigin %s class %s serial %u\n",
zp->z_origin, p_class(zp->z_class),
old_serial);
fprintf(ifp, "zone:\torigin %s class %s serial %u\n",
zp->z_origin, p_class(zp->z_class),
old_serial);
if (ifp)
fprintf(ifp,
"zone:\torigin %s class %s serial %lu\n",
zp->z_origin, p_class(zp->z_class),
(u_long)old_serial);
break;
case S_PREREQ:
opcode = rrecp->r_opcode;
@@ -317,15 +341,17 @@ printupdatelog(struct sockaddr_in srcaddr,
while (dp != NULL) {
if (dp->d_rcode == 0 &&
!was_added(updlist, dp)) {
fprintf(ifp,
"update:\t{%s} %s. %u %s %s ",
"delete",
rrecp->r_dname,
dp->d_ttl,
p_class(dp->d_class),
p_type(dp->d_type));
(void) rdata_dump(dp, ifp);
fprintf(ifp, "\n");
if (ifp) {
fprintf(ifp,
"update:\t{%s} %s. %u %s %s ",
"delete",
rrecp->r_dname,
dp->d_ttl,
p_class(dp->d_class),
p_type(dp->d_type));
(void) rdata_dump(dp, ifp);
fprintf(ifp, "\n");
}
}
dp = dp->d_next;
}
@@ -338,13 +364,15 @@ printupdatelog(struct sockaddr_in srcaddr,
dp->d_type != T_SOA &&
(dp->d_mark & D_MARK_ADDED) != 0 &&
!was_deleted(updlist, dp)) {
fprintf(ifp, "update:\t{%s} %s. ",
opcodes[opcode], rrecp->r_dname);
fprintf(ifp, "%u ", rrecp->r_ttl);
fprintf(ifp, "%s ", p_class(zp->z_class));
fprintf(ifp, "%s ", p_type(rrecp->r_type));
(void) rdata_dump(dp, ifp);
fprintf(ifp, "\n");
if (ifp) {
fprintf(ifp, "update:\t{%s} %s. ",
opcodes[opcode], rrecp->r_dname);
fprintf(ifp, "%u ", rrecp->r_ttl);
fprintf(ifp, "%s ", p_class(zp->z_class));
fprintf(ifp, "%s ", p_type(rrecp->r_type));
(void) rdata_dump(dp, ifp);
fprintf(ifp, "\n");
}
}
/* Update log. */
fprintf(fp, "update:\t{%s} %s. ",
@@ -383,13 +411,15 @@ printupdatelog(struct sockaddr_in srcaddr,
dp->d_type == T_SOA &&
(dp->d_mark & D_MARK_ADDED) != 0 &&
!was_deleted(updlist, dp)) {
fprintf(ifp, "update:\t{%s} %s. ",
opcodes[opcode], rrecp->r_dname);
fprintf(ifp, "%u ", rrecp->r_ttl);
fprintf(ifp, "%s ", p_class(zp->z_class));
fprintf(ifp, "%s ", p_type(rrecp->r_type));
(void) rdata_dump(dp, ifp);
fprintf(ifp, "\n[END_DELTA]\n");
if (ifp) {
fprintf(ifp, "update:\t{%s} %s. ",
opcodes[opcode], rrecp->r_dname);
fprintf(ifp, "%u ", rrecp->r_ttl);
fprintf(ifp, "%s ", p_class(zp->z_class));
fprintf(ifp, "%s ", p_type(rrecp->r_type));
(void) rdata_dump(dp, ifp);
fprintf(ifp, "\n[END_DELTA]\n");
}
}
break;
default:
@@ -398,7 +428,8 @@ printupdatelog(struct sockaddr_in srcaddr,
}
fprintf(fp, "\n");
(void) close_transaction_log(zp, fp);
(void) close_ixfr_log(zp, ifp);
if (ifp)
(void) close_ixfr_log(zp, ifp);
}
static void
@@ -425,16 +456,10 @@ schedule_soa_update(struct zoneinfo *zp, int numupdated) {
*/
zp->z_updatecnt += numupdated;
if (zp->z_updatecnt >= zp->z_deferupdcnt) {
if (incr_serial(zp) < 0) {
ns_error(ns_log_update,
"error updating serial number for %s from %d",
zp->z_origin, zp->z_serial);
} else
return (0);
/*
* Note we continue scheduling if for some reason
* incr_serial fails.
*/
if (zp->z_soaincrtime > tt.tv_sec) {
zp->z_soaincrtime = tt.tv_sec;
return (1);
}
}
if (zp->z_soaincrintvl > 0) {
@@ -538,7 +563,7 @@ process_prereq(ns_updrec *ur, int *rcodep, u_int16_t zclass) {
*/
if (rdp && (rdp->d_mark & D_MARK_FOUND) != 0) {
/* Already processed. */
return (1);
return (1);
}
if (ttl != 0) {
ns_debug(ns_log_update, 1,
@@ -655,8 +680,6 @@ process_prereq(ns_updrec *ur, int *rcodep, u_int16_t zclass) {
*rcodep = FORMERR;
return (0);
}
htp = hashtab;
np = nlookup(dname, &htp, &fname, 0);
if (np == NULL || fname != dname) {
*rcodep = NXRRSET;
return (0);
@@ -706,16 +729,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);
@@ -784,16 +805,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:
@@ -863,14 +885,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)) {
@@ -880,6 +898,12 @@ prescan_update(ns_updrec *ur, int *rcodep, u_int16_t zclass) {
*rcodep = FORMERR;
return (0);
}
if (ttl > MAXIMUM_TTL) {
ns_debug(ns_log_update, 1,
"prescan_update: invalid ttl (%u)", ttl);
*rcodep = FORMERR;
return (0);
}
} else if (class == C_ANY) {
if (ttl != 0 || rdp->d_size ||
(!ns_t_rr_p(type) && type != T_ANY))
@@ -922,11 +946,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];
@@ -1115,25 +1138,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;
@@ -1189,8 +1207,9 @@ 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, "unapproved 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);
}
@@ -1210,10 +1229,11 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg,
if (zp->z_type == Z_SECONDARY) {
/*
* XXX The code below is broken.
* Until fixed, we just refuse.
* Until fixed, we just return NOTIMPL.
*/
#if 1
return (Refuse);
hp->rcode = ns_r_notimpl;
return (Finish);
#else
/* We are a slave for this zone, forward it to the master. */
for (cnt = 0; cnt < zp->z_addrcnt; cnt++)
@@ -1236,12 +1256,12 @@ req_update_private(HEADER *hp, u_char *cp, u_char *eom, u_char *msg,
eom -= tsig_len;
free_nsp(nsp);
switch (n) {
case FW_OK:
case FW_DUP:
case FW_OK:
case FW_DUP:
return (Return);
case FW_NOSERVER:
case FW_NOSERVER:
/* should not happen */
case FW_SERVFAIL:
case FW_SERVFAIL:
hp->rcode = SERVFAIL;
return (Finish);
}
@@ -1321,10 +1341,11 @@ 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);
if (cp > eom) {
if (cp > eom) {
ns_info(ns_log_update,
"Malformed response from %s (overrun)",
inet_ntoa(from.sin_addr));
@@ -1376,8 +1397,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;
}
@@ -1415,19 +1439,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)
@@ -1436,7 +1467,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 {
@@ -1452,6 +1482,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);
@@ -1465,9 +1497,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;
@@ -1769,7 +1803,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);
@@ -1912,7 +1946,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;
@@ -2044,7 +2078,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;
@@ -2059,10 +2093,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);
@@ -2092,7 +2126,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!
*/
@@ -2103,13 +2137,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);
@@ -2249,7 +2284,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++;
@@ -2307,7 +2342,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;
}
@@ -2422,14 +2457,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;
@@ -2444,12 +2480,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;
@@ -2635,21 +2673,21 @@ merge_logs(struct zoneinfo *zp, char *logname) {
}
} else { /* section == S_UPDATE */
if (opcode == DELETE) {
ttl = 0;
ttl = 0;
if (n == 0) {
class = C_ANY;
if (type == -1)
type = T_ANY;
/* WTF? C_NONE or C_ANY _must_ be the case if
* we really are to delete this. If
* C_NONE is used, according to process_updates(),
* the class is gotten from the zone's class.
* This still isn't perfect, but it will at least
* work.
*
* Question: What is so special about the class
* of the update while we are deleting??
*/
/* WTF? C_NONE or C_ANY _must_ be the case if
* we really are to delete this. If
* C_NONE is used, according to process_updates(),
* the class is gotten from the zone's class.
* This still isn't perfect, but it will at least
* work.
*
* Question: What is so special about the class
* of the update while we are deleting??
*/
} else /* if (zp->z_xferpid != XFER_ISIXFR) */ {
class = C_NONE;
}
@@ -2678,13 +2716,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);
}
@@ -2794,22 +2833,25 @@ 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));
return (-1);
}
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)
ns_error(ns_log_update,
"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",
zp->z_ixfr_tmp, zp->z_source,
strerror(errno));
return (-1);
}
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);
}
st.st_mode &= ~WRITEABLE_MASK;
if (chmod(zp->z_source, st.st_mode) < 0)
ns_error(ns_log_update,
@@ -2817,22 +2859,28 @@ 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));
return (-1);
}
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);
}
}
} else
ns_debug(ns_log_update, 1, "zonedump: no zone to dump");
@@ -2844,15 +2892,15 @@ zonedump(struct zoneinfo *zp, int mode) {
struct databuf *
findzonesoa(struct zoneinfo *zp) {
struct hashbuf *htp;
struct namebuf *np;
struct databuf *dp;
const char *fname;
struct hashbuf *htp;
struct namebuf *np;
struct databuf *dp;
const char *fname;
htp = hashtab;
np = nlookup(zp->z_origin, &htp, &fname, 0);
if (np == NULL || fname != zp->z_origin)
return (NULL);
np = nlookup(zp->z_origin, &htp, &fname, 0);
if (np == NULL || fname != zp->z_origin)
return (NULL);
foreach_rr(dp, np, T_SOA, zp->z_class, zp - zones)
return (dp);
return (NULL);
@@ -2933,7 +2981,7 @@ incr_serial(struct zoneinfo *zp) {
unsigned char *cp;
old_serial = get_serial(zp);
serial = old_serial + 1;
serial = old_serial + 1;
if (serial == 0)
serial = 1;
set_serial(zp, serial);
@@ -2950,29 +2998,35 @@ incr_serial(struct zoneinfo *zp) {
ifp = open_ixfr_log(zp);
if (ifp == NULL)
return (-1);
dp = findzonesoa(zp);
if (dp) {
olddp = memget(DATASIZE(dp->d_size));
if (olddp != NULL) {
memcpy(olddp, dp, DATASIZE(dp->d_size));
cp = findsoaserial(olddp->d_data);
PUTLONG(old_serial, cp);
fprintf(ifp, "update: {delete} %s. %u %s %s ",
if (zp->z_maintain_ixfr_base) {
ifp = open_ixfr_log(zp);
if (ifp == NULL)
return (-1);
dp = findzonesoa(zp);
if (dp) {
olddp = memget(DATASIZE(dp->d_size));
if (olddp != NULL) {
memcpy(olddp, dp, DATASIZE(dp->d_size));
cp = findsoaserial(olddp->d_data);
PUTLONG(old_serial, cp);
fprintf(ifp, "update: {delete} %s. %u %s %s ",
zp->z_origin, dp->d_ttl,
p_class(dp->d_class),
p_type(dp->d_type));
(void) rdata_dump(olddp, ifp);
fprintf(ifp, "\n");
memput(olddp, DATASIZE(dp->d_size));
}
fprintf(ifp, "update: {add} %s. %u %s %s ",
zp->z_origin, dp->d_ttl,
p_class(dp->d_class), p_type(dp->d_type));
(void) rdata_dump(olddp, ifp);
p_class(dp->d_class), p_type(dp->d_type));
(void) rdata_dump(dp, ifp);
fprintf(ifp, "\n");
memput(olddp, DATASIZE(dp->d_size));
}
fprintf(ifp, "update: {add} %s. %u %s %s ",
zp->z_origin, dp->d_ttl,
p_class(dp->d_class), p_type(dp->d_type));
(void) rdata_dump(dp, ifp);
fprintf(ifp, "\n");
fprintf(ifp, "[END_DELTA]\n");
if (close_ixfr_log(zp, ifp) < 0)
return (-1);
}
fprintf(ifp, "[END_DELTA]\n");
if (close_ixfr_log(zp, ifp)<0)
return (-1);
/*
* This shouldn't happen, but we check to be sure.
@@ -2991,7 +3045,7 @@ incr_serial(struct zoneinfo *zp) {
void
dynamic_about_to_exit(void) {
struct zoneinfo *zp;
struct zoneinfo *zp;
ns_debug(ns_log_update, 1,
"shutting down; dumping zones that need it");
+75 -47
View File
@@ -1,9 +1,9 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ns_xfr.c,v 8.55 1999/10/13 16:39:13 vixie Exp $";
static const char rcsid[] = "$Id: ns_xfr.c,v 8.63 2000/12/23 08:14:43 vixie Exp $";
#endif /* not lint */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
@@ -79,7 +79,7 @@ ns_xfr(struct qstream *qsp, struct namebuf *znp,
#ifdef SO_SNDLOWAT
static const int sndlowat = XFER_BUFSIZE;
#endif
ns_updrec *changes;
ns_deltalist *changes;
switch (type) {
case ns_t_axfr: /*FALLTHROUGH*/
@@ -123,6 +123,8 @@ ns_xfr(struct qstream *qsp, struct namebuf *znp,
qsp->xfr.top.axfr = znp;
qsp->xfr.zone = zone;
qsp->xfr.class = class;
if (qsp->flags & STREAM_AXFRIXFR)
type = ns_t_axfr;
qsp->xfr.type = type;
qsp->xfr.id = id;
qsp->xfr.opcode = opcode;
@@ -186,25 +188,32 @@ 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);
if (changes != NULL)
{
ixfr_log_maint(&zones[zone]);
if (changes != NULL) {
qsp->xfr.serial = serial_ixfr;
qsp->xfr.top.ixfr = changes;
}
else
type = ns_t_axfr;
}
else {
qsp->xfr.top.ixfr = NULL;
goto abort;
}
} else {
if (sx_pushlev(qsp, znp) < 0) {
abort:
(void) shutdown(qsp->s_rfd, 2);
sq_remove(qsp);
return;
}
if (type != ns_t_ixfr)
}
if (type != ns_t_ixfr) {
ns_debug(ns_log_default, 3, "sq_writeh sx_sendsoa (%s)",
zones[zone].z_origin);
(void) sq_writeh(qsp, sx_sendsoa);
else
} else {
ns_debug(ns_log_default, 3, "sq_writeh sx_send_ixfr (%s)",
zones[zone].z_origin);
(void) sq_writeh(qsp, sx_send_ixfr);
}
}
/*
@@ -217,6 +226,8 @@ ns_stopxfrs(struct zoneinfo *zp) {
struct qstream *this, *next;
u_int zone = (u_int)(zp - zones);
ns_debug(ns_log_default, 3, "ns_stopxfrs (%s)", zp->z_origin);
for (this = streamq; this; this = next) {
next = this->s_next;
if (this->xfr.zone == zone) {
@@ -234,19 +245,37 @@ ns_stopxfrs(struct zoneinfo *zp) {
*/
void
ns_freexfr(struct qstream *qsp) {
ns_delta *dp;
ns_updrec *rp;
if (qsp->xfr.msg != NULL) {
memput(qsp->xfr.msg, XFER_BUFSIZE);
qsp->xfr.msg = NULL;
}
if (qsp->xfr.type == ns_t_ixfr && qsp->xfr.top.ixfr != NULL) {
while ((dp = HEAD(*qsp->xfr.top.ixfr)) != NULL) {
UNLINK(*qsp->xfr.top.ixfr, dp, d_link);
while ((rp = HEAD(dp->d_changes)) != NULL) {
UNLINK(dp->d_changes, rp, r_link);
if (rp->r_dp != NULL)
db_freedata(rp->r_dp);
rp->r_dp = NULL;
res_freeupdrec(rp);
}
memput(dp, sizeof *dp);
}
memput(qsp->xfr.top.ixfr, sizeof *qsp->xfr.top.ixfr);
qsp->xfr.top.ixfr = NULL;
}
while (qsp->xfr.lev)
qsp->xfr.lev = sx_freelev(qsp->xfr.lev);
zones[qsp->xfr.zone].z_numxfrs--;
qsp->flags &= ~STREAM_AXFR;
qsp->flags &= ~(STREAM_AXFR | STREAM_AXFRIXFR);
}
/*
* u_char *
* renew_msg(msg)
* sx_newmsg(msg)
* init the header of a message, reset the compression pointers, and
* reset the write pointer to the first byte following the header.
*/
@@ -285,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;
@@ -315,7 +344,7 @@ sx_flush(struct qstream *qsp) {
* int
* sx_addrr(qsp, name, dp)
* add name/dp's RR to the current assembly message. if it won't fit,
* write current message out, renew the message, and then RR should fit.
* write current message out, renew the message, and then RR *must* fit.
* return:
* -1 = the sx_flush() failed so we could not queue the full message.
* 0 = one way or another, everything is fine.
@@ -339,18 +368,20 @@ sx_addrr(struct qstream *qsp, const char *dname, struct databuf *dp) {
/*
* Add question to first answer.
*/
if (qsp->xfr.state == s_x_firstsoa && dp->d_type == T_SOA ) {
if ((qsp->xfr.type == ns_t_ixfr) || (qsp->flags & STREAM_AXFRIXFR)) {
n = dn_comp(dname, qsp->xfr.cp, qsp->xfr.eom - qsp->xfr.cp,
qsp->xfr.ptrs, edp);
if (n > 0 && (qsp->xfr.cp + n + INT16SZ * 2) <= qsp->xfr.eom) {
qsp->xfr.cp += n;
type = (qsp->xfr.type == ns_t_zxfr) ?
ns_t_axfr : qsp->xfr.type;
PUTSHORT((u_int16_t) type, qsp->xfr.cp);
PUTSHORT((u_int16_t) qsp->xfr.class, qsp->xfr.cp);
hp->qdcount = htons(ntohs(hp->qdcount) + 1);
}
if (qsp->xfr.state == s_x_firstsoa && dp->d_type == T_SOA) {
n = dn_comp(dname, qsp->xfr.cp, qsp->xfr.eom - qsp->xfr.cp,
qsp->xfr.ptrs, edp);
if (n > 0 && (qsp->xfr.cp + n + INT16SZ * 2) <= qsp->xfr.eom) {
qsp->xfr.cp += n;
if (qsp->xfr.type == ns_t_zxfr)
type = ns_t_axfr;
else if ((qsp->flags & STREAM_AXFRIXFR) != 0)
type = ns_t_ixfr;
else
type = qsp->xfr.type;
PUTSHORT((u_int16_t) type, qsp->xfr.cp);
PUTSHORT((u_int16_t) qsp->xfr.class, qsp->xfr.cp);
hp->qdcount = htons(ntohs(hp->qdcount) + 1);
}
}
@@ -416,11 +447,9 @@ sx_soarr(struct qstream *qsp) {
/*
* int
* sx_nsrrs(qsp)
* add the NS RR's at the current level's current np,
* to the assembly message
* This function also adds the SIG(NS), KEY, SIG(KEY), NXT, SIG(NXT)
* the reason for this these records are part of the delegation.
*
* add the NS RR's at the current level's current np to the assembly msg.
* This function also adds the SIG(NS), KEY, SIG(KEY), NXT, SIG(NXT),
* since these records are also part of the delegation (see DNSSEC).
* return:
* >1 = number of NS RRs added, note that there may be more
* 0 = success, there are no more NS RRs at this level
@@ -438,15 +467,13 @@ sx_nsrrs(struct qstream *qsp) {
struct namebuf *gnp, *tnp, *top;
struct hashbuf *htp;
const char *fname;
int rrcount, class;
int class;
class = qsp->xfr.class;
top = qsp->xfr.top.axfr;
rrcount = 0;
for ((void)NULL;
(dp = qsp->xfr.lev->dp) != NULL;
qsp->xfr.lev->dp = db_next(dp)) {
/* XYZZY foreach_rr? */
if (dp->d_class != class && class != C_ANY)
continue;
if (dp->d_rcode)
@@ -475,7 +502,9 @@ sx_nsrrs(struct qstream *qsp) {
}
if (dp->d_type != T_NS) /* no glue processing */
continue;
rrcount++; /* only count NS records */
/* Remember we have found a zone cut */
if (qsp->xfr.top.axfr != qsp->xfr.lev->np)
qsp->xfr.lev->flags |= SXL_ZONECUT;
}
/*
@@ -528,9 +557,17 @@ sx_nsrrs(struct qstream *qsp) {
*/
return (-1);
}
foreach_rr(gdp, gnp, ns_t_a6, class, DB_Z_CACHE)
if (sx_addrr(qsp, fname, gdp) < 0) {
/*
* Rats. We already sent the NS RR, too.
* Note that SXL_GLUING is being left on.
*/
return (-1);
}
qsp->xfr.lev->flags &= ~SXL_GLUING;
}
return (rrcount);
return (0);
}
/*
@@ -565,7 +602,6 @@ sx_allrrs(struct qstream *qsp) {
for ((void)NULL;
(dp = qsp->xfr.lev->dp) != NULL;
qsp->xfr.lev->dp = db_next(dp)) {
/* XYZZY foreach_rr? */
if (dp->d_class != class && class != C_ANY)
continue;
if (dp->d_rcode)
@@ -605,7 +641,6 @@ sx_allrrs(struct qstream *qsp) {
void
sx_sendlev(struct qstream *qsp) {
struct qs_x_lev *lev;
int rrcount;
again:
lev = qsp->xfr.lev;
@@ -618,16 +653,9 @@ sx_sendlev(struct qstream *qsp) {
sq_remove(qsp);
return;
}
rrcount = sx_nsrrs(qsp);
/* If we can't pack this one in, come back later. */
if (rrcount < 0)
if (sx_nsrrs(qsp) < 0)
return;
/*
* NS RRs other than those at the
* zone top are zone cuts.
*/
if (rrcount > 0 && qsp->xfr.top.axfr != lev->np)
lev->flags |= SXL_ZONECUT;
}
/* No more DP's for the NS RR pass on this NP. */
if (lev->flags & SXL_ZONECUT) {
+6 -2
View File
@@ -1,9 +1,9 @@
/*
* $Id: pathtemplate.h,v 8.4 1999/01/08 19:28:30 vixie Exp $
* $Id: pathtemplate.h,v 8.6 2000/04/21 06:54:15 vixie Exp $
*/
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
* Copyright (c) 1996-2000 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
@@ -42,8 +42,12 @@
#endif
#ifndef _PATH_NDCSOCK
#ifdef NEED_SECURE_DIRECTORY
#define _PATH_NDCSOCK "%DESTRUN%/ndc.d/ndc"
#else
#define _PATH_NDCSOCK "%DESTRUN%/ndc"
#endif
#endif
#ifndef _PATH_STATS
#define _PATH_STATS "named.stats"
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 1.15 1999/08/08 17:51:02 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
@@ -44,7 +44,8 @@ INSTALL_LIB=-o bin -g bin
PS=ps
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL} ${DEFS}
PROG= ndc
SRCS= ${PROG}.c
+36 -11
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ndc.c,v 1.13 1999/10/13 16:39:16 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.13 1999/10/13 16:39:16 vixie Exp $";
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
@@ -47,7 +48,9 @@ static const char rcsid[] = "$Id: ndc.c,v 1.13 1999/10/13 16:39:16 vixie Exp $";
typedef union {
struct sockaddr_in in;
#ifndef NO_SOCKADDR_UN
struct sockaddr_un un;
#endif
} sockaddr_t;
typedef void (*closure)(void *, const char *, int);
@@ -294,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
@@ -369,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;
}
@@ -494,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");
@@ -603,22 +619,29 @@ static int
get_sockaddr(char *name, sockaddr_t *addr) {
char *slash;
#ifndef NO_SOCKADDR_UN
if (name[0] == '/') {
memset(&addr->un, '\0', sizeof addr->un);
addr->un.sun_family = AF_UNIX;
strncpy(addr->un.sun_path, name, sizeof addr->un.sun_path - 1);
addr->un.sun_path[sizeof addr->un.sun_path - 1] = '\0';
} else if ((slash = strrchr(name, '/')) != NULL) {
*slash = '\0';
} else
#endif
if ((slash = strrchr(name, '/')) != NULL) {
char *ibuf = malloc(slash - name + 1);
if (!ibuf)
usage("no memory for IP address (%s)", name);
memcpy(ibuf, name, slash - name);
ibuf[slash - name] = '\0';
memset(&addr->in, '\0', sizeof addr->in);
if (!inet_pton(AF_INET, name, &addr->in.sin_addr))
if (!inet_pton(AF_INET, ibuf, &addr->in.sin_addr))
usage("bad ip address (%s)", name);
if ((addr->in.sin_port = htons(atoi(slash+1))) == 0)
usage("bad ip port (%s)", slash+1);
addr->in.sin_family = AF_INET;
*slash = ':';
} else {
return (0);
free (ibuf);
} else {
return (0);
}
return (1);
}
@@ -630,8 +653,10 @@ impute_addrlen(const struct sockaddr *sa) {
switch (sa->sa_family) {
case AF_INET:
return (sizeof(struct sockaddr_in));
#ifndef NO_SOCKADDR_UN
case AF_UNIX:
return (sizeof(struct sockaddr_un));
#endif
default:
abort();
}
+6 -5
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.24 1999/10/13 01:14:46 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
@@ -42,8 +42,9 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
DEFS= -D_PATH_HELPFILE=\"${DESTHELP}/nslookup.help\"
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS}
DEFS= -D_PATH_HELPFILE=\"${DESTDIR}${DESTHELP}/nslookup.help\"
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL} ${DEFS}
PROG= nslookup
CSRCS= main.c getinfo.c debug.c send.c skip.c list.c subr.c
+3 -5
View File
@@ -96,6 +96,8 @@ static char sccsid[] = "@(#)commands.l 5.13 (Berkeley) 7/24/90";
#include "port_before.h"
#include <sys/types.h>
#include <histedit.h>
#include <netinet/in.h>
#include <histedit.h>
#include "port_after.h"
#include "res.h"
@@ -159,7 +161,7 @@ nslookup_yy_input(buf, result, max_size, intr)
%}
WS [ \t]
FLET [A-Za-z0-9.*\\_]
LET [A-Za-z0-9.*]
LET [A-Za-z0-9.*_]
NAME [A-Za-z0-9.*=_/-]
%%
^{WS}*server{WS}+{LET}{NAME}*{WS}*$ {
@@ -196,10 +198,6 @@ NAME [A-Za-z0-9.*=_/-]
Finger(yytext, 0);
return(1);
}
^{WS}*view{WS}+{NAME}+{WS}*$ {
ViewList((char *)yytext);
return(1);
}
^{WS}*ls{WS}+(("-a"|"-d"|"-h"|"-m"|"-s"){WS}+)?{LET}{NAME}*{WS}+>>?{WS}+{NAME}+{WS}*$ {
/*
* 2nd arg.
+11 -2
View File
@@ -54,7 +54,7 @@
#ifndef lint
static const char sccsid[] = "@(#)debug.c 5.26 (Berkeley) 3/21/91";
static const char rcsid[] = "$Id: debug.c,v 8.15 1999/10/13 16:39:16 vixie Exp $";
static const char rcsid[] = "$Id: debug.c,v 8.17 2000/11/08 06:47:31 marka Exp $";
#endif /* not lint */
/*
@@ -90,7 +90,9 @@ static const char rcsid[] = "$Id: debug.c,v 8.15 1999/10/13 16:39:16 vixie Exp $
/*
* Imported from res_debug.c
*/
#ifndef HAVE_DECL_RES_OPCODES
extern char *_res_opcodes[];
#endif
/*
* Used to highlight the start of a record when printing it.
@@ -622,8 +624,15 @@ Print_rr(const u_char *ocp, const u_char *msg, const u_char *eom, FILE *file) {
case T_KEY:
default: {
char buf[2048]; /* XXX need to malloc/realloc. */
char rrname[NS_MAXDNAME];
if (ns_sprintrrf(msg, eom - msg, "?", (ns_class)class,
cp2 = p_fqnname(ocp, msg, NS_MAXCDNAME, rrname, sizeof rrname);
if (cp2 == NULL) {
fprintf(file, "(name truncated?)\n");
return (NULL); /* compression error */
}
if (ns_sprintrrf(msg, eom - msg, rrname, (ns_class)class,
(ns_type)type, rrttl, cp1, dlen, NULL, NULL,
buf, sizeof buf) < 0) {
perror("ns_sprintrrf");
+6 -5
View File
@@ -54,7 +54,7 @@
#ifndef lint
static const char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91";
static const char rcsid[] = "$Id: getinfo.c,v 8.15 1999/10/13 16:39:16 vixie Exp $";
static const char rcsid[] = "$Id: getinfo.c,v 8.17 2000/12/23 08:14:46 vixie Exp $";
#endif /* not lint */
/*
@@ -651,11 +651,11 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
* - there is at least one dot, there is no trailing dot,
* and RES_DNSRCH is set.
*/
if ((n == 0 && res.options & RES_DEFNAMES) ||
(n != 0 && *--cp != '.' && res.options & RES_DNSRCH))
for (domain = res.dnsrch; *domain; domain++) {
if ((n == 0 && (res.options & RES_DEFNAMES) != 0) ||
(n != 0 && *--cp != '.' && (res.options & RES_DNSRCH) != 0))
for (domain = res.dnsrch; *domain != NULL; domain++) {
result = GetHostDomain(nsAddrPtr, queryClass, queryType,
name, *domain, hostPtr, isServer);
name, *domain, hostPtr, isServer);
/*
* If no server present, give up.
* If name isn't found in this domain,
@@ -694,6 +694,7 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
* Perform a query on the concatenation of name and domain,
* removing a trailing dot from name if domain is NULL.
*/
int
GetHostDomain(nsAddrPtr, queryClass, queryType, name, domain, hostPtr, isServer)
struct in_addr *nsAddrPtr;
int queryClass;
+18 -63
View File
@@ -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.21 1999/10/15 19:49:08 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.21 1999/10/15 19:49:08 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>
@@ -135,7 +137,6 @@ int ListSubr();
*
* To see all types of information sorted by name, do the following:
* ls -d domain.edu > file
* view file
*
* Results:
* SUCCESS the listing was successful.
@@ -259,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;
@@ -267,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.
@@ -322,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;
@@ -422,8 +427,12 @@ ListSubr(int qtype, char *domain, char *cmd) {
}
name = ns_rr_name(rr);
if (origin[0] == '\0' && name[0] != '\0') {
fprintf(filePtr, "$ORIGIN %s.\n", name);
strcpy(origin, name);
if (strcmp(name, ".") != 0)
strcpy(origin, name);
fprintf(filePtr, "$ORIGIN %s.\n", origin);
if (strcmp(name, ".") == 0)
strcpy(origin, name);
strcpy(name_ctx, "@");
}
if (qtype == T_ANY || ns_rr_type(rr) == qtype) {
if (ns_sprintrr(&handle, &rr, name_ctx, origin,
@@ -496,60 +505,6 @@ ListSubr(int qtype, char *domain, char *cmd) {
return (ERROR);
}
}
/*
*******************************************************************************
*
* ViewList --
*
* A hack to view the output of the ls command in sorted
* order using more.
*
*******************************************************************************
*/
void
ViewList(char *string) {
char file[PATH_MAX];
char command[PATH_MAX];
int i, j;
char soafile[PATH_MAX];
/* sscanf(string, " view %s", file); */
i = matchString(" view ", string);
if (i > 0) {
j = pickString(string + i, file, sizeof file);
if (j == 0) {
fprintf(stderr, "*** invalid file name: %s\n", string + i);
return ;
}
}
if ( !mktemp(strcpy(soafile,"/var/tmp/nslookup_tmpXXXXXX"))) {
fprintf(stderr, "*** cannot create temp file\n");
return ;
}
(void)sprintf(command, "sed '\
/^$/,${\
/@/,$d\
}\
/^[^ ]/{\
h\
s/^\\([^ ]* *\\).*/\\1/\
x\
}\
1,/^$/{\
w %s\
d\
}\
/^ /{\
G\
s/^ *//\
s/^\\(.*\\)\\n\\(.*\\)$/\\2\\1/\
}' %s | sort | (cat %s -; rm %s) | %s",
soafile, file, soafile, soafile, pager);
system(command);
}
/*
*******************************************************************************
@@ -569,6 +524,7 @@ s/^\\(.*\\)\\n\\(.*\\)$/\\2\\1/\
*******************************************************************************
*/
int
Finger(string, putToFile)
char *string;
int putToFile;
@@ -692,8 +648,7 @@ Finger(string, putToFile)
}
void
ListHost_close()
{
ListHost_close(void) {
if (sockFD != -1) {
(void) close(sockFD);
sockFD = -1;
+24 -20
View File
@@ -78,7 +78,7 @@ char copyright[] =
#ifndef lint
static const char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91";
static const char rcsid[] = "$Id: main.c,v 8.13 1999/10/13 16:39:19 vixie Exp $";
static const char rcsid[] = "$Id: main.c,v 8.16 2000/12/23 08:14:47 vixie Exp $";
#endif /* not lint */
/*
@@ -115,19 +115,22 @@ static const char rcsid[] = "$Id: main.c,v 8.13 1999/10/13 16:39:19 vixie Exp $"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "port_after.h"
#include "res.h"
#include "pathnames.h"
int yylex(void);
/*
* Name of a top-level name server. Can be changed with
* the "set root" command.
*/
#ifndef ROOT_SERVER
#define ROOT_SERVER "a.root-servers.net."
#define ROOT_SERVER "f.root-servers.net."
#endif
char rootServerName[NAME_LEN] = ROOT_SERVER;
@@ -172,7 +175,7 @@ jmp_buf env;
/*
* Browser command for help and view.
* Browser command for help.
*/
char *pager;
@@ -182,10 +185,10 @@ static void ReadRC();
/*
* Forward declarations.
*/
void LocalServer(HostInfo *defaultPtr);
void res_re_init(void);
void res_dnsrch(char *cp);
static void LocalServer(HostInfo *defaultPtr);
static void res_re_init(void);
static void res_dnsrch(char *cp);
static void Usage(void);
/*
******************************************************************************
@@ -199,10 +202,8 @@ void res_dnsrch(char *cp);
******************************************************************************
*/
main(argc, argv)
int argc;
char **argv;
{
int
main(int argc, char **argv) {
char *wantedHost = NULL;
Boolean useLocalServer;
int result;
@@ -300,8 +301,8 @@ main(argc, argv)
break;
} else {
result = GetHostInfoByAddr(&(res.nsaddr_list[i].sin_addr),
&(res.nsaddr_list[i].sin_addr),
defaultPtr);
&(res.nsaddr_list[i].sin_addr),
defaultPtr);
if (result != SUCCESS) {
fprintf(stderr,
"*** Can't find server name for address %s: %s\n",
@@ -403,8 +404,8 @@ LocalServer(defaultPtr)
******************************************************************************
*/
Usage()
{
static void
Usage(void) {
fprintf(stderr, "Usage:\n");
fprintf(stderr,
" nslookup [-opt ...] # interactive mode using default server\n");
@@ -778,10 +779,7 @@ LookupHost(string, putToFile)
*/
int
LookupHostWithServer(string, putToFile)
char *string;
Boolean putToFile;
{
LookupHostWithServer(char *string, Boolean putToFile) {
char file[PATH_MAX];
char host[NAME_LEN];
char server[NAME_LEN];
@@ -952,7 +950,13 @@ SetOption(option)
return(ERROR);
}
queryType = StringToType(type, queryType, stderr);
i = StringToType(type, queryType, stderr);
if (ns_t_xfr_p(i)) {
fprintf(stderr, "*** qtype may not be a zone transfer\n");
return(ERROR);
}
queryType = i;
}
} else if (strncmp(option, "cl", 2) == 0) { /* query class */
ptr = strchr(option, '=');
+1 -2
View File
@@ -1,4 +1,4 @@
$Id: nslookup.help,v 8.4 1996/10/25 18:09:41 vixie Exp $
$Id: nslookup.help,v 8.5 2000/03/30 23:25:35 vixie Exp $
Commands: (identifiers are shown in uppercase, [] means optional)
NAME - print info about the host/domain NAME using default server
@@ -30,5 +30,4 @@ ls [opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional: output to FILE)
-s - list well-known services
-d - list all records
-t TYPE - list records of the given type (e.g., A,CNAME,MX, etc.)
view FILE - sort an 'ls' output file and view it with more
exit - exit the program, ^D also exits
+3 -1
View File
@@ -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
+23 -1
View File
@@ -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);
+4 -3
View File
@@ -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;
+2 -1
View File
@@ -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>
+5 -4
View File
@@ -13,16 +13,16 @@
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
# $Id: Makefile,v 8.24 1999/08/08 17:51:02 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
@@ -42,7 +42,8 @@ INSTALL_EXEC=
INSTALL_LIB=-o bin -g bin
LDFLAGS=
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
CFLAGS= ${CDEBUG}
CPPFLAGS= -I${PORTINCL} -I${INCL}
PROG= nsupdate
SRCS= ${PROG}.c
+11 -16
View File
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: nsupdate.c,v 8.21 1999/10/19 22:22:59 cyarnell 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;
@@ -196,7 +189,7 @@ main(argc, argv)
*colon='\0';
break;
}
case 'n':
case 'n':
keyname=optarg;
break;
default:
@@ -204,6 +197,8 @@ main(argc, argv)
}
}
INIT_LIST(listuprec);
if (keyfile) {
#ifdef PARSE_KEYFILE
if ((fp=fopen(keyfile, "r"))==NULL) {
@@ -397,7 +392,7 @@ main(argc, argv)
exit (1);
}
r_dname = dnbuf;
r_ttl = 0;
r_ttl = (r_opcode == ADD) ? -1 : 0;
r_type = -1;
r_class = C_IN; /* default to IN */
r_size = 0;
@@ -429,8 +424,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) {
@@ -500,7 +495,7 @@ main(argc, argv)
r_size = endp - cp + 1;
break;
case ADD:
if (r_ttl == 0) {
if (r_ttl == -1) {
fprintf (stderr,
"ttl must be specified for record to be added: %s\n", buf);
exit (1);
+3 -3
View File
@@ -12,9 +12,9 @@
<A NAME="Syntax"><H3>Syntax</H3></A>
<PRE>
<VAR>address_match_list</VAR> = 1*<VAR>address_match_element</VAR>
<VAR>address_match_list</VAR> = <VAR>address_match_element</VAR> [ <VAR>address_match_element</VAR> ... ]
<VAR>address_match_element</VAR> = [ "!" ] (<VAR><A HREF="docdef.html">address_match_list</A></VAR> / <VAR><A HREF="docdef.html">ip_address</A></VAR> / <VAR><A HREF="docdef.html">ip_prefix</A></VAR> / <VAR><A HREF="acl.html">acl_name</A></VAR> / <VAR><A HREF="docdef.html">"key" key_id</A></VAR>) ";"
<VAR>address_match_element</VAR> = [ "!" ] ( <VAR><A HREF="docdef.html">ip_address</A></VAR> / <VAR><A HREF="docdef.html">ip_prefix</A></VAR> / <VAR><A HREF="acl.html">acl_name</A></VAR> / <VAR><A HREF="docdef.html">"key" key_id</A></VAR> / { <VAR>address_match_list</VAR> } ) ;
</PRE>
<HR>
@@ -94,7 +94,7 @@ fall through.
<HR>
<ADDRESS>
Last Updated: $Id: address_list.html,v 1.8 1999/09/15 20:28:00 cyarnell Exp $
Last Updated: $Id: address_list.html,v 1.9 1999/12/03 02:20:42 gson Exp $
</ADDRESS>
</BODY>
</HTML>
+2 -2
View File
@@ -11,7 +11,7 @@
<H3>Overview</H3>
<P>BIND 8 is much more configurable than previous release of BIND.
<P>BIND 8 is much more configurable than previous releases of BIND.
There are entirely new areas of configuration, such as access control lists
and categorized logging. Many options that previously applied to all zones
can now be used selectively. These features, plus a consideration of future
@@ -91,7 +91,7 @@ the BIND 8.2.x source kits.
<HR>
<ADDRESS>
Last Updated: $Id: config.html,v 1.10 1999/09/15 20:28:01 cyarnell Exp $
Last Updated: $Id: config.html,v 1.11 2000/11/28 20:03:48 cyarnell Exp $
</ADDRESS>
</BODY>
</HTML>
+3 -3
View File
@@ -11,9 +11,9 @@
<UL>
<LI>DNS Dynamic Updates
(<A HREF=http://ds.internic.net/rfc/rfc2136.txt>RFC 2136</A>)</LI>
(<A HREF=http://www.ietf.org/rfc/rfc2136.txt>RFC 2136</A>)</LI>
<LI>DNS Change Notification
(<A HREF=http://ds.internic.net/rfc/rfc1996.txt>RFC 1996</A>)</LI>
(<A HREF=http://www.ietf.org/rfc/rfc1996.txt>RFC 1996</A>)</LI>
<LI>Completely new configuration syntax</LI>
<LI>Flexible, categorized logging system</LI>
<LI>IP-address-based access control for queries, zone transfers, and
@@ -58,7 +58,7 @@ and generally kind hearted folk such as yourself.
<HR>
<ADDRESS>
Last Updated: $Id: index.html,v 1.5 1998/11/24 01:44:43 marka Exp $
Last Updated: $Id: index.html,v 1.6 1999/12/28 10:03:40 cyarnell Exp $
</ADDRESS>
</BODY>
+4 -4
View File
@@ -11,7 +11,7 @@
<P>
The Master File Format was initially defined in
<A HREF=http://ds.internic.net/rfc/rfc1035.txt>RFC 1035</A>
<A HREF=http://www.ietf.org/rfc/rfc1035.txt>RFC 1035</A>
and has subsequently been extended.
<P>
While the Master File Format is class independent all records in a
@@ -46,7 +46,7 @@ point.
set to that value otherwise the current <CODE>$ORIGIN</CODE> is used.
<I>NOTE: The behaviour when &lt;origin&gt; is specified differs from that
described in
<A HREF=http://ds.internic.net/rfc/rfc1035.txt>RFC 1035</A>.</I>
<A HREF=http://www.ietf.org/rfc/rfc1035.txt>RFC 1035</A>.</I>
<P>
The origin and current domain revert to the values they were prior to the
<CODE>$INCLUDE</CODE> once the file has been read.
@@ -57,7 +57,7 @@ Set the default Time To Live (TTL) for subsequent records with undefined
TTL's. Valid TTL's are of the range 0-2147483647.
<P>
<CODE>$TTL</CODE> is defined in
<A HREF=http://ds.internic.net/rfc/rfc2308.txt>RFC 2308</A>.
<A HREF=http://www.ietf.org/rfc/rfc2308.txt>RFC 2308</A>.
<H3>BIND Master File Extentions</H3>
<H4>$GENERATE</H4>
Syntax: <CODE>$GENERATE &lt;range&gt; &lt;lhs&gt; &lt;type&gt; &lt;rhs&gt;
@@ -67,7 +67,7 @@ Syntax: <CODE>$GENERATE &lt;range&gt; &lt;lhs&gt; &lt;type&gt; &lt;rhs&gt;
that only differ from each other by an iterator. <CODE>$GENERATE</CODE>
can be used to easily generate the sets of records required to support
sub /24 reverse delegations described in
<A HREF=http://ds.internic.net/rfc/rfc2317.txt>RFC 2317: Classless IN-ADDR.ARPA delegation</A>.
<A HREF=http://www.ietf.org/rfc/rfc2317.txt>RFC 2317: Classless IN-ADDR.ARPA delegation</A>.
<PRE>
$ORIGIN 0.0.192.IN-ADDR.ARPA.
+14 -9
View File
@@ -27,13 +27,14 @@ options {
[ fetch-glue <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ has-old-clients <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ host-statistics <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ host-statistics-max <VAR>number</VAR>; ]
[ multiple-cnames <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ notify <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ recursion <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ rfc2308-type1 <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ use-id-pool <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ treat-cr-as-space <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ also-notify { <VAR><A HREF="docdef.html">ip_addr</A></VAR>; [ <VAR><A HREF="docdef.html">ip_addr</A></VAR>; ... ] };
[ also-notify { <VAR><A HREF="docdef.html">ip_addr</A></VAR>; [ <VAR><A HREF="docdef.html">ip_addr</A></VAR>; ... ] }; ]
[ forward ( only | first ); ]
[ forwarders { [ <VAR><A HREF="docdef.html">in_addr</A></VAR> ; [ <VAR><A HREF="docdef.html">in_addr</A></VAR> ; ... ] ] }; ]
[ check-names ( master | slave | response ) ( warn | fail | ignore); ]
@@ -65,7 +66,7 @@ options {
[ statistics-interval <VAR>number</VAR>; ]
[ <A HREF="#topology">topology</A> { <VAR>address_match_list</VAR> }; ]
[ <A HREF="#sortlist">sortlist</A> { <VAR>address_match_list</VAR> }; ]
[ rrset-order { <VAR>order_spec</VAR> ; [ <VAR>order_spec</VAR> ; ... ] ] };
[ rrset-order { <VAR>order_spec</VAR> ; [ <VAR>order_spec</VAR> ; ... ] }; ]
};
</PRE>
<HR>
@@ -189,12 +190,10 @@ becoming corrupted (at the cost of requiring more work from the client).
<DT><CODE>has-old-clients</CODE>
<DD>
Setting the option to <CODE>yes</CODE> is equivalent to setting the follow
three options <CODE>auth-nxdomain yes;</CODE>, <CODE>maintain-ixfr-base
yes;</CODE> and <CODE>rfc2308-type1 no;</CODE>.
The use of <CODE>has-old-clients</CODE> with <CODE>auth-nxdomain</CODE>,
<CODE>maintain-ixfr-base</CODE> and <CODE>rfc2308-type1</CODE> is order
dependant.
Setting the option to <CODE>yes</CODE> is equivalent to setting the following
options: <CODE>auth-nxdomain yes;</CODE> and <CODE>rfc2308-type1 no;</CODE>.
The use of <CODE>has-old-clients</CODE> with <CODE>auth-nxdomain</CODE>
and <CODE>rfc2308-type1</CODE> is order dependent.
<DT><CODE>host-statistics</CODE>
<DD>
@@ -202,6 +201,12 @@ If <CODE>yes</CODE>, statistics are kept for every host that the
the nameserver interacts with. The default is <CODE>no</CODE>. <I>Note:</I>
turning on <CODE>host-statistics</CODE> can consume huge amounts of memory.
<DT><CODE>host-statistics-max</CODE>
<DD>
The maximum number of host records that will be kept. When this limit is
reached no new hosts will be added to the host statistics. If the set
to zero then there is no limit set. The default value is zero.
<DT><CODE>maintain-ixfr-base</CODE>
<DD>
If <CODE>yes</CODE>, a transaction log is kept for
@@ -808,7 +813,7 @@ request for the root servers to be accepted. Default 2.
<HR>
<ADDRESS>
Last Updated: $Id: options.html,v 1.36 1999/10/13 20:57:05 cyarnell Exp $
Last Updated: $Id: options.html,v 1.41 2000/11/29 11:49:09 marka Exp $
</ADDRESS>
</BODY>
</HTML>
+4 -2
View File
@@ -30,7 +30,9 @@ associated with a remote name server.</P>
<P>If you discover that a server is giving out bad data, marking it as
<CODE>bogus</CODE> will prevent further queries to it. The default value of
<CODE>bogus</CODE> is <CODE>no</CODE>.
<CODE>bogus</CODE> is <CODE>no</CODE>. Marking a server as <CODE>bogus</CODE>
will mark all other addresses for that server as <CODE>bogus</CODE> when
a match is made when looking up a server's address by name.
<P>The server supports two zone transfer methods. The first,
<CODE>one-answer</CODE>, uses one DNS message per resource record
@@ -63,7 +65,7 @@ required to be signed by this key.
<HR>
<ADDRESS>
Last Updated: $Id: server.html,v 1.10 1999/09/15 20:28:02 cyarnell Exp $
Last Updated: $Id: server.html,v 1.11 2000/11/08 04:15:07 marka Exp $
</ADDRESS>
</BODY>
</HTML>
+4 -4
View File
@@ -23,10 +23,10 @@ zone <VAR><A HREF="docdef.html">domain_name</A></VAR> [ ( in | hs | hesiod | cha
[ allow-transfer { <VAR><A HREF="address_list.html">address_match_list</A></VAR> }; ]
[ dialup <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ notify <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ also-notify { <VAR><A HREF="docdef.html">ip_addr</A></VAR>; [ <VAR>ip_addr</VAR>; ... ] };
[ also-notify { <VAR><A HREF="docdef.html">ip_addr</A></VAR>; [ <VAR>ip_addr</VAR>; ... ] }; ]
[ ixfr-base <VAR><A HREF="docdef.html">path_name</A></VAR>; ]
[ pubkey <VAR><A HREF="docdef.html">number</A></VAR> <VAR><A HREF="docdef.html">number</A></VAR> <VAR><A HREF="docdef.html">number</A></VAR> <VAR>string</VAR>; ]
};
};
zone <VAR><A HREF="docdef.html">domain_name</A></VAR> [ ( in | hs | hesiod | chaos ) ] {
type ( slave | stub );
@@ -43,7 +43,7 @@ zone <VAR><A HREF="docdef.html">domain_name</A></VAR> [ ( in | hs | hesiod | cha
[ dialup <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ max-transfer-time-in <VAR>number</VAR>; ]
[ notify <VAR><A HREF="docdef.html">yes_or_no</A></VAR>; ]
[ also-notify { <VAR><A HREF="docdef.html">ip_addr</A></VAR>; [ <VAR>ip_addr</VAR>; ... ] };
[ also-notify { <VAR><A HREF="docdef.html">ip_addr</A></VAR>; [ <VAR>ip_addr</VAR>; ... ] }; ]
[ pubkey <VAR><A HREF="docdef.html">number</A></VAR> <VAR><A HREF="docdef.html">number</A></VAR> <VAR><A HREF="docdef.html">number</A></VAR> <VAR>string</VAR>; ]
};
@@ -238,7 +238,7 @@ string representing the key.
<HR>
<ADDRESS>
Last Updated: $Id: zone.html,v 1.23 1999/09/30 17:58:41 cyarnell Exp $
Last Updated: $Id: zone.html,v 1.24 2000/01/12 01:28:32 cyarnell Exp $
</ADDRESS>
</BODY>
</HTML>
+1 -1
View File
@@ -279,7 +279,7 @@ NSUPDATE_OUT = nsupdate.${SYS_OPS_OUT_EXT}
# Network library routines manual entries
#
LIB_NETWORK_BASE = gethostbyname inet_cidr resolver hesiod getnetent \
tsig getaddrinfo inet_cidr getipnodebyname
tsig getaddrinfo getnameinfo getipnodebyname
LIB_NETWORK_SRC_EXT = 3
LIB_NETWORK_SRC = gethostbyname.${LIB_NETWORK_SRC_EXT} \
inet_cidr.${LIB_NETWORK_SRC_EXT} \
Loaded 100 of 1152 files, more files were not shown because too many files have changed in this diff. Show more