mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-02 12:20:51 +00:00
Import Paul Vixie/ISC's bind-4.9.5-patch1 onto the vendor branch.
This has some (all?) of the DNSSEC key management/distribution mechanism in place. (The SIG and KEY RR's) Obtained from: Paul Vixie / ISC / ftp.isc.org
This commit is contained in:
parent
d6da9453b6
commit
e5167894d1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/bind/dist/; revision=21138
@ -1,4 +1,268 @@
|
||||
$Id: CHANGES,v 8.40 1996/08/05 08:31:20 vixie Exp $
|
||||
$Id: CHANGES,v 8.52 1996/12/18 04:09:41 vixie Exp $
|
||||
|
||||
--- 4.9.5-p1 released ---
|
||||
|
||||
776. [doc] doc/misc/FAQ.* updated by its author.
|
||||
|
||||
775. [bug] KEY RRs were not allowed to default fields per [DNSSEC].
|
||||
|
||||
774. [bug] nslookup was overflowing yet another internal data structure.
|
||||
|
||||
773. [bug] syslog was being given an unprotected string to format from.
|
||||
|
||||
772. [debug] a debugging syslog() was made clearer.
|
||||
|
||||
771. [contrib] contrib/host updated by its author.
|
||||
|
||||
770. [bug] nslookup was overflowing an internal data structure.
|
||||
|
||||
769. [port] ultrix linkage hackery removed from res/res_comp.c.
|
||||
|
||||
768. [lint] named-xfer u_char* vs. char*.
|
||||
|
||||
767. [port] shres/sunos updates from the author.
|
||||
|
||||
766. [bug] nslookup was not limiting the number of addresses it handled.
|
||||
|
||||
765. [port] LOG_NOWAIT turned on if available.
|
||||
|
||||
764. [lint] nslookup NULL vs ERROR.
|
||||
|
||||
763. [bug] p_rr() was erroneously reporting short packets.
|
||||
|
||||
762. [bug] minor memory leak fixed (during bad-name syslogging).
|
||||
|
||||
761. [port] NeXTstep portability improved for modern systems.
|
||||
|
||||
760. [bug] NAPTR RR support was incomplete/broken in named-xfer.
|
||||
|
||||
759. [port] The resolver's POSIX.3 conformance is now optional since
|
||||
it was causing trouble for vendor shared library editing.
|
||||
|
||||
--- 4.9.5-rel released ---
|
||||
|
||||
758. [doc] more Linux libc discussions included.
|
||||
|
||||
757. [doc] RFCs 1876, 1995, 1996, 2010, and 2052 now included.
|
||||
|
||||
756. [contrib] new version of contrib/host received from author.
|
||||
|
||||
755. [bug] nslookup had a latent buffer overrun in initialization.
|
||||
|
||||
754. [port] NCR's flavour of SVr4 is now supported.
|
||||
|
||||
753. [bug] fp_nquery() could read past end of buffer. (fix from BIND 8.1)
|
||||
|
||||
752. [conf] SENSIBLE_DOTS is now the default. SGI can use WANT_PIDFILE.
|
||||
|
||||
751. [doc] the the BOG had an extra "the" in two places.
|
||||
|
||||
750. [bug] erroneous zones weren't resetting z_ftime.
|
||||
|
||||
749. [bug] named-xfer's handling of unknown type codes was not robust.
|
||||
(it's still wrong but now it's wrong more gracefully.)
|
||||
|
||||
748. [lint] u_char vs. char changes in db_load.c.
|
||||
|
||||
747. [bug] a previous patch had leftovers.
|
||||
|
||||
746. [bug] dangling CNAMEs were not handled properly.
|
||||
|
||||
745. [doc] shres/sunos/INSTALL, ./INSTALL and man/gethostbyname.3
|
||||
modernized.
|
||||
|
||||
744. [bug] NAPTR replacement domains were being verified as hostnames.
|
||||
|
||||
743. [port] hpux10.10 makefile cleanup.
|
||||
|
||||
742. [bug] inet_net_pton() was doing bad things to subnets and b'casts.
|
||||
|
||||
741. [func] source and owner are now logged with name errors.
|
||||
|
||||
--- 4.9.5-t6b released ---
|
||||
|
||||
740. [bug] dangling cname checking had a few memory leaks.
|
||||
|
||||
739. [func] SRV support made more complete; NAPTR support added.
|
||||
|
||||
738. [protocol] dangling CNAMEs are no longer considered format errors.
|
||||
|
||||
737. [bug] owner domain names like "*." were not considered valid.
|
||||
|
||||
736. [contrib] new version of contrib/host included.
|
||||
|
||||
735. [doc] added some text to shres/solaris/INSTALL.
|
||||
|
||||
734. [bug] loading a zone with a single line SOA RR killed following line.
|
||||
|
||||
733. [bug] priming could deadlock in odd cases.
|
||||
|
||||
732. [bug] SIGHUP now caught before initial zone load.
|
||||
|
||||
731. [bug] IP/TCP session logging now controlled by #ifdef DEBUG.
|
||||
|
||||
730. [port] untested HPUX 10 support added to top level Makefile.
|
||||
|
||||
729. [port] ultrix vs. _res_close(); ultrix wins.
|
||||
|
||||
728. [bug] several d_rcode references weren't #ifdef'd NCACHE.
|
||||
|
||||
727. [bug] SOA timer warnings now consistently logged at LOG_WARNING.
|
||||
|
||||
726. [protocol] added T_NAPTR as RR type 35, hoping the IANA concurs.
|
||||
|
||||
--- 4.9.5-t5b released ---
|
||||
|
||||
725. [port] shared libraries should work on Linux now.
|
||||
|
||||
724. [bug] "dig @0 VERSION.BIND TXT CHAOS" had never been tested.
|
||||
|
||||
723. [port] Solaris 2.6 has AF_LINK but not sa_len.
|
||||
|
||||
722. [protocol] verify RdLength of A and AAAA RRs.
|
||||
|
||||
721. [port] missing include directories will be made during "install".
|
||||
|
||||
720. [port] solaris and sunos should use native assemblers with gcc.
|
||||
|
||||
719. [port] cleaned up some A/UX linkages.
|
||||
|
||||
718. [func] some SOA sanity checks were changed from errors to warnings.
|
||||
|
||||
717. [port] BSD/named/Makefile needed to have dmalloc.c reference removed.
|
||||
|
||||
716. [protocol] cnames and referrals were generating spurious log messages.
|
||||
|
||||
715. [port] ultrix PCC didn't like a =&, said it was ambigious somehow.
|
||||
|
||||
--- 4.9.5-t4b released ---
|
||||
|
||||
714. [port] contrib/os2-emx now contains files nec'y for OS/2 (EMX).
|
||||
|
||||
713. [func] gethostbyname2(x, AF_INET6) now accepts address literals.
|
||||
|
||||
712. [bug] gethostbyname() wasn't seeing RES_USE_INET6 early enough.
|
||||
|
||||
711. [bug] nslookup was printing IPv6 addresses improperly.
|
||||
|
||||
710. [port] an alignment bug was found and fixed by Cray.
|
||||
|
||||
709. [bug] named-xfer was dumping core on incoming LOC RRs.
|
||||
|
||||
708. [protocol] primary zones are edited to make rrset ttl's coherent during
|
||||
loading.
|
||||
|
||||
707. [protocol] rrsets with coherent ttl's won't be overridden by new rrsets
|
||||
with incoherent ttl's.
|
||||
|
||||
706. [port] Ultrix portability restored.
|
||||
|
||||
705. [func] added "limit files XXX" to boot file.
|
||||
|
||||
704. [bug] trace generation code was getting unaligned accesses.
|
||||
|
||||
703. [contrib] added contrib/getkeyby, from gnu@toad.com.
|
||||
|
||||
702. [func] MAXDNAME is now 4*256+1 to allow for \000 and the NUL.
|
||||
|
||||
701. [bug] samedomain() wasn't paying attention to escapes.
|
||||
|
||||
700. [func] allow long text strings in T_X25 RRs.
|
||||
|
||||
699. [port] added base64.c to shres/*/Makefile.
|
||||
|
||||
698. [port] picked some lint out of tools/nslookup/getinfo.c.
|
||||
|
||||
697. [bug] we were calling isupper() without calling isascii() first.
|
||||
|
||||
696. [protocol] a new kind of bad referral is now caught and ignored.
|
||||
|
||||
--- 4.9.5-t3b released ---
|
||||
|
||||
695. [func] Use delete_stale() in preference to delete_all() more often.
|
||||
|
||||
694. [func] DATUMREFCNT is no longer an option.
|
||||
|
||||
693. [port] fixed up the CPPFLAGS usage in the top level Makefile.
|
||||
|
||||
692. [port] fixed up the __ defines (for POSIX.3) in include/resolv.h.
|
||||
|
||||
691. [port] removed all uses of "ssize_t", the world is not ready for it.
|
||||
(fixed two latent signed/unsigned code bugs in the process.)
|
||||
|
||||
--- 4.9.5-t3a released ---
|
||||
|
||||
690. [bug] the stale() and delete_all() calls in finddata() weren't
|
||||
respectful toward T_ANY and C_ANY queries.
|
||||
|
||||
689. [lint] miscellaneous compiler warnings were disappeared.
|
||||
|
||||
688. [func] handles insane/unreachable root servers a little better now.
|
||||
|
||||
687. [bug] T1A's core dumps from bad databufs should be all fixed now.
|
||||
|
||||
686. [func] overlong TXT strings should work again.
|
||||
|
||||
685. [port] updated compat/include/sys/cdefs.h to BSD 4.4-Lite (8.7) vers.
|
||||
|
||||
684. [doc] doc/i-d/* added.
|
||||
|
||||
683. [contrib] "nslint" added to contrib/.
|
||||
|
||||
682. [protocol] irrelevant authority information is now correctly ignored.
|
||||
|
||||
681. [func] DO_RELOAD Is no longer optional.
|
||||
|
||||
680. [cleanup] ALLOW_UPDATES is gone.
|
||||
|
||||
679. [port] some systems need _res to be in text rather than bss.
|
||||
|
||||
678. [port] -Dssize_t=int is gone; see portability.h.
|
||||
|
||||
677. [contrib] outdates #671; update to contrib/host version 960808.
|
||||
|
||||
676. [doc] formatting fix to man/named.man8.
|
||||
|
||||
--- 4.9.5-t2a released ---
|
||||
|
||||
675. [lint] various.
|
||||
|
||||
674. [feature] support added for SRV RR (untested).
|
||||
|
||||
673. [protocol] added definitions for EID, NIMLOC, SRV, ATMA, and IXFR.
|
||||
|
||||
672. [bug] fixed decoding problem wrt AAAA in tools/nslookup/debug.c.
|
||||
|
||||
671. [bug] fixed formatting problem wrt TXT in contrib/host/host.c.
|
||||
|
||||
--- 4.9.5-t1a released ---
|
||||
|
||||
670. [feature] added SIG and KEY RR support (without signature or
|
||||
verification).
|
||||
|
||||
669. [internal] name/number translations are now mostly table driven.
|
||||
|
||||
668. [feature] nslookup now has better[/different] error messages.
|
||||
|
||||
667. [feature] inet_neta(), inet_net_ntop(), inet_net_pton() added.
|
||||
|
||||
666. [bug] parent zone will be reloaded when a child zone changes.
|
||||
|
||||
665. [protocol] RETURNSOA logic has been refined, and now ships "enabled."
|
||||
|
||||
664. [protocol] cached RRsets are now completely flushed when new data arrives.
|
||||
|
||||
663. [port] IRIX shared libraries are now supported.
|
||||
|
||||
662. [port] SCO OSE5 support has been upgraded slightly.
|
||||
|
||||
661. [bug] insane root servers will now be handled correctly.
|
||||
|
||||
660. [bug] TXT RRs are now parsed and displayed in full RFC1035 form.
|
||||
|
||||
659. [port] UXP/DS is now supported in the top level Makefile.
|
||||
|
||||
658. [feature] BIND now checks that UDP checksums are enabled in the kernel.
|
||||
|
||||
--- 4.9.4-p1 released ---
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$Id: INSTALL,v 8.6 1995/12/24 06:43:57 vixie Exp $
|
||||
$Id: INSTALL,v 8.7 1996/11/11 06:36:40 vixie Exp $
|
||||
|
||||
THE FILES:
|
||||
----------
|
||||
@ -7,20 +7,26 @@ README -- Release announcements, tips and traps (some out of date)
|
||||
OPTIONS -- The options that can be turned on and off
|
||||
RUNSON -- What machines/compilers is BIND known to build on
|
||||
TODO -- Have spare time? Consider contributing to the project!
|
||||
BSD/* -- How to integrate BIND into a 4.4BSD or 4.4BSD-Lite
|
||||
contrib/* -- Useful BIND-related contributions
|
||||
doc/info/* -- Platform-dependent build hints
|
||||
doc/* -- other RFCs, drafts, papers and
|
||||
|
||||
HOW TO BUILD:
|
||||
INTRODUCTION:
|
||||
-------------
|
||||
4.9.3 is considerably easier to build than previous releases. These
|
||||
are the instructions on how to compile the software. For information
|
||||
on how to create your configuration files (resolv.conf, named.boot, and
|
||||
zone files) see the doc/bog directory and/or get "DNS and BIND" by C.
|
||||
Liu and P. Albitz from O'Reilly & Associates, Sebastopol, CA, ISBN
|
||||
0-937175-82-X 1992
|
||||
BIND used to be extremely difficult to build. That changed around
|
||||
version 4.9.3. These are the instructions on how to compile the
|
||||
software. For information on how to create your configuration files
|
||||
(resolv.conf, named.boot, and zone files) see the doc/bog directory for
|
||||
the complete "BIND Operations Guide". You might also consider getting
|
||||
"DNS and BIND" by C. Liu and P. Albitz from O'Reilly & Associates,
|
||||
Sebastopol, CA, ISBN 0-937175-82-X 1992
|
||||
|
||||
Note: If you maintain a BSD or are otherwise running a 4.4BSD-based system
|
||||
and want to integrate BIND into it, check out BSD/README.
|
||||
|
||||
BUILDING & INSTALLING:
|
||||
----------------------
|
||||
1. (optional) If you are going to compile for multiple platforms, you
|
||||
can make a symbolic link tree for each platform to save disk space. To
|
||||
create a directory called "sun4.dir", do:
|
||||
@ -30,15 +36,28 @@ copy of the source. Just be careful if you are modifying a file, make
|
||||
sure you turn any links into files:
|
||||
mv file file.tmp ; cp file.tmp file ; rm file.tmp
|
||||
|
||||
2. Edit "conf/options.h" and turn on any options that you want. The
|
||||
2. (optional) If you have a typical site, you should find yourself only
|
||||
editing Makefile and conf/options.h. Make backups of them now:
|
||||
|
||||
mv Makefile Makefile.tmp
|
||||
cp Makefile.tmp Makefile ; rm Makefile.tmp
|
||||
chmod u+w Makefile
|
||||
|
||||
mv conf/options.h conf/options.h.tmp
|
||||
cp conf/options.h.tmp conf/options.h ; rm conf/options.h.tmp
|
||||
chmod u+w conf/options.h
|
||||
|
||||
3. Edit "conf/options.h" and turn on any options that you want. The
|
||||
defaults are pretty reasonable for most installations.
|
||||
|
||||
3. Edit "Makefile". Go to the section that describes your operating
|
||||
system and uncoment it out. Add any other variables (for example,
|
||||
I added a line "DISTHELP=/usr/local/lib".) If in doubt, use the
|
||||
default!
|
||||
4. Edit "Makefile". The default build parameters are given for 4.4 BSD.
|
||||
They should be overridden (not edited!). Do this by going to the
|
||||
section that describes your operating system and uncoment the
|
||||
appropriate lines. Add any other variables (for example, some people
|
||||
add "DISTHELP=/usr/local/lib".) If in doubt, use the default! Read
|
||||
the comments carefully!
|
||||
|
||||
4. "make" should build everything. Consider putting "./bin" in your
|
||||
5. "make" should build everything. Consider putting "./bin" in your
|
||||
path if "make depend" fails and you think bin/mkdep will help you out.
|
||||
|
||||
*** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
|
||||
@ -49,26 +68,30 @@ path if "make depend" fails and you think bin/mkdep will help you out.
|
||||
|
||||
*** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
|
||||
|
||||
5. "make install" will install everything. You might first do
|
||||
6. "make install" will install everything. You might first do
|
||||
"make -n install" to see what commands would be executed by "make install"
|
||||
to make sure you understand where everything is about to be installed.
|
||||
|
||||
6. (optional, SunOS 4.1.x/NetBSD-1.x/Solaris 2.x only): You can integrate
|
||||
the new resolver (client-side) code into the shared libraries of your
|
||||
operating system so that all dynamicly linked programs take advantage of
|
||||
the new resolver. Read shres/<osname>/INSTALL to find out how to do it.
|
||||
7. (optional, SunOS 4, SunOS 5, NetBSD-1.x, IRIX, Linix only): You can
|
||||
integrate the new resolver (client-side) code into the shared libraries
|
||||
of your operating system so that all dynamicly linked programs take
|
||||
advantage of the new resolver. Read shres/<osname>/INSTALL to find out
|
||||
how to do it.
|
||||
|
||||
|
||||
|
||||
HOW TO GET HELP:
|
||||
----------------
|
||||
If you have any problems or fixes send them to
|
||||
bind@uunet.uu.net
|
||||
|
||||
To be added to that mailing list, send mail to
|
||||
----------------
|
||||
The "bind@uunet.uu.net" mailing list was created especially for people
|
||||
to talk about and ask questions about installation, maintenance, etc.
|
||||
It is highly recommended that you first help yourself by reading
|
||||
the BOG (doc/bog) or a book on DNS and BIND.
|
||||
|
||||
To be added to this mailing list, send mail to
|
||||
bind-request@uunet.uu.net
|
||||
|
||||
|
||||
|
||||
This INSTALL was originally written on 15Jul94 by Tom Limoncelli <tal@plts.org>
|
||||
Minor changes 23Dec95 by Christopher Davis <ckd@kei.com>
|
||||
This INSTALL was originally written on 15Jul94 by Tom Limoncelli
|
||||
<tal@bell-labs.org> Minor changes 23Dec95 by Christopher Davis
|
||||
<ckd@kei.com> and then by Tom Limoncelli 16Oct96.
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile for BIND>=4.9 top level
|
||||
# vixie@decwrl December, 1992 [original]
|
||||
#
|
||||
# $Id: Makefile,v 8.39 1996/08/05 08:31:20 vixie Exp $
|
||||
# $Id: Makefile,v 8.48 1996/11/26 10:11:13 vixie Exp $
|
||||
|
||||
## ++Copyright++ 1989
|
||||
## -
|
||||
@ -56,7 +56,7 @@
|
||||
## -
|
||||
## --Copyright--
|
||||
|
||||
VER = 4.9.4-P1
|
||||
VER = 4.9.5-P1
|
||||
SHELL = /bin/sh
|
||||
MAKE = make
|
||||
DESTDIR =
|
||||
@ -101,11 +101,12 @@ PS = ps
|
||||
IOT = ABRT
|
||||
SHCC =
|
||||
SHLD =
|
||||
PIC =
|
||||
|
||||
# (NetBSD - for details on shared library building, see shres/netbsd/INSTALL)
|
||||
#uncomment next three lines to build a shared library version of libresolv
|
||||
#SHRES = shres/netbsd
|
||||
#SHCC = cc
|
||||
#SHCC = cc $(CPPFLAGS)
|
||||
#PIC = -fpic
|
||||
|
||||
#(Linux - on modern systems, all you need to do is rename or remove
|
||||
@ -113,13 +114,27 @@ SHLD =
|
||||
#CC = gcc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -DSYSV
|
||||
#LEX=flex -8 -I
|
||||
#INSTALL_COMPAT = install-compat
|
||||
#LIBS = -lfl
|
||||
#DESTEXEC = /usr/sbin
|
||||
#DESTMAN = /usr/man
|
||||
#MANDIR = man
|
||||
#MANROFF = cat
|
||||
#DESTHELP = /usr/lib
|
||||
#CATEXT = $$$$N
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
#uncomment next line to build a shared library version of libresolv
|
||||
#SHRES = shres/linux
|
||||
#uncomment next line to build tools and named with shared libresolv
|
||||
#RES = $(SHRES)/libresolv.so
|
||||
# ... and then (for shared) uncomment these lines too:
|
||||
#SHCC = gcc $(CPPFLAGS) -fomit-frame-pointer -pipe
|
||||
#PIC= -fpic
|
||||
#SHMAJVER=4
|
||||
#SHVER=$(SHMAJVER).9.5.0.4
|
||||
#SHLD= gcc -shared -Wl,-rpath,$(DESTDIR)$(DESTLIB),-soname,libresolv.so.$(SHMAJVER) -lfl
|
||||
|
||||
#(CRAY)
|
||||
#CDEBUG = -g
|
||||
@ -145,9 +160,9 @@ SHLD =
|
||||
#(DEC AXP OSF/1 Version 3.0 and after)
|
||||
#CC = cc $(CPPFLAGS) -std
|
||||
#CDEBUG = -g3 -O2 -Olimit 2000
|
||||
#CPPFLAGS =
|
||||
#CPPFLAGS = -DCHECK_UDP_SUM
|
||||
#LEX = lex
|
||||
#LIBS = -ll -lutil
|
||||
#LIBS = -ll -lutil -lmld
|
||||
#DESTEXEC = /usr/sbin
|
||||
#COMPINCL = compat/include
|
||||
#INSTALL_COMPAT = install-compat
|
||||
@ -157,13 +172,16 @@ SHLD =
|
||||
#CATEXT = $$$$N
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
#KSYMS = /vmunix
|
||||
#KMEM = /dev/kmem
|
||||
#UDPSUM = udpcksum
|
||||
|
||||
#(irix4)
|
||||
#CC = cc $(CPPFLAGS) -xansi -signed
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -D__STDC__ -D_BSD_SIGNALS -DSIG_FN=int
|
||||
#CPPFLAGS = -D__STDC__ -D_BSD_SIGNALS -DSIG_FN=int -DCHECK_UDP_SUM -DKMAP
|
||||
#LEX = lex
|
||||
#LIBS = -ll
|
||||
#LIBS = -ll -lmld
|
||||
#DESTSBIN = /usr/etc
|
||||
#DESTEXEC = /usr/etc
|
||||
#DESTMAN = /usr/catman/local
|
||||
@ -173,13 +191,17 @@ SHLD =
|
||||
#PS = ps -p
|
||||
#(bsdinstall.sh is in conf/)
|
||||
#IOT = IOT
|
||||
#KSYMS = /unix
|
||||
#KMEM = /dev/kmem
|
||||
#UDPSUM = udpcksum
|
||||
|
||||
#(irix5)
|
||||
#(irix5 and irix6.2)
|
||||
#CC = cc $(CPPFLAGS) -xansi -signed
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -D__STDC__ -D_BSD_SIGNALS -DSIG_FN=void -D__BIT_TYPES_DEFINED__
|
||||
#CPPFLAGS = -D__STDC__ -D_BSD_SIGNALS -DSIG_FN=void -D__BIT_TYPES_DEFINED__ \
|
||||
# -DCHECK_UDP_SUM -DKMAP
|
||||
#LEX = lex
|
||||
#LIBS = -ll
|
||||
#LIBS = -ll -lelf
|
||||
#DESTSBIN = /usr/etc
|
||||
#DESTEXEC = /usr/etc
|
||||
#DESTMAN = /usr/share/catman/local
|
||||
@ -189,11 +211,20 @@ SHLD =
|
||||
#PS = ps -p
|
||||
#(bsdinstall.sh is in conf/)
|
||||
#IOT = IOT
|
||||
#KSYMS = /unix
|
||||
#KMEM = /dev/kmem
|
||||
#UDPSUM = udpcksum
|
||||
# shared libresolv.o options below.
|
||||
# they could work under irix6, if the cmplr didn't change alot
|
||||
#SHRES = shres/irix
|
||||
#SHCC = $(CC) $(CPPFLAGS)
|
||||
#SHLD = ld -shared
|
||||
#RES = $(SHRES)/libresolv.so
|
||||
|
||||
#(sunos4.x)
|
||||
#CC = /usr/bin/cc
|
||||
#CC = /usr/bin/cc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -DSUNOS4 -DSPRINTF_CHAR
|
||||
#CPPFLAGS = -DSUNOS4 -DSPRINTF_CHAR -DCHECK_UDP_SUM -Dconst=
|
||||
#INDOT = in.
|
||||
#XFER_INDOT = in.
|
||||
#LEX = lex
|
||||
@ -211,6 +242,9 @@ SHLD =
|
||||
#INSTALL_COMPAT = install-compat
|
||||
#INSTALL = install
|
||||
#IOT = IOT
|
||||
#KSYMS = /vmunix
|
||||
#KMEM = /dev/kmem
|
||||
#UDPSUM = _udp_cksum
|
||||
# (for details on shared library building, see shres/sunos/INSTALL;
|
||||
# note that shres/solaris/INSTALL has some good testing notes for sunos)
|
||||
#uncomment next line to build a shared library version of libresolv
|
||||
@ -219,7 +253,7 @@ SHLD =
|
||||
# -- if you use gcc (recommended)
|
||||
# (if -fpic doesn't work, see shres/sunos/PROBLEMS)
|
||||
#SHCC = gcc -DSUNSECURITY $(CPPFLAGS)
|
||||
#PIC= -fpic -D_res=_res_shlib
|
||||
#PIC= -B/usr/bin/ -fpic -D_res=_res_shlib
|
||||
# -- if you use Sun's cc
|
||||
#SHCC = /usr/bin/cc -DSUNSECURITY $(CPPFLAGS)
|
||||
#PIC = -pic -D_res=_res_shlib
|
||||
@ -229,7 +263,7 @@ SHLD =
|
||||
|
||||
#(ULTRIX, other 4.[23]bsd-alikes)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS =
|
||||
#CPPFLAGS = -DCHECK_UDP_SUM
|
||||
#LEX = lex
|
||||
#LIBS = -ll
|
||||
#PIDDIR = /etc
|
||||
@ -244,6 +278,9 @@ SHLD =
|
||||
#MANDIR = man
|
||||
#MANROFF = cat
|
||||
#IOT = IOT
|
||||
#KSYMS = /vmunix
|
||||
#KMEM = /dev/kmem
|
||||
#UDPSUM = udpcksum
|
||||
|
||||
#(solaris2.x/sunos5.x)
|
||||
#be careful with installation - note in particular that the system ships
|
||||
@ -258,17 +295,20 @@ SHLD =
|
||||
#LEX = lex
|
||||
#uncomment next line for Sun C compiler
|
||||
#CC = /opt/SUNWspro/bin/cc $(CPPFLAGS) -R$(DESTLIB)
|
||||
#uncomment next line for GNU C compiler
|
||||
#CC = gcc $(CPPFLAGS) -Xlinker -R$(DESTLIB)
|
||||
#uncomment next two lines for GNU C compiler
|
||||
#CC = gcc $(CPPFLAGS)
|
||||
#LDFLAGS=-Xlinker -R$(DESTLIB)
|
||||
#otherwise uncomment the next line and hope for the best
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -DSVR4 -D_SYS_STREAM_H $(SOLCOMPAT)
|
||||
#CPPPFLAGS = -DSVR4 -D_SYS_STREAM_H
|
||||
#CPPFLAGS = $(CPPPFLAGS) $(SOLCOMPAT)
|
||||
#INDOT = in.
|
||||
#XFER_INDOT =
|
||||
#LIBS = -ll -lnsl -lsocket
|
||||
#DESTEXEC = /usr/sbin
|
||||
#DESTHELP = /usr/lib
|
||||
#INSTALL_COMPAT = install-compat
|
||||
#LDS = :
|
||||
#INSTALL = /usr/ucb/install
|
||||
#RANLIB = :
|
||||
@ -295,18 +335,18 @@ SHLD =
|
||||
# uncomment only one of the triplets of lines below
|
||||
# -- if you use gcc (recommended)
|
||||
# (if -fpic doesn't work, see shres/solaris/ISSUES)
|
||||
#SHCC = gcc -DSVR4 -D_SYS_STREAM_H
|
||||
#SHCC = gcc -B/usr/ccs/bin/ $(CPPPFLAGS)
|
||||
#PIC= -fpic
|
||||
#SHLD = /usr/ccs/bin/ld -G
|
||||
# -- if you use Sun's cc
|
||||
#SHCC = /opt/SUNWspro/bin/cc -DSVR4 -D_SYS_STREAM_H
|
||||
#SHCC = /opt/SUNWspro/bin/cc $(CPPPFLAGS)
|
||||
#PIC = -Kpic
|
||||
#SHLD = /opt/SUNWspro/bin/cc -G
|
||||
|
||||
#(hpux7.0,hpux8.0,hpux9.0,)
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS =
|
||||
#CPPFLAGS = -DCHECK_UDP_SUM
|
||||
#LEX = lex
|
||||
#LIBS = -ll -lBSD
|
||||
#PIDDIR = /etc
|
||||
@ -318,6 +358,28 @@ SHLD =
|
||||
#RANLIB = :
|
||||
#MANROFF = cat
|
||||
#PS = ps -p
|
||||
#KSYMS = /hp-ux
|
||||
#KMEM = /dev/kmem
|
||||
#UDPSUM = udpcksum
|
||||
#(bsdinstall.sh is in conf/)
|
||||
|
||||
#(hpux10.10)
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -Dconst=
|
||||
#LEX = lex
|
||||
#LIBS = -ll
|
||||
#PIDDIR = /etc
|
||||
#DESTSBIN = /usr/sbin
|
||||
#DESTEXEC = /usr/sbin
|
||||
#DESTMAN = /usr/man
|
||||
#DESTHELP = /usr/lib
|
||||
#LDS = :
|
||||
#INSTALL = bsdinstall.sh
|
||||
#RANLIB = :
|
||||
#MANROFF = cat
|
||||
#PS = ps -p
|
||||
#INSTALL_COMPAT = install-install
|
||||
#(bsdinstall.sh is in conf/)
|
||||
|
||||
#(apollo domainos)
|
||||
@ -346,6 +408,18 @@ SHLD =
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
|
||||
#(AIX4)
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -D_BSD=44
|
||||
#LIBS = -ll -lbsd
|
||||
#DESTEXEC = /usr/sbin
|
||||
#INSTALL = /usr/ucb/install
|
||||
#CATEXT = $$$$N
|
||||
#LEX = lex
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
|
||||
# (ConvexOS-10.x)
|
||||
#CC = gcc $(CPPFLAGS) -g -O2 -fpcc-struct-return -fno-builtin -funsigned-char
|
||||
#CDEBUG = -g
|
||||
@ -398,10 +472,19 @@ SHLD =
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
|
||||
# SCO Unix 3.4.2 / ODT 3.0 using gcc (the only choice for now)
|
||||
# SCO OSE5, SCO ODT 3.0, SCO Unix 3.2v4.2
|
||||
# uncomment only one set of the CC/CDEBUG lines below
|
||||
# -- OSE5 using SCO's cc
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG=-O3
|
||||
# -- ODT 3.0 / 3.2v4.2 using SCO's cc ( lots of warnings during compilation )
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG=-O
|
||||
# -- if you use gcc ( gcc highly recommended on 3.2v4.2 / ODT 3.0 )
|
||||
#CC = gcc $(CPPFLAGS)
|
||||
#CPPFLAGS = -DSYSV -DSYSV3
|
||||
#CDEBUG=-O6
|
||||
# For the time being, the rest is common for all supported SCO flavors
|
||||
#CPPFLAGS = -DSYSV -DSYSV3
|
||||
#LDFLAGS=-s
|
||||
#INDOT=
|
||||
#LEX=lex
|
||||
@ -586,8 +669,8 @@ SHLD =
|
||||
#IOT = IOT
|
||||
|
||||
#(ISC4.0 using GCC)
|
||||
#CC = gcc -DISC -posix
|
||||
#CPPFLAGS =
|
||||
#CC = gcc $(CPPFLAGS) -posix
|
||||
#CPPFLAGS = -DISC
|
||||
#CDEBUG = -g
|
||||
#LEX = flex -I
|
||||
#LIBS = -lbsd
|
||||
@ -649,6 +732,98 @@ SHLD =
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
|
||||
#NCR System Vr4.3 3.x
|
||||
#also, use 'make install' at your own risk.
|
||||
#PIDDIR = /etc/inet
|
||||
#LEX = lex
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -DSVR4 -Hnocopyr -DPOSIX_SIGNALS -DNO_SA_LEN -DNCR -w
|
||||
#INDOT = in.
|
||||
#XFER_INDOT = in.
|
||||
#LIBS = -ll -lnsl -lsocket
|
||||
#DESTEXEC = /usr/sbin
|
||||
#LDS = :
|
||||
#RANLIB = :
|
||||
#ARPREF = `lorder
|
||||
#ARSUFF = | tsort`
|
||||
#CATEXT = $$$$N
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
|
||||
#NCR System Vr4.3-3.0
|
||||
#also, use 'make install' at your own risk.
|
||||
#PIDDIR = /etc/inet
|
||||
#LEX = lex
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -DSVR4 -Hnocopyr -DPOSIX_SIGNALS -DNO_SA_LEN -DNCR -w
|
||||
#INDOT = in.
|
||||
#XFER_INDOT = in.
|
||||
#LIBS = -ll -lnsl -lsocket
|
||||
#DESTEXEC = /usr/sbin
|
||||
#LDS = :
|
||||
#RANLIB = :
|
||||
#ARPREF = `lorder
|
||||
#ARSUFF = | tsort`
|
||||
#CATEXT = $$$$N
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
#SHCC = cc $(CPPPFLAGS)
|
||||
#PIC = -Kpic
|
||||
#SHLD = cc -G
|
||||
#SHRES = shres/ncr
|
||||
|
||||
#NCR System Vr4.3-2.03
|
||||
#also, use 'make install' at your own risk.
|
||||
#PIDDIR = /etc
|
||||
#LEX = lex
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG = -g
|
||||
#CPPFLAGS = -DSVR4 -Hnocopyr -DPOSIX_SIGNALS -DNO_SA_LEN -DNCR -w
|
||||
#INDOT =
|
||||
#XFER_INDOT =
|
||||
#LIBS = -ll -lnsl -lsocket
|
||||
#DESTSBIN = /usr/etc
|
||||
#DESTEXEC = /usr/etc
|
||||
#LDS = :
|
||||
#RANLIB = :
|
||||
#ARPREF = `lorder
|
||||
#ARSUFF = | tsort`
|
||||
#CATEXT = $$$$N
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
#SHCC = cc $(CPPPFLAGS)
|
||||
#PIC = -Kpic
|
||||
#SHLD = cc -G
|
||||
#SHRES = shres/ncr
|
||||
|
||||
#(UXP/DS)
|
||||
#PIDDIR = /etc
|
||||
#LEX = lex
|
||||
#CC = cc $(CPPFLAGS)
|
||||
#CDEBUG = -O
|
||||
#CPPFLAGS = -DSVR4 -D_SYS_STREAM_H -DUSE_POSIX
|
||||
#INDOT = in.
|
||||
#XFER_INDOT =
|
||||
#LIBS = -ll -lnsl -lsocket
|
||||
#LDS = :
|
||||
#COMPINCL = compat/include
|
||||
#AR = ar -cru
|
||||
## for V10L20
|
||||
#INSTALL = /usr/ucb/install -g sys
|
||||
## for V20L10
|
||||
#INSTALL = /usr/ucb/install
|
||||
#RANLIB = :
|
||||
#ARPREF = `lorder
|
||||
#ARSUFF = | tsort`
|
||||
#CATEXT = $$$$N
|
||||
#PS = ps -p
|
||||
#IOT = IOT
|
||||
#PIC = -Kpic
|
||||
#MANROFF = ( tbl | nroff -man )
|
||||
#MANDIR = man
|
||||
|
||||
####################################################################
|
||||
############ no user servicable parts beyond this point ############
|
||||
####################################################################
|
||||
@ -666,7 +841,8 @@ MARGS = "VER=${VER}" "CC=${CC}" "CDEBUG=${CDEBUG}" "LIBS=${LIBS}" \
|
||||
"DESTHELP=${DESTHELP}" "PIC=${PIC}" "SHCC=${SHCC}" "SHLD=${SHLD}" \
|
||||
"AR=${AR}" "RANLIB=${RANLIB}" "LDS=${LDS}" 'ARPREF=${ARPREF}' \
|
||||
'ARSUFF=${ARSUFF}' $(MANARGS) PS="${PS}" "IOT=${IOT}" \
|
||||
"CPPFLAGS=${CPPFLAGS}"
|
||||
"CPPFLAGS=${CPPFLAGS}" "KSYMS=${KSYMS}" "KMEM=${KMEM}" \
|
||||
"UDPSUM=${UDPSUM}" "SHVER=${SHVER}" "SHMAJVER=${SHMAJVER}"
|
||||
|
||||
MACHINE = native
|
||||
DST = $(MACHINE).b
|
||||
@ -694,8 +870,10 @@ clean:: FRC
|
||||
depend:: FRC
|
||||
|
||||
mkdirs: FRC
|
||||
-set +e; for x in $(DESTBIN) $(DESTSBIN) $(DESTEXEC) \
|
||||
$(DESTMAN) $(DESTHELP) $(DESTLIB) $(DESTINC); do \
|
||||
-set +e; for x in $(DESTDIR)$(DESTBIN) $(DESTDIR)$(DESTSBIN) \
|
||||
$(DESTDIR)$(DESTEXEC) $(DESTDIR)$(DESTMAN) \
|
||||
$(DESTDIR)$(DESTHELP) $(DESTDIR)$(DESTLIB) \
|
||||
$(DESTDIR)$(DESTINC); do \
|
||||
test -d $$x || mkdir -p $$x; \
|
||||
done
|
||||
|
||||
@ -770,6 +948,12 @@ $(DST): FRC
|
||||
( mkdir solaris; cd solaris; ln -s ../../SRC/shres/solaris SRC; \
|
||||
cp SRC/Makefile .; chmod +w Makefile; \
|
||||
); \
|
||||
( mkdir irix; cd irix; ln -s ../../SRC/shres/irix SRC; \
|
||||
cp SRC/Makefile .; chmod +w Makefile; \
|
||||
); \
|
||||
( mkdir linux; cd linux; ln -s ../../SRC/shres/linux SRC; \
|
||||
cp SRC/Makefile .; chmod +w Makefile; \
|
||||
); \
|
||||
); \
|
||||
( mkdir man; cd man; ln -s ../SRC/man SRC; \
|
||||
cp SRC/Makefile .; chmod +w Makefile; \
|
||||
|
@ -1,7 +1,4 @@
|
||||
The official way to get BIND is: ftp ftp.vix.com
|
||||
cd pub/bind/release
|
||||
binary
|
||||
get bind.tar.gz
|
||||
The official place to get BIND is <URL:ftp://ftp.vix.com/pub/bind/release>.
|
||||
|
||||
The official mailing lists are: bind-users@vix.com - users/admins
|
||||
(use *-request@* for admin mail) bind-workers@vix.com - developers
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* options.h - specify the conditionally-compiled features
|
||||
* vix 28mar92 [moved out of the Makefile because they were getting too big]
|
||||
*
|
||||
* $Id: options.h,v 8.9 1996/05/17 09:10:41 vixie Exp $
|
||||
* $Id: options.h,v 8.12 1996/11/11 06:36:43 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -93,7 +93,7 @@
|
||||
#define SLAVE_FORWARD /* use sensible timeouts on slave forwarders (pma) */
|
||||
#define WANT_PIDFILE /* if you want the named.pid file (ucb/arc) */
|
||||
#define DOTTED_SERIAL /* if you want to be able to specify dotted serial#s */
|
||||
/*#define SENSIBLE_DOTS /* if you want dotted serial#s to make numeric sense */
|
||||
#define SENSIBLE_DOTS /* if you want dotted serial#s to make numeric sense */
|
||||
#define NCACHE /* negative caching (anant@isi.edu) */
|
||||
/*#define VALIDATE /* validation procedure (anant@isi.edu) (BUGGY!) */
|
||||
/*#define SHORT_FNAMES /* file names used in named-xfer need to be short */
|
||||
@ -107,11 +107,10 @@
|
||||
#define ADDAUTH /* return NS and glue w/ authorative answers (mpa) */
|
||||
#define RFC1535 /* use RFC 1535 default for "search" list (vix) */
|
||||
#define GEN_AXFR /* distinct zones within each class */
|
||||
#define DATUMREFCNT /* use reference counts on datums (mpa) */
|
||||
#define LAME_DELEGATION /* lame delegations (original-del,reworked-bb&del)*/
|
||||
#define LAME_LOGGING LOG_DEBUG /* log lame delegations, set log level */
|
||||
#define GETSER_LOGGING LOG_INFO /* log errors/timeouts getting serial number */
|
||||
/*#define RETURNSOA /* good code that the world isn't ready for yet */
|
||||
#define RETURNSOA /* good code that the world might be ready for now */
|
||||
#define CLEANCACHE /* useful and necessary in the face of NCACHE */
|
||||
#define PURGE_ZONE /* remove all traces of a zone when reloading (mpa) */
|
||||
#define STATS /* keep nameserver statistics; uses more memory */
|
||||
@ -150,14 +149,6 @@
|
||||
# include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
/* systems with killall(1M) don't need this
|
||||
*/
|
||||
#ifdef __sgi
|
||||
# ifdef WANT_PIDFILE
|
||||
# undef WANT_PIDFILE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef LAME_LOGGING
|
||||
# define LAME_DELEGATION
|
||||
#endif
|
||||
|
@ -1,12 +1,10 @@
|
||||
/* portability.h - include or define things that aren't present on all systems
|
||||
* vixie@decwrl 26dec92 [new]
|
||||
*
|
||||
* $Id: portability.h,v 8.14 1996/06/06 20:19:09 vixie Exp $
|
||||
* $Id: portability.h,v 8.20 1996/11/26 10:11:16 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* ++Copyright++
|
||||
* -
|
||||
* Copyright (c)
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
@ -37,7 +35,9 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* -
|
||||
*/
|
||||
|
||||
/*
|
||||
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
@ -55,21 +55,38 @@
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
/* XXX: this file has become a hopeless morass, and will be redone someday. */
|
||||
/*
|
||||
* Portions Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __BIND_PORTABILITY_H
|
||||
#define __BIND_PORTABILITY_H
|
||||
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#ifndef TIME_H_INCLUDED
|
||||
# include <sys/time.h>
|
||||
# define TIME_H_INCLUDED
|
||||
#endif
|
||||
|
||||
/* (ISC = INTERACTIVE Systems Corporation in the next #ifdef, btw.) */
|
||||
#ifdef ISC
|
||||
# ifndef _POSIX_SOURCE
|
||||
# define _POSIX_SOURCE
|
||||
@ -102,7 +119,15 @@
|
||||
# define setitimer(a,b,c) __setitimer(a,b,c)
|
||||
#endif
|
||||
|
||||
/* This is defined in the Makefile for ISC compiles. */
|
||||
/* This is for AIX 4.1.x */
|
||||
#ifdef _AIX41
|
||||
# include <sys/select.h>
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
# define vfork fork
|
||||
#endif
|
||||
|
||||
/* This is defined in the Makefile for INTERACTIVE compiles. */
|
||||
#if defined(ISC)
|
||||
# define ftruncate(a,b) __ftruncate(a,b)
|
||||
# define USE_MEMCPY
|
||||
@ -112,17 +137,23 @@
|
||||
|
||||
/* SCO UNIX defines only this unique symbol, apparently. */
|
||||
#if defined(M_UNIX)
|
||||
/* XXX - why is this POSIX_SOURCE instead of _POSIX_SOURCE? */
|
||||
# undef POSIX_SOURCE
|
||||
# define POSIX_SIGNALS
|
||||
# define HAVE_FCHMOD 0
|
||||
# define writev(a,b,c) __writev(a,b,c)
|
||||
# define ftruncate(a,b) __ftruncate(a,b)
|
||||
# if !defined(_SCO_DS)
|
||||
/* This section is for 3.2v4.2/ODT3.0 and maybe also for 3.2v4.1/3.2v4.0 */
|
||||
/* XXX - why is this POSIX_SOURCE instead of _POSIX_SOURCE? */
|
||||
# undef POSIX_SOURCE
|
||||
# define HAVE_FCHMOD 0
|
||||
# define NEED_WRITEV
|
||||
# define writev(a,b,c) __writev(a,b,c)
|
||||
# define ftruncate(a,b) __ftruncate(a,b)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef NeXT
|
||||
# define NEED_PUTENV
|
||||
# define NEED_SETENV
|
||||
# define HAVE_STDLIB_H
|
||||
# define NEED_STRDUP
|
||||
# define inet_addr(a) __inet_addr(a)
|
||||
#endif
|
||||
|
||||
@ -133,9 +164,10 @@
|
||||
|
||||
#if defined(SUNOS4)
|
||||
# define BSD 43
|
||||
# define NEED_STRTOUL
|
||||
#endif
|
||||
|
||||
#if defined(__osf__) && defined(__alpha)
|
||||
#if defined(__osf__) && defined(__alpha) && defined(BSD) && (BSD < 199103)
|
||||
# undef BSD
|
||||
# define BSD 199103
|
||||
#endif
|
||||
@ -148,14 +180,16 @@
|
||||
# define USE_MEMCPY
|
||||
#endif
|
||||
|
||||
#if defined(apollo)
|
||||
# define HAVE_STDLIB_H
|
||||
#endif
|
||||
|
||||
#if defined(SVR4) && !defined(SYSV)
|
||||
# define SYSV
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_SOURCE) || defined(__sgi) || defined(__ultrix) || \
|
||||
defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || \
|
||||
(defined(sun) && defined(SYSV))
|
||||
defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || defined(sun)
|
||||
# define USE_POSIX
|
||||
#endif
|
||||
|
||||
@ -237,38 +271,43 @@ struct timezoneBSD {
|
||||
# define _TIMEZONE timezone
|
||||
#endif
|
||||
|
||||
#if defined(USE_POSIX)
|
||||
#if defined(USE_POSIX) || defined(HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
# include <limits.h>
|
||||
# if defined(__ultrix)
|
||||
# define NEED_STRDUP
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
# define NEED_STRTOUL
|
||||
# define NEED_STRDUP
|
||||
# if !defined(_SCO_DS)
|
||||
# define NEED_STRDUP
|
||||
# define NEED_STRTOUL
|
||||
# endif
|
||||
|
||||
# define STDIN_FILENO 0
|
||||
# define STDOUT_FILENO 1
|
||||
# define STDERR_FILENO 2
|
||||
# ifndef NeXT
|
||||
extern char *getenv __P((char *));
|
||||
# else
|
||||
extern char *getenv __P((const char *));
|
||||
# endif
|
||||
extern int errno;
|
||||
|
||||
# if !defined(DMALLOC) && !defined(NeXT)
|
||||
extern char *malloc(), *realloc(), *calloc();
|
||||
# if defined(sun)
|
||||
extern int free();
|
||||
# else
|
||||
extern void free();
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /*HAVE_STDLIB_H*/
|
||||
|
||||
#if defined(USE_POSIX)
|
||||
# include <unistd.h>
|
||||
# include <limits.h>
|
||||
|
||||
#else
|
||||
|
||||
# define STDIN_FILENO 0
|
||||
# define STDOUT_FILENO 1
|
||||
# define STDERR_FILENO 2
|
||||
extern int errno;
|
||||
|
||||
extern int getdtablesize __P((void));
|
||||
# ifdef SHORT_FNAMES
|
||||
extern long pathconf __P((const char *path, int name));
|
||||
@ -323,13 +362,15 @@ int strcasecmp __P((const char *, const char *));
|
||||
extern void syslog();
|
||||
# endif
|
||||
extern char *ctime __P((const time_t *clock));
|
||||
# if !defined(M_UNIX)
|
||||
extern int close(), setitimer(), recv(), sendto(), sigsetmask(),
|
||||
atoi(), getpid(), fork(), read(), ioctl(),
|
||||
setsockopt(), socket(), bind();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(bcopy) /* some machines have their own macros for this */
|
||||
# if defined(USE_POSIX) || \
|
||||
# if (defined(USE_POSIX) && !defined(SUNOS4)) || \
|
||||
(defined(__STDC__) && !defined(sun) && !defined(sequent) \
|
||||
&& !defined(M_UNIX))
|
||||
/* use ANSI C3.159-1989 (``ANSI C'') functions if possible;
|
||||
@ -368,13 +409,15 @@ extern int bcmp();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (!defined(BSD) || (BSD < 43))
|
||||
#if (!defined(BSD) || (BSD < 43)) && !defined(__hpux)
|
||||
# define NEED_MKSTEMP
|
||||
# if !defined(__ultrix) && !defined(apollo)
|
||||
# define NEED_STRCASECMP
|
||||
# define NEED_MKTEMP
|
||||
# if !defined(SVR4)
|
||||
# define NEED_STRPBRK
|
||||
# if !defined(_SCO_DS)
|
||||
# define NEED_STRCASECMP
|
||||
# define NEED_MKTEMP
|
||||
# if !defined(SVR4)
|
||||
# define NEED_STRPBRK
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
@ -411,8 +454,8 @@ extern int bcmp();
|
||||
|
||||
#if !defined(ntohl) && !defined(htonl) && defined(BSD) && (BSD <= 43)
|
||||
/* if these aren't null macros in netinet/in.h, extern them here. */
|
||||
extern u_short htons(), ntohs();
|
||||
extern u_long htonl(), ntohl();
|
||||
extern u_short htons __P((u_short)), ntohs __P((u_short));
|
||||
extern u_long htonl __P((u_long)), ntohl __P((u_long));
|
||||
#endif
|
||||
|
||||
#if defined(USE_POSIX) && !defined(sun) && !defined(__sgi) \
|
||||
@ -555,12 +598,11 @@ extern u_long htonl(), ntohl();
|
||||
# define HAVE_FCHMOD 1
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types needed for POSIX but missing on some systems.
|
||||
* Some systems need _res to be linked into text rather than bss.
|
||||
*/
|
||||
#if defined(SUNOS4)
|
||||
typedef int ssize_t;
|
||||
#if defined(__m88k__)
|
||||
# define __BIND_RES_TEXT
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -593,3 +635,5 @@ extern int gethostname __P((char *, size_t));
|
||||
#ifdef NEED_STRDUP
|
||||
extern char *strdup __P((const char *));
|
||||
#endif
|
||||
|
||||
#endif /*__BIND_PORTABILITY_H*/
|
||||
|
@ -57,7 +57,7 @@
|
||||
.b "Name Server Operations Guide"
|
||||
.b "for \s-1BIND\s+1"
|
||||
.sz
|
||||
\fIRelease 4.9.4\fP
|
||||
\fIRelease 4.9.5\fP
|
||||
.eh 'SMM:10-%''Name Server Operations Guide for \s-1BIND\s+1'
|
||||
.oh 'Name Server Operations Guide for \s-1BIND\s+1''\s-1SMM\s+1:10-%'
|
||||
.sp
|
||||
|
@ -62,6 +62,9 @@ ME= -me
|
||||
NROFF= nroff -rb3
|
||||
PRINTER= -Pdp
|
||||
TBL= dtbl $(PRINTER)
|
||||
# For Linux:
|
||||
#PRINTER=
|
||||
#TBL= tbl $(PRINTER)
|
||||
TROFF= ditroff $(PRINTER)
|
||||
GROFF= groff -Tps -t $(ME)
|
||||
|
||||
|
@ -250,7 +250,7 @@ Slave mode is activated by placing the simple command
|
||||
\fIoptions forward-only\fP
|
||||
.)b
|
||||
in the bootfile. If this option is used, then you must specify forwarders.
|
||||
When in slave mode, the server will forward each query to each of the the
|
||||
When in slave mode, the server will forward each query to each of the
|
||||
forwarders until an answer is found or the list of forwarders is exhausted.
|
||||
The server will not try to contact any remote name server other than those
|
||||
named in the \fIforwarders\fP list.
|
||||
@ -829,7 +829,7 @@ protocol per address. Note that RFC1123 says of \fIWKS\fP records:
|
||||
...
|
||||
The TXT and WKS RR types have not been widely used by
|
||||
Internet sites; as a result, an application cannot rely
|
||||
on the the existence of a TXT or WKS RR in most
|
||||
on the existence of a TXT or WKS RR in most
|
||||
domains.
|
||||
.)l
|
||||
.sh 3 "CNAME - Canonical Name"
|
||||
@ -1046,6 +1046,10 @@ recognize it.
|
||||
|
||||
.sh 2 "Discussion about the TTL"
|
||||
.pp
|
||||
The use of different Time To Live fields with in a RRset have been
|
||||
deprecated and this is enforced by the server when loading a primary
|
||||
zone. See the Security section for more discussion of differing TTLs.
|
||||
.pp
|
||||
The Time To Live assigned to the records and to the zone via the
|
||||
Minimum field in the SOA record is very important. High values will
|
||||
lead to lower BIND network traffic and faster response time. Lower
|
||||
|
@ -1,5 +1,3 @@
|
||||
.\" ++Copyright++ 1986, 1988
|
||||
.\" -
|
||||
.\" Copyright (c) 1986, 1988
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
@ -48,8 +46,6 @@
|
||||
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
.\" SOFTWARE.
|
||||
.\" -
|
||||
.\" --Copyright--
|
||||
.\"
|
||||
.\" @(#)ns.me 6.3 (Berkeley) 9/19/89
|
||||
.\"
|
||||
@ -94,3 +90,38 @@ Berkeley would look as follows:
|
||||
.)b
|
||||
The top level domain for educational organizations is EDU;
|
||||
Berkeley is a subdomain of EDU and monet is the name of the host.
|
||||
.sh 1 Security
|
||||
.pp
|
||||
This section examines some of the know security implications of various
|
||||
versions of BIND. Some of these have been used to attack the nameservers
|
||||
in the past.
|
||||
.sh 2 "Unnecessary Glue"
|
||||
.pp
|
||||
Unnecessary glue can lead to incorrect records being loaded into the
|
||||
server. This can result in connections going to the wrong machines.
|
||||
.pp
|
||||
To prevent unnecessary glue being loaded, all the servers of zones being
|
||||
servered by a server and the servers of the parent zones need to be
|
||||
upgraded to BIND 4.9.3 or later.
|
||||
.sh 2 "Insertion of data into a zone that is being servered"
|
||||
.pp
|
||||
BIND versions prior to BIND 4.9.2 are subject to the insertion of
|
||||
resource records into zone that they are serving.
|
||||
.sh 2 "Denial of Service: Hash Bug Exploit"
|
||||
.pp
|
||||
September 1996 saw the COM TLD subject to a denial of service attack by
|
||||
injecting into the DNS a record with a final label of COM, eight spaces
|
||||
and COM. This effected BIND 4.9.4 servers. Similar attacks are possible
|
||||
on BIND 4.9.3 and BIND 4.9.3-P1.
|
||||
.pp
|
||||
It is recommend that you run a BIND 4.9.4-P1 or later server to avoid
|
||||
this exploit.
|
||||
.sh 2 "Denial of Service: TTL Inconsistency Attacks"
|
||||
.pp
|
||||
If you are still using multiple TTL values within a RRset you can be
|
||||
subject to a denial of service attack. BIND 4.9.5 onwards uses multiple
|
||||
ttl values within a RRset to reject obviously bad RRset.
|
||||
.pp
|
||||
It is recommend that you upgrade to BIND 4.9.5 or later as these server
|
||||
prevent you loading multiple TTL values and doesn't merge answers received
|
||||
across the network.
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -61,7 +61,10 @@ all depend:
|
||||
clean:
|
||||
rm -f *~ *.BAK *.CKP *.orig
|
||||
|
||||
install:
|
||||
install: ${DESTDIR}${DESTINC}/arpa
|
||||
set -x; for x in ${HFILES}; do \
|
||||
${INSTALL} -c -m 444 $$x ${DESTDIR}${DESTINC}/arpa/$$x; \
|
||||
done
|
||||
|
||||
${DESTDIR}${DESTINC}/arpa:
|
||||
mkdir $@
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
/*
|
||||
* @(#)inet.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: inet.h,v 8.5 1996/05/22 04:56:29 vixie Exp $
|
||||
* $Id: inet.h,v 8.6 1996/08/08 06:54:29 vixie Exp $
|
||||
*/
|
||||
|
||||
#ifndef _INET_H_
|
||||
@ -76,13 +76,16 @@ unsigned long inet_addr __P((const char *));
|
||||
int inet_aton __P((const char *, struct in_addr *));
|
||||
unsigned long inet_lnaof __P((struct in_addr));
|
||||
struct in_addr inet_makeaddr __P((u_long , u_long));
|
||||
char * inet_neta __P((u_long, char *, size_t));
|
||||
unsigned long inet_netof __P((struct in_addr));
|
||||
unsigned long inet_network __P((const char *));
|
||||
char *inet_net_ntop __P((int, const void *, int, char *, size_t));
|
||||
int inet_net_pton __P((int, const char *, void *, size_t));
|
||||
char *inet_ntoa __P((struct in_addr));
|
||||
int inet_pton __P((int af, const char *src, void *dst));
|
||||
const char *inet_ntop __P((int af, const void *src, char *dst, size_t s));
|
||||
u_int inet_nsap_addr __P((const char *, u_char *, int maxlen));
|
||||
char *inet_nsap_ntoa __P((int, const u_char *, char *ascii));
|
||||
int inet_pton __P((int, const char *, void *));
|
||||
const char *inet_ntop __P((int, const void *, char *, size_t));
|
||||
u_int inet_nsap_addr __P((const char *, u_char *, int));
|
||||
char *inet_nsap_ntoa __P((int, const u_char *, char *));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_INET_H_ */
|
||||
|
@ -50,12 +50,34 @@
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)nameser.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: nameser.h,v 8.5 1996/08/05 08:31:28 vixie Exp $
|
||||
* $Id: nameser.h,v 8.11 1996/10/08 04:51:02 vixie Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NAMESER_H_
|
||||
@ -70,10 +92,8 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifdef _AUX_SOURCE
|
||||
#include <sys/types.h> /* ech for A/UX */
|
||||
#define res_send ucb_res_send /* already def'd in libc */
|
||||
#define _res_close _ucb_res_close /* removing res_send.o from the library */
|
||||
#endif /* gives an undefined symbol... */
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* revision information. this is the release date in YYYYMMDD format.
|
||||
@ -83,13 +103,13 @@
|
||||
* is new enough to contain a certain feature.
|
||||
*/
|
||||
|
||||
#define __BIND 19950621 /* interface version stamp */
|
||||
#define __BIND 19960801 /* interface version stamp */
|
||||
|
||||
/*
|
||||
* Define constants based on rfc883
|
||||
*/
|
||||
#define PACKETSZ 512 /* maximum packet size */
|
||||
#define MAXDNAME 256 /* maximum domain name */
|
||||
#define MAXDNAME 1025 /* maximum presentation domain name */
|
||||
#define MAXCDNAME 255 /* maximum compressed domain name */
|
||||
#define MAXLABEL 63 /* maximum length of domain label */
|
||||
#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
|
||||
@ -113,17 +133,6 @@
|
||||
#define STATUS 0x2 /* nameserver status query */
|
||||
/*#define xxx 0x3*/ /* 0x3 reserved */
|
||||
#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
|
||||
#ifdef ALLOW_UPDATES
|
||||
/* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */
|
||||
# define UPDATEA 0x9 /* add resource record */
|
||||
# define UPDATED 0xa /* delete a specific resource record */
|
||||
# define UPDATEDA 0xb /* delete all named resource record */
|
||||
# define UPDATEM 0xc /* modify a specific resource record */
|
||||
# define UPDATEMA 0xd /* modify all named resource record */
|
||||
# define ZONEINIT 0xe /* initial zone transfer */
|
||||
# define ZONEREF 0xf /* incremental zone referesh */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Currently defined response codes
|
||||
*/
|
||||
@ -133,10 +142,6 @@
|
||||
#define NXDOMAIN 3 /* non existent domain */
|
||||
#define NOTIMP 4 /* not implemented */
|
||||
#define REFUSED 5 /* query refused */
|
||||
#ifdef ALLOW_UPDATES
|
||||
/* non standard */
|
||||
# define NOCHANGE 0xf /* update failed to change db */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Type values for resources and queries
|
||||
@ -170,12 +175,19 @@
|
||||
#define T_GPOS 27 /* geographical position (withdrawn) */
|
||||
#define T_AAAA 28 /* IP6 Address */
|
||||
#define T_LOC 29 /* Location Information */
|
||||
#define T_NXT 30 /* Next Valid Name in Zone */
|
||||
#define T_EID 31 /* Endpoint identifier */
|
||||
#define T_NIMLOC 32 /* Nimrod locator */
|
||||
#define T_SRV 33 /* Server selection */
|
||||
#define T_ATMA 34 /* ATM Address */
|
||||
#define T_NAPTR 35 /* Naming Authority PoinTeR */
|
||||
/* non standard */
|
||||
#define T_UINFO 100 /* user (finger) information */
|
||||
#define T_UID 101 /* user ID */
|
||||
#define T_GID 102 /* group ID */
|
||||
#define T_UNSPEC 103 /* Unspecified format (binary data) */
|
||||
/* Query type values which do not appear in resource records */
|
||||
#define T_IXFR 251 /* incremental zone transfer */
|
||||
#define T_AXFR 252 /* transfer zone of authority */
|
||||
#define T_MAILB 253 /* transfer mailbox records */
|
||||
#define T_MAILA 254 /* transfer mail agent records */
|
||||
@ -191,6 +203,48 @@
|
||||
/* Query class values which do not appear in resource records */
|
||||
#define C_ANY 255 /* wildcard match */
|
||||
|
||||
/*
|
||||
* Flags field of the KEY RR rdata
|
||||
*/
|
||||
#define KEYFLAG_TYPEMASK 0xC000 /* Mask for "type" bits */
|
||||
#define KEYFLAG_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
|
||||
#define KEYFLAG_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
|
||||
#define KEYFLAG_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
|
||||
#define KEYFLAG_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
|
||||
/* The type bits can also be interpreted independently, as single bits: */
|
||||
#define KEYFLAG_NO_AUTH 0x8000 /* Key not usable for authentication */
|
||||
#define KEYFLAG_NO_CONF 0x4000 /* Key not usable for confidentiality */
|
||||
|
||||
#define KEYFLAG_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */
|
||||
#define KEYFLAG_RESERVED3 0x1000 /* reserved - must be zero */
|
||||
#define KEYFLAG_RESERVED4 0x0800 /* reserved - must be zero */
|
||||
#define KEYFLAG_USERACCOUNT 0x0400 /* key is assoc. with a user acct */
|
||||
#define KEYFLAG_ENTITY 0x0200 /* key is assoc. with entity eg host */
|
||||
#define KEYFLAG_ZONEKEY 0x0100 /* key is zone key for the zone named */
|
||||
#define KEYFLAG_IPSEC 0x0080 /* key is for IPSEC use (host or user)*/
|
||||
#define KEYFLAG_EMAIL 0x0040 /* key is for email (MIME security) */
|
||||
#define KEYFLAG_RESERVED10 0x0020 /* reserved - must be zero */
|
||||
#define KEYFLAG_RESERVED11 0x0010 /* reserved - must be zero */
|
||||
#define KEYFLAG_SIGNATORYMASK 0x000F /* key can sign DNS RR's of same name */
|
||||
|
||||
#define KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \
|
||||
KEYFLAG_RESERVED4 | \
|
||||
KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
|
||||
|
||||
/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
|
||||
#define ALGORITHM_MD5RSA 1 /* MD5 with RSA */
|
||||
#define ALGORITHM_EXPIRE_ONLY 253 /* No alg, no security */
|
||||
#define ALGORITHM_PRIVATE_OID 254 /* Key begins with OID indicating alg */
|
||||
|
||||
/* Signatures */
|
||||
/* Size of a mod or exp in bits */
|
||||
#define MIN_MD5RSA_KEY_PART_BITS 512
|
||||
#define MAX_MD5RSA_KEY_PART_BITS 2552
|
||||
/* Total of binary mod and exp, bytes */
|
||||
#define MAX_MD5RSA_KEY_BYTES ((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3)
|
||||
/* Max length of text sig block */
|
||||
#define MAX_KEY_BASE64 (((MAX_MD5RSA_KEY_BYTES+2)/3)*4)
|
||||
|
||||
/*
|
||||
* Status return codes for T_UNSPEC conversion routines
|
||||
*/
|
||||
@ -259,7 +313,9 @@ typedef struct {
|
||||
unsigned rd: 1; /* recursion desired */
|
||||
/* fields in fourth byte */
|
||||
unsigned ra: 1; /* recursion available */
|
||||
unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */
|
||||
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
|
||||
unsigned ad: 1; /* authentic data from named */
|
||||
unsigned cd: 1; /* checking disabled by resolver */
|
||||
unsigned rcode :4; /* response code */
|
||||
#endif
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
|
||||
@ -271,7 +327,9 @@ typedef struct {
|
||||
unsigned qr :1; /* response flag */
|
||||
/* fields in fourth byte */
|
||||
unsigned rcode :4; /* response code */
|
||||
unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */
|
||||
unsigned cd: 1; /* checking disabled by resolver */
|
||||
unsigned ad: 1; /* authentic data from named */
|
||||
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
|
||||
unsigned ra :1; /* recursion available */
|
||||
#endif
|
||||
/* remaining bytes */
|
||||
@ -286,18 +344,6 @@ typedef struct {
|
||||
*/
|
||||
#define INDIR_MASK 0xc0
|
||||
|
||||
/*
|
||||
* Structure for passing resource records around.
|
||||
*/
|
||||
struct rrec {
|
||||
int16_t r_zone; /* zone number */
|
||||
int16_t r_class; /* class number */
|
||||
int16_t r_type; /* type number */
|
||||
u_int32_t r_ttl; /* time to live */
|
||||
int r_size; /* size of data area */
|
||||
char *r_data; /* pointer to data */
|
||||
};
|
||||
|
||||
extern u_int16_t _getshort __P((const u_char *));
|
||||
extern u_int32_t _getlong __P((const u_char *));
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
/*
|
||||
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: resolv.h,v 8.11 1996/06/02 08:20:38 vixie Exp $
|
||||
* $Id: resolv.h,v 8.17 1996/11/26 10:11:20 vixie Exp $
|
||||
*/
|
||||
|
||||
#ifndef _RESOLV_H_
|
||||
@ -71,14 +71,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* revision information. this is the release date in YYYYMMDD format.
|
||||
* it can change every day so the right thing to do with it is use it
|
||||
* in preprocessor commands such as "#if (__RES > 19931104)". do not
|
||||
* Revision information. This is the release date in YYYYMMDD format.
|
||||
* It can change every day so the right thing to do with it is use it
|
||||
* in preprocessor commands such as "#if (__RES > 19931104)". Do not
|
||||
* compare for equality; rather, use it to determine whether your resolver
|
||||
* is new enough to contain a certain feature.
|
||||
*/
|
||||
|
||||
#define __RES 19960229
|
||||
#define __RES 19960801
|
||||
|
||||
/*
|
||||
* Resolver configuration file.
|
||||
@ -110,9 +110,9 @@ struct __res_state {
|
||||
struct sockaddr_in
|
||||
nsaddr_list[MAXNS]; /* address of name server */
|
||||
#define nsaddr nsaddr_list[0] /* for backward compatibility */
|
||||
u_short id; /* current packet id */
|
||||
u_short id; /* current message id */
|
||||
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
|
||||
char defdname[MAXDNAME]; /* default domain */
|
||||
char defdname[256]; /* default domain (deprecated) */
|
||||
u_long pfcode; /* RES_PRF_ flags - see below. */
|
||||
unsigned ndots:4; /* threshold for initial abs. query */
|
||||
unsigned nsort:4; /* number of elements in sort_list[] */
|
||||
@ -121,7 +121,7 @@ struct __res_state {
|
||||
struct in_addr addr;
|
||||
u_int32_t mask;
|
||||
} sort_list[MAXRESOLVSORT];
|
||||
char pad[72]; /* On an i38this means 512b total. */
|
||||
char pad[72]; /* on an i386 this means 512b total */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -182,16 +182,30 @@ typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr_in *ns,
|
||||
int anssiz,
|
||||
int *resplen));
|
||||
|
||||
struct res_sym {
|
||||
int number; /* Identifying number, like T_MX */
|
||||
char * name; /* Its symbolic name, like "MX" */
|
||||
char * humanname; /* Its fun name, like "mail exchanger" */
|
||||
};
|
||||
|
||||
extern struct __res_state _res;
|
||||
extern const struct res_sym __p_class_syms[];
|
||||
extern const struct res_sym __p_type_syms[];
|
||||
|
||||
/* Private routines shared between libc/net, named, nslookup and others. */
|
||||
#define res_hnok __res_hnok
|
||||
#define res_ownok __res_ownok
|
||||
#define res_mailok __res_mailok
|
||||
#define res_dnok __res_dnok
|
||||
#define sym_ston __sym_ston
|
||||
#define sym_ntos __sym_ntos
|
||||
#define sym_ntop __sym_ntop
|
||||
#define b64_ntop __b64_ntop
|
||||
#define b64_pton __b64_pton
|
||||
#define loc_ntoa __loc_ntoa
|
||||
#define loc_aton __loc_aton
|
||||
#define dn_skipname __dn_skipname
|
||||
#define fp_resstat __fp_resstat
|
||||
#define fp_query __fp_query
|
||||
#define fp_nquery __fp_nquery
|
||||
#define hostalias __hostalias
|
||||
@ -200,55 +214,83 @@ extern struct __res_state _res;
|
||||
#define p_class __p_class
|
||||
#define p_time __p_time
|
||||
#define p_type __p_type
|
||||
#define p_query __p_query
|
||||
#define p_cdnname __p_cdnname
|
||||
#define p_cdname __p_cdname
|
||||
#define p_fqnname __p_fqnname
|
||||
#define p_fqname __p_fqname
|
||||
#define p_rr __p_rr
|
||||
#define p_option __p_option
|
||||
#define p_secstodate __p_secstodate
|
||||
#define dn_count_labels __dn_count_labels
|
||||
#define dn_comp __dn_comp
|
||||
#define res_randomid __res_randomid
|
||||
#define res_send __res_send
|
||||
#define res_isourserver __res_isourserver
|
||||
#define res_nameinquery __res_nameinquery
|
||||
#define res_queriesmatch __res_queriesmatch
|
||||
#define res_close __res_close
|
||||
|
||||
#ifdef BIND_RES_POSIX3
|
||||
#define dn_expand __dn_expand
|
||||
#define res_init __res_init
|
||||
#define res_query __res_query
|
||||
#define res_search __res_search
|
||||
#define res_querydomain __res_querydomain
|
||||
#define res_mkquery __res_mkquery
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
int __res_hnok __P((const char *));
|
||||
int __res_ownok __P((const char *));
|
||||
int __res_mailok __P((const char *));
|
||||
int __res_dnok __P((const char *));
|
||||
int __loc_aton __P((const char *ascii, u_char *binary));
|
||||
char * __loc_ntoa __P((const u_char *binary, char *ascii));
|
||||
int __dn_skipname __P((const u_char *, const u_char *));
|
||||
void __fp_resstat __P((struct __res_state *, FILE *));
|
||||
void __fp_query __P((const u_char *, FILE *));
|
||||
void __fp_nquery __P((const u_char *, int, FILE *));
|
||||
char *__hostalias __P((const char *));
|
||||
void __putlong __P((u_int32_t, u_char *));
|
||||
void __putshort __P((u_int16_t, u_char *));
|
||||
char *__p_time __P((u_int32_t));
|
||||
void __p_query __P((const u_char *));
|
||||
const u_char *__p_cdnname __P((const u_char *, const u_char *, int, FILE *));
|
||||
const u_char *__p_cdname __P((const u_char *, const u_char *, FILE *));
|
||||
const u_char *__p_fqname __P((const u_char *, const u_char *, FILE *));
|
||||
const u_char *__p_rr __P((const u_char *, const u_char *, FILE *));
|
||||
const char *__p_type __P((int));
|
||||
const char *__p_class __P((int));
|
||||
const char *__p_option __P((u_long option));
|
||||
int dn_comp __P((const char *, u_char *, int, u_char **, u_char **));
|
||||
int dn_expand __P((const u_char *, const u_char *, const u_char *,
|
||||
char *, int));
|
||||
int res_init __P((void));
|
||||
u_int16_t res_randomid __P((void));
|
||||
int res_query __P((const char *, int, int, u_char *, int));
|
||||
int res_search __P((const char *, int, int, u_char *, int));
|
||||
int res_querydomain __P((const char *, const char *, int, int,
|
||||
u_char *, int));
|
||||
int res_mkquery __P((int, const char *, int, int, const u_char *, int,
|
||||
const u_char *, u_char *, int));
|
||||
int res_send __P((const u_char *, int, u_char *, int));
|
||||
int res_isourserver __P((const struct sockaddr_in *));
|
||||
int res_nameinquery __P((const char *, int, int,
|
||||
const u_char *, const u_char *));
|
||||
int res_queriesmatch __P((const u_char *, const u_char *,
|
||||
const u_char *, const u_char *));
|
||||
int res_hnok __P((const char *));
|
||||
int res_ownok __P((const char *));
|
||||
int res_mailok __P((const char *));
|
||||
int res_dnok __P((const char *));
|
||||
int sym_ston __P((const struct res_sym *, char *, int *));
|
||||
const char * sym_ntos __P((const struct res_sym *, int, int *));
|
||||
const char * sym_ntop __P((const struct res_sym *, int, int *));
|
||||
int b64_ntop __P((u_char const *, size_t, char *, size_t));
|
||||
int b64_pton __P((char const *, u_char *, size_t));
|
||||
int loc_aton __P((const char *, u_char *));
|
||||
const char * loc_ntoa __P((const u_char *, char *));
|
||||
int dn_skipname __P((const u_char *, const u_char *));
|
||||
void fp_resstat __P((struct __res_state *, FILE *));
|
||||
void fp_query __P((const u_char *, FILE *));
|
||||
void fp_nquery __P((const u_char *, int, FILE *));
|
||||
const char * hostalias __P((const char *));
|
||||
void putlong __P((u_int32_t, u_char *));
|
||||
void putshort __P((u_int16_t, u_char *));
|
||||
const char * p_class __P((int));
|
||||
const char * p_time __P((u_int32_t));
|
||||
const char * p_type __P((int));
|
||||
void p_query __P((const u_char *));
|
||||
const u_char * p_cdnname __P((const u_char *, const u_char *, int, FILE *));
|
||||
const u_char * p_cdname __P((const u_char *, const u_char *, FILE *));
|
||||
const u_char * p_fqnname __P((const u_char *cp, const u_char *msg,
|
||||
int, char *, int));
|
||||
const u_char * p_fqname __P((const u_char *, const u_char *, FILE *));
|
||||
const u_char * p_rr __P((const u_char *, const u_char *, FILE *));
|
||||
const char * p_option __P((u_long option));
|
||||
char * p_secstodate __P((u_long));
|
||||
int dn_count_labels __P((char *));
|
||||
int dn_comp __P((const char *, u_char *, int,
|
||||
u_char **, u_char **));
|
||||
int dn_expand __P((const u_char *, const u_char *, const u_char *,
|
||||
char *, int));
|
||||
int res_init __P((void));
|
||||
u_int res_randomid __P((void));
|
||||
int res_query __P((const char *, int, int, u_char *, int));
|
||||
int res_search __P((const char *, int, int, u_char *, int));
|
||||
int res_querydomain __P((const char *, const char *, int, int,
|
||||
u_char *, int));
|
||||
int res_mkquery __P((int, const char *, int, int, const u_char *, int,
|
||||
const u_char *, u_char *, int));
|
||||
int res_send __P((const u_char *, int, u_char *, int));
|
||||
int res_isourserver __P((const struct sockaddr_in *));
|
||||
int res_nameinquery __P((const char *, int, int,
|
||||
const u_char *, const u_char *));
|
||||
int res_queriesmatch __P((const u_char *, const u_char *,
|
||||
const u_char *, const u_char *));
|
||||
void res_close __P((void));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RESOLV_H_ */
|
||||
|
@ -103,8 +103,10 @@ The first address in h_addr_list; this is for backward compatibility.
|
||||
.PP
|
||||
When using the nameserver,
|
||||
.I gethostbyname
|
||||
will search for the named host in the current domain and its parents
|
||||
unless the name ends in a dot.
|
||||
will search for the named host in each parent domain given in the ``search''
|
||||
directive of
|
||||
.IR resolv.conf (5)
|
||||
unless the name contains a dot.
|
||||
If the name contains no dot, and if the environment variable ``HOSTALAIASES''
|
||||
contains the name of an alias file, the alias file will first be searched
|
||||
for an alias matching the input name.
|
||||
|
@ -128,22 +128,23 @@ The following is a small example:
|
||||
;
|
||||
directory /usr/local/adm/named
|
||||
|
||||
.ta \w'forwarders\ 'u +\w'6.32.128.IN-ADDR.ARPA\ 'u +\w'128.32.137.8 128.32.137.3\ 'u
|
||||
.ta \w'check-names\ 'u +\w'6.32.128.IN-ADDR.ARPA\ 'u +\w'128.32.137.8 128.32.137.3\ 'u
|
||||
; type domain source host/file backup file
|
||||
|
||||
cache . root.cache
|
||||
cache . root.cache
|
||||
primary Berkeley.EDU berkeley.edu.zone
|
||||
primary 32.128.IN-ADDR.ARPA ucbhosts.rev
|
||||
secondary CC.Berkeley.EDU 128.32.137.8 128.32.137.3 cc.zone.bak
|
||||
secondary 6.32.128.IN-ADDR.ARPA 128.32.137.8 128.32.137.3 cc.rev.bak
|
||||
primary 0.0.127.IN-ADDR.ARPA localhost.rev
|
||||
primary 0.0.127.IN-ADDR.ARPA localhost.rev
|
||||
forwarders 10.0.0.78 10.2.0.78
|
||||
limit transfers-in 10
|
||||
limit datasize 64M
|
||||
limit files 256
|
||||
options forward-only query-log fake-iquery
|
||||
check-names primary fail
|
||||
check-names secondary warn
|
||||
check-names response ignore
|
||||
check-names primary fail
|
||||
check-names secondary warn
|
||||
check-names response ignore
|
||||
|
||||
.DT
|
||||
.fi
|
||||
@ -241,6 +242,10 @@ a warning message.
|
||||
which \s-1BIND\s+1 will spawn at any one time.
|
||||
\fBtransfers-per-ns\fP's argument is the maximum number of zone transfers to
|
||||
be simultaneously initiated to any given remote name server.
|
||||
\fBfiles\fP's argument sets the number of file descriptors available to
|
||||
the process. \fINote:\fP not all systems provide a call to implement
|
||||
this -- on such systems, the use of the \fBfiles\fP parameter of ``limit''
|
||||
will result in a warning message.
|
||||
.LP
|
||||
The ``options'' directive introduces a boolean specifier that changes the
|
||||
behaviour of \s-1BIND\s+1. More than one option can be specified in a single
|
||||
@ -263,7 +268,7 @@ bogus reply to ``inverse queries'' rather than responding with an error --
|
||||
this is helpful if you have a lot of microcomputers or SunOS hosts or both.
|
||||
.LP
|
||||
The ``check-names'' directive tells \s-1BIND\s+1 to check names in either
|
||||
``primary'' or ``secondary'' zone files, or in messages (``response'')
|
||||
``primary'' or ``secondary'' zone files, or in messages (``response'')
|
||||
received during recursion (for example, those which would be forwarded back
|
||||
to a firewalled requestor). For each type of name,
|
||||
\s-1BIND\s+1 can be told to ``fail'', such that a zone would not be loaded
|
||||
@ -356,12 +361,13 @@ Each master zone file should begin with an SOA record for the zone.
|
||||
An example SOA record is as follows:
|
||||
.LP
|
||||
.nf
|
||||
@ IN SOA ucbvax.Berkeley.EDU. rwh.ucbvax.Berkeley.EDU. (
|
||||
1989020501 ; serial
|
||||
10800 ; refresh
|
||||
3600 ; retry
|
||||
3600000 ; expire
|
||||
86400 ) ; minimum
|
||||
@ IN SOA ucbvax.Berkeley.EDU. rwh.ucbvax.Berkeley.EDU. (
|
||||
.ta \w'x\ IN\ SOA\ 'u +\w'1989020501\ 'u
|
||||
1989020501 ; serial
|
||||
10800 ; refresh
|
||||
3600 ; retry
|
||||
3600000 ; expire
|
||||
86400 ) ; minimum
|
||||
.fi
|
||||
.LP
|
||||
The SOA specifies a serial number, which should be changed each time the
|
||||
|
@ -1,6 +1,6 @@
|
||||
#
|
||||
# @(#)Makefile.dist 5.4 (Berkeley) 8/15/90
|
||||
# $Id: Makefile,v 8.7 1995/12/22 10:20:30 vixie Exp $
|
||||
# $Id: Makefile,v 8.10 1996/09/22 00:13:10 vixie Exp $
|
||||
#
|
||||
|
||||
## ++Copyright++ 1987, 1988, 1990
|
||||
@ -89,7 +89,8 @@ CDEBUG= -g
|
||||
LIBS=
|
||||
COMPLIB= ../compat/lib/lib44bsd.a
|
||||
PATH_XFER = ${DESTEXEC}/${XFER_INDOT}named-xfer
|
||||
DEFS = -D_PATH_XFER=\"${PATH_XFER}\" -D_PATH_PIDFILE=\"${PIDDIR}/named.pid\"
|
||||
DEFS = -D_PATH_XFER=\"${PATH_XFER}\" -D_PATH_PIDFILE=\"${PIDDIR}/named.pid\" \
|
||||
-DKSYMS=\"${KSYMS}\" -DKMEM=\"${KMEM}\" -DUDPSUM=\"${UDPSUM}\"
|
||||
INSTALL = install
|
||||
PS=ps
|
||||
IOT=ABRT
|
||||
@ -101,14 +102,14 @@ SRCS= db_dump.c db_load.c db_lookup.c db_reload.c db_save.c db_update.c \
|
||||
db_secure.c db_glue.c \
|
||||
ns_forw.c ns_init.c ns_main.c ns_maint.c ns_req.c ns_resp.c \
|
||||
ns_sort.c ns_stats.c ns_validate.c ns_ncache.c \
|
||||
storage.c dmalloc.c tree.c
|
||||
storage.c tree.c ns_udp.c
|
||||
OBJS= db_dump.o db_load.o db_lookup.o db_reload.o db_save.o db_update.o \
|
||||
db_secure.o db_glue.o \
|
||||
ns_forw.o ns_init.o ns_main.o ns_maint.o ns_req.o ns_resp.o \
|
||||
ns_sort.o ns_stats.o ns_validate.o ns_ncache.o \
|
||||
storage.o dmalloc.o tree.o
|
||||
storage.o tree.o ns_udp.o
|
||||
XFERSRCS= named-xfer.c
|
||||
XFEROBJ= named-xfer.o db_glue.o storage.o dmalloc.o version.o
|
||||
XFEROBJ= named-xfer.o db_glue.o storage.o version.o
|
||||
|
||||
all: named named-xfer named.reload named.restart ndc
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* from db.h 4.16 (Berkeley) 6/1/90
|
||||
* $Id: db_defs.h,v 8.4 1996/05/17 09:10:46 vixie Exp $
|
||||
* $Id: db_defs.h,v 8.5 1996/08/27 08:33:23 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -90,16 +90,15 @@ struct databuf {
|
||||
int16_t d_zone; /* zone number or 0 for the cache */
|
||||
int16_t d_class; /* class number */
|
||||
int16_t d_type; /* type number */
|
||||
int16_t d_mark; /* place to mark data */
|
||||
int16_t d_size; /* size of data area */
|
||||
#ifdef NCACHE
|
||||
int16_t d_rcode; /* rcode added for negative caching */
|
||||
unsigned d_rcode :4; /* rcode added for negative caching */
|
||||
#endif
|
||||
int16_t d_rcnt;
|
||||
unsigned d_rcnt :12;
|
||||
#ifdef STATS
|
||||
struct nameser *d_ns; /* NS from whence this came */
|
||||
#endif
|
||||
/*XXX*/ u_int32_t d_nstime; /* NS response time, milliseconds */
|
||||
u_int16_t d_nstime; /* NS response time, milliseconds */
|
||||
u_char d_data[sizeof(char*)]; /* malloc'd (padded) */
|
||||
};
|
||||
#define DATASIZE(n) (sizeof(struct databuf) - sizeof(char*) + n)
|
||||
@ -108,6 +107,7 @@ struct databuf {
|
||||
* d_flags definitions
|
||||
*/
|
||||
#define DB_F_HINT 0x01 /* databuf belongs to fcachetab */
|
||||
#define DB_F_ACTIVE 0x02 /* databuf is linked into a cache */
|
||||
|
||||
/*
|
||||
* d_cred definitions
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)db_dump.c 4.33 (Berkeley) 3/3/91";
|
||||
static char rcsid[] = "$Id: db_dump.c,v 8.14 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: db_dump.c,v 8.19 1996/10/08 04:51:03 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -55,6 +55,28 @@ static char rcsid[] = "$Id: db_dump.c,v 8.14 1996/08/05 08:31:30 vixie Exp $";
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
@ -260,42 +282,6 @@ doadump()
|
||||
syslog(LOG_NOTICE, "finished dumping nameserver data\n");
|
||||
}
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
/* Create a disk database to back up zones
|
||||
*/
|
||||
void
|
||||
zonedump(zp)
|
||||
register struct zoneinfo *zp;
|
||||
{
|
||||
FILE *fp;
|
||||
char *fname;
|
||||
struct hashbuf *htp;
|
||||
char *op;
|
||||
struct stat st;
|
||||
|
||||
/* Only dump zone if there is a cache specified */
|
||||
if (zp->z_source && *(zp->z_source)) {
|
||||
dprintf(1, (ddt, "zonedump(%s)\n", zp->z_source));
|
||||
|
||||
if ((fp = fopen(zp->z_source, "w")) == NULL)
|
||||
return;
|
||||
if (op = strchr(zp->z_origin, '.'))
|
||||
op++;
|
||||
gettime(&tt);
|
||||
htp = hashtab;
|
||||
if (nlookup(zp->z_origin, &htp, &fname, 0) != NULL) {
|
||||
db_dump(htp, fp, zp-zones, (op == NULL ? "" : op));
|
||||
zp->z_flags &= ~Z_CHANGED; /* Checkpointed */
|
||||
}
|
||||
(void) my_fclose(fp);
|
||||
if (stat(zp->z_source, &st) == 0)
|
||||
zp->z_ftime = st.st_mtime;
|
||||
} else {
|
||||
dprintf(1, (ddt, "zonedump: no zone to dump\n"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
zt_dump(fp)
|
||||
FILE *fp;
|
||||
@ -365,7 +351,12 @@ db_dump(htp, fp, zone, origin)
|
||||
register u_char *cp;
|
||||
u_char *end;
|
||||
char *proto, *sep;
|
||||
int16_t type;
|
||||
int found_data = 0, tab, printed_origin = 0;
|
||||
u_int16_t keyflags;
|
||||
u_char *sigdata;
|
||||
u_char *savecp;
|
||||
char temp_base64[MAX_KEY_BASE64];
|
||||
|
||||
npp = htp->h_tab;
|
||||
nppend = npp + htp->h_size;
|
||||
@ -407,7 +398,7 @@ db_dump(htp, fp, zone, origin)
|
||||
fprintf(fp, ".%s.\t", origin); /* ??? */
|
||||
} else
|
||||
fprintf(fp, "%s\t", NAME(*np));
|
||||
if (NAMELEN(*np) < (size_t)8)
|
||||
if (NAMELEN(*np) < (unsigned)8)
|
||||
tab = 1;
|
||||
found_data++;
|
||||
} else {
|
||||
@ -432,27 +423,29 @@ db_dump(htp, fp, zone, origin)
|
||||
p_type(dp->d_type));
|
||||
cp = (u_char *)dp->d_data;
|
||||
sep = "\t;";
|
||||
type = dp->d_type;
|
||||
#ifdef NCACHE
|
||||
#ifdef RETURNSOA
|
||||
if (dp->d_rcode == NOERROR_NODATA) {
|
||||
fprintf(fp, "NODATA%s-$", sep);
|
||||
goto eoln;
|
||||
}
|
||||
#else
|
||||
if (dp->d_rcode == NXDOMAIN ||
|
||||
dp->d_rcode == NOERROR_NODATA) {
|
||||
#ifdef RETURNSOA
|
||||
if (dp->d_size == 0) {
|
||||
#endif
|
||||
fprintf(fp, "%s%s-$",
|
||||
(dp->d_rcode == NXDOMAIN)
|
||||
?"NXDOMAIN" :"NODATA",
|
||||
sep);
|
||||
goto eoln;
|
||||
}
|
||||
#ifdef RETURNSOA
|
||||
} else {
|
||||
type = T_SOA;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Print type specific data
|
||||
*/
|
||||
switch (dp->d_type) {
|
||||
switch (type) {
|
||||
case T_A:
|
||||
switch (dp->d_class) {
|
||||
case C_IN:
|
||||
@ -486,24 +479,28 @@ db_dump(htp, fp, zone, origin)
|
||||
break;
|
||||
|
||||
case T_HINFO:
|
||||
case T_ISDN:
|
||||
case T_ISDN: {
|
||||
char buf[256];
|
||||
if ((n = *cp++) != '\0') {
|
||||
fprintf(fp, "\"%.*s\"", (int)n, cp);
|
||||
bcopy(cp, buf, n); buf[n] = '\0';
|
||||
fprintf(fp, "\"%.*s\"", (int)n, buf);
|
||||
cp += n;
|
||||
} else
|
||||
fprintf(fp, "\"\"");
|
||||
if ((n = *cp++) != '\0')
|
||||
fprintf(fp, " \"%.*s\"", (int)n, cp);
|
||||
else
|
||||
if ((n = *cp++) != '\0') {
|
||||
bcopy(cp, buf, n); buf[n] = '\0';
|
||||
fprintf(fp, " \"%.*s\"", (int)n, buf);
|
||||
} else
|
||||
fprintf(fp, " \"\"");
|
||||
break;
|
||||
}
|
||||
|
||||
case T_SOA:
|
||||
fprintf(fp, "%s.", cp);
|
||||
cp += strlen((char *)cp) + 1;
|
||||
fprintf(fp, " %s. (\n", cp);
|
||||
#if defined(RETURNSOA) && defined(NCACHE)
|
||||
if (dp->d_rcode == NXDOMAIN)
|
||||
if (dp->d_rcode)
|
||||
fputs(";", fp);
|
||||
#endif
|
||||
cp += strlen((char *)cp) + 1;
|
||||
@ -518,8 +515,11 @@ db_dump(htp, fp, zone, origin)
|
||||
GETLONG(n, cp);
|
||||
fprintf(fp, " %lu )", (u_long)n);
|
||||
#if defined(RETURNSOA) && defined(NCACHE)
|
||||
if (dp->d_rcode == NXDOMAIN) {
|
||||
fprintf(fp,";%s.;NXDOMAIN%s-$",cp,sep);
|
||||
if (dp->d_rcode) {
|
||||
fprintf(fp,";%s.;%s%s-$",cp,
|
||||
(dp->d_rcode == NXDOMAIN) ?
|
||||
"NXDOMAIN" : "NODATA",
|
||||
sep);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -540,21 +540,28 @@ db_dump(htp, fp, zone, origin)
|
||||
fprintf(fp, " %s.", cp);
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
case T_X25:
|
||||
if ((n = *cp++) != '\0')
|
||||
fprintf(fp, " \"%.*s\"", (int)n, cp);
|
||||
else
|
||||
fprintf(fp, " \"\"");
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
end = (u_char *)dp->d_data + dp->d_size;
|
||||
(void) putc('"', fp);
|
||||
while (cp < end) {
|
||||
if ((n = *cp++) != '\0') {
|
||||
for (j = n ; j > 0 && cp < end ; j--)
|
||||
if (*cp == '\n') {
|
||||
(void) putc('\\', fp);
|
||||
(void) putc(*cp++, fp);
|
||||
} else
|
||||
(void) putc(*cp++, fp);
|
||||
}
|
||||
(void) putc('"', fp);
|
||||
if ((n = *cp++) != '\0') {
|
||||
for (j = n ; j > 0 && cp < end ; j--) {
|
||||
if (*cp == '\n' || *cp == '"' || *cp == '\\')
|
||||
(void) putc('\\', fp);
|
||||
(void) putc(*cp++, fp);
|
||||
}
|
||||
}
|
||||
(void) putc('"', fp);
|
||||
if (cp < end)
|
||||
(void) putc(' ', fp);
|
||||
}
|
||||
(void) fputs("\"", fp);
|
||||
break;
|
||||
|
||||
case T_NSAP:
|
||||
@ -580,6 +587,43 @@ db_dump(htp, fp, zone, origin)
|
||||
break;
|
||||
}
|
||||
#endif /* LOC_RR */
|
||||
|
||||
case T_NAPTR: {
|
||||
u_int order, preference;
|
||||
|
||||
GETSHORT(order, cp);
|
||||
fprintf(fp, "%lu", (u_long)order);
|
||||
|
||||
GETSHORT(preference, cp);
|
||||
fprintf(fp, "%lu", (u_long)preference);
|
||||
|
||||
if (n = *cp++) {
|
||||
fprintf(fp, "\"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
if (n = *cp++) {
|
||||
fprintf(fp, "\"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
if (n = *cp++) {
|
||||
fprintf(fp, " \"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
fprintf(fp, " %s.", cp);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case T_SRV: {
|
||||
u_int priority, weight, port;
|
||||
|
||||
GETSHORT(priority, cp);
|
||||
GETSHORT(weight, cp);
|
||||
GETSHORT(port, cp);
|
||||
fprintf(fp, "\t%u %u %u %s.",
|
||||
priority, weight, port, cp);
|
||||
break;
|
||||
}
|
||||
case T_UINFO:
|
||||
fprintf(fp, "\"%s\"", cp);
|
||||
break;
|
||||
@ -619,6 +663,63 @@ db_dump(htp, fp, zone, origin)
|
||||
cp += strlen((char *)cp) + 1;
|
||||
fprintf(fp, " %s.", cp);
|
||||
break;
|
||||
|
||||
case T_KEY:
|
||||
savecp = cp; /* save the beginning */
|
||||
/*>>> Flags (unsigned_16) */
|
||||
GETSHORT(keyflags,cp);
|
||||
fprintf(fp, "0x%04x ", keyflags);
|
||||
/*>>> Protocol (8-bit decimal) */
|
||||
fprintf(fp, "%3u ", *cp++);
|
||||
/*>>> Algorithm id (8-bit decimal) */
|
||||
fprintf(fp, "%3u ", *cp++);
|
||||
|
||||
/*>>> Public-Key Data (multidigit BASE64) */
|
||||
/* containing ExponentLen, Exponent, and Modulus */
|
||||
i = b64_ntop(cp, dp->d_size - (cp - savecp),
|
||||
temp_base64,
|
||||
sizeof temp_base64);
|
||||
if (i < 0)
|
||||
fprintf(fp, "; BAD BASE64");
|
||||
else
|
||||
fprintf(fp, "%s", temp_base64);
|
||||
break;
|
||||
|
||||
case T_SIG:
|
||||
sigdata = cp;
|
||||
/* RRtype (char *) */
|
||||
GETSHORT(n,cp);
|
||||
fprintf(fp, "%s ", p_type(n));
|
||||
/* Algorithm id (8-bit decimal) */
|
||||
fprintf(fp, "%d ", *cp++);
|
||||
/* Labels (8-bit decimal) (not saved in file) */
|
||||
/* FIXME -- check value and print err if bad */
|
||||
cp++;
|
||||
/* OTTL (u_long) */
|
||||
GETLONG(n, cp);
|
||||
fprintf(fp, "%lu ", n);
|
||||
/* Texp (u_long) */
|
||||
GETLONG(n, cp);
|
||||
fprintf(fp, "%s ", p_secstodate (n));
|
||||
/* Tsig (u_long) */
|
||||
GETLONG(n, cp);
|
||||
fprintf(fp, "%s ", p_secstodate (n));
|
||||
/* Kfootprint (unsigned_16) */
|
||||
GETSHORT(n, cp);
|
||||
fprintf(fp, "%lu ", n);
|
||||
/* Signer's Name (char *) */
|
||||
fprintf(fp, "%s ", cp);
|
||||
cp += strlen((char *)cp) + 1;
|
||||
/* Signature (base64 of any length) */
|
||||
i = b64_ntop(cp, dp->d_size - (cp - sigdata),
|
||||
temp_base64,
|
||||
sizeof temp_base64);
|
||||
if (i < 0)
|
||||
fprintf(fp, "; BAD BASE64");
|
||||
else
|
||||
fprintf(fp, "%s", temp_base64);
|
||||
break;
|
||||
|
||||
#ifdef ALLOW_T_UNSPEC
|
||||
case T_UNSPEC:
|
||||
/* Dump binary data out in an ASCII-encoded
|
||||
@ -860,7 +961,7 @@ byte_btoa(c, bufp)
|
||||
register int32_t tmpword = word;
|
||||
|
||||
if (tmpword < 0) {
|
||||
/* Because some don't support unsigned long */
|
||||
/* Because some don't support u_long */
|
||||
tmp = 32;
|
||||
tmpword -= (int32_t)(85 * 85 * 85 * 85 * 32);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* db_proc.h - prototypes for functions in db_*.c
|
||||
*
|
||||
* $Id: db_func.h,v 8.9 1996/06/02 08:20:39 vixie Exp $
|
||||
* $Id: db_func.h,v 8.12 1996/09/22 00:13:10 vixie Exp $
|
||||
*/
|
||||
|
||||
/* ++from db_update.c++ */
|
||||
@ -9,6 +9,7 @@ extern int db_update __P((char name[],
|
||||
struct databuf *newdp,
|
||||
int flags,
|
||||
struct hashbuf *htp)),
|
||||
db_cmp __P((struct databuf *,struct databuf *)),
|
||||
findMyZone __P((struct namebuf *np, int class));
|
||||
/* --from db_update.c-- */
|
||||
|
||||
@ -18,16 +19,7 @@ extern void db_reload __P((void));
|
||||
|
||||
/* ++from db_save.c++ */
|
||||
extern struct namebuf *savename __P((const char *, int));
|
||||
#ifdef DMALLOC
|
||||
extern struct databuf *savedata_tagged __P((char *, int,
|
||||
int, int, u_int32_t,
|
||||
u_char *, int));
|
||||
#define savedata(class, type, ttl, data, size) \
|
||||
savedata_tagged(__FILE__, __LINE__, class, type, ttl, data, size)
|
||||
#else
|
||||
extern struct databuf *savedata __P((int, int, u_int32_t,
|
||||
u_char *, int));
|
||||
#endif
|
||||
extern struct databuf *savedata __P((int, int, u_int32_t, u_char *, int));
|
||||
extern struct hashbuf *savehash __P((struct hashbuf *));
|
||||
/* --from db_save.c-- */
|
||||
|
||||
@ -37,9 +29,6 @@ extern int db_dump __P((struct hashbuf *, FILE *, int, char *)),
|
||||
atob __P((char *, int, char *, int, int *));
|
||||
extern void doachkpt __P((void)),
|
||||
doadump __P((void));
|
||||
#ifdef ALLOW_UPDATES
|
||||
extern void zonedump __P((struct zoneinfo *));
|
||||
#endif
|
||||
extern u_int db_getclev __P((const char *));
|
||||
/* --from db_dump.c-- */
|
||||
|
||||
@ -97,6 +86,7 @@ extern char * ctimel __P((long));
|
||||
extern struct in_addr data_inaddr __P((const u_char *data));
|
||||
extern void setsignal __P((int, int, SIG_FN (*)())),
|
||||
resignal __P((int, int, SIG_FN (*)()));
|
||||
extern void db_free __P((struct databuf *));
|
||||
/* --from db_glue.c-- */
|
||||
|
||||
/* ++from db_lookup.c++ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* from db.h 4.16 (Berkeley) 6/1/90
|
||||
* $Id: db_glob.h,v 8.3 1995/12/06 20:34:38 vixie Exp $
|
||||
* $Id: db_glob.h,v 8.4 1996/08/27 08:33:23 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -63,10 +63,10 @@
|
||||
*/
|
||||
|
||||
/* ONE_WEEK maximum ttl */
|
||||
DECL int max_cache_ttl INIT(7*24*60*60);
|
||||
DECL u_int max_cache_ttl INIT(7*24*60*60);
|
||||
|
||||
/* no minimum ttl */
|
||||
DECL int min_cache_ttl INIT(0);
|
||||
DECL u_int min_cache_ttl INIT(0);
|
||||
|
||||
/* current line number */
|
||||
DECL int lineno;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)db_glue.c 4.4 (Berkeley) 6/1/90";
|
||||
static char rcsid[] = "$Id: db_glue.c,v 8.13 1996/06/02 08:20:39 vixie Exp $";
|
||||
static char rcsid[] = "$Id: db_glue.c,v 8.16 1996/09/22 00:13:10 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -481,23 +481,33 @@ rm_datum(dp, np, pdp)
|
||||
np->n_data = ndp;
|
||||
else
|
||||
pdp->d_next = ndp;
|
||||
#ifdef DATUMREFCNT
|
||||
if ((dp->d_flags & DB_F_ACTIVE) == 0)
|
||||
panic(-1, "rm_datum: DB_F_ACTIVE not set");
|
||||
dp->d_flags &= ~DB_F_ACTIVE;
|
||||
dp->d_next = NULL;
|
||||
if (--(dp->d_rcnt)) {
|
||||
#ifdef DEBUG
|
||||
int32_t ii;
|
||||
#endif
|
||||
|
||||
switch(dp->d_type) {
|
||||
case T_NS:
|
||||
dprintf(1, (ddt, "rm_datum: %s rcnt = %d\n",
|
||||
dp->d_data, dp->d_rcnt));
|
||||
break;
|
||||
case T_A:
|
||||
|
||||
#ifdef DEBUG
|
||||
bcopy(dp->d_data, &ii, sizeof(ii));
|
||||
#endif
|
||||
dprintf(1, (ddt, "rm_datum: %08.8X rcnt = %d\n",
|
||||
*(int32_t*)(dp->d_data), dp->d_rcnt));
|
||||
ii, dp->d_rcnt));
|
||||
break;
|
||||
default:
|
||||
dprintf(1, (ddt, "rm_datum: rcnt = %d\n", dp->d_rcnt));
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
free((char *)dp);
|
||||
db_free(dp);
|
||||
return (ndp);
|
||||
}
|
||||
|
||||
@ -551,7 +561,7 @@ getname(np, buf, buflen)
|
||||
|
||||
cp = buf;
|
||||
while (np != NULL) {
|
||||
i = NAMELEN(*np);
|
||||
i = (int) NAMELEN(*np);
|
||||
if (i + 1 >= buflen) {
|
||||
*cp = '\0';
|
||||
syslog(LOG_INFO, "domain name too long: %s...\n", buf);
|
||||
@ -718,45 +728,93 @@ samedomain(a, b)
|
||||
const char *a, *b;
|
||||
{
|
||||
size_t la, lb;
|
||||
int diff, i, escaped;
|
||||
const char *cp;
|
||||
|
||||
la = strlen(a);
|
||||
lb = strlen(b);
|
||||
|
||||
/* don't count trailing dots, if any. */
|
||||
if (la && a[la-1]=='.')
|
||||
la--;
|
||||
if (lb && b[lb-1]=='.')
|
||||
lb--;
|
||||
/* ignore a trailing label separator (i.e. an unescaped dot) in 'a' */
|
||||
if (la && a[la-1] == '.') {
|
||||
escaped = 0;
|
||||
/* note this loop doesn't get executed if la==1 */
|
||||
for (i = la - 2; i >= 0; i--)
|
||||
if (a[i] == '\\') {
|
||||
if (escaped)
|
||||
escaped = 0;
|
||||
else
|
||||
escaped = 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (!escaped)
|
||||
la--;
|
||||
}
|
||||
/* ignore a trailing label separator (i.e. an unescaped dot) in 'b' */
|
||||
if (lb && b[lb-1] == '.') {
|
||||
escaped = 0;
|
||||
/* note this loop doesn't get executed if lb==1 */
|
||||
for (i = lb - 2; i >= 0; i--)
|
||||
if (b[i] == '\\') {
|
||||
if (escaped)
|
||||
escaped = 0;
|
||||
else
|
||||
escaped = 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (!escaped)
|
||||
lb--;
|
||||
}
|
||||
|
||||
/* lb==0 means b is the root domain, so a must be in b. */
|
||||
/* lb==0 means 'b' is the root domain, so 'a' must be in 'b'. */
|
||||
if (lb == 0)
|
||||
return (1);
|
||||
|
||||
/* b longer than a means a can't be in b. */
|
||||
/* 'b' longer than 'a' means 'a' can't be in 'b'. */
|
||||
if (lb > la)
|
||||
return (0);
|
||||
|
||||
/* We use strncasecmp because we might be trying to
|
||||
* ignore trailing dots. */
|
||||
* ignore a trailing dot. */
|
||||
if (lb == la)
|
||||
return (strncasecmp(a, b, lb) == 0);
|
||||
|
||||
/* Ok, we know la > lb. */
|
||||
|
||||
/* Point at the character before the last 'lb' characters of a. */
|
||||
cp = a + (la - lb - 1);
|
||||
diff = la - lb;
|
||||
|
||||
/* If it isn't '.', can't be a match (this lets us avoid
|
||||
* having "foobar.com" match "bar.com"). */
|
||||
if (*cp != '.')
|
||||
/* If 'a' is only 1 character longer than 'b', then it can't be
|
||||
a subdomain of 'b' (because of the need for the '.' label
|
||||
separator). */
|
||||
if (diff < 2)
|
||||
return (0);
|
||||
|
||||
cp++;
|
||||
/* If the character before the last 'lb' characters of 'b'
|
||||
isn't '.', then it can't be a match (this lets us avoid
|
||||
having "foobar.com" match "bar.com"). */
|
||||
if (a[diff-1] != '.')
|
||||
return (0);
|
||||
|
||||
/* We're not sure about that '.', however. It could be escaped
|
||||
and thus not a really a label separator. */
|
||||
escaped=0;
|
||||
for (i = diff-2; i >= 0; i--)
|
||||
if (a[i] == '\\') {
|
||||
if (escaped)
|
||||
escaped = 0;
|
||||
else
|
||||
escaped = 1;
|
||||
}
|
||||
else
|
||||
break;
|
||||
if (escaped)
|
||||
return (0);
|
||||
|
||||
/* We use strncasecmp because we might be trying to
|
||||
* ignore trailing dots. */
|
||||
return (strncasecmp(cp, b, lb)==0);
|
||||
cp = a + diff;
|
||||
return (strncasecmp(cp, b, lb) == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -784,8 +842,8 @@ data_inaddr(data)
|
||||
struct in_addr ret;
|
||||
u_int32_t tmp;
|
||||
|
||||
bcopy((char *)data, (char *)&tmp, INADDRSZ);
|
||||
ret.s_addr = tmp;
|
||||
GETLONG(tmp, data);
|
||||
ret.s_addr = htonl(tmp);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -833,3 +891,19 @@ resignal(catch, block, handler)
|
||||
setsignal(catch, block, handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
db_free(dp)
|
||||
struct databuf *dp;
|
||||
{
|
||||
int bytes = DATASIZE(dp->d_size);
|
||||
|
||||
if (dp->d_rcnt != 0)
|
||||
panic(-1, "db_free: d_rcnt != 0");
|
||||
if (dp->d_flags & DB_F_ACTIVE)
|
||||
panic(-1, "db_free: DB_F_ACTIVE set");
|
||||
if (dp->d_next)
|
||||
panic(-1, "db_free: d_next != 0");
|
||||
memset(dp, 0x5E, bytes);
|
||||
free((char*)dp);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)db_lookup.c 4.18 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: db_lookup.c,v 8.7 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: db_lookup.c,v 8.9 1996/09/22 00:13:10 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -119,7 +119,8 @@ nlookup(name, htpp, fname, insert)
|
||||
/* rotate left HASHSHIFT */
|
||||
hval = (hval << HASHSHIFT) |
|
||||
(hval>>((sizeof(hval)*8)-HASHSHIFT));
|
||||
hval += (isupper(c) ? tolower(c) : c) & HASHMASK;
|
||||
hval += ((isascii(c) && isupper(c)) ? tolower(c) : c)
|
||||
& HASHMASK;
|
||||
if (escaped)
|
||||
escaped = 0;
|
||||
else if (c == '\\')
|
||||
@ -133,7 +134,7 @@ nlookup(name, htpp, fname, insert)
|
||||
np != NULL;
|
||||
np = np->n_next) {
|
||||
if (np->n_hashval == hval &&
|
||||
(NAMELEN(*np) == (cp - name)) &&
|
||||
((size_t)NAMELEN(*np) == (cp - name)) &&
|
||||
(strncasecmp(name, NAME(*np), cp - name) == 0)) {
|
||||
*fname = name;
|
||||
return (np);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)db_reload.c 4.22 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: db_reload.c,v 8.2 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: db_reload.c,v 8.3 1996/08/27 08:33:23 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -98,7 +98,7 @@ db_reload()
|
||||
#if 0
|
||||
/* someday we'll need this.. (untested since before 1990) */
|
||||
void
|
||||
db_free(htp)
|
||||
ht_free(htp)
|
||||
struct hashbuf *htp;
|
||||
{
|
||||
register struct databuf *dp, *nextdp;
|
||||
@ -114,7 +114,7 @@ db_free(htp)
|
||||
(void) free((char *)np->n_dname);
|
||||
for (dp = np->n_data; dp != NULL; ) {
|
||||
nextdp = dp->d_next;
|
||||
(void) free((char *)dp);
|
||||
db_free(dp);
|
||||
dp = nextdp;
|
||||
}
|
||||
nextnp = np->n_next;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)db_save.c 4.16 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: db_save.c,v 8.4 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: db_save.c,v 8.6 1996/09/22 00:13:10 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -84,12 +84,12 @@ savename(name, len)
|
||||
{
|
||||
register struct namebuf *np;
|
||||
|
||||
assert(len >= 0 && len <= (MAXLABEL * 2));
|
||||
assert(len >= 0 && len <= (MAXLABEL * 4));
|
||||
np = (struct namebuf *) malloc(NAMESIZE(len));
|
||||
if (np == NULL)
|
||||
panic(errno, "savename: malloc");
|
||||
bzero((char*)np, NAMESIZE(len));
|
||||
NAMELEN(*np) = len;
|
||||
NAMELEN(*np) = (unsigned)len;
|
||||
bcopy(name, NAME(*np), len);
|
||||
NAME(*np)[len] = '\0';
|
||||
return (np);
|
||||
@ -99,28 +99,16 @@ savename(name, len)
|
||||
* Allocate a data buffer & save data.
|
||||
*/
|
||||
struct databuf *
|
||||
#ifdef DMALLOC
|
||||
savedata_tagged(file, line, class, type, ttl, data, size)
|
||||
char *file;
|
||||
int line;
|
||||
#else
|
||||
savedata(class, type, ttl, data, size)
|
||||
#endif
|
||||
int class, type;
|
||||
u_int32_t ttl;
|
||||
u_char *data;
|
||||
int size;
|
||||
{
|
||||
register struct databuf *dp;
|
||||
int bytes = (type == T_NS) ? DATASIZE(size)+INT32SZ : DATASIZE(size);
|
||||
int bytes = DATASIZE(size);
|
||||
|
||||
dp = (struct databuf *)
|
||||
#ifdef DMALLOC
|
||||
dmalloc(file, line, bytes)
|
||||
#else
|
||||
malloc(bytes)
|
||||
#endif
|
||||
;
|
||||
dp = (struct databuf *)malloc(bytes);
|
||||
if (dp == NULL)
|
||||
panic(errno, "savedata: malloc");
|
||||
bzero((char*)dp, bytes);
|
||||
@ -129,7 +117,6 @@ savedata(class, type, ttl, data, size)
|
||||
dp->d_class = class;
|
||||
dp->d_ttl = ttl;
|
||||
dp->d_size = size;
|
||||
dp->d_mark = 0;
|
||||
dp->d_flags = 0;
|
||||
dp->d_cred = 0;
|
||||
dp->d_clev = 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)db_update.c 4.28 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: db_update.c,v 8.12 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: db_update.c,v 8.18 1996/10/08 04:51:03 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -72,8 +72,6 @@ static char rcsid[] = "$Id: db_update.c,v 8.12 1996/08/05 08:31:30 vixie Exp $";
|
||||
#include "named.h"
|
||||
|
||||
static void fixttl __P((struct databuf *));
|
||||
static int db_cmp __P((struct databuf *,
|
||||
struct databuf *));
|
||||
|
||||
/* int
|
||||
* isRefByNS(name, htp)
|
||||
@ -218,6 +216,7 @@ db_update(name, odp, newdp, flags, htp)
|
||||
register struct databuf *dp, *pdp;
|
||||
register struct namebuf *np;
|
||||
int zn, isHintNS;
|
||||
int check_ttl = 0;
|
||||
const char *fname;
|
||||
|
||||
dprintf(3, (ddt, "db_update(%s, 0x%lx, 0x%lx, 0%o, 0x%lx)%s\n",
|
||||
@ -226,6 +225,9 @@ db_update(name, odp, newdp, flags, htp)
|
||||
np = nlookup(name, &htp, &fname, newdp != NULL);
|
||||
if (np == NULL || fname != name)
|
||||
return (NONAME);
|
||||
|
||||
if (newdp && zones[newdp->d_zone].z_type == Z_PRIMARY)
|
||||
check_ttl = 1;
|
||||
|
||||
/* don't let nonauthoritative updates write in authority zones */
|
||||
if (newdp && ((zn = findMyZone(np, newdp->d_class)) != DB_Z_CACHE) &&
|
||||
@ -312,7 +314,7 @@ db_update(name, odp, newdp, flags, htp)
|
||||
!= OK) {
|
||||
dprintf(3, (ddt, "db_update: hint %lx freed\n",
|
||||
(u_long)dp));
|
||||
(void) free((char *)dp);
|
||||
db_free(dp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,10 +327,18 @@ db_update(name, odp, newdp, flags, htp)
|
||||
/* {class,type} doesn't match. these are
|
||||
* the aggregation cases.
|
||||
*/
|
||||
if ((dp->d_type == T_CNAME ||
|
||||
odp->d_type == T_CNAME) &&
|
||||
/* Check that CNAMEs are only accompanied by
|
||||
* Secure DNS RR's (KEY, SIG, and NXT).
|
||||
*/
|
||||
if (((dp->d_type == T_CNAME &&
|
||||
odp->d_type != T_KEY &&
|
||||
odp->d_type != T_SIG &&
|
||||
odp->d_type != T_NXT) ||
|
||||
(odp->d_type == T_CNAME &&
|
||||
dp->d_type != T_KEY &&
|
||||
dp->d_type != T_SIG &&
|
||||
dp->d_type != T_NXT)) &&
|
||||
odp->d_class == dp->d_class &&
|
||||
odp->d_mark == dp->d_mark &&
|
||||
#ifdef NCACHE
|
||||
/* neither the odp nor the new dp are
|
||||
* negatively cached records...
|
||||
@ -338,7 +348,7 @@ db_update(name, odp, newdp, flags, htp)
|
||||
#endif /*NCACHE*/
|
||||
zones[odp->d_zone].z_type != Z_CACHE) {
|
||||
syslog(LOG_INFO,
|
||||
"%s has CNAME and other data (illegal)\n",
|
||||
"%s has CNAME and other data (invalid)\n",
|
||||
name);
|
||||
goto skip;
|
||||
}
|
||||
@ -520,6 +530,19 @@ db_update(name, odp, newdp, flags, htp)
|
||||
!bcmp(dp->d_data, newdp->d_data,
|
||||
INT32SZ + sizeof(u_char)))
|
||||
goto delete;
|
||||
if (check_ttl) {
|
||||
if (newdp->d_ttl != dp->d_ttl)
|
||||
syslog(LOG_WARNING,
|
||||
"%s %s %s differing ttls: corrected",
|
||||
name[0]?name:".",
|
||||
p_class(dp->d_class),
|
||||
p_type(dp->d_type));
|
||||
if (newdp->d_ttl > dp->d_ttl) {
|
||||
newdp->d_ttl = dp->d_ttl;
|
||||
} else {
|
||||
dp->d_ttl = newdp->d_ttl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((flags & DB_NODATA) && !db_cmp(dp, odp)) {
|
||||
/* refresh ttl if cache entry */
|
||||
@ -552,6 +575,10 @@ db_update(name, odp, newdp, flags, htp)
|
||||
if (odp->d_size > 0)
|
||||
if (db_cmp(dp, odp))
|
||||
goto skip;
|
||||
if (odp->d_clev < dp->d_clev)
|
||||
goto skip;
|
||||
if (odp->d_cred < dp->d_cred)
|
||||
goto skip;
|
||||
foundRR = 1;
|
||||
if (flags & DB_DELETE) {
|
||||
delete: dp = rm_datum(dp, np, pdp);
|
||||
@ -588,9 +615,10 @@ db_update(name, odp, newdp, flags, htp)
|
||||
/* Add to end of list, generally preserving order */
|
||||
newdp->d_next = NULL;
|
||||
if ((dp = np->n_data) == NULL) {
|
||||
#ifdef DATUMREFCNT
|
||||
newdp->d_rcnt = 1;
|
||||
#endif
|
||||
if (newdp->d_flags & DB_F_ACTIVE)
|
||||
panic(-1, "db_update: DB_F_ACTIVE set");
|
||||
newdp->d_flags |= DB_F_ACTIVE;
|
||||
np->n_data = newdp;
|
||||
return (OK);
|
||||
}
|
||||
@ -601,9 +629,10 @@ db_update(name, odp, newdp, flags, htp)
|
||||
}
|
||||
if ((flags & DB_NODATA) && !db_cmp(dp, newdp))
|
||||
return (DATAEXISTS);
|
||||
#ifdef DATUMREFCNT
|
||||
newdp->d_rcnt = 1;
|
||||
#endif
|
||||
if (newdp->d_flags & DB_F_ACTIVE)
|
||||
panic(-1, "db_update: DB_F_ACTIVE set");
|
||||
newdp->d_flags |= DB_F_ACTIVE;
|
||||
dp->d_next = newdp;
|
||||
return (OK);
|
||||
}
|
||||
@ -628,7 +657,7 @@ fixttl(dp)
|
||||
* Must be case insensitive for some domain names.
|
||||
* Return 0 if equivalent, nonzero otherwise.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
db_cmp(dp1, dp2)
|
||||
register struct databuf *dp1, *dp2;
|
||||
{
|
||||
@ -639,8 +668,6 @@ db_cmp(dp1, dp2)
|
||||
return (1);
|
||||
if (dp1->d_size != dp2->d_size)
|
||||
return (1);
|
||||
if (dp1->d_mark != dp2->d_mark)
|
||||
return (1); /* old and new RR's are distinct */
|
||||
#ifdef NCACHE
|
||||
if (dp1->d_rcode && dp2->d_rcode)
|
||||
return ((dp1->d_rcode == dp1->d_rcode)?0:1);
|
||||
@ -650,6 +677,8 @@ db_cmp(dp1, dp2)
|
||||
|
||||
switch (dp1->d_type) {
|
||||
|
||||
case T_SIG:
|
||||
case T_KEY:
|
||||
case T_A:
|
||||
case T_UID:
|
||||
case T_GID:
|
||||
@ -705,13 +734,64 @@ db_cmp(dp1, dp2)
|
||||
cp2 += strlen((char *)cp2) + 1;
|
||||
return (bcmp(cp1, cp2, INT32SZ * 5));
|
||||
|
||||
case T_NAPTR: {
|
||||
int t1,t2;
|
||||
|
||||
if (dp1->d_size != dp2->d_size)
|
||||
return (1);
|
||||
cp1 = dp1->d_data;
|
||||
cp2 = dp2->d_data;
|
||||
|
||||
/* Order */
|
||||
if (*cp1++ != *cp2++ || *cp1++ != *cp2++)
|
||||
return (1);
|
||||
|
||||
/* Preference */
|
||||
if (*cp1++ != *cp2++ || *cp1++ != *cp2++)
|
||||
return (1);
|
||||
|
||||
/* Flags */
|
||||
t1 = *cp1++; t2 = *cp2++;
|
||||
if (t1 != t2 || bcmp(cp1, cp2, t1))
|
||||
return (1);
|
||||
cp1 += t1; cp2 += t2;
|
||||
|
||||
/* Services */
|
||||
t1 = *cp1++; t2 = *cp2++;
|
||||
if (t1 != t2 || bcmp(cp1, cp2, t1))
|
||||
return (1);
|
||||
cp1 += t1; cp2 += t2;
|
||||
|
||||
/* Regexp */
|
||||
t1 = *cp1++; t2 = *cp2++;
|
||||
if (t1 != t2 || bcmp(cp1, cp2, t1))
|
||||
return (1);
|
||||
cp1 += t1; cp2 += t2;
|
||||
|
||||
/* Replacement */
|
||||
t1 = strlen((char *)cp1); t2 = strlen((char *)cp2);
|
||||
if (t1 != t2 || bcmp(cp1, cp2, t1))
|
||||
return (1);
|
||||
cp1 += t1 + 1; cp2 += t2 + 1;
|
||||
|
||||
/* they all checked out! */
|
||||
return (0);
|
||||
}
|
||||
|
||||
case T_MX:
|
||||
case T_AFSDB:
|
||||
case T_RT:
|
||||
case T_SRV:
|
||||
cp1 = dp1->d_data;
|
||||
cp2 = dp2->d_data;
|
||||
if (*cp1++ != *cp2++ || *cp1++ != *cp2++) /* cmp prio */
|
||||
return (1);
|
||||
if (dp1->d_type == T_SRV) {
|
||||
if (*cp1++ != *cp2++ || *cp1++ != *cp2++) /* weight */
|
||||
return (1);
|
||||
if (*cp1++ != *cp2++ || *cp1++ != *cp2++) /* port */
|
||||
return (1);
|
||||
}
|
||||
return (strcasecmp((char *)cp1, (char *)cp2));
|
||||
|
||||
case T_PX:
|
||||
|
@ -58,6 +58,28 @@
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
@ -70,7 +92,7 @@ char copyright[] =
|
||||
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)named-xfer.c 4.18 (Berkeley) 3/7/91";
|
||||
static char rcsid[] = "$Id: named-xfer.c,v 8.15 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: named-xfer.c,v 8.22 1996/12/02 09:17:21 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -347,8 +369,7 @@ main(argc, argv)
|
||||
(void) signal(SIGFPE, SIG_IGN);
|
||||
#endif /* SIGUSR1&&SIGUSR2 */
|
||||
|
||||
dprintf(1, (ddt,
|
||||
"domain `%s'; file `%s'; serial %lu; closed %d\n",
|
||||
dprintf(1, (ddt, "domain `%s'; file `%s'; serial %lu; closed %d\n",
|
||||
domain, dbfile, (u_long)serial_no, closed));
|
||||
|
||||
buildservicelist();
|
||||
@ -425,20 +446,16 @@ main(argc, argv)
|
||||
(void) unlink(tmpname);
|
||||
exit(XFER_UPTODATE);
|
||||
|
||||
case XFER_TIMEOUT:
|
||||
#ifdef DEBUG
|
||||
if (!debug)
|
||||
#endif
|
||||
(void) unlink(tmpname);
|
||||
exit(XFER_TIMEOUT); /* servers not reachable exit */
|
||||
|
||||
case XFER_FAIL:
|
||||
default:
|
||||
result = XFER_FAIL;
|
||||
/* fall through */
|
||||
case XFER_TIMEOUT:
|
||||
case XFER_FAIL:
|
||||
#ifdef DEBUG
|
||||
if (!debug)
|
||||
#endif
|
||||
(void) unlink(tmpname);
|
||||
exit(XFER_FAIL); /* yuck exit */
|
||||
exit(result); /* error or timeout */
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
@ -663,6 +680,7 @@ getzone(zp, serial_no, port)
|
||||
goto tryagain;
|
||||
}
|
||||
#endif
|
||||
#ifndef ultrix
|
||||
syslog(LOG_NOTICE,
|
||||
"[%s] %s for %s, SOA query got rcode %d, aa %d, ancount %d, aucount %d",
|
||||
inet_ntoa(sin.sin_addr),
|
||||
@ -671,6 +689,7 @@ getzone(zp, serial_no, port)
|
||||
: "not authoritative"),
|
||||
zp->z_origin[0] != '\0' ? zp->z_origin : ".",
|
||||
hp->rcode, hp->aa, ancount, aucount);
|
||||
#endif
|
||||
error++;
|
||||
(void) my_close(s);
|
||||
continue;
|
||||
@ -711,13 +730,40 @@ getzone(zp, serial_no, port)
|
||||
(void) my_close(s);
|
||||
continue;
|
||||
}
|
||||
/* ... Answer Section. */
|
||||
n = dn_expand(buf, eom, tmp, name2, sizeof name2);
|
||||
if (n < 0) {
|
||||
badsoa_msg = "aname error";
|
||||
goto badsoa;
|
||||
}
|
||||
tmp += n;
|
||||
/* ... Answer Section.
|
||||
* We may have to loop a little, to bypass SIG SOA's in
|
||||
* the response.
|
||||
*/
|
||||
do {
|
||||
u_char *cp4;
|
||||
u_short type, class, dlen;
|
||||
u_long ttl;
|
||||
|
||||
n = dn_expand(buf, eom, tmp, name2, sizeof name2);
|
||||
if (n < 0) {
|
||||
badsoa_msg = "aname error";
|
||||
goto badsoa;
|
||||
}
|
||||
tmp += n;
|
||||
|
||||
/* Are type, class, and ttl OK? */
|
||||
cp4 = tmp; /* Leave tmp pointing to type field */
|
||||
if (eom - cp4 < 3 * INT16SZ + INT32SZ) {
|
||||
badsoa_msg = "zinfo too short";
|
||||
goto badsoa;
|
||||
}
|
||||
GETSHORT(type, cp4);
|
||||
GETSHORT(class, cp4);
|
||||
GETLONG(ttl, cp4);
|
||||
GETSHORT(dlen, cp4);
|
||||
if (type == T_SOA)
|
||||
break;
|
||||
/* Skip to next record, if any. */
|
||||
dprintf (1, (ddt, "skipping %s %s RR in response\n",
|
||||
name2, p_type (type)));
|
||||
tmp = cp4 + dlen;
|
||||
} while (1);
|
||||
|
||||
if (strcasecmp(zp->z_origin, name2) != 0) {
|
||||
syslog(LOG_INFO,
|
||||
"wrong answer in resp from [%s], zone %s: [%s %s %s]\n",
|
||||
@ -860,24 +906,34 @@ getzone(zp, serial_no, port)
|
||||
#ifdef STUBS
|
||||
if (zp->z_type == Z_STUB) {
|
||||
ancount = ntohs(hp->ancount);
|
||||
for (cnt = 0 ; cnt < ancount ; cnt++) {
|
||||
|
||||
for (n = cnt = 0 ; cnt < ancount ; cnt++) {
|
||||
n = print_output(buf, bufsize, cp);
|
||||
if (n < 0)
|
||||
break;
|
||||
cp += n;
|
||||
}
|
||||
if (hp->nscount) {
|
||||
if (n >= 0 && hp->nscount) {
|
||||
/* we should not get here */
|
||||
ancount = ntohs(hp->nscount);
|
||||
for (cnt = 0 ; cnt < ancount ; cnt++) {
|
||||
n = print_output(buf, bufsize, cp);
|
||||
cp += n;
|
||||
if (n < 0)
|
||||
break;
|
||||
cp += n;
|
||||
}
|
||||
}
|
||||
ancount = ntohs(hp->arcount);
|
||||
for (cnt = 0 ; cnt < ancount ; cnt ++) {
|
||||
for (cnt = 0 ; n >= 0 && cnt < ancount ; cnt++) {
|
||||
n = print_output(buf, bufsize, cp);
|
||||
cp += n;
|
||||
}
|
||||
if (n < 0) {
|
||||
syslog(LOG_INFO,
|
||||
"print_output: unparseable answer (%d), zone %s",
|
||||
hp->rcode, zp->z_origin);
|
||||
error++;
|
||||
break;
|
||||
}
|
||||
if (cp != eom) {
|
||||
syslog(LOG_INFO,
|
||||
"print_output: short answer (%d, %d), zone %s",
|
||||
@ -889,10 +945,19 @@ getzone(zp, serial_no, port)
|
||||
} else {
|
||||
#endif /*STUBS*/
|
||||
ancount = ntohs(hp->ancount);
|
||||
for (cnt = 0; cnt < ancount; cnt++) {
|
||||
for (n = cnt = 0; cnt < ancount; cnt++) {
|
||||
n = print_output(buf, bufsize, cp);
|
||||
if (n < 0)
|
||||
break;
|
||||
cp += n;
|
||||
}
|
||||
if (n < 0) {
|
||||
syslog(LOG_INFO,
|
||||
"print_output: unparseable answer (%d), zone %s",
|
||||
hp->rcode, zp->z_origin);
|
||||
error++;
|
||||
break;
|
||||
}
|
||||
if (cp != eom) {
|
||||
syslog(LOG_INFO,
|
||||
"print_output: short answer (%d, %d), zone %s",
|
||||
@ -1029,7 +1094,7 @@ getzone(zp, serial_no, port)
|
||||
#else
|
||||
(void) sigvec(SIGALRM, &osv, (struct sigvec *)0);
|
||||
#endif
|
||||
if (error)
|
||||
if (!error)
|
||||
return (XFER_TIMEOUT);
|
||||
return (XFER_FAIL);
|
||||
}
|
||||
@ -1162,7 +1227,8 @@ print_output(msg, msglen, rrp)
|
||||
int i, j, tab, result, class, type, dlen, n1, n;
|
||||
char data[BUFSIZ];
|
||||
u_char *cp1, *cp2, *temp_ptr;
|
||||
char *cdata, *origin, *proto, dname[MAXDNAME];
|
||||
u_char *cdata;
|
||||
char *origin, *proto, dname[MAXDNAME];
|
||||
char *ignore = "";
|
||||
|
||||
cp = rrp;
|
||||
@ -1187,6 +1253,11 @@ print_output(msg, msglen, rrp)
|
||||
dname, type, class, ttl));
|
||||
/*
|
||||
* Convert the resource record data into the internal database format.
|
||||
* CP points to the raw resource record.
|
||||
* After this switch:
|
||||
* CP has been updated to point past the RR.
|
||||
* CP1 points to the internal database version.
|
||||
* N is the length of the internal database version.
|
||||
*/
|
||||
switch (type) {
|
||||
case T_A:
|
||||
@ -1201,6 +1272,7 @@ print_output(msg, msglen, rrp)
|
||||
case T_AAAA:
|
||||
case T_UID:
|
||||
case T_GID:
|
||||
case T_KEY:
|
||||
cp1 = cp;
|
||||
n = dlen;
|
||||
cp += n;
|
||||
@ -1255,14 +1327,59 @@ print_output(msg, msglen, rrp)
|
||||
cp1 = (u_char *)data;
|
||||
break;
|
||||
|
||||
case T_NAPTR:
|
||||
/* Grab weight and port. */
|
||||
bcopy(cp, data, INT16SZ*2);
|
||||
cp1 = (u_char *) (data + INT16SZ*2);
|
||||
cp += INT16SZ*2;
|
||||
|
||||
/* Flags */
|
||||
n = *cp++;
|
||||
*cp1++ = n;
|
||||
bcopy(cp, cp1, n);
|
||||
cp += n; cp1 += n;
|
||||
|
||||
/* Service */
|
||||
n = *cp++;
|
||||
*cp1++ = n;
|
||||
bcopy(cp, cp1, n);
|
||||
cp += n; cp1 += n;
|
||||
|
||||
/* Regexp */
|
||||
n = *cp++;
|
||||
*cp1++ = n;
|
||||
bcopy(cp, cp1, n);
|
||||
cp += n; cp1 += n;
|
||||
|
||||
/* Replacement */
|
||||
n = dn_expand(msg, msg + msglen, cp, (char *)cp1,
|
||||
sizeof data - ((char *)cp1 - data));
|
||||
if (n < 0)
|
||||
return (-1);
|
||||
cp += n;
|
||||
|
||||
/* compute end of data */
|
||||
cp1 += strlen((char *)cp1) + 1;
|
||||
/* compute size of data */
|
||||
n = cp1 - (u_char *)data;
|
||||
cp1 = (u_char *)data;
|
||||
break;
|
||||
|
||||
case T_MX:
|
||||
case T_AFSDB:
|
||||
case T_RT:
|
||||
case T_SRV:
|
||||
/* grab preference */
|
||||
bcopy((char *)cp, data, INT16SZ);
|
||||
cp1 = (u_char *)data + INT16SZ;
|
||||
cp += INT16SZ;
|
||||
|
||||
if (type == T_SRV) {
|
||||
bcopy((char *)cp, data, INT16SZ*2);
|
||||
cp1 += INT16SZ*2;
|
||||
cp += INT16SZ*2;
|
||||
}
|
||||
|
||||
/* get name */
|
||||
n = dn_expand(msg, msg + msglen, cp,
|
||||
(char *)cp1, sizeof data - INT16SZ);
|
||||
@ -1302,12 +1419,46 @@ print_output(msg, msglen, rrp)
|
||||
cp1 = (u_char *)data;
|
||||
break;
|
||||
|
||||
case T_SIG:
|
||||
/* CP is the raw resource record as it arrived.
|
||||
* CP1, after this switch, points to the internal database version. */
|
||||
cp1 = (u_char *)data;
|
||||
|
||||
/* first just copy over the type_covered, algorithm, */
|
||||
/* labels, orig ttl, two timestamps, and the footprint */
|
||||
bcopy( cp, cp1, 18 );
|
||||
cp += 18;
|
||||
cp1 += 18;
|
||||
|
||||
/* then the signer's name */
|
||||
n = dn_expand(msg, msg + msglen, cp,
|
||||
(char *)cp1, (sizeof data) - 18);
|
||||
if (n < 0)
|
||||
return (-1);
|
||||
cp += n;
|
||||
cp1 += strlen((char*)cp1)+1;
|
||||
|
||||
/* finally, we copy over the variable-length signature.
|
||||
Its size is the total data length, minus what we copied. */
|
||||
n = dlen - (18 + n);
|
||||
if (n > (sizeof data) - (cp1 - (u_char *)data))
|
||||
return (-1); /* out of room! */
|
||||
bcopy(cp, cp1, n);
|
||||
cp += n;
|
||||
cp1 += n;
|
||||
|
||||
/* compute size of data */
|
||||
n = cp1 - (u_char *)data;
|
||||
cp1 = (u_char *)data;
|
||||
break;
|
||||
|
||||
default:
|
||||
syslog(LOG_INFO, "\"%s %s %s\" - unknown type (%d)",
|
||||
dname, p_class(class), p_type(type), type);
|
||||
hp->rcode = NOTIMP;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (n > MAXDATA) {
|
||||
dprintf(1, (ddt,
|
||||
"update type %d: %d bytes is too much data\n",
|
||||
@ -1315,7 +1466,7 @@ print_output(msg, msglen, rrp)
|
||||
hp->rcode = FORMERR;
|
||||
return (-1);
|
||||
}
|
||||
cdata = (char *) cp1;
|
||||
cdata = cp1;
|
||||
result = cp - rrp;
|
||||
|
||||
/*
|
||||
@ -1424,7 +1575,7 @@ print_output(msg, msglen, rrp)
|
||||
(void) putc('\t', dbfp);
|
||||
|
||||
(void) fprintf(dbfp, "%s\t%s\t", p_class(class), p_type(type));
|
||||
cp = (u_char *) cdata;
|
||||
cp = cdata;
|
||||
|
||||
/*
|
||||
* Print type specific data
|
||||
@ -1455,7 +1606,7 @@ print_output(msg, msglen, rrp)
|
||||
break;
|
||||
|
||||
case T_NS:
|
||||
cp = (u_char *) cdata;
|
||||
cp = cdata;
|
||||
if (cp[0] == '\0')
|
||||
(void) fprintf(dbfp, ".\t");
|
||||
else
|
||||
@ -1528,8 +1679,8 @@ print_output(msg, msglen, rrp)
|
||||
case T_TXT:
|
||||
case T_X25:
|
||||
cp1 = cp + n;
|
||||
(void) putc('"', dbfp);
|
||||
while (cp < cp1) {
|
||||
(void) putc('"', dbfp);
|
||||
if (i = *cp++) {
|
||||
for (j = i; j > 0 && cp < cp1; j--) {
|
||||
if (strchr("\n\"\\", *cp))
|
||||
@ -1537,8 +1688,11 @@ print_output(msg, msglen, rrp)
|
||||
(void) putc(*cp++, dbfp);
|
||||
}
|
||||
}
|
||||
(void) putc('"', dbfp);
|
||||
if (cp < cp1)
|
||||
(void) putc(' ', dbfp);
|
||||
}
|
||||
(void) fputs("\"\n", dbfp);
|
||||
(void) putc('\n', dbfp);
|
||||
break;
|
||||
|
||||
case T_NSAP:
|
||||
@ -1550,17 +1704,65 @@ print_output(msg, msglen, rrp)
|
||||
|
||||
fprintf(dbfp, "%s\n", inet_ntop(AF_INET6, cp, t, sizeof t));
|
||||
break;
|
||||
}
|
||||
}
|
||||
case T_UINFO:
|
||||
(void) fprintf(dbfp, "\"%s\"\n", cp);
|
||||
break;
|
||||
|
||||
#ifdef LOC_RR
|
||||
case T_LOC:
|
||||
(void) fprintf(dbfp, "%s\n", loc_ntoa(cp, NULL));
|
||||
case T_LOC: {
|
||||
char t[255];
|
||||
|
||||
(void) fprintf(dbfp, "%s\n", loc_ntoa(cp, t));
|
||||
break;
|
||||
}
|
||||
#endif /* LOC_RR */
|
||||
|
||||
case T_NAPTR: {
|
||||
u_int order, preference;
|
||||
|
||||
/* Order */
|
||||
GETSHORT(order, cp);
|
||||
fprintf(dbfp, "%lu", (u_long)order);
|
||||
|
||||
/* Preference */
|
||||
GETSHORT(preference, cp);
|
||||
fprintf(dbfp, " %lu", (u_long)preference);
|
||||
|
||||
/* Flags */
|
||||
if (n = *cp++) {
|
||||
fprintf(dbfp, " \"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
|
||||
/* Service */
|
||||
if (n = *cp++) {
|
||||
fprintf(dbfp, " \"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
|
||||
/* Regexp */
|
||||
if (n = *cp++) {
|
||||
fprintf(dbfp, " \"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
|
||||
/* Replacement */
|
||||
fprintf(dbfp, " %s.\n", cp);
|
||||
|
||||
break;
|
||||
}
|
||||
case T_SRV: {
|
||||
u_int priority, weight, port;
|
||||
|
||||
GETSHORT(priority, cp);
|
||||
GETSHORT(weight, cp);
|
||||
GETSHORT(port, cp);
|
||||
fprintf(dbfp, "\t%u %u %u %s.\n",
|
||||
priority, weight, port, cp);
|
||||
break;
|
||||
}
|
||||
|
||||
case T_UID:
|
||||
case T_GID:
|
||||
if (n == INT32SZ) {
|
||||
@ -1578,7 +1780,7 @@ print_output(msg, msglen, rrp)
|
||||
cp += sizeof(char);
|
||||
(void) fprintf(dbfp, "%s ", proto);
|
||||
i = 0;
|
||||
while (cp < (u_char *) cdata + n) {
|
||||
while (cp < cdata + n) {
|
||||
j = *cp++;
|
||||
do {
|
||||
if (j & 0200)
|
||||
@ -1597,7 +1799,76 @@ print_output(msg, msglen, rrp)
|
||||
(void) fprintf(dbfp, " %s.\n", cp);
|
||||
break;
|
||||
|
||||
case T_KEY: {
|
||||
char databuf[16+MAX_KEY_BASE64]; /* 16 for slop */
|
||||
u_int16_t keyflags;
|
||||
|
||||
/* get & format key flags */
|
||||
keyflags = _getshort(cp);
|
||||
(void) fprintf(dbfp, "0x%04x ", keyflags);
|
||||
cp += INT16SZ;
|
||||
|
||||
/* protocol id */
|
||||
(void) fprintf(dbfp, " %u", *cp++);
|
||||
|
||||
/* algorithm id */
|
||||
(void) fprintf(dbfp, " %u ", *cp++);
|
||||
|
||||
/* key itself (which may have zero length) */
|
||||
n = b64_ntop(cp, (cp1 + n) - cp, databuf, sizeof databuf);
|
||||
if (n < 0)
|
||||
fprintf(dbfp, "; BAD BASE64\n");
|
||||
else
|
||||
fprintf(dbfp, "%s\n", databuf);
|
||||
break;
|
||||
}
|
||||
|
||||
case T_SIG: {
|
||||
char databuf[16+MAX_KEY_BASE64]; /* 16 for slop */
|
||||
|
||||
/* get & format rr type which signature covers */
|
||||
(void) fprintf(dbfp,"%s", p_type(_getshort((u_char*)cp)));
|
||||
cp += INT16SZ;
|
||||
|
||||
/* algorithm id */
|
||||
(void) fprintf(dbfp," %d",*cp++);
|
||||
|
||||
/* labels (# of labels in name) - skip in textual record */
|
||||
cp++;
|
||||
|
||||
/* orig time to live (TTL)) */
|
||||
(void) fprintf(dbfp," %d", _getlong((u_char*)cp));
|
||||
cp += INT32SZ;
|
||||
|
||||
/* expiration time */
|
||||
(void) fprintf(dbfp," %s", p_secstodate(_getlong((u_char*)cp)));
|
||||
cp += INT32SZ;
|
||||
|
||||
/* time signed */
|
||||
(void) fprintf(dbfp," %s", p_secstodate(_getlong((u_char*)cp)));
|
||||
cp += INT32SZ;
|
||||
|
||||
/* Key footprint */
|
||||
(void) fprintf(dbfp," %d", _getshort((u_char*)cp));
|
||||
cp += INT16SZ;
|
||||
|
||||
/* signer's name */
|
||||
(void) fprintf(dbfp, " %s. ", cp);
|
||||
cp += strlen((char *) cp) + 1;
|
||||
|
||||
/* signature itself */
|
||||
n = b64_ntop(cp, (cdata + n) - cp, databuf, sizeof databuf);
|
||||
if (n < 0)
|
||||
fprintf (dbfp, "; BAD BASE64\n");
|
||||
else
|
||||
fprintf (dbfp, "%s\n", databuf);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
cp1 = cp + n;
|
||||
while (cp < cp1)
|
||||
fprintf(dbfp, "0x%02.2X ", *cp++ & 0xFF);
|
||||
(void) fprintf(dbfp, "???\n");
|
||||
}
|
||||
if (ferror(dbfp)) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* from ns.h 4.33 (Berkeley) 8/23/90
|
||||
* $Id: ns_defs.h,v 8.6 1996/05/17 09:10:46 vixie Exp $
|
||||
* $Id: ns_defs.h,v 8.8 1996/09/22 00:13:10 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -167,13 +167,8 @@ struct notify {
|
||||
#define Z_INCLUDE 0x0080 /* set if include used in file */
|
||||
#define Z_DB_BAD 0x0100 /* errors when loading file */
|
||||
#define Z_TMP_FILE 0x0200 /* backup file for xfer is temporary */
|
||||
#ifdef ALLOW_UPDATES
|
||||
#define Z_DYNAMIC 0x0400 /* allow dynamic updates */
|
||||
#define Z_DYNADDONLY 0x0800 /* dynamic mode: add new data only */
|
||||
#define Z_CHANGED 0x1000 /* zone has changed */
|
||||
#endif /* ALLOW_UPDATES */
|
||||
#define Z_XFER_ABORTED 0x2000 /* zone transfer has been aborted */
|
||||
#define Z_XFER_GONE 0x4000 /* zone transfer process is gone */
|
||||
#define Z_XFER_ABORTED 0x0400 /* zone transfer has been aborted */
|
||||
#define Z_XFER_GONE 0x0800 /* zone transfer process is gone */
|
||||
|
||||
/* named_xfer exit codes */
|
||||
#define XFER_UPTODATE 0 /* zone is up-to-date */
|
||||
@ -224,9 +219,10 @@ struct qinfo {
|
||||
int16_t q_nqueries; /* # of queries required */
|
||||
struct qstream *q_stream; /* TCP stream, null if UDP */
|
||||
struct zoneinfo *q_zquery; /* Zone query is about (Q_ZSERIAL) */
|
||||
#if defined(LAME_DELEGATION) || defined(VALIDATE)
|
||||
char q_domain[MAXDNAME]; /* domain for servers we are querying */
|
||||
#endif
|
||||
char *q_domain; /* domain of most enclosing zone cut */
|
||||
char *q_name; /* domain of query */
|
||||
u_int16_t q_class; /* class of query */
|
||||
u_int16_t q_type; /* type of query */
|
||||
#ifdef BIND_NOTIFY
|
||||
int q_notifyzone; /* zone which needs a sysnotify()
|
||||
* when the reply to this comes in.
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)ns_forw.c 4.32 (Berkeley) 3/3/91";
|
||||
static char rcsid[] = "$Id: ns_forw.c,v 8.14 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: ns_forw.c,v 8.19 1996/12/02 09:27:36 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -83,7 +83,7 @@ static char rcsid[] = "$Id: ns_forw.c,v 8.14 1996/08/05 08:31:30 vixie Exp $";
|
||||
* (no action is taken on errors and qpp is not filled in.)
|
||||
*/
|
||||
int
|
||||
ns_forw(nsp, msg, msglen, fp, qsp, dfd, qpp, dname, np)
|
||||
ns_forw(nsp, msg, msglen, fp, qsp, dfd, qpp, dname, class, type, np)
|
||||
struct databuf *nsp[];
|
||||
u_char *msg;
|
||||
int msglen;
|
||||
@ -92,9 +92,11 @@ ns_forw(nsp, msg, msglen, fp, qsp, dfd, qpp, dname, np)
|
||||
int dfd;
|
||||
struct qinfo **qpp;
|
||||
char *dname;
|
||||
int class, type;
|
||||
struct namebuf *np;
|
||||
{
|
||||
register struct qinfo *qp;
|
||||
char tmpdomain[MAXDNAME];
|
||||
struct sockaddr_in *nsa;
|
||||
HEADER *hp;
|
||||
u_int16_t id;
|
||||
@ -121,16 +123,19 @@ ns_forw(nsp, msg, msglen, fp, qsp, dfd, qpp, dname, np)
|
||||
}
|
||||
}
|
||||
|
||||
qp = qnew();
|
||||
#if defined(LAME_DELEGATION) || defined(VALIDATE)
|
||||
getname(np, qp->q_domain, sizeof qp->q_domain);
|
||||
#endif
|
||||
qp = qnew(dname, class, type);
|
||||
getname(np, tmpdomain, sizeof tmpdomain);
|
||||
qp->q_domain = strdup(tmpdomain);
|
||||
if (!qp->q_domain)
|
||||
panic(ENOMEM, "ns_forw: strdup failed");
|
||||
qp->q_from = *fp; /* nslookup wants to know this */
|
||||
if ((n = nslookup(nsp, qp, dname, "ns_forw")) < 0) {
|
||||
n = nslookup(nsp, qp, dname, "ns_forw");
|
||||
if (n < 0) {
|
||||
dprintf(2, (ddt, "forw: nslookup reports danger\n"));
|
||||
qfree(qp);
|
||||
return (FW_SERVFAIL);
|
||||
} else if (n == 0 && !fwdtab) {
|
||||
}
|
||||
if (n == 0 && !fwdtab) {
|
||||
dprintf(2, (ddt, "forw: no nameservers found\n"));
|
||||
qfree(qp);
|
||||
return (FW_NOSERVER);
|
||||
@ -345,7 +350,7 @@ nslookupComplain(sysloginfo, queryname, complaint, dname, a_rr, nsdp)
|
||||
complaint, dname,
|
||||
print_a ?
|
||||
inet_ntoa(data_inaddr(a_rr->d_data)) : "");
|
||||
syslog(LOG_INFO, buf);
|
||||
syslog(LOG_INFO, "%s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,7 +381,7 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
register struct databuf *dp, *nsdp;
|
||||
register struct qserv *qs;
|
||||
register int n;
|
||||
register unsigned int i;
|
||||
register u_int i;
|
||||
struct hashbuf *tmphtp;
|
||||
char *dname;
|
||||
const char *fname;
|
||||
@ -423,7 +428,7 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
* to see if we've got missing glue
|
||||
*/
|
||||
for (; np; np = np_parent(np))
|
||||
for (dp = np->n_data; dp; dp=dp->d_next)
|
||||
for (dp = np->n_data; dp; dp = dp->d_next)
|
||||
if (match(dp, class, T_NS)) {
|
||||
#ifdef NCACHE
|
||||
if (dp->d_rcode)
|
||||
@ -447,10 +452,7 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
found_arr = 0;
|
||||
goto need_sysquery;
|
||||
} else {
|
||||
static char *complaint =
|
||||
"Authoritative A RR missing";
|
||||
nslookupComplain(sysloginfo, syslogdname,
|
||||
complaint, dname, dp, nsdp);
|
||||
/* Authoritative A RR missing. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -458,11 +460,13 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
oldn = n;
|
||||
|
||||
/* look for name server addresses */
|
||||
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
|
||||
delete_stale(np);
|
||||
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
|
||||
struct in_addr nsa;
|
||||
|
||||
if (dp->d_type == T_CNAME && dp->d_class == class) {
|
||||
static char *complaint = "NS points to CNAME";
|
||||
static const char *complaint =
|
||||
"NS points to CNAME";
|
||||
#ifdef NCACHE
|
||||
if (dp->d_rcode)
|
||||
continue;
|
||||
@ -475,7 +479,7 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
continue;
|
||||
#ifdef NCACHE
|
||||
if (dp->d_rcode) {
|
||||
static char *complaint =
|
||||
static const char *complaint =
|
||||
"A RR negative cache entry";
|
||||
nslookupComplain(sysloginfo, syslogdname,
|
||||
complaint, dname, dp, nsdp);
|
||||
@ -483,7 +487,8 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
}
|
||||
#endif
|
||||
if (data_inaddr(dp->d_data).s_addr == INADDR_ANY) {
|
||||
static char *complaint = "Bogus (0.0.0.0) A RR";
|
||||
static const char *complaint =
|
||||
"Bogus (0.0.0.0) A RR";
|
||||
nslookupComplain(sysloginfo, syslogdname,
|
||||
complaint, dname, dp, nsdp);
|
||||
continue;
|
||||
@ -491,26 +496,29 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
#ifdef INADDR_LOOPBACK
|
||||
if (ntohl(data_inaddr(dp->d_data).s_addr) ==
|
||||
INADDR_LOOPBACK) {
|
||||
static char *complaint = "Bogus LOOPBACK A RR";
|
||||
static const char *complaint =
|
||||
"Bogus LOOPBACK A RR";
|
||||
nslookupComplain(sysloginfo, syslogdname,
|
||||
complaint, dname, dp, nsdp);
|
||||
complaint, dname, dp, nsdp);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifdef INADDR_BROADCAST
|
||||
if (ntohl(data_inaddr(dp->d_data).s_addr) ==
|
||||
INADDR_BROADCAST) {
|
||||
static char *complaint = "Bogus BROADCAST A RR";
|
||||
static const char *complaint =
|
||||
"Bogus BROADCAST A RR";
|
||||
nslookupComplain(sysloginfo, syslogdname,
|
||||
complaint, dname, dp, nsdp);
|
||||
complaint, dname, dp, nsdp);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifdef IN_MULTICAST
|
||||
if (IN_MULTICAST(ntohl(data_inaddr(dp->d_data).s_addr))) {
|
||||
static char *complaint = "Bogus MULTICAST A RR";
|
||||
static const char *complaint =
|
||||
"Bogus MULTICAST A RR";
|
||||
nslookupComplain(sysloginfo, syslogdname,
|
||||
complaint, dname, dp, nsdp);
|
||||
complaint, dname, dp, nsdp);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -520,26 +528,14 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
* Never delete our safety-belt information!
|
||||
*/
|
||||
if ((dp->d_zone == 0) &&
|
||||
#ifdef DATUMREFCNT
|
||||
(dp->d_ttl < curtime) &&
|
||||
#else
|
||||
(dp->d_ttl < (curtime+900)) &&
|
||||
#endif
|
||||
!(dp->d_flags & DB_F_HINT) )
|
||||
{
|
||||
dprintf(3, (ddt,
|
||||
"nslookup: stale entry '%s'\n",
|
||||
NAME(*np)));
|
||||
/* Cache invalidate the NS RR's */
|
||||
#ifndef DATUMREFCNT
|
||||
if (dp->d_ttl < curtime)
|
||||
#endif
|
||||
{
|
||||
delete_all(np, class, T_A);
|
||||
n = oldn;
|
||||
found_arr = 0;
|
||||
goto need_sysquery;
|
||||
}
|
||||
syslog(LOG_DEBUG, "nslookup: stale '%s'\n",
|
||||
NAME(*np));
|
||||
n = oldn;
|
||||
found_arr = 0;
|
||||
goto need_sysquery;
|
||||
}
|
||||
#ifdef VALIDATE
|
||||
/* anant@isi.edu validation procedure, maintains a
|
||||
@ -635,7 +631,7 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
skipserver:
|
||||
NULL;
|
||||
}
|
||||
out:
|
||||
out:
|
||||
dprintf(3, (ddt, "nslookup: %d ns addrs total\n", n));
|
||||
qp->q_naddr = n;
|
||||
if (n == 0 && potential_ns == 0 && !fwdtab) {
|
||||
@ -648,13 +644,11 @@ nslookup(nsp, qp, syslogdname, sysloginfo)
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
#ifdef DATUMREFCNT
|
||||
/* must be run before the sort */
|
||||
for (i = naddr ; i < n ; i++) {
|
||||
/* Update the refcounts before the sort. */
|
||||
for (i = naddr; i < n; i++) {
|
||||
qp->q_addr[i].nsdata->d_rcnt++;
|
||||
qp->q_addr[i].ns->d_rcnt++;
|
||||
}
|
||||
#endif
|
||||
if (n > 1) {
|
||||
qsort((char *)qp->q_addr, n, sizeof(struct qserv),
|
||||
(int (*)__P((const void *, const void *)))qcomp);
|
||||
@ -840,7 +834,7 @@ retry(qp)
|
||||
(u_long)qp, (u_long)qp->q_expire,
|
||||
(int)(tt.tv_sec - qp->q_expire),
|
||||
(u_long)tt.tv_sec));
|
||||
if (qp->q_stream) /* return failure code on stream */
|
||||
if (qp->q_stream || (qp->q_flags & Q_PRIMING))
|
||||
goto fail;
|
||||
qremove(qp);
|
||||
return;
|
||||
@ -970,6 +964,7 @@ qflush()
|
||||
while (nsqhead)
|
||||
qremove(nsqhead);
|
||||
nsqhead = QINFO_NULL;
|
||||
priming = 0;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1005,45 +1000,67 @@ qfindid(id)
|
||||
}
|
||||
|
||||
struct qinfo *
|
||||
#ifdef DMALLOC
|
||||
qnew_tagged(file, line)
|
||||
char *file;
|
||||
int line;
|
||||
#else
|
||||
qnew()
|
||||
#endif
|
||||
qnew(name, class, type)
|
||||
const char *name;
|
||||
int class;
|
||||
int type;
|
||||
{
|
||||
register struct qinfo *qp;
|
||||
|
||||
qp = (struct qinfo *)
|
||||
#ifdef DMALLOC
|
||||
dcalloc(file, line, 1, sizeof(struct qinfo));
|
||||
#else
|
||||
calloc(1, sizeof(struct qinfo));
|
||||
#endif
|
||||
if (qp == NULL) {
|
||||
dprintf(5, (ddt, "qnew: calloc error\n"));
|
||||
syslog(LOG_ERR, "forw: %m");
|
||||
exit(12);
|
||||
}
|
||||
dprintf(5, (ddt, "qnew(x%lx)\n", (u_long)qp));
|
||||
qp = (struct qinfo *)calloc(1, sizeof(struct qinfo));
|
||||
if (qp == NULL)
|
||||
panic(ENOMEM, "qnew: calloc failed");
|
||||
dprintf(5, (ddt, "qnew(%#x)\n", qp));
|
||||
#ifdef BIND_NOTIFY
|
||||
qp->q_notifyzone = DB_Z_CACHE;
|
||||
#endif
|
||||
qp->q_link = nsqhead;
|
||||
nsqhead = qp;
|
||||
qp->q_name = strdup(name);
|
||||
if (!qp->q_name)
|
||||
panic(ENOMEM, "qnew: strdup failed");
|
||||
qp->q_class = (u_int16_t)class;
|
||||
qp->q_type = (u_int16_t)type;
|
||||
return (qp);
|
||||
}
|
||||
|
||||
void
|
||||
nsfree(qp, where)
|
||||
struct qinfo *qp;
|
||||
char *where;
|
||||
{
|
||||
static const char freed[] = "freed", busy[] = "busy";
|
||||
const char *result;
|
||||
struct databuf *dp;
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < (int)qp->q_naddr ; i++) {
|
||||
dp = qp->q_addr[i].ns;
|
||||
if (dp) {
|
||||
result = (--(dp->d_rcnt)) ? busy : freed;
|
||||
dprintf(1, (ddt, "%s: ns %s rcnt %d (%s)\n",
|
||||
where, dp->d_data, dp->d_rcnt, result));
|
||||
if (result == freed)
|
||||
db_free(dp);
|
||||
}
|
||||
dp = qp->q_addr[i].nsdata;
|
||||
if (dp) {
|
||||
result = (--(dp->d_rcnt)) ? busy : freed;
|
||||
dprintf(1, (ddt, "%s: nsdata %s rcnt %d (%s)\n",
|
||||
where, inet_ntoa(data_inaddr(dp->d_data)),
|
||||
dp->d_rcnt, result));
|
||||
if (result == freed)
|
||||
db_free(dp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
qfree(qp)
|
||||
struct qinfo *qp;
|
||||
{
|
||||
register struct qinfo *np;
|
||||
register struct databuf *dp;
|
||||
#ifdef DATUMREFCNT
|
||||
int i;
|
||||
#endif
|
||||
struct qinfo *np;
|
||||
struct databuf *dp;
|
||||
|
||||
dprintf(3, (ddt, "Qfree(x%lx)\n", (u_long)qp));
|
||||
if (qp->q_next)
|
||||
@ -1053,42 +1070,20 @@ qfree(qp)
|
||||
free(qp->q_msg);
|
||||
if (qp->q_cmsg)
|
||||
free(qp->q_cmsg);
|
||||
#ifdef DATUMREFCNT
|
||||
for (i = 0 ; i < (int)qp->q_naddr ; i++) {
|
||||
dp = qp->q_addr[i].ns;
|
||||
if (dp)
|
||||
if (--(dp->d_rcnt)) {
|
||||
dprintf(3, (ddt, "qfree: ns %s rcnt %d\n",
|
||||
dp->d_data,
|
||||
dp->d_rcnt));
|
||||
} else {
|
||||
dprintf(3, (ddt, "qfree: ns %s rcnt %d delayed\n",
|
||||
dp->d_data,
|
||||
dp->d_rcnt));
|
||||
free((char*)dp);
|
||||
}
|
||||
dp = qp->q_addr[i].nsdata;
|
||||
if (dp)
|
||||
if ((--(dp->d_rcnt))) {
|
||||
dprintf(3, (ddt, "qfree: nsdata %08.8X rcnt %d\n",
|
||||
*(int32_t *)(dp->d_data),
|
||||
dp->d_rcnt));
|
||||
} else {
|
||||
dprintf(3, (ddt, "qfree: nsdata %08.8X rcnt %d delayed\n",
|
||||
*(int32_t *)(dp->d_data),
|
||||
dp->d_rcnt));
|
||||
free((char*)dp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if( nsqhead == qp ) {
|
||||
if (qp->q_domain)
|
||||
free(qp->q_domain);
|
||||
if (qp->q_name)
|
||||
free(qp->q_name);
|
||||
nsfree(qp, "qfree");
|
||||
if (nsqhead == qp)
|
||||
nsqhead = qp->q_link;
|
||||
} else {
|
||||
for( np=nsqhead; np->q_link != QINFO_NULL; np = np->q_link ) {
|
||||
if( np->q_link != qp ) continue;
|
||||
else {
|
||||
for (np = nsqhead; np->q_link != QINFO_NULL; np = np->q_link) {
|
||||
if (np->q_link != qp)
|
||||
continue;
|
||||
np->q_link = qp->q_link; /* dequeue */
|
||||
break;
|
||||
}
|
||||
}
|
||||
free((char *)qp);
|
||||
free((char*)qp);
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
/* ns_func.h - declarations for ns_*.c's externally visible functions
|
||||
*
|
||||
* $Id: ns_func.h,v 8.9 1996/05/20 15:10:01 vixie Exp $
|
||||
* $Id: ns_func.h,v 8.13 1996/11/11 06:36:49 vixie Exp $
|
||||
*/
|
||||
|
||||
/* ++from ns_resp.c++ */
|
||||
extern void ns_resp __P((u_char *, int)),
|
||||
prime_cache __P((void)),
|
||||
delete_all __P((struct namebuf *, int, int));
|
||||
delete_all __P((struct namebuf *, int, int)),
|
||||
delete_stale __P((struct namebuf *));
|
||||
extern struct qinfo *sysquery __P((const char *, int, int,
|
||||
struct in_addr *, int, int));
|
||||
extern struct notify *findNotifyPeer __P((const struct zoneinfo *,
|
||||
@ -55,6 +56,7 @@ extern int ns_forw __P((struct databuf *nsp[],
|
||||
int dfd,
|
||||
struct qinfo **qpp,
|
||||
char *dname,
|
||||
int class, int type,
|
||||
struct namebuf *np)),
|
||||
haveComplained __P((const char *, const char *)),
|
||||
nslookup __P((struct databuf *nsp[],
|
||||
@ -68,14 +70,10 @@ extern void schedretry __P((struct qinfo *, time_t)),
|
||||
retry __P((struct qinfo *)),
|
||||
qflush __P((void)),
|
||||
qremove __P((struct qinfo *)),
|
||||
nsfree __P((struct qinfo *, char *)),
|
||||
qfree __P((struct qinfo *));
|
||||
extern struct qinfo *qfindid __P((u_int16_t)),
|
||||
#ifdef DMALLOC
|
||||
*qnew_tagged __P((void));
|
||||
# define qnew() qnew_tagged(__FILE__, __LINE__)
|
||||
#else
|
||||
*qnew();
|
||||
#endif
|
||||
*qnew __P((const char *, int, int));
|
||||
/* --from ns_forw.c-- */
|
||||
|
||||
/* ++from ns_main.c++ */
|
||||
@ -129,7 +127,9 @@ extern void ns_refreshtime __P((struct zoneinfo *, time_t)),
|
||||
extern enum context ns_ptrcontext __P((const char *owner));
|
||||
extern enum context ns_ownercontext __P((int type, enum transport));
|
||||
extern int ns_nameok __P((const char *name, int class,
|
||||
enum transport, enum context));
|
||||
enum transport, enum context,
|
||||
const char *owner,
|
||||
struct in_addr source));
|
||||
extern int ns_wildcard __P((const char *name));
|
||||
/* --from ns_init.c-- */
|
||||
|
||||
@ -137,6 +137,10 @@ extern int ns_wildcard __P((const char *name));
|
||||
extern void cache_n_resp __P((u_char *, int));
|
||||
/* --from ns_ncache.c-- */
|
||||
|
||||
/* ++from ns_udp.c++ */
|
||||
extern void ns_udp __P((void));
|
||||
/* --from ns_udp.c-- */
|
||||
|
||||
/* ++from ns_stats.c++ */
|
||||
extern void ns_stats __P((void));
|
||||
#ifdef XSTATS
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* from ns.h 4.33 (Berkeley) 8/23/90
|
||||
* $Id: ns_glob.h,v 8.9 1996/05/20 15:10:01 vixie Exp $
|
||||
* $Id: ns_glob.h,v 8.11 1996/11/11 06:36:49 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -123,15 +123,6 @@ DECL int needToChkpt INIT(0);
|
||||
/* need to dump statistics */
|
||||
DECL int needStatsDump INIT(0);
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
/* need to exit (may need to doadump
|
||||
* first, if database has changed since
|
||||
* it was last dumped/booted). Gets
|
||||
* set by shutdown signal handler
|
||||
* (onintr)
|
||||
*/
|
||||
DECL int needToExit INIT(0);
|
||||
#endif /* ALLOW_UPDATES */
|
||||
#ifdef XSTATS
|
||||
/* need to exit
|
||||
* set by shutdown signal handler
|
||||
@ -289,3 +280,5 @@ DECL const char *severity_strings[]
|
||||
= { "ignore", "warn", "fail", NULL }
|
||||
#endif
|
||||
;
|
||||
|
||||
DECL struct in_addr inaddr_any; /* Inits to 0.0.0.0 */
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)ns_init.c 4.38 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: ns_init.c,v 8.17 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: ns_init.c,v 8.24 1996/12/02 09:17:21 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -75,7 +75,7 @@ static char rcsid[] = "$Id: ns_init.c,v 8.17 1996/08/05 08:31:30 vixie Exp $";
|
||||
|
||||
#undef nsaddr
|
||||
|
||||
enum limit { Datasize };
|
||||
enum limit { Datasize , Files };
|
||||
|
||||
static void zoneinit __P((struct zoneinfo *)),
|
||||
get_forwarders __P((FILE *)),
|
||||
@ -83,6 +83,7 @@ static void zoneinit __P((struct zoneinfo *)),
|
||||
#ifdef DEBUG
|
||||
content_zone __P((int)),
|
||||
#endif
|
||||
do_reload __P((char *, int, int)),
|
||||
free_forwarders __P((void)),
|
||||
ns_limit __P((const char *name, int value)),
|
||||
ns_checknames __P((const char *names,
|
||||
@ -197,6 +198,7 @@ ns_init(bootfile)
|
||||
#ifdef SECURE_ZONES
|
||||
free_netlist(&zp->secure_nets);
|
||||
#endif
|
||||
do_reload(zp->z_origin, zp->z_type, zp->z_class);
|
||||
syslog(LOG_NOTICE, "Zone \"%s\" was removed", zp->z_origin);
|
||||
free(zp->z_origin);
|
||||
free(zp->z_source);
|
||||
@ -240,9 +242,6 @@ boot_read(filename, includefile)
|
||||
#endif
|
||||
struct stat f_time;
|
||||
static int tmpnum = 0; /* unique number for tmp zone files */
|
||||
#ifdef ALLOW_UPDATES
|
||||
char *flag;
|
||||
#endif
|
||||
int slineno; /* Saved global line number. */
|
||||
int i;
|
||||
|
||||
@ -497,29 +496,7 @@ boot_read(filename, includefile)
|
||||
|
||||
case Z_PRIMARY:
|
||||
source = savestr(buf);
|
||||
#ifdef ALLOW_UPDATES
|
||||
if (getword(buf, sizeof(buf), fp, 0)) {
|
||||
endline(fp);
|
||||
flag = buf;
|
||||
while (flag) {
|
||||
char *cp = strchr(flag, ',');
|
||||
if (cp)
|
||||
*cp++ = 0;
|
||||
if (strcasecmp(flag, "dynamic") == 0)
|
||||
zp->z_flags |= Z_DYNAMIC;
|
||||
else if (strcasecmp(flag, "addonly") == 0)
|
||||
zp->z_flags |= Z_DYNADDONLY;
|
||||
else {
|
||||
syslog(LOG_NOTICE,
|
||||
"%s: line %d: bad flag '%s'\n",
|
||||
filename, lineno, flag);
|
||||
}
|
||||
flag = cp;
|
||||
}
|
||||
}
|
||||
#else /*ALLOW_UPDATES*/
|
||||
endline(fp);
|
||||
#endif
|
||||
|
||||
dprintf(1, (ddt, ", source = %s\n", source));
|
||||
/*
|
||||
@ -552,13 +529,8 @@ boot_read(filename, includefile)
|
||||
dprintf(1, (ddt, "reloading zone\n"));
|
||||
if (!db_load(zp->z_source, zp->z_origin, zp, NULL))
|
||||
zp->z_flags |= Z_AUTH;
|
||||
#ifdef ALLOW_UPDATES
|
||||
/* Guarantee calls to ns_maint() */
|
||||
zp->z_refresh = maint_interval;
|
||||
#else
|
||||
zp->z_refresh = 0; /* no maintenance needed */
|
||||
zp->z_time = 0;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case Z_SECONDARY:
|
||||
@ -603,7 +575,7 @@ boot_read(filename, includefile)
|
||||
if (zp->z_source &&
|
||||
(strcmp(source, zp->z_source) ||
|
||||
(stat(zp->z_source, &f_time) == -1 ||
|
||||
(zp->z_ftime != f_time.st_mtime)))) {
|
||||
(zp->z_ftime != f_time.st_mtime)))) {
|
||||
dprintf(1, (ddt, "backup file changed\n"));
|
||||
free(zp->z_source);
|
||||
zp->z_source = NULL;
|
||||
@ -614,6 +586,11 @@ boot_read(filename, includefile)
|
||||
#else
|
||||
remove_zone(hashtab, zp - zones);
|
||||
#endif
|
||||
/*
|
||||
* reload parent so that NS records are
|
||||
* present during the zone transfer.
|
||||
*/
|
||||
do_reload(zp->z_origin, zp->z_type, zp->z_class);
|
||||
}
|
||||
if (zp->z_source)
|
||||
free(source);
|
||||
@ -693,71 +670,6 @@ zoneinit(zp)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
/*
|
||||
* Look for the authoritative zone with the longest matching RHS of dname
|
||||
* and return its zone # or zero if not found.
|
||||
*/
|
||||
int
|
||||
findzone(dname, class)
|
||||
char *dname;
|
||||
int class;
|
||||
{
|
||||
char *dZoneName, *zoneName;
|
||||
int dZoneNameLen, zoneNameLen;
|
||||
int maxMatchLen = 0;
|
||||
int maxMatchZoneNum = 0;
|
||||
int zoneNum;
|
||||
|
||||
dprintf(4, (ddt, "findzone(dname=%s, class=%d)\n", dname, class));
|
||||
#ifdef DEBUG
|
||||
if (debug >= 5) {
|
||||
fprintf(ddt, "zone dump:\n");
|
||||
for (zoneNum = 1; zoneNum < nzones; zoneNum++)
|
||||
printzoneinfo(zoneNum);
|
||||
}
|
||||
#endif
|
||||
|
||||
dZoneName = strchr(dname, '.');
|
||||
if (dZoneName == NULL)
|
||||
dZoneName = ""; /* root */
|
||||
else
|
||||
dZoneName++; /* There is a '.' in dname, so use remainder of
|
||||
string as the zone name */
|
||||
dZoneNameLen = strlen(dZoneName);
|
||||
for (zoneNum = 1; zoneNum < nzones; zoneNum++) {
|
||||
if (zones[zoneNum].z_type == Z_NIL)
|
||||
continue;
|
||||
zoneName = (zones[zoneNum]).z_origin;
|
||||
zoneNameLen = strlen(zoneName);
|
||||
/* The zone name may or may not end with a '.' */
|
||||
if (zoneName[zoneNameLen - 1] == '.')
|
||||
zoneNameLen--;
|
||||
if (dZoneNameLen != zoneNameLen)
|
||||
continue;
|
||||
dprintf(5, (ddt, "about to strncasecmp('%s', '%s', %d)\n",
|
||||
dZoneName, zoneName, dZoneNameLen));
|
||||
if (strncasecmp(dZoneName, zoneName, dZoneNameLen) == 0) {
|
||||
dprintf(5, (ddt, "match\n"));
|
||||
/*
|
||||
* See if this is as long a match as any so far.
|
||||
* Check if "<=" instead of just "<" so that if
|
||||
* root domain (whose name length is 0) matches,
|
||||
* we use it's zone number instead of just 0
|
||||
*/
|
||||
if (maxMatchLen <= zoneNameLen) {
|
||||
maxMatchZoneNum = zoneNum;
|
||||
maxMatchLen = zoneNameLen;
|
||||
}
|
||||
} else {
|
||||
dprintf(5, (ddt, "no match\n"));
|
||||
}
|
||||
}
|
||||
dprintf(4, (ddt, "findzone: returning %d\n", maxMatchZoneNum));
|
||||
return (maxMatchZoneNum);
|
||||
}
|
||||
#endif /* ALLOW_UPDATES */
|
||||
|
||||
static void
|
||||
get_forwarders(fp)
|
||||
FILE *fp;
|
||||
@ -881,6 +793,75 @@ find_zone(name, type, class)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
do_reload(domain, type, class)
|
||||
char *domain;
|
||||
int type;
|
||||
int class;
|
||||
{
|
||||
char *s;
|
||||
struct zoneinfo *zp;
|
||||
|
||||
dprintf(1, (ddt, "do_reload: %s %d %d\n",
|
||||
*domain ? domain : ".", type, class));
|
||||
|
||||
/* the zone has changed type? */
|
||||
/* NOTE: we still exist so don't match agains ourselves */
|
||||
/* If we are a STUB or SECONDARY check that we have loaded */
|
||||
if (((type != Z_STUB) && (zp = find_zone(domain, Z_STUB, class)) &&
|
||||
zp->z_serial) ||
|
||||
((type != Z_CACHE) && find_zone(domain, Z_CACHE, class)) ||
|
||||
((type != Z_PRIMARY) && find_zone(domain, Z_PRIMARY, class)) ||
|
||||
((type != Z_SECONDARY)
|
||||
&& (zp = find_zone(domain, Z_SECONDARY, class)) && zp->z_serial)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ((s = strchr(domain, '.')) || *domain) {
|
||||
if (s)
|
||||
domain = s + 1; /* skip dot */
|
||||
else
|
||||
domain = ""; /* root zone */
|
||||
|
||||
if ((zp = find_zone(domain, Z_STUB, class)) ||
|
||||
(zp = find_zone(domain, Z_CACHE, class)) ||
|
||||
(zp = find_zone(domain, Z_PRIMARY, class)) ||
|
||||
(zp = find_zone(domain, Z_SECONDARY, class))) {
|
||||
|
||||
dprintf(1, (ddt, "do_reload: matched %s\n",
|
||||
*domain ? domain : "."));
|
||||
|
||||
#ifdef CLEANCACHE
|
||||
if (zp->z_type == Z_CACHE)
|
||||
remove_zone(fcachetab, 0, 1);
|
||||
else
|
||||
remove_zone(hashtab, zp - zones, 1);
|
||||
#else
|
||||
if (zp->z_type == Z_CACHE)
|
||||
remove_zone(fcachetab, 0);
|
||||
else
|
||||
remove_zone(hashtab, zp - zones);
|
||||
#endif
|
||||
zp->z_flags &= ~Z_AUTH;
|
||||
|
||||
switch (zp->z_type) {
|
||||
case Z_SECONDARY:
|
||||
case Z_STUB:
|
||||
zoneinit(zp);
|
||||
break;
|
||||
case Z_PRIMARY:
|
||||
case Z_CACHE:
|
||||
if (db_load(zp->z_source, zp->z_origin, zp, 0)
|
||||
== 0)
|
||||
zp->z_flags |= Z_AUTH;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* prints out the content of zones */
|
||||
static void
|
||||
@ -906,6 +887,8 @@ ns_limit(name, value)
|
||||
max_xfers_per_ns = value;
|
||||
} else if (!strcasecmp(name, "datasize")) {
|
||||
ns_rlimit("datasize", Datasize, value);
|
||||
} else if (!strcasecmp(name, "files")) {
|
||||
ns_rlimit("files", Files, value);
|
||||
} else {
|
||||
syslog(LOG_ERR,
|
||||
"error: unrecognized limit in bootfile: \"%s\"",
|
||||
@ -985,7 +968,7 @@ ns_ownercontext(type, transport)
|
||||
context = hostname_ctx;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
panic(-1, "impossible condition in ns_ownercontext()");
|
||||
}
|
||||
break;
|
||||
case T_MB:
|
||||
@ -999,14 +982,16 @@ ns_ownercontext(type, transport)
|
||||
}
|
||||
|
||||
int
|
||||
ns_nameok(name, class, transport, context)
|
||||
ns_nameok(name, class, transport, context, owner, source)
|
||||
const char *name;
|
||||
int class;
|
||||
enum transport transport;
|
||||
enum context context;
|
||||
struct in_addr source;
|
||||
const char *owner;
|
||||
{
|
||||
int ok = 1;
|
||||
enum severity severity = checkname_severity[transport];
|
||||
int ok;
|
||||
|
||||
if (severity == ignore)
|
||||
return (1);
|
||||
@ -1024,17 +1009,44 @@ ns_nameok(name, class, transport, context)
|
||||
ok = res_hnok(name);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
panic(-1, "impossible condition in ns_nameok()");
|
||||
}
|
||||
if (!ok) {
|
||||
char *s, *o;
|
||||
|
||||
if (source.s_addr == INADDR_ANY)
|
||||
s = strdup(transport_strings[transport]);
|
||||
else {
|
||||
s = malloc(strlen(transport_strings[transport]) +
|
||||
sizeof " from [000.000.000.000]");
|
||||
if (s)
|
||||
sprintf(s, "%s from [%s]",
|
||||
transport_strings[transport],
|
||||
inet_ntoa(source));
|
||||
}
|
||||
if (strcasecmp(owner, name) == 0)
|
||||
o = strdup("");
|
||||
else {
|
||||
const char *t = (*owner == '\0') ? "." : owner;
|
||||
|
||||
o = malloc(strlen(t) + sizeof " (owner \"\")");
|
||||
if (o)
|
||||
sprintf(o, " (owner \"%s\")", t);
|
||||
}
|
||||
#ifndef ultrix
|
||||
syslog((transport == response_trans) ? LOG_INFO : LOG_NOTICE,
|
||||
"%s name \"%s %s\" (%s) is invalid - %s",
|
||||
"%s name \"%s\"%s %s (%s) is invalid - %s",
|
||||
context_strings[context],
|
||||
name, p_class(class),
|
||||
transport_strings[transport],
|
||||
name, o != NULL ? o : "[malloc failed]", p_class(class),
|
||||
s != NULL ? s : "[malloc failed]",
|
||||
(severity == fail) ? "rejecting" : "proceeding anyway");
|
||||
#endif
|
||||
if (severity == warn)
|
||||
ok = 1;
|
||||
if (s)
|
||||
free(s);
|
||||
if (o)
|
||||
free(o);
|
||||
}
|
||||
return (ok);
|
||||
}
|
||||
@ -1062,14 +1074,25 @@ ns_rlimit(name, limit, value)
|
||||
name);
|
||||
#else
|
||||
struct rlimit limits;
|
||||
int rlimit;
|
||||
int rlimit = -1;
|
||||
|
||||
switch (limit) {
|
||||
case Datasize:
|
||||
rlimit = RLIMIT_DATA;
|
||||
break;
|
||||
case Files:
|
||||
#ifdef RLIMIT_NOFILE
|
||||
rlimit = RLIMIT_NOFILE;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
panic(-1, "impossible condition in ns_rlimit()");
|
||||
}
|
||||
if (rlimit == -1) {
|
||||
syslog(LOG_WARNING,
|
||||
"limit \"%s\" not supported on this system - ignored",
|
||||
name);
|
||||
return;
|
||||
}
|
||||
if (getrlimit(rlimit, &limits) < 0) {
|
||||
syslog(LOG_WARNING, "getrlimit(%s): %m", name);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)ns_main.c 4.55 (Berkeley) 7/1/91";
|
||||
static char rcsid[] = "$Id: ns_main.c,v 8.17 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: ns_main.c,v 8.24 1996/11/26 10:11:22 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -173,13 +173,6 @@ main(argc, argv, envp)
|
||||
int rfd, size, len;
|
||||
time_t lasttime, maxctime;
|
||||
u_char buf[BUFSIZ];
|
||||
#ifdef POSIX_SIGNALS
|
||||
struct sigaction sact;
|
||||
#else
|
||||
#ifndef SYSV
|
||||
struct sigvec vec;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NeXT
|
||||
int old_sigmask;
|
||||
#endif
|
||||
@ -196,6 +189,9 @@ main(argc, argv, envp)
|
||||
#ifdef IP_OPTIONS
|
||||
u_char ip_opts[50]; /* arbitrary size */
|
||||
#endif
|
||||
#ifdef RLIMIT_NOFILE
|
||||
struct rlimit rl;
|
||||
#endif
|
||||
|
||||
local_ns_port = ns_port = htons(NAMESERVER_PORT);
|
||||
|
||||
@ -304,7 +300,10 @@ main(argc, argv, envp)
|
||||
n = 0;
|
||||
#if defined(DEBUG) && defined(LOG_PERROR)
|
||||
if (debug)
|
||||
n = LOG_PERROR;
|
||||
n |= LOG_PERROR;
|
||||
#endif
|
||||
#ifdef LOG_NOWAIT
|
||||
n |= LOG_NOWAIT;
|
||||
#endif
|
||||
#ifdef LOG_DAEMON
|
||||
openlog("named", LOG_PID|LOG_CONS|LOG_NDELAY|n, LOGFAC);
|
||||
@ -312,6 +311,14 @@ main(argc, argv, envp)
|
||||
openlog("named", LOG_PID);
|
||||
#endif
|
||||
|
||||
#ifdef RLIMIT_NOFILE
|
||||
rl.rlim_cur = rl.rlim_max = FD_SETSIZE;
|
||||
if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
|
||||
syslog(LOG_ERR, "setrlimit(RLIMIT_FSIZE,FD_SETSIZE): %m");
|
||||
#endif
|
||||
/* check that udp checksums are on */
|
||||
ns_udp();
|
||||
|
||||
#ifdef WANT_PIDFILE
|
||||
/* tuck my process id away */
|
||||
#ifdef PID_FIX
|
||||
@ -344,10 +351,21 @@ main(argc, argv, envp)
|
||||
** Open stream port.
|
||||
*/
|
||||
for (n = 0; ; n++) {
|
||||
int fd;
|
||||
if ((vs = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
syslog(LOG_ERR, "socket(SOCK_STREAM): %m");
|
||||
exit(1);
|
||||
}
|
||||
#ifdef F_DUPFD
|
||||
/*
|
||||
* leave a space for stdio to work in
|
||||
*/
|
||||
if ((fd = fcntl(vs, F_DUPFD, 20)) != -1) {
|
||||
close(vs);
|
||||
vs = fd;
|
||||
} else
|
||||
syslog(LOG_NOTICE, "fcntl(vs, F_DUPFD, 20): %m");
|
||||
#endif
|
||||
if (setsockopt(vs, SOL_SOCKET, SO_REUSEADDR, (char *)&on,
|
||||
sizeof(on)) != 0)
|
||||
{
|
||||
@ -395,6 +413,7 @@ main(argc, argv, envp)
|
||||
setsignal(SIGIOT, -1, setstatsflg);
|
||||
setsignal(SIGUSR1, -1, setIncrDbgFlg);
|
||||
setsignal(SIGUSR2, -1, setNoDbgFlg);
|
||||
setsignal(SIGHUP, -1, onhup);
|
||||
|
||||
#if defined(SIGWINCH) && defined(QRYLOG)
|
||||
setsignal(SIGWINCH, -1, setQrylogFlg);
|
||||
@ -427,7 +446,6 @@ main(argc, argv, envp)
|
||||
setsignal(SIGALRM, SIGCHLD, maint_alarm);
|
||||
setsignal(SIGCHLD, SIGALRM, reapchild);
|
||||
setsignal(SIGPIPE, -1, (SIG_FN (*)())SIG_IGN);
|
||||
setsignal(SIGHUP, -1, onhup);
|
||||
|
||||
#if defined(SIGXFSZ)
|
||||
/* Wierd DEC Hesiodism, harmless. */
|
||||
@ -438,12 +456,6 @@ main(argc, argv, envp)
|
||||
setsignal(SIGSYS, -1, sigprof);
|
||||
#endif /* SIGSYS */
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
/* Catch SIGTERM so we can dump the database upon shutdown if it
|
||||
has changed since it was last dumped/booted */
|
||||
setsignal(SIGTERM, -1, onintr);
|
||||
#endif
|
||||
|
||||
#ifdef XSTATS
|
||||
/* Catch SIGTERM so we can write stats before exiting. */
|
||||
setsignal(SIGTERM, -1, onintr);
|
||||
@ -562,22 +574,6 @@ main(argc, argv, envp)
|
||||
ddt = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef ALLOW_UPDATES
|
||||
if (needToExit) {
|
||||
struct zoneinfo *zp;
|
||||
sigblock(~0); /*
|
||||
* Block all blockable signals
|
||||
* to ensure a consistant
|
||||
* state during final dump
|
||||
*/
|
||||
dprintf(1, (ddt, "Received shutdown signal\n"));
|
||||
for (zp = zones; zp < &zones[nzones]; zp++) {
|
||||
if (zp->z_flags & Z_CHANGED)
|
||||
zonedump(zp);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
#endif /* ALLOW_UPDATES */
|
||||
#ifdef XSTATS
|
||||
if (needToExit) {
|
||||
ns_logstats();
|
||||
@ -675,6 +671,8 @@ main(argc, argv, envp)
|
||||
ntohs(from_addr.sin_port),
|
||||
dqp->dq_dfd, n,
|
||||
ctimel(tt.tv_sec)));
|
||||
if (n < HFIXEDSZ)
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
if (debug >= 10)
|
||||
fp_nquery(buf, n, ddt);
|
||||
@ -790,10 +788,12 @@ main(argc, argv, envp)
|
||||
sp->s_bufp = (u_char *)&sp->s_tempsize;
|
||||
FD_SET(rfd, &mask);
|
||||
FD_SET(rfd, &tmpmask);
|
||||
dprintf(1, (ddt,
|
||||
"\nTCP connection from [%s].%d (fd %d)\n",
|
||||
inet_ntoa(sp->s_from.sin_addr),
|
||||
ntohs(sp->s_from.sin_port), rfd));
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
syslog(LOG_DEBUG,
|
||||
"IP/TCP connection from %s (fd %d)\n",
|
||||
sin_ntoa(&sp->s_from), rfd);
|
||||
#endif
|
||||
}
|
||||
if (streamq)
|
||||
dprintf(3, (ddt, "streamq = 0x%lx\n",
|
||||
@ -871,8 +871,8 @@ main(argc, argv, envp)
|
||||
* if we have a query id, then we will send an
|
||||
* error back to the user.
|
||||
*/
|
||||
if (sp->s_bufsize == 0 &&
|
||||
(sp->s_bufp - sp->s_buf > INT16SZ)) {
|
||||
if (sp->s_bufsize == 0) {
|
||||
if (sp->s_bufp - sp->s_buf > INT16SZ) {
|
||||
HEADER *hp;
|
||||
|
||||
hp = (HEADER *)sp->s_buf;
|
||||
@ -885,7 +885,30 @@ main(argc, argv, envp)
|
||||
hp->rcode = SERVFAIL;
|
||||
(void) writemsg(sp->s_rfd, sp->s_buf,
|
||||
HFIXEDSZ);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* If the message is too short to contain a valid
|
||||
* header, try to send back an error, and drop the
|
||||
* message.
|
||||
*/
|
||||
if (sp->s_bufp - sp->s_buf < HFIXEDSZ) {
|
||||
if (sp->s_bufp - sp->s_buf > INT16SZ) {
|
||||
HEADER *hp;
|
||||
|
||||
hp = (HEADER *)sp->s_buf;
|
||||
hp->qr = 1;
|
||||
hp->ra = (NoRecurse == 0);
|
||||
hp->ancount = 0;
|
||||
hp->qdcount = 0;
|
||||
hp->nscount = 0;
|
||||
hp->arcount = 0;
|
||||
hp->rcode = SERVFAIL;
|
||||
(void) writemsg(sp->s_rfd, sp->s_buf,
|
||||
HFIXEDSZ);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((n == -1) && (errno == PORT_WOULDBLK))
|
||||
continue;
|
||||
@ -937,7 +960,9 @@ getnetconf()
|
||||
exit(1);
|
||||
}
|
||||
ntp = NULL;
|
||||
#if defined(AF_LINK) && !defined(RISCOS_BSD) && !defined(M_UNIX)
|
||||
#if defined(AF_LINK) && \
|
||||
!defined(RISCOS_BSD) && !defined(M_UNIX) && \
|
||||
!defined(sgi) && !defined(sun) && !defined(NO_SA_LEN)
|
||||
#define my_max(a, b) (a > b ? a : b)
|
||||
#define my_size(p) my_max((p).sa_len, sizeof(p))
|
||||
#else
|
||||
@ -1168,6 +1193,7 @@ opensocket(dqp)
|
||||
{
|
||||
int m, n;
|
||||
int on = 1;
|
||||
int fd;
|
||||
|
||||
/*
|
||||
* Open datagram sockets bound to interface address.
|
||||
@ -1176,6 +1202,16 @@ opensocket(dqp)
|
||||
syslog(LOG_ERR, "socket(SOCK_DGRAM): %m - exiting");
|
||||
exit(1);
|
||||
}
|
||||
#ifdef F_DUPFD
|
||||
/*
|
||||
* leave a space for stdio to work in
|
||||
*/
|
||||
if ((fd = fcntl(dqp->dq_dfd, F_DUPFD, 20)) != -1) {
|
||||
close(dqp->dq_dfd);
|
||||
dqp->dq_dfd = fd;
|
||||
} else
|
||||
syslog(LOG_NOTICE, "fcntl(dfd, F_DUPFD, 20): %m");
|
||||
#endif
|
||||
dprintf(1, (ddt, "dqp->dq_addr %s d_dfd %d\n",
|
||||
inet_ntoa(dqp->dq_addr), dqp->dq_dfd));
|
||||
if (setsockopt(dqp->dq_dfd, SOL_SOCKET, SO_REUSEADDR,
|
||||
@ -1252,22 +1288,6 @@ maint_alarm()
|
||||
}
|
||||
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
/*
|
||||
* Signal handler to schedule shutdown. Just set flag, to ensure a consistent
|
||||
* state during dump.
|
||||
*/
|
||||
static SIG_FN
|
||||
onintr()
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
resignal(SIGTERM, -1, onintr);
|
||||
needToExit = 1;
|
||||
errno = save_errno;
|
||||
}
|
||||
#endif /* ALLOW_UPDATES */
|
||||
|
||||
#ifdef XSTATS
|
||||
/*
|
||||
* Signal handler to write log information
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)ns_maint.c 4.39 (Berkeley) 3/2/91";
|
||||
static char rcsid[] = "$Id: ns_maint.c,v 8.16 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: ns_maint.c,v 8.18 1996/09/22 00:13:10 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -98,9 +98,7 @@ static time_t stats_time;
|
||||
#endif
|
||||
/*
|
||||
* Invoked at regular intervals by signal interrupt; refresh all secondary
|
||||
* zones from primary name server and remove old cache entries. Also,
|
||||
* ifdef'd ALLOW_UPDATES, dump database if it has changed since last
|
||||
* dump/bootup.
|
||||
* zones from primary name server and remove old cache entries.
|
||||
*/
|
||||
void
|
||||
ns_maint()
|
||||
@ -147,18 +145,6 @@ ns_maint()
|
||||
}
|
||||
qserial_query(zp);
|
||||
break;
|
||||
#ifdef ALLOW_UPDATES
|
||||
case Z_PRIMARY:
|
||||
/*
|
||||
* Checkpoint the zone if it has changed
|
||||
* since we last checkpointed
|
||||
*/
|
||||
if (zp->z_flags & Z_CHANGED) {
|
||||
zonedump(zp);
|
||||
ns_refreshtime(zp, tt.tv_sec);
|
||||
}
|
||||
break;
|
||||
#endif /* ALLOW_UPDATES */
|
||||
}
|
||||
gettime(&tt);
|
||||
}
|
||||
@ -403,7 +389,7 @@ static void
|
||||
startxfer(zp)
|
||||
struct zoneinfo *zp;
|
||||
{
|
||||
static char *argv[NSMAX + 20], argv_ns[NSMAX][MAXDNAME];
|
||||
char *argv[NSMAX + 20], argv_ns[NSMAX][MAXDNAME];
|
||||
int argc = 0, argc_ns = 0, pid, i;
|
||||
unsigned int cnt;
|
||||
char debug_str[10];
|
||||
@ -937,7 +923,8 @@ endxfer()
|
||||
if (WIFSIGNALED(status)) {
|
||||
if (WTERMSIG(status) != SIGKILL) {
|
||||
syslog(LOG_NOTICE,
|
||||
"named-xfer exited with signal %d\n",
|
||||
"named-xfer \"%s\" exited with signal %d\n",
|
||||
zp->z_origin[0]?zp->z_origin:".",
|
||||
WTERMSIG(status));
|
||||
}
|
||||
ns_retrytime(zp, tt.tv_sec);
|
||||
|
@ -32,7 +32,9 @@ cache_n_resp(msg, msglen)
|
||||
char dname[MAXDNAME];
|
||||
int n;
|
||||
int type, class;
|
||||
#ifdef VALIDATE
|
||||
int Vcode;
|
||||
#endif
|
||||
int flags;
|
||||
|
||||
nameserIncr(from_addr.sin_addr, nssRcvdNXD);
|
||||
@ -62,67 +64,74 @@ cache_n_resp(msg, msglen)
|
||||
}
|
||||
#endif
|
||||
#ifdef RETURNSOA
|
||||
if (hp->rcode==NXDOMAIN) {
|
||||
u_int32_t ttl;
|
||||
u_int16_t atype;
|
||||
u_char * tp = cp;
|
||||
u_char * cp1;
|
||||
u_char data[BUFSIZ+MAXDNAME];
|
||||
int len = sizeof(data);
|
||||
if (hp->nscount) {
|
||||
u_int32_t ttl;
|
||||
u_int16_t atype;
|
||||
u_char *tp = cp;
|
||||
u_char *cp1;
|
||||
u_char data[BUFSIZ+MAXDNAME];
|
||||
size_t len = sizeof data;
|
||||
|
||||
/* store ther SOA record */
|
||||
if (!hp->nscount) {
|
||||
dprintf(3, (ddt, "ncache: nscount == 0\n"));
|
||||
return;
|
||||
}
|
||||
n = dn_skipname(tp, msg + msglen);
|
||||
if (n < 0) {
|
||||
dprintf(3, (ddt, "ncache: form error\n"));
|
||||
return;
|
||||
}
|
||||
tp += n;
|
||||
GETSHORT(atype,tp); /* type */
|
||||
if (atype != T_SOA) {
|
||||
dprintf(3, (ddt, "ncache: type (%d) != T_SOA\n",atype));
|
||||
return;
|
||||
}
|
||||
tp += sizeof(u_int16_t); /* class */
|
||||
GETLONG(ttl,tp); /* ttl */
|
||||
tp += sizeof(u_int16_t); /* dlen */
|
||||
/* we store NXDOMAIN as T_SOA regardless of the query type */
|
||||
if (hp->rcode == NXDOMAIN)
|
||||
type = T_SOA;
|
||||
|
||||
if ((n = dn_expand(msg, msg + msglen, tp, data, len))
|
||||
< 0 ) {
|
||||
dprintf(3, (ddt, "ncache: form error 2\n"));
|
||||
return;
|
||||
} /* origin */
|
||||
tp += n;
|
||||
cp1 = data + (n = strlen(data) + 1);
|
||||
len -= n;
|
||||
if ((n = dn_expand(msg, msg + msglen, tp, cp1, len)) < 0 ) {
|
||||
dprintf(3, (ddt, "ncache: form error 2\n"));
|
||||
return;
|
||||
} /* mail */
|
||||
tp += n;
|
||||
n = strlen(cp1) + 1;
|
||||
cp1 += n;
|
||||
len -= n;
|
||||
bcopy(tp, cp1, n = 5 * sizeof(u_int32_t));
|
||||
/* serial, refresh, retry, expire, min */
|
||||
cp1 += n;
|
||||
len -= n;
|
||||
/* store the zone of the soa record */
|
||||
if ((n = dn_expand(msg, msg + msglen, cp, cp1, len)) < 0 ) {
|
||||
dprintf(3, (ddt, "ncache: form error 2\n"));
|
||||
return;
|
||||
}
|
||||
n = strlen(cp1) + 1;
|
||||
cp1 += n;
|
||||
/* store ther SOA record */
|
||||
n = dn_skipname(tp, msg + msglen);
|
||||
if (n < 0) {
|
||||
dprintf(3, (ddt, "ncache: form error\n"));
|
||||
return;
|
||||
}
|
||||
tp += n;
|
||||
GETSHORT(atype, tp); /* type */
|
||||
if (atype != T_SOA) {
|
||||
dprintf(3, (ddt,
|
||||
"ncache: type (%d) != T_SOA\n",atype));
|
||||
goto no_soa;
|
||||
}
|
||||
tp += INT16SZ; /* class */
|
||||
GETLONG(ttl, tp); /* ttl */
|
||||
tp += INT16SZ; /* dlen */
|
||||
|
||||
dp = savedata(class, T_SOA, MIN(ttl,NTTL)+tt.tv_sec, data,
|
||||
cp1 - data);
|
||||
/* origin */
|
||||
n = dn_expand(msg, msg + msglen, tp, (char*)data, len);
|
||||
if (n < 0) {
|
||||
dprintf(3, (ddt, "ncache: form error 2\n"));
|
||||
return;
|
||||
}
|
||||
tp += n;
|
||||
n = strlen((char*)data) + 1;
|
||||
cp1 = data + n;
|
||||
len -= n;
|
||||
/* mail */
|
||||
n = dn_expand(msg, msg + msglen, tp, (char*)cp1, len);
|
||||
if (n < 0) {
|
||||
dprintf(3, (ddt, "ncache: form error 2\n"));
|
||||
return;
|
||||
}
|
||||
tp += n;
|
||||
n = strlen((char*)cp1) + 1;
|
||||
cp1 += n;
|
||||
len -= n;
|
||||
bcopy(tp, cp1, n = 5 * INT32SZ);
|
||||
/* serial, refresh, retry, expire, min */
|
||||
cp1 += n;
|
||||
len -= n;
|
||||
/* store the zone of the soa record */
|
||||
n = dn_expand(msg, msg + msglen, cp, (char*)cp1, len);
|
||||
if (n < 0) {
|
||||
dprintf(3, (ddt, "ncache: form error 2\n"));
|
||||
return;
|
||||
}
|
||||
n = strlen((char*)cp1) + 1;
|
||||
cp1 += n;
|
||||
|
||||
dp = savedata(class, type, MIN(ttl, NTTL) + tt.tv_sec, data,
|
||||
cp1 - data);
|
||||
} else {
|
||||
no_soa:
|
||||
#endif
|
||||
dp = savedata(class, type, NTTL+tt.tv_sec, NULL, 0);
|
||||
dp = savedata(class, type, NTTL + tt.tv_sec, NULL, 0);
|
||||
#ifdef RETURNSOA
|
||||
}
|
||||
#endif
|
||||
@ -137,11 +146,11 @@ cache_n_resp(msg, msglen)
|
||||
flags = DB_NOTAUTH|DB_NOHINTS;
|
||||
}
|
||||
|
||||
if ((n = db_update(dname,dp,dp,flags,hashtab)) != OK) {
|
||||
if ((n = db_update(dname, dp, dp, flags, hashtab)) != OK) {
|
||||
dprintf(1, (ddt,
|
||||
"db_update failed return value:%d, cache_n_resp()\n",
|
||||
n));
|
||||
free((char *)dp);
|
||||
db_free(dp);
|
||||
return;
|
||||
}
|
||||
dprintf(4, (ddt,
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)ns_req.c 4.47 (Berkeley) 7/1/91";
|
||||
static char rcsid[] = "$Id: ns_req.c,v 8.20 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: ns_req.c,v 8.27 1996/10/08 04:51:03 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -55,6 +55,28 @@ static char rcsid[] = "$Id: ns_req.c,v 8.20 1996/08/05 08:31:30 vixie Exp $";
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
@ -99,27 +121,15 @@ static enum req_action req_notify __P((HEADER *hp, u_char **cpp, u_char *eom,
|
||||
#endif
|
||||
|
||||
static void fwritemsg __P((FILE *, u_char *, int)),
|
||||
#ifdef DEBUG
|
||||
printSOAdata __P((struct databuf)),
|
||||
#endif
|
||||
doaxfr __P((struct namebuf *, FILE *,
|
||||
struct namebuf *, int)),
|
||||
startxfr __P((struct qstream *, struct namebuf *,
|
||||
u_char *, int, int, const char *));
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
static int InitDynUpdate __P((register HEADER *hp,
|
||||
char *msg,
|
||||
int msglen,
|
||||
u_char *startcp,
|
||||
struct sockaddr_in *from,
|
||||
struct qstream *qsp,
|
||||
int dfd));
|
||||
#endif
|
||||
|
||||
static struct addinfo addinfo[NADDRECS];
|
||||
static void addname __P((const char *, const char *,
|
||||
u_int16_t, u_int16_t));
|
||||
static void copyCharString __P((u_char **, const char *));
|
||||
|
||||
/*
|
||||
* Process request using database; assemble and send response.
|
||||
@ -192,41 +202,6 @@ ns_req(msg, msglen, buflen, qsp, from, dfd)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
#define FORWARDED 1000
|
||||
/*
|
||||
* In a sense the following constant should be defined in <arpa/nameser.h>,
|
||||
* since it is returned here in place of a response code if the update was
|
||||
* forwarded, and the response codes are defined in nameser.h. On the other
|
||||
* hand, though, this constant is only seen in this file. The assumption
|
||||
* here is that none of the other return codes equals this one (a good
|
||||
* assumption, since they only occupy 4 bits over-the-wire)
|
||||
*/
|
||||
/* Call InitDynUpdate for all dynamic update requests */
|
||||
case UPDATEM:
|
||||
case UPDATEMA:
|
||||
case UPDATED:
|
||||
case UPDATEDA:
|
||||
case UPDATEA:
|
||||
n = InitDynUpdate(hp, msg, msglen, cp, from, qsp, dfd);
|
||||
if (n == FORWARDED) {
|
||||
/* Return directly because InitDynUpdate
|
||||
* forwarded the query to the primary, so we
|
||||
* will send response later
|
||||
*/
|
||||
action = Return;
|
||||
} else {
|
||||
/* Either sucessful primary update or failure;
|
||||
* return response code to client
|
||||
*/
|
||||
action = Finish;
|
||||
}
|
||||
|
||||
case ZONEREF:
|
||||
dprintf(1, (ddt, "Refresh Zone\n"));
|
||||
/*FALLTHROUGH*/
|
||||
#endif /* ALLOW_UPDATES */
|
||||
|
||||
default:
|
||||
dprintf(1, (ddt, "ns_req: Opcode %d not implemented\n",
|
||||
hp->opcode));
|
||||
@ -453,10 +428,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
nameserIncr(from->sin_addr, nssRcvdQ);
|
||||
#endif
|
||||
|
||||
#ifdef DATUMREFCNT
|
||||
nsp[0] = NULL;
|
||||
#endif
|
||||
|
||||
dpp = dnptrs;
|
||||
*dpp++ = msg;
|
||||
*dpp = NULL;
|
||||
@ -503,6 +475,33 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
|
||||
qtypeIncr(type);
|
||||
|
||||
/*
|
||||
* Yow!
|
||||
*/
|
||||
if (!strcasecmp(dnbuf, "VERSION.BIND") &&
|
||||
class == C_CHAOS && type == T_TXT) {
|
||||
u_char *tp;
|
||||
|
||||
hp->ancount = htons(1);
|
||||
hp->nscount = htons(0);
|
||||
hp->arcount = htons(0);
|
||||
hp->rcode = NOERROR;
|
||||
hp->aa = 1;
|
||||
hp->ra = 0;
|
||||
copyCharString(cpp, "VERSION"); /* Name */
|
||||
copyCharString(cpp, "BIND");
|
||||
*(*cpp)++ = 0x00;
|
||||
PUTSHORT(T_TXT, *cpp); /* Type */
|
||||
PUTSHORT(C_CHAOS, *cpp); /* Class */
|
||||
PUTLONG(0, *cpp); /* TTL */
|
||||
tp = *cpp; /* Temp RdLength */
|
||||
PUTSHORT(0, *cpp);
|
||||
copyCharString(cpp, Version);
|
||||
PUTSHORT((*cpp) - (tp + INT16SZ), tp); /* Real RdLength */
|
||||
*msglenp = *cpp - msg; /* Total message length */
|
||||
return (Finish);
|
||||
}
|
||||
|
||||
/*
|
||||
* Process query.
|
||||
*/
|
||||
@ -551,7 +550,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
}
|
||||
#endif /*QRYLOG*/
|
||||
|
||||
try_again:
|
||||
try_again:
|
||||
dprintf(1, (ddt, "req: nlookup(%s) id %d type=%d class=%d\n",
|
||||
dname, ntohs(hp->id), type, class));
|
||||
htp = hashtab; /* lookup relative to root */
|
||||
@ -645,15 +644,17 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
n = finddata(np, class, T_SOA, hp, &dname,
|
||||
buflenp, &count);
|
||||
if (n != 0 ) {
|
||||
if (count) {
|
||||
*cpp += n;
|
||||
*buflenp -= n;
|
||||
*msglenp += n;
|
||||
hp->nscount = htons((u_int16_t)count);
|
||||
}
|
||||
if (hp->rcode == NOERROR_NODATA) {
|
||||
/* this should not occur */
|
||||
hp->rcode = NOERROR;
|
||||
return (Finish);
|
||||
}
|
||||
*cpp += n;
|
||||
*buflenp -= n;
|
||||
*msglenp += n;
|
||||
hp->nscount = htons((u_int16_t)count);
|
||||
}
|
||||
#endif
|
||||
hp->rcode = NXDOMAIN;
|
||||
@ -683,6 +684,14 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
#ifdef NCACHE
|
||||
if (hp->rcode == NOERROR_NODATA) {
|
||||
hp->rcode = NOERROR;
|
||||
#ifdef RETURNSOA
|
||||
if (count) {
|
||||
*cpp += n;
|
||||
*buflenp -= n;
|
||||
*msglenp += n;
|
||||
hp->nscount = htons(count);
|
||||
}
|
||||
#endif
|
||||
founddata = 1;
|
||||
return (Finish);
|
||||
}
|
||||
@ -746,7 +755,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
return (Finish);
|
||||
#endif
|
||||
|
||||
fetchns:
|
||||
fetchns:
|
||||
/*
|
||||
* If we're already out of room in the response, we're done.
|
||||
*/
|
||||
@ -758,9 +767,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
* section or record the address for forwarding the query
|
||||
* (recursion desired).
|
||||
*/
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
nsp[0] = NULL;
|
||||
count = 0;
|
||||
switch (findns(&np, class, nsp, &count, 0)) {
|
||||
@ -772,11 +779,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
dname, hp->rcode));
|
||||
if (class != C_ANY) {
|
||||
hp->aa = 1;
|
||||
/* XXX: should return SOA if founddata == 0,
|
||||
* but old named's are confused by an SOA
|
||||
* in the auth. section if there's no error.
|
||||
*/
|
||||
if (foundname == 0 && np) {
|
||||
if (np && (!foundname || !founddata)) {
|
||||
n = doaddauth(hp, *cpp, *buflenp, np, nsp[0]);
|
||||
*cpp += n;
|
||||
*buflenp -= n;
|
||||
@ -784,9 +787,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
} else if (ntohs(hp->ancount) != 0) {
|
||||
/* don't add NS records for NOERROR NODATA
|
||||
as some servers can get confused */
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
switch (findns(&np, class, nsp, &count, 1)) {
|
||||
case NXDOMAIN:
|
||||
case SERVFAIL:
|
||||
@ -811,18 +812,14 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
#endif /*ADDAUTH*/
|
||||
}
|
||||
}
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (Finish);
|
||||
|
||||
case SERVFAIL:
|
||||
/* We're authoritative but the zone isn't loaded. */
|
||||
if (!founddata && !(forward_only && fwdtab)) {
|
||||
hp->rcode = SERVFAIL;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (Finish);
|
||||
}
|
||||
}
|
||||
@ -850,9 +847,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
*buflenp -= n;
|
||||
hp->nscount = htons((u_int16_t)count);
|
||||
}
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
/* Our caller will handle the Additional section. */
|
||||
return (Finish);
|
||||
}
|
||||
@ -869,9 +864,7 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
if (omsg == (u_char *)NULL) {
|
||||
syslog(LOG_INFO, "ns_req: Out Of Memory");
|
||||
hp->rcode = SERVFAIL;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (Finish);
|
||||
}
|
||||
id = hp->id;
|
||||
@ -883,14 +876,13 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
if (n < 0) {
|
||||
syslog(LOG_INFO, "res_mkquery(%s) failed", dname);
|
||||
hp->rcode = SERVFAIL;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (Finish);
|
||||
}
|
||||
*msglenp = n;
|
||||
}
|
||||
n = ns_forw(nsp, msg, *msglenp, from, qsp, dfd, &qp, dname, np);
|
||||
n = ns_forw(nsp, msg, *msglenp, from, qsp, dfd, &qp,
|
||||
dname, class, type, np);
|
||||
if (n != FW_OK && cname)
|
||||
free(omsg);
|
||||
switch (n) {
|
||||
@ -906,22 +898,20 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
break; /* Duplicate request dropped */
|
||||
case FW_NOSERVER:
|
||||
/*
|
||||
** Don't go into an infinite loop if
|
||||
** the admin gave root NS records in the cache
|
||||
** file without giving address records
|
||||
** for the root servers.
|
||||
*/
|
||||
* Don't go into an infinite loop if
|
||||
* the admin gave root NS records in the cache
|
||||
* file without giving address records
|
||||
* for the root servers.
|
||||
*/
|
||||
if (np) {
|
||||
if (NAME(*np)[0] == '\0') {
|
||||
syslog(LOG_NOTICE,
|
||||
"ns_req: no address for root server");
|
||||
hp->rcode = SERVFAIL;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (Finish);
|
||||
}
|
||||
#ifdef VALIDATE
|
||||
#ifdef VALIDATE
|
||||
/*
|
||||
* we need to kill all the NS records here as
|
||||
* validate will fail as we are talking to the parent
|
||||
@ -956,14 +946,10 @@ req_query(hp, cpp, eom, qsp, buflenp, msglenp, msg, dfd, from)
|
||||
case FW_SERVFAIL:
|
||||
do_servfail:
|
||||
hp->rcode = SERVFAIL;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (Finish);
|
||||
}
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (Return);
|
||||
}
|
||||
|
||||
@ -1179,6 +1165,7 @@ stale(dp)
|
||||
zp->z_origin);
|
||||
}
|
||||
zp->z_flags &= ~Z_AUTH;
|
||||
needmaint = 1;
|
||||
return (1);
|
||||
}
|
||||
if (zp->z_lastupdate > tt.tv_sec) {
|
||||
@ -1188,6 +1175,7 @@ stale(dp)
|
||||
zp->z_origin);
|
||||
}
|
||||
zp->z_flags &= ~Z_AUTH;
|
||||
needmaint = 1;
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
@ -1223,6 +1211,7 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
u_char *cp1, *sp;
|
||||
struct zoneinfo *zp;
|
||||
register int32_t n;
|
||||
register int16_t type = dp->d_type;
|
||||
register u_int32_t ttl;
|
||||
u_char **edp = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
|
||||
|
||||
@ -1233,7 +1222,7 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
#ifdef NCACHE
|
||||
if (dp->d_rcode
|
||||
#ifdef RETURNSOA
|
||||
&& dp->d_rcode != NXDOMAIN
|
||||
&& dp->d_size == 0
|
||||
#endif
|
||||
) {
|
||||
panic(-1, "make_rr: impossible d_rcode value");
|
||||
@ -1268,23 +1257,24 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
|
||||
buflen -= RRFIXEDSZ;
|
||||
#if defined(RETURNSOA) && defined(NCACHE)
|
||||
if (dp->d_rcode == NXDOMAIN) {
|
||||
if (dp->d_rcode) {
|
||||
name = (char *)dp->d_data;
|
||||
name += strlen(name) +1;
|
||||
name += strlen(name) +1;
|
||||
name += 5 * INT32SZ;
|
||||
type = T_SOA;
|
||||
}
|
||||
#endif
|
||||
if ((n = dn_comp(name, buf, buflen, dnptrs, edp)) < 0)
|
||||
return (-1);
|
||||
cp = buf + n;
|
||||
buflen -= n;
|
||||
PUTSHORT((u_int16_t)dp->d_type, cp);
|
||||
PUTSHORT((u_int16_t)type, cp);
|
||||
PUTSHORT((u_int16_t)dp->d_class, cp);
|
||||
PUTLONG(ttl, cp);
|
||||
sp = cp;
|
||||
cp += INT16SZ;
|
||||
switch (dp->d_type) {
|
||||
switch (type) {
|
||||
case T_CNAME:
|
||||
case T_MG:
|
||||
case T_MR:
|
||||
@ -1306,7 +1296,7 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
cp += n;
|
||||
if (doadd)
|
||||
addname((char*)dp->d_data, name,
|
||||
dp->d_type, dp->d_class);
|
||||
type, dp->d_class);
|
||||
break;
|
||||
|
||||
case T_SOA:
|
||||
@ -1317,13 +1307,13 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
if (n < 0)
|
||||
return (-1);
|
||||
cp += n;
|
||||
buflen -= dp->d_type == T_SOA ? n + 5 * INT32SZ : n;
|
||||
buflen -= type == T_SOA ? n + 5 * INT32SZ : n;
|
||||
cp1 += strlen((char *)cp1) + 1;
|
||||
n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
|
||||
if (n < 0)
|
||||
return (-1);
|
||||
cp += n;
|
||||
if (dp->d_type == T_SOA) {
|
||||
if (type == T_SOA) {
|
||||
cp1 += strlen((char *)cp1) + 1;
|
||||
bcopy(cp1, cp, (n = 5 * INT32SZ));
|
||||
cp += n;
|
||||
@ -1332,9 +1322,74 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
PUTSHORT((u_int16_t)n, sp);
|
||||
break;
|
||||
|
||||
case T_NAPTR:
|
||||
/* cp1 == our data/ cp == data of RR */
|
||||
cp1 = dp->d_data;
|
||||
|
||||
if ((buflen -= INT16SZ) < 0)
|
||||
return (-1);
|
||||
|
||||
/* copy order */
|
||||
bcopy(cp1, cp, INT16SZ);
|
||||
cp += INT16SZ;
|
||||
cp1 += INT16SZ;
|
||||
n = (u_int16_t)((cp - sp) - INT16SZ);
|
||||
dprintf(1, (ddt, "current size n = %u\n", n));
|
||||
|
||||
/* copy preference */
|
||||
bcopy(cp1, cp, INT16SZ);
|
||||
cp += INT16SZ;
|
||||
cp1 += INT16SZ;
|
||||
n = (u_int16_t)((cp - sp) - INT16SZ);
|
||||
dprintf(1, (ddt, "current size n = %u\n", n));
|
||||
|
||||
/* Flags */
|
||||
n = *cp1++;
|
||||
dprintf(1, (ddt, "size of n at flags = %d\n", n));
|
||||
*cp++ = n;
|
||||
bcopy(cp1,cp,n);
|
||||
cp += n;
|
||||
cp1 += n;
|
||||
n = (u_int16_t)((cp - sp) - INT16SZ);
|
||||
dprintf(1, (ddt, "current size n = %u\n", n));
|
||||
|
||||
/* Service */
|
||||
n = *cp1++;
|
||||
*cp++ = n;
|
||||
bcopy(cp1,cp,n);
|
||||
cp += n;
|
||||
cp1 += n;
|
||||
n = (u_int16_t)((cp - sp) - INT16SZ);
|
||||
dprintf(1, (ddt, "current size n = %u\n", n));
|
||||
|
||||
/* Regexp */
|
||||
n = *cp1++;
|
||||
*cp++ = n;
|
||||
bcopy(cp1,cp,n);
|
||||
cp += n;
|
||||
cp1 += n;
|
||||
n = (u_int16_t)((cp - sp) - INT16SZ);
|
||||
dprintf(1, (ddt, "current size n = %u\n", n));
|
||||
|
||||
/* Replacement */
|
||||
dprintf(1, (ddt, "Replacement = %s\n", cp1));
|
||||
n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
|
||||
dprintf(1, (ddt, "dn_comp's n = %u\n", n));
|
||||
if (n < 0)
|
||||
return (-1);
|
||||
cp += n;
|
||||
|
||||
/* save data length */
|
||||
n = (u_int16_t)((cp - sp) - INT16SZ);
|
||||
dprintf(1, (ddt, "saved size n = %u\n", n));
|
||||
PUTSHORT((u_int16_t)n, sp);
|
||||
|
||||
break;
|
||||
|
||||
case T_MX:
|
||||
case T_AFSDB:
|
||||
case T_RT:
|
||||
case T_SRV:
|
||||
/* cp1 == our data/ cp == data of RR */
|
||||
cp1 = dp->d_data;
|
||||
|
||||
@ -1346,6 +1401,12 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
cp += INT16SZ;
|
||||
cp1 += INT16SZ;
|
||||
|
||||
if (type == T_SRV) {
|
||||
bcopy(cp1, cp, INT16SZ*2);
|
||||
cp += INT16SZ*2;
|
||||
cp1 += INT16SZ*2;
|
||||
}
|
||||
|
||||
n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
|
||||
if (n < 0)
|
||||
return (-1);
|
||||
@ -1355,7 +1416,7 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
n = (u_int16_t)((cp - sp) - INT16SZ);
|
||||
PUTSHORT((u_int16_t)n, sp);
|
||||
if (doadd)
|
||||
addname((char*)cp1, name, dp->d_type, dp->d_class);
|
||||
addname((char*)cp1, name, type, dp->d_class);
|
||||
break;
|
||||
|
||||
case T_PX:
|
||||
@ -1385,6 +1446,39 @@ make_rr(name, dp, buf, buflen, doadd)
|
||||
PUTSHORT((u_int16_t)n, sp);
|
||||
break;
|
||||
|
||||
case T_SIG:
|
||||
/* cp1 == our data; cp == data of target RR */
|
||||
cp1 = dp->d_data;
|
||||
|
||||
/* 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! */
|
||||
bcopy( cp1, cp, 18 );
|
||||
cp += 18;
|
||||
cp1 += 18;
|
||||
buflen -= 18;
|
||||
|
||||
/* then the signer's name */
|
||||
n = dn_comp((char *)cp1, cp, buflen, NULL, NULL);
|
||||
if (n < 0)
|
||||
return (-1);
|
||||
cp += n;
|
||||
buflen -= n;
|
||||
cp1 += strlen((char*)cp1)+1;
|
||||
|
||||
/* 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! */
|
||||
bcopy(cp1, cp, n);
|
||||
cp += n;
|
||||
|
||||
/* save data length & return */
|
||||
n = (u_int16_t)((cp - sp) - INT16SZ);
|
||||
PUTSHORT((u_int16_t)n, sp);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (dp->d_size > buflen)
|
||||
return (-1);
|
||||
@ -1458,8 +1552,7 @@ doaddinfo(hp, msg, msglen)
|
||||
count = 0;
|
||||
cp = msg;
|
||||
for (ap = addinfo; --addcount >= 0; ap++) {
|
||||
int foundstale = 0,
|
||||
foundany = 0,
|
||||
int foundany = 0,
|
||||
foundcname = 0,
|
||||
save_count = count,
|
||||
save_msglen = msglen;
|
||||
@ -1473,6 +1566,7 @@ doaddinfo(hp, msg, msglen)
|
||||
goto next_rr;
|
||||
dprintf(3, (ddt, "found it\n"));
|
||||
/* look for the data */
|
||||
delete_stale(np);
|
||||
for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
|
||||
#ifdef NCACHE
|
||||
if (dp->d_rcode)
|
||||
@ -1490,17 +1584,6 @@ doaddinfo(hp, msg, msglen)
|
||||
continue;
|
||||
}
|
||||
foundany++;
|
||||
if (stale(dp)) {
|
||||
foundstale++;
|
||||
dprintf(1, (ddt,
|
||||
"doaddinfo: stale entry '%s'%s\n",
|
||||
NAME(*np),
|
||||
(dp->d_flags&DB_F_HINT)
|
||||
? " hint"
|
||||
: ""
|
||||
));
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Should be smart and eliminate duplicate
|
||||
* data here. XXX
|
||||
@ -1532,11 +1615,7 @@ doaddinfo(hp, msg, msglen)
|
||||
count++;
|
||||
}
|
||||
next_rr:
|
||||
if (foundstale) {
|
||||
/* Cache invalidate the address RR's */
|
||||
delete_all(np, (int)ap->a_class, T_A);
|
||||
}
|
||||
if (!NoFetchGlue && !foundcname && (foundstale || !foundany)) {
|
||||
if (!NoFetchGlue && !foundcname && !foundany) {
|
||||
/* ask a real server for this info */
|
||||
(void) sysquery(ap->a_dname, (int)ap->a_class, T_A,
|
||||
NULL, 0, QUERY);
|
||||
@ -1730,6 +1809,16 @@ doaxfr(np, rfp, top, class)
|
||||
*/
|
||||
if (dp->d_type == T_SOA || dp->d_type == T_NS)
|
||||
continue;
|
||||
|
||||
#if 0 /* Not yet implemented. Only a SHOULD in the I-D. -gnu@toad.com */
|
||||
/* skip the SIG AXFR record because we did it first too. */
|
||||
if (dp->d_type == T_SIG) {
|
||||
int sig_rrtype = GETSHORT (dp->d_data);
|
||||
if (sig_rrtype == T_AXFR)
|
||||
continue;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
if (dp->d_zone == 0 || stale(dp))
|
||||
continue;
|
||||
#ifdef NCACHE
|
||||
@ -1791,228 +1880,6 @@ doaxfr(np, rfp, top, class)
|
||||
dprintf(1, (ddt, "exit doaxfr()\n"));
|
||||
}
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
/*
|
||||
* Called by UPDATE{A,D,DA,M,MA} to initiate a dynamic update. If this is the
|
||||
* primary server for the zone being updated, we update the zone's serial
|
||||
* number and then call doupdate directly. If this is a secondary, we just
|
||||
* forward the update; this way, if the primary update fails (e.g., if the
|
||||
* primary is unavailable), we don't update the secondary; if the primary
|
||||
* update suceeds, ns_resp will get called with the response (when it comes
|
||||
* in), and then update the secondary's copy.
|
||||
*/
|
||||
static int
|
||||
InitDynUpdate(hp, msg, msglen, startcp, from, qsp, dfd)
|
||||
register HEADER *hp;
|
||||
char *msg;
|
||||
int msglen;
|
||||
u_char *startcp;
|
||||
struct sockaddr_in *from;
|
||||
struct qstream *qsp;
|
||||
int dfd;
|
||||
{
|
||||
struct databuf *nsp[NSMAX];
|
||||
struct zoneinfo *zp;
|
||||
char dnbuf[MAXDNAME];
|
||||
struct hashbuf *htp = hashtab; /* lookup relative to root */
|
||||
struct namebuf *np;
|
||||
struct databuf *olddp, *newdp, *dp;
|
||||
struct databuf **nspp;
|
||||
char *fname;
|
||||
register u_char *cp = startcp;
|
||||
u_int16_t class, type;
|
||||
int n, size, zonenum;
|
||||
char ZoneName[MAXDNAME], *znp;
|
||||
|
||||
#ifdef DATUMREFCNT
|
||||
nsp[0] = NULL;
|
||||
#endif
|
||||
if ((n = dn_expand(msg, msg + msglen, cp, dnbuf, sizeof(dnbuf))) < 0) {
|
||||
dprintf(1, (ddt,"FORMERR InitDynUpdate expand name failed\n"));
|
||||
hp->rcode = FORMERR;
|
||||
return (FORMERR);
|
||||
}
|
||||
cp += n;
|
||||
GETSHORT(type, cp);
|
||||
if (type == T_SOA) { /* T_SOA updates not allowed */
|
||||
hp->rcode = REFUSED;
|
||||
dprintf(1, (ddt, "InitDynUpdate: REFUSED - SOA update\n"));
|
||||
return (REFUSED);
|
||||
}
|
||||
GETSHORT(class, cp);
|
||||
cp += INT32SZ;
|
||||
GETSHORT(size, cp);
|
||||
/****XXX - need bounds checking here ****/
|
||||
cp += size;
|
||||
|
||||
if ((zonenum = findzone(dnbuf, class)) == 0) { /* zone not found */
|
||||
hp->rcode = NXDOMAIN;
|
||||
return (NXDOMAIN);
|
||||
}
|
||||
zp = &zones[zonenum];
|
||||
|
||||
/* Disallow updates for which we aren't authoratative. Note: the
|
||||
following test doesn't work right: If it's for a non-local zone,
|
||||
we will think it's a primary but be unable to lookup the namebuf,
|
||||
thus returning 'NXDOMAIN' */
|
||||
if (zp->z_type != Z_PRIMARY && zp->z_type != Z_SECONDARY) {
|
||||
hp->rcode = REFUSED;
|
||||
dprintf(1, (ddt,
|
||||
"InitDynUpdate: REFUSED - non-{primary,secondary} update\n"));
|
||||
return (REFUSED);
|
||||
}
|
||||
if (!(zp->z_flags & Z_DYNAMIC)) {
|
||||
hp->rcode = REFUSED;
|
||||
dprintf(1, (ddt,
|
||||
"InitDynUpdate: REFUSED - dynamic flag not set for zone\n"));
|
||||
return (REFUSED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the zone namebuf. Lookup "xyz" not "xyz.", since
|
||||
* otherwise the lookup fails, because '.' may have a nil n_hash
|
||||
* associated with it.
|
||||
*/
|
||||
strcpy(ZoneName, zp->z_origin);
|
||||
znp = &ZoneName[strlen(ZoneName) - 1];
|
||||
if (*znp == '.')
|
||||
*znp = NULL;
|
||||
np = nlookup(ZoneName, &htp, &fname, 0);
|
||||
if ((np == NULL) || (fname != ZoneName)) {
|
||||
syslog(LOG_ERR, "InitDynUpdate: lookup failed on zone (%s)\n",
|
||||
ZoneName);
|
||||
hp->rcode = NXDOMAIN;
|
||||
return (NXDOMAIN);
|
||||
}
|
||||
|
||||
/*
|
||||
* If this is the primary copy increment the serial number. Don't
|
||||
* increment the serial number if this is a secondary; this way, if 2
|
||||
* different secondaries both update the primary, they will both have
|
||||
* lower serial numbers than the primary has, and hence eventually
|
||||
* refresh and get all updates and become consistent.
|
||||
*
|
||||
* Note that the serial number must be incremented in both the zone
|
||||
* data structure and the zone's namebuf.
|
||||
*/
|
||||
switch (zp->z_type) {
|
||||
case Z_SECONDARY: /* forward update to primary */
|
||||
nspp = nsp;
|
||||
dp = np->n_data;
|
||||
while (dp != NULL) {
|
||||
if (match(dp, class, T_NS)) {
|
||||
if (nspp < &nsp[NSMAX-1]) {
|
||||
*nspp++ = dp;
|
||||
#ifdef DATUMREFCNT
|
||||
dp->d_rcnt++;
|
||||
#endif
|
||||
} else
|
||||
break;
|
||||
}
|
||||
dp = dp->d_next;
|
||||
}
|
||||
*nspp = NULL; /* Delimiter */
|
||||
if (ns_forw(nsp, msg, msglen, from, qsp, dfd, NULL, dnbuf, np)
|
||||
<
|
||||
0) {
|
||||
hp->rcode = SERVFAIL;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (SERVFAIL);
|
||||
}
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (FORWARDED);
|
||||
|
||||
case Z_PRIMARY:
|
||||
zp->z_serial++;
|
||||
/* Find the SOA record */
|
||||
for (olddp = np->n_data; olddp != NULL; olddp = olddp->d_next)
|
||||
if (match(olddp, class, T_SOA))
|
||||
break;
|
||||
if (olddp == NULL) {
|
||||
syslog(LOG_NOTICE,
|
||||
"InitDynUpdate: Couldn't find SOA RR for '%s'\n",
|
||||
ZoneName);
|
||||
hp->rcode = NXDOMAIN;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (NXDOMAIN);
|
||||
}
|
||||
newdp = savedata(olddp->d_class, olddp->d_type, olddp->d_ttl,
|
||||
olddp->d_data, olddp->d_size);
|
||||
newdp->d_zone = olddp->d_zone;
|
||||
newdp->d_cred = DB_C_AUTH; /* XXX - it may not be so */
|
||||
newdp->d_clev = db_getclev(zp->z_origin);
|
||||
cp = (u_char *)newdp->d_data;
|
||||
cp += strlen(cp) + 1; /* skip origin string */
|
||||
cp += strlen(cp) + 1; /* skip in-charge string */
|
||||
putlong((u_int32_t)(zp->z_serial), cp);
|
||||
dprintf(4, (ddt, "after stuffing data into newdp:\n"));
|
||||
#ifdef DEBUG
|
||||
if (debug >= 4)
|
||||
printSOAdata(newdp);
|
||||
#endif
|
||||
|
||||
if ((n = db_update(ZoneName, olddp, newdp, DB_DELETE,
|
||||
hashtab)) != NOERROR) { /* XXX */
|
||||
dprintf(1, (ddt,
|
||||
"InitDynUpdate: SOA update failed\n"));
|
||||
hp->rcode = NOCHANGE;
|
||||
free((char*) dp);
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (NOCHANGE);
|
||||
}
|
||||
|
||||
/* Now update the RR itself */
|
||||
/* XXX - DB_C_AUTH may be wrong */
|
||||
if (doupdate(msg, msglen, msg + HFIXEDSZ, zonenum,
|
||||
(struct databuf *)0, DB_NODATA, DB_C_AUTH) < 0) {
|
||||
dprintf(1, (ddt, "InitDynUpdate: doupdate failed\n"));
|
||||
/* doupdate fills in rcode */
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (hp->rcode);
|
||||
}
|
||||
zp->z_flags |= Z_CHANGED;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (NOERROR);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* Print the contents of the data in databuf pointed to by dp for an SOA record
|
||||
*/
|
||||
static void
|
||||
printSOAdata(dp)
|
||||
struct databuf *dp;
|
||||
{
|
||||
register u_char *cp;
|
||||
|
||||
if (!debug)
|
||||
return; /* Otherwise fprintf to ddt will bomb */
|
||||
cp = (u_char *)dp->d_data;
|
||||
fprintf(ddt, "printSOAdata(%#lx): origin(%#lx)='%s'\n",
|
||||
(u_long)dp, (u_long)cp, cp);
|
||||
cp += strlen(cp) + 1; /* skip origin string */
|
||||
fprintf(ddt, "printSOAdata: in-charge(%#lx)='%s'\n",
|
||||
(u_long)cp, cp);
|
||||
cp += strlen(cp) + 1; /* skip in-charge string */
|
||||
fprintf(ddt, "printSOAdata: serial(%lx)=%lu\n",
|
||||
(u_long)cp, (u_long)_getlong(cp));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void
|
||||
startxfr(qsp, np, soa, soalen, class, dname)
|
||||
struct qstream *qsp;
|
||||
@ -2159,7 +2026,6 @@ free_addinfo() {
|
||||
addcount = 0;
|
||||
}
|
||||
|
||||
#ifdef DATUMREFCNT
|
||||
void
|
||||
free_nsp(nsp)
|
||||
struct databuf **nsp;
|
||||
@ -2171,9 +2037,20 @@ free_nsp(nsp)
|
||||
} else {
|
||||
dprintf(3, (ddt, "free_nsp: %s rcnt %d delayed\n",
|
||||
(*nsp)->d_data, (*nsp)->d_rcnt));
|
||||
free(*nsp); /* delayed free */
|
||||
db_free(*nsp); /* delayed free */
|
||||
}
|
||||
*nsp++ = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
copyCharString(dst, src)
|
||||
u_char **dst;
|
||||
const char *src;
|
||||
{
|
||||
size_t len = strlen(src) & 0xff;
|
||||
|
||||
*(*dst)++ = (u_char) len;
|
||||
memcpy(*dst, src, len);
|
||||
*dst += len;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char sccsid[] = "@(#)ns_stats.c 4.10 (Berkeley) 6/27/90";
|
||||
static char rcsid[] = "$Id: ns_stats.c,v 8.7 1996/08/05 08:31:30 vixie Exp $";
|
||||
static char rcsid[] = "$Id: ns_stats.c,v 8.8 1996/09/22 00:13:10 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -132,11 +132,6 @@ ns_stats()
|
||||
fprintf(f, "%ld\ttime since reset (secs)\n",
|
||||
(long)(timenow - resettime));
|
||||
|
||||
#ifdef DMALLOC
|
||||
/* malloc statistics */
|
||||
dmallocstats(f);
|
||||
#endif
|
||||
|
||||
/* query type statistics */
|
||||
fprintf(f, "%lu\tUnknown query types\n", (u_long)typestats[0]);
|
||||
for(i=1; i < T_ANY+1; i++)
|
||||
|
113
contrib/bind/named/ns_udp.c
Normal file
113
contrib/bind/named/ns_udp.c
Normal file
@ -0,0 +1,113 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char rcsid[] = "$Id: ns_udp.c,v 8.3 1996/08/27 08:33:23 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <netdb.h>
|
||||
#include <nlist.h>
|
||||
#include <resolv.h>
|
||||
|
||||
#include "named.h"
|
||||
|
||||
void
|
||||
ns_udp() {
|
||||
#if defined(CHECK_UDP_SUM) || defined(FIX_UDP_SUM)
|
||||
struct nlist nl[2];
|
||||
int fd;
|
||||
int sum;
|
||||
u_long res, offset;
|
||||
|
||||
nl[0].n_name = UDPSUM;
|
||||
nl[1].n_name = 0;
|
||||
|
||||
if (nlist(KSYMS, nl)) {
|
||||
dprintf(1, (ddt, "ns_udp: nlist (%s,%s) failed\n",
|
||||
KSYMS, UDPSUM));
|
||||
return;
|
||||
}
|
||||
|
||||
dprintf(1, (ddt, "ns_udp: %s %d %lu (%ld)\n",
|
||||
nl[0].n_name, nl[0].n_type, nl[0].n_value,
|
||||
nl[0].n_value));
|
||||
|
||||
if (!nl[0].n_type)
|
||||
return;
|
||||
|
||||
if ((fd = open(KMEM, O_RDWR, 0)) < 0) {
|
||||
dprintf(1, (ddt, "ns_udp: open %s failed\n", KMEM));
|
||||
return;
|
||||
}
|
||||
|
||||
offset = nl[0].n_value;
|
||||
#ifdef KMAP
|
||||
offset &= ((~0UL)>>1);
|
||||
#endif
|
||||
|
||||
res = lseek(fd, offset, SEEK_SET);
|
||||
if (res != offset) {
|
||||
dprintf(1, (ddt, "ns_udp: lseek %ul failed %lu %d\n",
|
||||
offset, res, errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (read(fd, &sum, sizeof(sum)) != sizeof(sum)) {
|
||||
dprintf(1, (ddt, "ns_udp: read failed\n"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dprintf(1, (ddt, "ns_udp: %d\n", sum));
|
||||
if (sum == 0) {
|
||||
#ifdef FIX_UDP_SUM
|
||||
sum = 1;
|
||||
lseek(fd, offset, SEEK_SET);
|
||||
if (res != offset) {
|
||||
dprintf(1, (ddt, "ns_udp: lseek %ul failed %lu %d\n",
|
||||
offset, res, errno));
|
||||
goto cleanup;
|
||||
}
|
||||
if (write(fd, &sum, sizeof(sum)) != sizeof(sum)) {
|
||||
dprintf(1, (ddt, "ns_udp: write failed\n"));
|
||||
goto cleanup;
|
||||
}
|
||||
dprintf(1, (ddt, "ns_udp: set to 1\n"));
|
||||
syslog(LOG_WARNING, "ns_udp: check sums turned on");
|
||||
#else
|
||||
dprintf(1, (ddt, "ns_udp: Exiting\n"));
|
||||
syslog(LOG_WARNING, "ns_udp: checksums NOT turned on: Exiting");
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
cleanup:
|
||||
close(fd);
|
||||
#endif
|
||||
}
|
@ -116,9 +116,7 @@ validate(dname, qdomain, server, type, class, data, dlen
|
||||
int exactmatch = 0;
|
||||
struct fwdinfo *fwd;
|
||||
|
||||
#ifdef DATUMREFCNT
|
||||
nsp[0] = NULL;
|
||||
#endif
|
||||
dprintf(3, (ddt,
|
||||
"validate(), d:%s, s:[%s], t:%d, c:%d\n",
|
||||
dname, inet_ntoa(server->sin_addr), type, class));
|
||||
@ -155,9 +153,7 @@ validate(dname, qdomain, server, type, class, data, dlen
|
||||
* in either case, do not cache
|
||||
**/
|
||||
dprintf(5, (ddt, "validate: auth data found\n"));
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
if (needs_prime_cache)
|
||||
needs_prime_cache = 0;
|
||||
|
||||
@ -211,9 +207,7 @@ validate(dname, qdomain, server, type, class, data, dlen
|
||||
/* stick_in_queue(dname, type, class, data); */
|
||||
if (needs_prime_cache)
|
||||
needs_prime_cache = 0;
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (INVALID);
|
||||
|
||||
case OK: /*proceed */
|
||||
@ -222,21 +216,15 @@ validate(dname, qdomain, server, type, class, data, dlen
|
||||
needs_prime_cache = 0;
|
||||
if (samedomain(dname, qdomain) ||
|
||||
check_addr_ns(nsp, server, dname)) {
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (VALID_CACHE);
|
||||
}
|
||||
/* server is not one of those we know of */
|
||||
/* stick_in_queue(dname, type, class, data); */
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (INVALID);
|
||||
default:
|
||||
#ifdef DATUMREFCNT
|
||||
free_nsp(nsp);
|
||||
#endif
|
||||
return (INVALID);
|
||||
} /*switch*/
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#
|
||||
# from @(#)Makefile 5.16 (Berkeley) 3/14/88
|
||||
# $Id: Makefile,v 8.11 1996/08/05 08:31:35 vixie Exp $
|
||||
# $Id: Makefile,v 8.13 1996/08/08 22:49:48 vixie Exp $
|
||||
#
|
||||
|
||||
## ++Copyright++ 1988, 1995
|
||||
@ -73,17 +73,17 @@ AROBJS= ${ARPREF} ${OBJS} ${ARSUFF}
|
||||
|
||||
CFLAGS= ${CDEBUG} -I${INCL} -I${COMPINCL} ${DEFS} ${LOCDEFS}
|
||||
|
||||
SRCS= herror.c res_debug.c res_data.c \
|
||||
SRCS= base64.c herror.c res_debug.c res_data.c \
|
||||
res_comp.c res_init.c res_mkquery.c res_query.c res_send.c \
|
||||
getnetbyaddr.c getnetbyname.c getnetent.c getnetnamadr.c \
|
||||
gethnamaddr.c sethostent.c nsap_addr.c hostnamelen.c \
|
||||
inet_addr.c inet_ntop.c inet_pton.c
|
||||
gethnamaddr.c sethostent.c nsap_addr.c hostnamelen.c inet_addr.c \
|
||||
inet_ntop.c inet_neta.c inet_pton.c inet_net_ntop.c inet_net_pton.c
|
||||
|
||||
OBJS= herror.o res_debug.o res_data.o \
|
||||
OBJS= base64.o herror.o res_debug.o res_data.o \
|
||||
res_comp.o res_init.o res_mkquery.o res_query.o res_send.o \
|
||||
getnetbyaddr.o getnetbyname.o getnetent.o getnetnamadr.o \
|
||||
gethnamaddr.o sethostent.o nsap_addr.o hostnamelen.o \
|
||||
inet_addr.o inet_ntop.o inet_pton.o
|
||||
gethnamaddr.o sethostent.o nsap_addr.o hostnamelen.o inet_addr.o \
|
||||
inet_ntop.o inet_neta.o inet_pton.o inet_net_ntop.o inet_net_pton.o
|
||||
|
||||
all: libresolv.a
|
||||
|
||||
@ -98,7 +98,7 @@ ${DESTDIR}${DESTLIB}/libresolv.a: libresolv.a
|
||||
( cd ${DESTDIR}${DESTLIB} ; $(RANLIB) libresolv.a )
|
||||
|
||||
.c.o:
|
||||
${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
|
||||
${CC} ${CFLAGS} -c $*.c
|
||||
-${LDS} ld -x -r $*.o
|
||||
${LDS} mv a.out $*.o
|
||||
|
||||
|
321
contrib/bind/res/base64.c
Normal file
321
contrib/bind/res/base64.c
Normal file
@ -0,0 +1,321 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <resolv.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
# include "../conf/portability.h"
|
||||
#endif
|
||||
|
||||
#define Assert(Cond) if (!(Cond)) abort()
|
||||
|
||||
static const char Base64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static const char Pad64 = '=';
|
||||
|
||||
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
|
||||
The following encoding technique is taken from RFC 1521 by Borenstein
|
||||
and Freed. It is reproduced here in a slightly edited form for
|
||||
convenience.
|
||||
|
||||
A 65-character subset of US-ASCII is used, enabling 6 bits to be
|
||||
represented per printable character. (The extra 65th character, "=",
|
||||
is used to signify a special processing function.)
|
||||
|
||||
The encoding process represents 24-bit groups of input bits as output
|
||||
strings of 4 encoded characters. Proceeding from left to right, a
|
||||
24-bit input group is formed by concatenating 3 8-bit input groups.
|
||||
These 24 bits are then treated as 4 concatenated 6-bit groups, each
|
||||
of which is translated into a single digit in the base64 alphabet.
|
||||
|
||||
Each 6-bit group is used as an index into an array of 64 printable
|
||||
characters. The character referenced by the index is placed in the
|
||||
output string.
|
||||
|
||||
Table 1: The Base64 Alphabet
|
||||
|
||||
Value Encoding Value Encoding Value Encoding Value Encoding
|
||||
0 A 17 R 34 i 51 z
|
||||
1 B 18 S 35 j 52 0
|
||||
2 C 19 T 36 k 53 1
|
||||
3 D 20 U 37 l 54 2
|
||||
4 E 21 V 38 m 55 3
|
||||
5 F 22 W 39 n 56 4
|
||||
6 G 23 X 40 o 57 5
|
||||
7 H 24 Y 41 p 58 6
|
||||
8 I 25 Z 42 q 59 7
|
||||
9 J 26 a 43 r 60 8
|
||||
10 K 27 b 44 s 61 9
|
||||
11 L 28 c 45 t 62 +
|
||||
12 M 29 d 46 u 63 /
|
||||
13 N 30 e 47 v
|
||||
14 O 31 f 48 w (pad) =
|
||||
15 P 32 g 49 x
|
||||
16 Q 33 h 50 y
|
||||
|
||||
Special processing is performed if fewer than 24 bits are available
|
||||
at the end of the data being encoded. A full encoding quantum is
|
||||
always completed at the end of a quantity. When fewer than 24 input
|
||||
bits are available in an input group, zero bits are added (on the
|
||||
right) to form an integral number of 6-bit groups. Padding at the
|
||||
end of the data is performed using the '=' character.
|
||||
|
||||
Since all base64 input is an integral number of octets, only the
|
||||
-------------------------------------------------
|
||||
following cases can arise:
|
||||
|
||||
(1) the final quantum of encoding input is an integral
|
||||
multiple of 24 bits; here, the final unit of encoded
|
||||
output will be an integral multiple of 4 characters
|
||||
with no "=" padding,
|
||||
(2) the final quantum of encoding input is exactly 8 bits;
|
||||
here, the final unit of encoded output will be two
|
||||
characters followed by two "=" padding characters, or
|
||||
(3) the final quantum of encoding input is exactly 16 bits;
|
||||
here, the final unit of encoded output will be three
|
||||
characters followed by one "=" padding character.
|
||||
*/
|
||||
|
||||
int
|
||||
b64_ntop(src, srclength, target, targsize)
|
||||
u_char const *src;
|
||||
size_t srclength;
|
||||
char *target;
|
||||
size_t targsize;
|
||||
{
|
||||
size_t datalength = 0;
|
||||
u_char input[3];
|
||||
u_char output[4];
|
||||
int i;
|
||||
|
||||
while (2 < srclength) {
|
||||
input[0] = *src++;
|
||||
input[1] = *src++;
|
||||
input[2] = *src++;
|
||||
srclength -= 3;
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||
output[3] = input[2] & 0x3f;
|
||||
Assert(output[0] < 64);
|
||||
Assert(output[1] < 64);
|
||||
Assert(output[2] < 64);
|
||||
Assert(output[3] < 64);
|
||||
|
||||
if (datalength + 4 > targsize)
|
||||
return (-1);
|
||||
target[datalength++] = Base64[output[0]];
|
||||
target[datalength++] = Base64[output[1]];
|
||||
target[datalength++] = Base64[output[2]];
|
||||
target[datalength++] = Base64[output[3]];
|
||||
}
|
||||
|
||||
/* Now we worry about padding. */
|
||||
if (0 != srclength) {
|
||||
/* Get what's left. */
|
||||
input[0] = input[1] = input[2] = '\0';
|
||||
for (i = 0; i < srclength; i++)
|
||||
input[i] = *src++;
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||
Assert(output[0] < 64);
|
||||
Assert(output[1] < 64);
|
||||
Assert(output[2] < 64);
|
||||
|
||||
if (datalength + 4 > targsize)
|
||||
return (-1);
|
||||
target[datalength++] = Base64[output[0]];
|
||||
target[datalength++] = Base64[output[1]];
|
||||
if (srclength == 1)
|
||||
target[datalength++] = Pad64;
|
||||
else
|
||||
target[datalength++] = Base64[output[2]];
|
||||
target[datalength++] = Pad64;
|
||||
}
|
||||
if (datalength >= targsize)
|
||||
return (-1);
|
||||
target[datalength] = '\0'; /* Returned value doesn't count \0. */
|
||||
return (datalength);
|
||||
}
|
||||
|
||||
/* skips all whitespace anywhere.
|
||||
converts characters, four at a time, starting at (or after)
|
||||
src from base - 64 numbers into three 8 bit bytes in the target area.
|
||||
it returns the number of data bytes stored at the target, or -1 on error.
|
||||
*/
|
||||
|
||||
int
|
||||
b64_pton(src, target, targsize)
|
||||
char const *src;
|
||||
u_char *target;
|
||||
size_t targsize;
|
||||
{
|
||||
int tarindex, state, ch;
|
||||
char *pos;
|
||||
|
||||
state = 0;
|
||||
tarindex = 0;
|
||||
|
||||
while ((ch = *src++) != '\0') {
|
||||
if (isspace(ch)) /* Skip whitespace anywhere. */
|
||||
continue;
|
||||
|
||||
if (ch == Pad64)
|
||||
break;
|
||||
|
||||
pos = strchr(Base64, ch);
|
||||
if (pos == 0) /* A non-base64 character. */
|
||||
return (-1);
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
if (target) {
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] = (pos - Base64) << 2;
|
||||
}
|
||||
state = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (target) {
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 4;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x0f)
|
||||
<< 4 ;
|
||||
}
|
||||
tarindex++;
|
||||
state = 2;
|
||||
break;
|
||||
case 2:
|
||||
if (target) {
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 2;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x03)
|
||||
<< 6;
|
||||
}
|
||||
tarindex++;
|
||||
state = 3;
|
||||
break;
|
||||
case 3:
|
||||
if (target) {
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64);
|
||||
}
|
||||
tarindex++;
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are done decoding Base-64 chars. Let's see if we ended
|
||||
* on a byte boundary, and/or with erroneous trailing characters.
|
||||
*/
|
||||
|
||||
if (ch == Pad64) { /* We got a pad char. */
|
||||
ch = *src++; /* Skip it, get next. */
|
||||
switch (state) {
|
||||
case 0: /* Invalid = in first position */
|
||||
case 1: /* Invalid = in second position */
|
||||
return (-1);
|
||||
|
||||
case 2: /* Valid, means one byte of info */
|
||||
/* Skip any number of spaces. */
|
||||
for (NULL; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
break;
|
||||
/* Make sure there is another trailing = sign. */
|
||||
if (ch != Pad64)
|
||||
return (-1);
|
||||
ch = *src++; /* Skip the = */
|
||||
/* Fall through to "single trailing =" case. */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 3: /* Valid, means two bytes of info */
|
||||
/*
|
||||
* We know this char is an =. Is there anything but
|
||||
* whitespace after it?
|
||||
*/
|
||||
for (NULL; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Now make sure for cases 2 and 3 that the "extra"
|
||||
* bits that slopped past the last full byte were
|
||||
* zeros. If we don't check them, they become a
|
||||
* subliminal channel.
|
||||
*/
|
||||
if (target && target[tarindex] != 0)
|
||||
return (-1);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We ended by seeing the end of the string. Make sure we
|
||||
* have no partial bytes lying around.
|
||||
*/
|
||||
if (state != 0)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (tarindex);
|
||||
}
|
@ -55,7 +55,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: gethnamaddr.c,v 8.17 1996/08/05 08:31:35 vixie Exp $";
|
||||
static char rcsid[] = "$Id: gethnamaddr.c,v 8.20 1996/09/28 06:51:07 vixie Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -79,10 +79,12 @@ static char rcsid[] = "$Id: gethnamaddr.c,v 8.17 1996/08/05 08:31:35 vixie Exp $
|
||||
#define MULTI_PTRS_ARE_ALIASES 1 /* XXX - experimental */
|
||||
|
||||
#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
# include "../conf/portability.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_OPTIONS_H)
|
||||
# include <../conf/options.h>
|
||||
#endif
|
||||
@ -100,7 +102,6 @@ static const char AskedForGot[] =
|
||||
"gethostby*.getanswer: asked for \"%s\", got \"%s\"";
|
||||
|
||||
static char *h_addr_ptrs[MAXADDRS + 1];
|
||||
static struct hostent *gethostbyname_ipv4 __P((const char *));
|
||||
|
||||
static struct hostent host;
|
||||
static char *host_aliases[MAXALIASES];
|
||||
@ -166,7 +167,7 @@ getanswer(answer, anslen, qname, qtype)
|
||||
int type, class, buflen, ancount, qdcount;
|
||||
int haveanswer, had_error;
|
||||
int toobig = 0;
|
||||
char tbuf[MAXDNAME+1];
|
||||
char tbuf[MAXDNAME];
|
||||
const char *tname;
|
||||
int (*name_ok) __P((const char *));
|
||||
|
||||
@ -340,12 +341,11 @@ getanswer(answer, anslen, qname, qtype)
|
||||
cp += n;
|
||||
continue; /* XXX - had_error++ ? */
|
||||
}
|
||||
if (haveanswer) {
|
||||
if (n != host.h_length) {
|
||||
cp += n;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (n != host.h_length) {
|
||||
cp += n;
|
||||
continue;
|
||||
}
|
||||
if (!haveanswer) {
|
||||
register int nn;
|
||||
|
||||
host.h_name = bp;
|
||||
@ -416,6 +416,10 @@ gethostbyname(name)
|
||||
{
|
||||
struct hostent *hp;
|
||||
|
||||
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
|
||||
h_errno = NETDB_INTERNAL;
|
||||
return (NULL);
|
||||
}
|
||||
if (_res.options & RES_USE_INET6) {
|
||||
hp = gethostbyname2(name, AF_INET6);
|
||||
if (hp)
|
||||
@ -502,6 +506,36 @@ gethostbyname2(name, af)
|
||||
if (!isdigit(*cp) && *cp != '.')
|
||||
break;
|
||||
}
|
||||
if (isxdigit(name[0]) || name[0] == ':')
|
||||
for (cp = name;; ++cp) {
|
||||
if (!*cp) {
|
||||
if (*--cp == '.')
|
||||
break;
|
||||
/*
|
||||
* All-IPv6-legal, no dot at the end.
|
||||
* Fake up a hostent as if we'd actually
|
||||
* done a lookup.
|
||||
*/
|
||||
if (inet_pton(af, name, host_addr) <= 0) {
|
||||
h_errno = HOST_NOT_FOUND;
|
||||
return (NULL);
|
||||
}
|
||||
strncpy(hostbuf, name, MAXDNAME);
|
||||
hostbuf[MAXDNAME] = '\0';
|
||||
bp = hostbuf + MAXDNAME;
|
||||
len = sizeof hostbuf - MAXDNAME;
|
||||
host.h_name = hostbuf;
|
||||
host.h_aliases = host_aliases;
|
||||
host_aliases[0] = NULL;
|
||||
h_addr_ptrs[0] = (char *)host_addr;
|
||||
h_addr_ptrs[1] = NULL;
|
||||
host.h_addr_list = h_addr_ptrs;
|
||||
h_errno = NETDB_SUCCESS;
|
||||
return (&host);
|
||||
}
|
||||
if (!isxdigit(*cp) && *cp != ':' && *cp != '.')
|
||||
break;
|
||||
}
|
||||
|
||||
if ((n = res_search(name, C_IN, type, buf.buf, sizeof(buf))) < 0) {
|
||||
dprintf("res_search failed (%d)\n", n);
|
||||
|
139
contrib/bind/res/inet_net_ntop.c
Normal file
139
contrib/bind/res/inet_net_ntop.c
Normal file
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
|
||||
char *dst, size_t size));
|
||||
|
||||
/*
|
||||
* char *
|
||||
* inet_net_ntop(af, src, bits, dst, size)
|
||||
* convert network number from network to presentation format.
|
||||
* generates CIDR style result always.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
char *
|
||||
inet_net_ntop(af, src, bits, dst, size)
|
||||
int af;
|
||||
const void *src;
|
||||
int bits;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_net_ntop_ipv4(src, bits, dst, size));
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* static char *
|
||||
* inet_net_ntop_ipv4(src, bits, dst, size)
|
||||
* convert IPv4 network number from network to presentation format.
|
||||
* generates CIDR style result always.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* note:
|
||||
* network byte order assumed. this means 192.5.5.240/28 has
|
||||
* 0x11110000 in its fourth octet.
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
static char *
|
||||
inet_net_ntop_ipv4(src, bits, dst, size)
|
||||
const u_char *src;
|
||||
int bits;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
char *odst = dst;
|
||||
char *t;
|
||||
u_int m;
|
||||
int b;
|
||||
|
||||
if (bits < 0 || bits > 32) {
|
||||
errno = EINVAL;
|
||||
return (NULL);
|
||||
}
|
||||
if (bits == 0) {
|
||||
if (size < sizeof "0")
|
||||
goto emsgsize;
|
||||
*dst++ = '0';
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
/* Format whole octets. */
|
||||
for (b = bits / 8; b > 0; b--) {
|
||||
if (size < sizeof "255.")
|
||||
goto emsgsize;
|
||||
t = dst;
|
||||
dst += SPRINTF((dst, "%u", *src++));
|
||||
if (b > 1) {
|
||||
*dst++ = '.';
|
||||
*dst = '\0';
|
||||
}
|
||||
size -= (size_t)(dst - t);
|
||||
}
|
||||
|
||||
/* Format partial octet. */
|
||||
b = bits % 8;
|
||||
if (b > 0) {
|
||||
if (size < sizeof ".255")
|
||||
goto emsgsize;
|
||||
t = dst;
|
||||
if (dst != odst)
|
||||
*dst++ = '.';
|
||||
m = ((1 << b) - 1) << (8 - b);
|
||||
dst += SPRINTF((dst, "%u", *src & m));
|
||||
size -= (size_t)(dst - t);
|
||||
}
|
||||
|
||||
/* Format CIDR /width. */
|
||||
if (size < sizeof "/32")
|
||||
goto emsgsize;
|
||||
dst += SPRINTF((dst, "/%u", bits));
|
||||
return (odst);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (NULL);
|
||||
}
|
207
contrib/bind/res/inet_net_pton.c
Normal file
207
contrib/bind/res/inet_net_pton.c
Normal file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
static int inet_net_pton_ipv4 __P((const char *src, u_char *dst,
|
||||
size_t size));
|
||||
|
||||
/*
|
||||
* static int
|
||||
* inet_net_pton(af, src, dst, size)
|
||||
* convert network number from presentation to network format.
|
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR.
|
||||
* "size" is in bytes and describes "dst".
|
||||
* return:
|
||||
* number of bits, either imputed classfully or specified with /CIDR,
|
||||
* or -1 if some failure occurred (check errno). ENOENT means it was
|
||||
* not a valid network specification.
|
||||
* author:
|
||||
* Paul Vixie (ISC), June 1996
|
||||
*/
|
||||
int
|
||||
inet_net_pton(af, src, dst, size)
|
||||
int af;
|
||||
const char *src;
|
||||
void *dst;
|
||||
size_t size;
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_net_pton_ipv4(src, dst, size));
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* static int
|
||||
* inet_net_pton_ipv4(src, dst, size)
|
||||
* convert IPv4 network number from presentation to network format.
|
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR.
|
||||
* "size" is in bytes and describes "dst".
|
||||
* return:
|
||||
* number of bits, either imputed classfully or specified with /CIDR,
|
||||
* or -1 if some failure occurred (check errno). ENOENT means it was
|
||||
* not an IPv4 network specification.
|
||||
* note:
|
||||
* network byte order assumed. this means 192.5.5.240/28 has
|
||||
* 0x11110000 in its fourth octet.
|
||||
* author:
|
||||
* Paul Vixie (ISC), June 1996
|
||||
*/
|
||||
static int
|
||||
inet_net_pton_ipv4(src, dst, size)
|
||||
const char *src;
|
||||
u_char *dst;
|
||||
size_t size;
|
||||
{
|
||||
static const char
|
||||
xdigits[] = "0123456789abcdef",
|
||||
digits[] = "0123456789";
|
||||
int n, ch, tmp, dirty, bits;
|
||||
const u_char *odst = dst;
|
||||
|
||||
ch = *src++;
|
||||
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
|
||||
&& isascii(src[1]) && isxdigit(src[1])) {
|
||||
/* Hexadecimal: Eat nybble string. */
|
||||
if (size <= 0)
|
||||
goto emsgsize;
|
||||
*dst = 0, dirty = 0;
|
||||
src++; /* skip x or X. */
|
||||
while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isxdigit(ch)) {
|
||||
if (isupper(ch))
|
||||
ch = tolower(ch);
|
||||
n = strchr(xdigits, ch) - xdigits;
|
||||
assert(n >= 0 && n <= 15);
|
||||
*dst |= n;
|
||||
if (!dirty++)
|
||||
*dst <<= 4;
|
||||
else if (size-- > 0)
|
||||
*++dst = 0, dirty = 0;
|
||||
else
|
||||
goto emsgsize;
|
||||
}
|
||||
if (dirty)
|
||||
size--;
|
||||
} else if (isascii(ch) && isdigit(ch)) {
|
||||
/* Decimal: eat dotted digit string. */
|
||||
for (;;) {
|
||||
tmp = 0;
|
||||
do {
|
||||
n = strchr(digits, ch) - digits;
|
||||
assert(n >= 0 && n <= 9);
|
||||
tmp *= 10;
|
||||
tmp += n;
|
||||
if (tmp > 255)
|
||||
goto enoent;
|
||||
} while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isdigit(ch));
|
||||
if (size-- <= 0)
|
||||
goto emsgsize;
|
||||
*dst++ = (u_char) tmp;
|
||||
if (ch == '\0' || ch == '/')
|
||||
break;
|
||||
if (ch != '.')
|
||||
goto enoent;
|
||||
ch = *src++;
|
||||
if (!isascii(ch) || !isdigit(ch))
|
||||
goto enoent;
|
||||
}
|
||||
} else
|
||||
goto enoent;
|
||||
|
||||
bits = -1;
|
||||
if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
|
||||
/* CIDR width specifier. Nothing can follow it. */
|
||||
ch = *src++; /* Skip over the /. */
|
||||
bits = 0;
|
||||
do {
|
||||
n = strchr(digits, ch) - digits;
|
||||
assert(n >= 0 && n <= 9);
|
||||
bits *= 10;
|
||||
bits += n;
|
||||
} while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isdigit(ch));
|
||||
if (ch != '\0')
|
||||
goto enoent;
|
||||
if (bits > 32)
|
||||
goto emsgsize;
|
||||
}
|
||||
|
||||
/* Firey death and destruction unless we prefetched EOS. */
|
||||
if (ch != '\0')
|
||||
goto enoent;
|
||||
|
||||
/* If nothing was written to the destination, we found no address. */
|
||||
if (dst == odst)
|
||||
goto enoent;
|
||||
/* If no CIDR spec was given, infer width from net class. */
|
||||
if (bits == -1) {
|
||||
if (*odst >= 240) /* Class E */
|
||||
bits = 32;
|
||||
else if (*odst >= 224) /* Class D */
|
||||
bits = 4;
|
||||
else if (*odst >= 192) /* Class C */
|
||||
bits = 24;
|
||||
else if (*odst >= 128) /* Class B */
|
||||
bits = 16;
|
||||
else /* Class A */
|
||||
bits = 8;
|
||||
/* If imputed mask is narrower than specified octets, widen. */
|
||||
if (bits >= 8 && bits < ((dst - odst) * 8))
|
||||
bits = (dst - odst) * 8;
|
||||
}
|
||||
/* Extend network to cover the actual mask. */
|
||||
while (bits > ((dst - odst) * 8)) {
|
||||
if (size-- <= 0)
|
||||
goto emsgsize;
|
||||
*dst++ = '\0';
|
||||
}
|
||||
return (bits);
|
||||
|
||||
enoent:
|
||||
errno = ENOENT;
|
||||
return (-1);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (-1);
|
||||
}
|
82
contrib/bind/res/inet_neta.c
Normal file
82
contrib/bind/res/inet_neta.c
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* char *
|
||||
* inet_neta(src, dst, size)
|
||||
* format a u_long network number into presentation format.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* note:
|
||||
* format of ``src'' is as for inet_network().
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
char *
|
||||
inet_neta(src, dst, size)
|
||||
u_long src;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
char *odst = dst;
|
||||
char *tp;
|
||||
|
||||
while (src & 0xffffffff) {
|
||||
u_char b = (src & 0xff000000) >> 24;
|
||||
|
||||
src <<= 8;
|
||||
if (b) {
|
||||
if (size < sizeof "255.")
|
||||
goto emsgsize;
|
||||
tp = dst;
|
||||
dst += SPRINTF((dst, "%u", b));
|
||||
if (src != 0L) {
|
||||
*dst++ = '.';
|
||||
*dst = '\0';
|
||||
}
|
||||
size -= (size_t)(dst - tp);
|
||||
}
|
||||
}
|
||||
if (dst == odst) {
|
||||
if (size < sizeof "0.0.0.0")
|
||||
goto emsgsize;
|
||||
strcpy(dst, "0.0.0.0");
|
||||
}
|
||||
return (odst);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (NULL);
|
||||
}
|
@ -55,7 +55,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: res_comp.c,v 8.8 1996/08/05 08:31:35 vixie Exp $";
|
||||
static char rcsid[] = "$Id: res_comp.c,v 8.11 1996/12/02 09:17:22 vixie Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -394,8 +394,12 @@ int
|
||||
res_ownok(dn)
|
||||
const char *dn;
|
||||
{
|
||||
if (asterchar(dn[0]) && periodchar(dn[1]))
|
||||
dn += 2;
|
||||
if (asterchar(dn[0])) {
|
||||
if (periodchar(dn[1]))
|
||||
return (res_hnok(dn+2));
|
||||
if (dn[1] == '\0')
|
||||
return (1);
|
||||
}
|
||||
return (res_hnok(dn));
|
||||
}
|
||||
|
||||
@ -500,36 +504,3 @@ __putlong(l, msgp)
|
||||
{
|
||||
PUTLONG(l, msgp);
|
||||
}
|
||||
|
||||
#ifdef ultrix
|
||||
/* ultrix 4.0 had some icky packaging in its libc.a. alias for it here.
|
||||
* there is more gunk of this kind over in res_debug.c.
|
||||
*/
|
||||
#undef putshort
|
||||
void
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
putshort(register u_short s, register u_char *msgp)
|
||||
#else
|
||||
putshort(s, msgp)
|
||||
register u_short s;
|
||||
register u_char *msgp;
|
||||
#endif
|
||||
{
|
||||
__putshort(s, msgp);
|
||||
}
|
||||
#undef putlong
|
||||
void
|
||||
putlong(l, msgp)
|
||||
register u_int32_t l;
|
||||
register u_char *msgp;
|
||||
{
|
||||
__putlong(l, msgp);
|
||||
}
|
||||
|
||||
#undef dn_skipname
|
||||
dn_skipname(comp_dn, eom)
|
||||
const u_char *comp_dn, *eom;
|
||||
{
|
||||
return (__dn_skipname(comp_dn, eom));
|
||||
}
|
||||
#endif /* Ultrix 4.0 hackery */
|
||||
|
@ -50,12 +50,34 @@
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: res_debug.c,v 8.12 1996/08/05 08:31:35 vixie Exp $";
|
||||
static char rcsid[] = "$Id: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -65,11 +87,14 @@ static char rcsid[] = "$Id: res_debug.c,v 8.12 1996/08/05 08:31:35 vixie Exp $";
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <resolv.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
# include "../conf/portability.h"
|
||||
@ -213,6 +238,7 @@ __p_query(msg)
|
||||
}
|
||||
|
||||
#ifdef ultrix
|
||||
#undef p_query
|
||||
/* ultrix 4.0's packaging has some icky packaging. alias for it here.
|
||||
* there is more junk of this kind over in res_comp.c.
|
||||
*/
|
||||
@ -261,7 +287,7 @@ __fp_nquery(msg, len, file)
|
||||
if ((_res.options & RES_INIT) == 0 && res_init() == -1)
|
||||
return;
|
||||
|
||||
#define TruncTest(x) if (x >= endMark) goto trunc
|
||||
#define TruncTest(x) if (x > endMark) goto trunc
|
||||
#define ErrorTest(x) if (x == NULL) goto error
|
||||
|
||||
/*
|
||||
@ -269,7 +295,7 @@ __fp_nquery(msg, len, file)
|
||||
*/
|
||||
hp = (HEADER *)msg;
|
||||
cp = msg + HFIXEDSZ;
|
||||
endMark = cp + len;
|
||||
endMark = msg + len;
|
||||
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX) || hp->rcode) {
|
||||
fprintf(file, ";; ->>HEADER<<- opcode: %s, status: %s, id: %d",
|
||||
_res_opcodes[hp->opcode],
|
||||
@ -291,6 +317,12 @@ __fp_nquery(msg, len, file)
|
||||
fprintf(file, " rd");
|
||||
if (hp->ra)
|
||||
fprintf(file, " ra");
|
||||
if (hp->unused)
|
||||
fprintf(file, " UNUSED-BIT-ON");
|
||||
if (hp->ad)
|
||||
fprintf(file, " ad");
|
||||
if (hp->cd)
|
||||
fprintf(file, " cd");
|
||||
}
|
||||
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD1)) {
|
||||
fprintf(file, "; Ques: %d", ntohs(hp->qdcount));
|
||||
@ -404,6 +436,30 @@ __p_cdname(cp, msg, file)
|
||||
return (p_cdnname(cp, msg, PACKETSZ, file));
|
||||
}
|
||||
|
||||
|
||||
/* Return a fully-qualified domain name from a compressed name (with
|
||||
length supplied). */
|
||||
|
||||
const u_char *
|
||||
__p_fqnname(cp, msg, msglen, name, namelen)
|
||||
const u_char *cp, *msg;
|
||||
int msglen;
|
||||
char *name;
|
||||
int namelen;
|
||||
{
|
||||
int n, newlen;
|
||||
|
||||
if ((n = dn_expand(msg, cp + msglen, cp, name, namelen)) < 0)
|
||||
return (NULL);
|
||||
newlen = strlen (name);
|
||||
if (newlen == 0 || name[newlen - 1] != '.')
|
||||
if (newlen+1 >= namelen) /* Lack space for final dot */
|
||||
return (NULL);
|
||||
else
|
||||
strcpy(name + newlen, ".");
|
||||
return (cp + n);
|
||||
}
|
||||
|
||||
/* XXX: the rest of these functions need to become length-limited, too. (vix)
|
||||
*/
|
||||
|
||||
@ -413,18 +469,13 @@ __p_fqname(cp, msg, file)
|
||||
FILE *file;
|
||||
{
|
||||
char name[MAXDNAME];
|
||||
int n;
|
||||
const u_char *n;
|
||||
|
||||
if ((n = dn_expand(msg, cp + MAXCDNAME, cp, name, sizeof name)) < 0)
|
||||
n = __p_fqnname(cp, msg, MAXCDNAME, name, sizeof name);
|
||||
if (n == NULL)
|
||||
return (NULL);
|
||||
if (name[0] == '\0') {
|
||||
putc('.', file);
|
||||
} else {
|
||||
fputs(name, file);
|
||||
if (name[strlen(name) - 1] != '.')
|
||||
putc('.', file);
|
||||
}
|
||||
return (cp + n);
|
||||
fputs(name, file);
|
||||
return (n);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -440,13 +491,19 @@ __p_rr(cp, msg, file)
|
||||
const u_char *cp1, *cp2;
|
||||
u_int32_t tmpttl, t;
|
||||
int lcnt;
|
||||
u_int16_t keyflags;
|
||||
char rrname[MAXDNAME]; /* The fqdn of this RR */
|
||||
char base64_key[MAX_KEY_BASE64];
|
||||
|
||||
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
|
||||
h_errno = NETDB_INTERNAL;
|
||||
return (NULL);
|
||||
}
|
||||
if ((cp = p_fqname(cp, msg, file)) == NULL)
|
||||
cp = __p_fqnname(cp, msg, MAXCDNAME, rrname, sizeof rrname);
|
||||
if (!cp)
|
||||
return (NULL); /* compression error */
|
||||
fputs(rrname, file);
|
||||
|
||||
type = _getshort((u_char*)cp);
|
||||
cp += INT16SZ;
|
||||
class = _getshort((u_char*)cp);
|
||||
@ -481,7 +538,7 @@ __p_rr(cp, msg, file)
|
||||
address = inet_ntoa(inaddr);
|
||||
cp += INADDRSZ;
|
||||
protocol = *(u_char*)cp;
|
||||
cp += sizeof(u_char);
|
||||
cp += sizeof (u_char);
|
||||
port = _getshort((u_char*)cp);
|
||||
cp += INT16SZ;
|
||||
fprintf(file, "\t%s\t; proto %d, port %d",
|
||||
@ -505,16 +562,16 @@ __p_rr(cp, msg, file)
|
||||
|
||||
case T_HINFO:
|
||||
case T_ISDN:
|
||||
(void) fputs("\t\"", file);
|
||||
cp2 = cp + dlen;
|
||||
(void) fputs("\t\"", file);
|
||||
if ((n = (unsigned char) *cp++) != 0) {
|
||||
for (c = n; c > 0 && cp < cp2; c--) {
|
||||
if (strchr("\n\"\\", *cp))
|
||||
(void) putc('\\', file);
|
||||
(void) putc(*cp++, file);
|
||||
}
|
||||
putc('"', file);
|
||||
}
|
||||
putc('"', file);
|
||||
if (cp < cp2 && (n = (unsigned char) *cp++) != 0) {
|
||||
(void) fputs ("\t\"", file);
|
||||
for (c = n; c > 0 && cp < cp2; c--) {
|
||||
@ -572,11 +629,24 @@ __p_rr(cp, msg, file)
|
||||
return (NULL);
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
case T_X25:
|
||||
cp2 = cp + dlen;
|
||||
(void) fputs("\t\"", file);
|
||||
if ((n = (unsigned char) *cp++) != 0) {
|
||||
for (c = n; c > 0 && cp < cp2; c--) {
|
||||
if (strchr("\n\"\\", *cp))
|
||||
(void) putc('\\', file);
|
||||
(void) putc(*cp++, file);
|
||||
}
|
||||
}
|
||||
putc('"', file);
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
(void) putc('\t', file);
|
||||
cp2 = cp1 + dlen;
|
||||
while (cp < cp2) {
|
||||
putc('"', file);
|
||||
if (n = (unsigned char) *cp++) {
|
||||
for (c = n; c > 0 && cp < cp2; c--) {
|
||||
if (strchr("\n\"\\", *cp))
|
||||
@ -584,8 +654,10 @@ __p_rr(cp, msg, file)
|
||||
(void) putc(*cp++, file);
|
||||
}
|
||||
}
|
||||
putc('"', file);
|
||||
if (cp < cp2)
|
||||
putc(' ', file);
|
||||
}
|
||||
putc('"', file);
|
||||
break;
|
||||
|
||||
case T_NSAP:
|
||||
@ -596,18 +668,53 @@ __p_rr(cp, msg, file)
|
||||
case T_AAAA: {
|
||||
char t[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
|
||||
|
||||
fprintf(file, "\t%s\n", inet_ntop(AF_INET6, cp, t, sizeof t));
|
||||
fprintf(file, "\t%s", inet_ntop(AF_INET6, cp, t, sizeof t));
|
||||
cp += dlen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case T_LOC: {
|
||||
char t[255];
|
||||
|
||||
(void) fprintf(file, "\t%s\n", loc_ntoa(cp, t));
|
||||
fprintf(file, "\t%s", loc_ntoa(cp, t));
|
||||
cp += dlen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case T_NAPTR: {
|
||||
u_int order, preference;
|
||||
|
||||
order = _getshort(cp); cp += INT16SZ;
|
||||
preference = _getshort(cp); cp += INT16SZ;
|
||||
fprintf(file, "\t%u %u ",order, preference);
|
||||
/* Flags */
|
||||
n = *cp++;
|
||||
fprintf(file,"\"%.*s\" ", (int)n, cp);
|
||||
cp += n;
|
||||
/* Service */
|
||||
n = *cp++;
|
||||
fprintf(file,"\"%.*s\" ", (int)n, cp);
|
||||
cp += n;
|
||||
/* Regexp */
|
||||
n = *cp++;
|
||||
fprintf(file,"\"%.*s\" ", (int)n, cp);
|
||||
cp += n;
|
||||
if ((cp = p_fqname(cp, msg, file)) == NULL)
|
||||
return (NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
case T_SRV: {
|
||||
u_int priority, weight, port;
|
||||
|
||||
priority = _getshort(cp); cp += INT16SZ;
|
||||
weight = _getshort(cp); cp += INT16SZ;
|
||||
port = _getshort(cp); cp += INT16SZ;
|
||||
fprintf(file, "\t%u %u %u ", priority, weight, port);
|
||||
if ((cp = p_fqname(cp, msg, file)) == NULL)
|
||||
return (NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
case T_MINFO:
|
||||
case T_RP:
|
||||
@ -641,7 +748,7 @@ __p_rr(cp, msg, file)
|
||||
fprintf(file, "\t%s %s ( ",
|
||||
inet_ntoa(inaddr),
|
||||
deproto((int) *cp));
|
||||
cp += sizeof(u_char);
|
||||
cp += sizeof (u_char);
|
||||
n = 0;
|
||||
lcnt = 0;
|
||||
while (cp < cp1 + dlen) {
|
||||
@ -662,6 +769,72 @@ __p_rr(cp, msg, file)
|
||||
putc(')', file);
|
||||
break;
|
||||
|
||||
case T_KEY:
|
||||
putc('\t', file);
|
||||
keyflags = _getshort(cp);
|
||||
cp += 2;
|
||||
fprintf(file,"0x%04x", keyflags ); /* flags */
|
||||
fprintf(file," %u", *cp++); /* protocol */
|
||||
fprintf(file," %u (", *cp++); /* algorithm */
|
||||
|
||||
n = b64_ntop(cp, (cp1 + dlen) - cp,
|
||||
base64_key, sizeof base64_key);
|
||||
for (c = 0; c < n; ++c) {
|
||||
if (0 == (c & 0x3F))
|
||||
fprintf(file, "\n\t");
|
||||
putc(base64_key[c], file); /* public key data */
|
||||
}
|
||||
|
||||
fprintf(file, " )");
|
||||
if (n < 0)
|
||||
fprintf(file, "\t; BAD BASE64");
|
||||
fflush(file);
|
||||
cp = cp1 + dlen;
|
||||
break;
|
||||
|
||||
case T_SIG:
|
||||
type = _getshort((u_char*)cp);
|
||||
cp += INT16SZ;
|
||||
fprintf(file, " %s", p_type(type));
|
||||
fprintf(file, "\t%d", *cp++); /* algorithm */
|
||||
/* Check label value and print error if wrong. */
|
||||
n = *cp++;
|
||||
c = dn_count_labels (rrname);
|
||||
if (n != c)
|
||||
fprintf(file, "\t; LABELS WRONG (%d should be %d)\n\t",
|
||||
n, c);
|
||||
/* orig ttl */
|
||||
n = _getlong((u_char*)cp);
|
||||
if (n != tmpttl)
|
||||
fprintf(file, " %u", n);
|
||||
cp += INT32SZ;
|
||||
/* sig expire */
|
||||
fprintf(file, " (\n\t%s",
|
||||
__p_secstodate(_getlong((u_char*)cp)));
|
||||
cp += INT32SZ;
|
||||
/* time signed */
|
||||
fprintf(file, " %s", __p_secstodate(_getlong((u_char*)cp)));
|
||||
cp += INT32SZ;
|
||||
/* sig footprint */
|
||||
fprintf(file," %u ", _getshort((u_char*)cp));
|
||||
cp += INT16SZ;
|
||||
/* signer's name */
|
||||
cp = p_fqname(cp, msg, file);
|
||||
n = b64_ntop(cp, (cp1 + dlen) - cp,
|
||||
base64_key, sizeof base64_key);
|
||||
for (c = 0; c < n; c++) {
|
||||
if (0 == (c & 0x3F))
|
||||
fprintf (file, "\n\t");
|
||||
putc(base64_key[c], file); /* signature */
|
||||
}
|
||||
/* Clean up... */
|
||||
fprintf(file, " )");
|
||||
if (n < 0)
|
||||
fprintf(file, "\t; BAD BASE64");
|
||||
fflush(file);
|
||||
cp = cp1+dlen;
|
||||
break;
|
||||
|
||||
#ifdef ALLOW_T_UNSPEC
|
||||
case T_UNSPEC:
|
||||
{
|
||||
@ -696,6 +869,137 @@ __p_rr(cp, msg, file)
|
||||
return (cp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Names of RR classes and qclasses. Classes and qclasses are the same, except
|
||||
* that C_ANY is a qclass but not a class. (You can ask for records of class
|
||||
* C_ANY, but you can't have any records of that class in the database.)
|
||||
*/
|
||||
const struct res_sym __p_class_syms[] = {
|
||||
{C_IN, "IN"},
|
||||
{C_CHAOS, "CHAOS"},
|
||||
{C_HS, "HS"},
|
||||
{C_HS, "HESIOD"},
|
||||
{C_ANY, "ANY"},
|
||||
{C_IN, (char *)0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Names of RR types and qtypes. Types and qtypes are the same, except
|
||||
* that T_ANY is a qtype but not a type. (You can ask for records of type
|
||||
* T_ANY, but you can't have any records of that type in the database.)
|
||||
*/
|
||||
const struct res_sym __p_type_syms[] = {
|
||||
{T_A, "A", "address"},
|
||||
{T_NS, "NS", "name server"},
|
||||
{T_MD, "MD", "mail destination (deprecated)"},
|
||||
{T_MF, "MF", "mail forwarder (deprecated)"},
|
||||
{T_CNAME, "CNAME", "canonical name"},
|
||||
{T_SOA, "SOA", "start of authority"},
|
||||
{T_MB, "MB", "mailbox"},
|
||||
{T_MG, "MG", "mail group member"},
|
||||
{T_MR, "MR", "mail rename"},
|
||||
{T_NULL, "NULL", "null"},
|
||||
{T_WKS, "WKS", "well-known service (deprecated)"},
|
||||
{T_PTR, "PTR", "domain name pointer"},
|
||||
{T_HINFO, "HINFO", "host information"},
|
||||
{T_MINFO, "MINFO", "mailbox information"},
|
||||
{T_MX, "MX", "mail exchanger"},
|
||||
{T_TXT, "TXT", "text"},
|
||||
{T_RP, "RP", "responsible person"},
|
||||
{T_AFSDB, "AFSDB", "DCE or AFS server"},
|
||||
{T_X25, "X25", "X25 address"},
|
||||
{T_ISDN, "ISDN", "ISDN address"},
|
||||
{T_RT, "RT", "router"},
|
||||
{T_NSAP, "NSAP", "nsap address"},
|
||||
{T_NSAP_PTR, "NSAP_PTR", "domain name pointer"},
|
||||
{T_SIG, "SIG", "signature"},
|
||||
{T_KEY, "KEY", "key"},
|
||||
{T_PX, "PX", "mapping information"},
|
||||
{T_GPOS, "GPOS", "geographical position (withdrawn)"},
|
||||
{T_AAAA, "AAAA", "IPv6 address"},
|
||||
{T_LOC, "LOC", "location"},
|
||||
{T_NXT, "NXT", "next valid name (unimplemented)"},
|
||||
{T_EID, "EID", "endpoint identifier (unimplemented)"},
|
||||
{T_NIMLOC, "NIMLOC", "NIMROD locator (unimplemented)"},
|
||||
{T_SRV, "SRV", "server selection"},
|
||||
{T_ATMA, "ATMA", "ATM address (unimplemented)"},
|
||||
{T_IXFR, "IXFR", "incremental zone transfer"},
|
||||
{T_AXFR, "AXFR", "zone transfer"},
|
||||
{T_MAILB, "MAILB", "mailbox-related data (deprecated)"},
|
||||
{T_MAILA, "MAILA", "mail agent (deprecated)"},
|
||||
{T_UINFO, "UINFO", "user information (nonstandard)"},
|
||||
{T_UID, "UID", "user ID (nonstandard)"},
|
||||
{T_GID, "GID", "group ID (nonstandard)"},
|
||||
{T_NAPTR, "NAPTR", "URN Naming Authority"},
|
||||
#ifdef ALLOW_T_UNSPEC
|
||||
{T_UNSPEC, "UNSPEC", "unspecified data (nonstandard)"},
|
||||
#endif /* ALLOW_T_UNSPEC */
|
||||
{T_ANY, "ANY", "\"any\""},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
int
|
||||
__sym_ston(syms, name, success)
|
||||
const struct res_sym *syms;
|
||||
char *name;
|
||||
int *success;
|
||||
{
|
||||
for (NULL; syms->name != 0; syms++) {
|
||||
if (strcasecmp (name, syms->name) == 0) {
|
||||
if (success)
|
||||
*success = 1;
|
||||
return (syms->number);
|
||||
}
|
||||
}
|
||||
if (success)
|
||||
*success = 0;
|
||||
return (syms->number); /* The default value. */
|
||||
}
|
||||
|
||||
const char *
|
||||
__sym_ntos(syms, number, success)
|
||||
const struct res_sym *syms;
|
||||
int number;
|
||||
int *success;
|
||||
{
|
||||
static char unname[20];
|
||||
|
||||
for (NULL; syms->name != 0; syms++) {
|
||||
if (number == syms->number) {
|
||||
if (success)
|
||||
*success = 1;
|
||||
return (syms->name);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf (unname, "%d", number);
|
||||
if (success)
|
||||
*success = 0;
|
||||
return (unname);
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
__sym_ntop(syms, number, success)
|
||||
const struct res_sym *syms;
|
||||
int number;
|
||||
int *success;
|
||||
{
|
||||
static char unname[20];
|
||||
|
||||
for (NULL; syms->name != 0; syms++) {
|
||||
if (number == syms->number) {
|
||||
if (success)
|
||||
*success = 1;
|
||||
return (syms->humanname);
|
||||
}
|
||||
}
|
||||
sprintf(unname, "%d", number);
|
||||
if (success)
|
||||
*success = 0;
|
||||
return (unname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a string for the type
|
||||
*/
|
||||
@ -703,48 +1007,7 @@ const char *
|
||||
__p_type(type)
|
||||
int type;
|
||||
{
|
||||
static char nbuf[20];
|
||||
|
||||
switch (type) {
|
||||
case T_A: return "A";
|
||||
case T_NS: return "NS";
|
||||
case T_CNAME: return "CNAME";
|
||||
case T_SOA: return "SOA";
|
||||
case T_MB: return "MB";
|
||||
case T_MG: return "MG";
|
||||
case T_MR: return "MR";
|
||||
case T_NULL: return "NULL";
|
||||
case T_WKS: return "WKS";
|
||||
case T_PTR: return "PTR";
|
||||
case T_HINFO: return "HINFO";
|
||||
case T_MINFO: return "MINFO";
|
||||
case T_MX: return "MX";
|
||||
case T_TXT: return "TXT";
|
||||
case T_RP: return "RP";
|
||||
case T_AFSDB: return "AFSDB";
|
||||
case T_X25: return "X25";
|
||||
case T_ISDN: return "ISDN";
|
||||
case T_RT: return "RT";
|
||||
case T_NSAP: return "NSAP";
|
||||
case T_NSAP_PTR: return "NSAP_PTR";
|
||||
case T_SIG: return "SIG";
|
||||
case T_KEY: return "KEY";
|
||||
case T_PX: return "PX";
|
||||
case T_GPOS: return "GPOS";
|
||||
case T_AAAA: return "AAAA";
|
||||
case T_LOC: return "LOC";
|
||||
case T_AXFR: return "AXFR";
|
||||
case T_MAILB: return "MAILB";
|
||||
case T_MAILA: return "MAILA";
|
||||
case T_ANY: return "ANY";
|
||||
case T_UINFO: return "UINFO";
|
||||
case T_UID: return "UID";
|
||||
case T_GID: return "GID";
|
||||
#ifdef ALLOW_T_UNSPEC
|
||||
case T_UNSPEC: return "UNSPEC";
|
||||
#endif /* ALLOW_T_UNSPEC */
|
||||
default: (void)sprintf(nbuf, "%d", type); return (nbuf);
|
||||
}
|
||||
return (__sym_ntos (__p_type_syms, type, (int *)0));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -754,14 +1017,7 @@ const char *
|
||||
__p_class(class)
|
||||
int class;
|
||||
{
|
||||
static char nbuf[20];
|
||||
|
||||
switch (class) {
|
||||
case C_IN: return "IN";
|
||||
case C_HS: return "HS";
|
||||
case C_ANY: return "ANY";
|
||||
default: (void)sprintf(nbuf, "%d", class); return (nbuf);
|
||||
}
|
||||
return (__sym_ntos (__p_class_syms, class, (int *)0));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -794,8 +1050,8 @@ __p_option(option)
|
||||
/*
|
||||
* Return a mnemonic for a time to live
|
||||
*/
|
||||
char *
|
||||
__p_time(value)
|
||||
const char *
|
||||
p_time(value)
|
||||
u_int32_t value;
|
||||
{
|
||||
static char nbuf[40];
|
||||
@ -856,7 +1112,7 @@ static const char *
|
||||
precsize_ntoa(prec)
|
||||
u_int8_t prec;
|
||||
{
|
||||
static char retbuf[sizeof("90000000.00")];
|
||||
static char retbuf[sizeof "90000000.00"];
|
||||
unsigned long val;
|
||||
int mantissa, exponent;
|
||||
|
||||
@ -1043,11 +1299,11 @@ loc_aton(ascii, binary)
|
||||
longit = lltemp1;
|
||||
latit = lltemp2;
|
||||
} else { /* some kind of brokenness */
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
default: /* we didn't get one of each */
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* altitude */
|
||||
@ -1122,7 +1378,7 @@ loc_aton(ascii, binary)
|
||||
}
|
||||
|
||||
/* takes an on-the-wire LOC RR and formats it in a human readable format. */
|
||||
char *
|
||||
const char *
|
||||
loc_ntoa(binary, ascii)
|
||||
const u_char *binary;
|
||||
char *ascii;
|
||||
@ -1223,3 +1479,53 @@ loc_ntoa(binary, ascii)
|
||||
|
||||
return (ascii);
|
||||
}
|
||||
|
||||
|
||||
/* Return the number of DNS hierarchy levels in the name. */
|
||||
int
|
||||
__dn_count_labels(name)
|
||||
char *name;
|
||||
{
|
||||
int i, len, count;
|
||||
|
||||
len = strlen(name);
|
||||
|
||||
for(i = 0, count = 0; i < len; i++) {
|
||||
if (name[i] == '.')
|
||||
count++;
|
||||
}
|
||||
|
||||
/* don't count initial wildcard */
|
||||
if (name[0] == '*')
|
||||
if (count)
|
||||
count--;
|
||||
|
||||
/* don't count the null label for root. */
|
||||
/* if terminating '.' not found, must adjust */
|
||||
/* count to include last label */
|
||||
if (len > 0 && name[len-1] != '.')
|
||||
count++;
|
||||
return (count);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Make dates expressed in seconds-since-Jan-1-1970 easy to read.
|
||||
* SIG records are required to be printed like this, by the Secure DNS RFC.
|
||||
*/
|
||||
char *
|
||||
__p_secstodate (secs)
|
||||
unsigned long secs;
|
||||
{
|
||||
static char output[15]; /* YYYYMMDDHHMMSS and null */
|
||||
time_t clock = secs;
|
||||
struct tm *time;
|
||||
|
||||
time = gmtime(&clock);
|
||||
time->tm_year += 1900;
|
||||
time->tm_mon += 1;
|
||||
sprintf(output, "%04d%02d%02d%02d%02d%02d",
|
||||
time->tm_year, time->tm_mon, time->tm_mday,
|
||||
time->tm_hour, time->tm_min, time->tm_sec);
|
||||
return (output);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
|
||||
static char rcsid[] = "$Id: res_init.c,v 8.5 1996/08/05 08:31:35 vixie Exp $";
|
||||
static char rcsid[] = "$Id: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -126,7 +126,11 @@ static u_int32_t net_mask __P((struct in_addr));
|
||||
* Resolver state default settings.
|
||||
*/
|
||||
|
||||
struct __res_state _res;
|
||||
struct __res_state _res
|
||||
# if defined(__BIND_RES_TEXT)
|
||||
= { RES_TIMEOUT, } /* Motorola, et al. */
|
||||
# endif
|
||||
;
|
||||
|
||||
/*
|
||||
* Set up default settings. If the configuration file exist, the values
|
||||
@ -641,7 +645,7 @@ netinfo_res_init(haveenv, havesearch)
|
||||
}
|
||||
#endif /* NeXT */
|
||||
|
||||
u_int16_t
|
||||
u_int
|
||||
res_randomid()
|
||||
{
|
||||
struct timeval now;
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: res_mkquery.c,v 8.4 1996/08/05 08:31:35 vixie Exp $";
|
||||
static char rcsid[] = "$Id: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -94,9 +94,6 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen)
|
||||
register HEADER *hp;
|
||||
register u_char *cp;
|
||||
register int n;
|
||||
#ifdef ALLOW_UPDATES
|
||||
struct rrec *newrr = (struct rrec *) newrr_in;
|
||||
#endif
|
||||
u_char *dnptrs[20], **dpp, **lastdnptr;
|
||||
|
||||
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
|
||||
@ -186,63 +183,6 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen)
|
||||
hp->ancount = htons(1);
|
||||
break;
|
||||
|
||||
#ifdef ALLOW_UPDATES
|
||||
/*
|
||||
* For UPDATEM/UPDATEMA, do UPDATED/UPDATEDA followed by UPDATEA
|
||||
* (Record to be modified is followed by its replacement in msg.)
|
||||
*/
|
||||
case UPDATEM:
|
||||
case UPDATEMA:
|
||||
|
||||
case UPDATED:
|
||||
/*
|
||||
* The res code for UPDATED and UPDATEDA is the same; user
|
||||
* calls them differently: specifies data for UPDATED; server
|
||||
* ignores data if specified for UPDATEDA.
|
||||
*/
|
||||
case UPDATEDA:
|
||||
buflen -= RRFIXEDSZ + datalen;
|
||||
if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
|
||||
return (-1);
|
||||
cp += n;
|
||||
__putshort(type, cp);
|
||||
cp += INT16SZ;
|
||||
__putshort(class, cp);
|
||||
cp += INT16SZ;
|
||||
__putlong(0, cp);
|
||||
cp += INT32SZ;
|
||||
__putshort(datalen, cp);
|
||||
cp += INT16SZ;
|
||||
if (datalen) {
|
||||
bcopy(data, cp, datalen);
|
||||
cp += datalen;
|
||||
}
|
||||
if ( (op == UPDATED) || (op == UPDATEDA) ) {
|
||||
hp->ancount = htons(0);
|
||||
break;
|
||||
}
|
||||
/* Else UPDATEM/UPDATEMA, so drop into code for UPDATEA */
|
||||
|
||||
case UPDATEA: /* Add new resource record */
|
||||
buflen -= RRFIXEDSZ + datalen;
|
||||
if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
|
||||
return (-1);
|
||||
cp += n;
|
||||
__putshort(newrr->r_type, cp);
|
||||
cp += INT16SZ;
|
||||
__putshort(newrr->r_class, cp);
|
||||
cp += INT16SZ;
|
||||
__putlong(0, cp);
|
||||
cp += INT32SZ;
|
||||
__putshort(newrr->r_size, cp);
|
||||
cp += INT16SZ;
|
||||
if (newrr->r_size) {
|
||||
bcopy(newrr->r_data, cp, newrr->r_size);
|
||||
cp += newrr->r_size;
|
||||
}
|
||||
hp->ancount = htons(0);
|
||||
break;
|
||||
#endif /* ALLOW_UPDATES */
|
||||
default:
|
||||
return (-1);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: res_query.c,v 8.7 1996/08/05 08:31:35 vixie Exp $";
|
||||
static char rcsid[] = "$Id: res_query.c,v 8.9 1996/09/22 00:13:28 vixie Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -86,7 +86,7 @@ static char rcsid[] = "$Id: res_query.c,v 8.7 1996/08/05 08:31:35 vixie Exp $";
|
||||
#define MAXPACKET 1024
|
||||
#endif
|
||||
|
||||
char *__hostalias __P((const char *));
|
||||
const char *hostalias __P((const char *));
|
||||
int h_errno;
|
||||
|
||||
/*
|
||||
@ -321,7 +321,7 @@ res_querydomain(name, domain, class, type, answer, anslen)
|
||||
u_char *answer; /* buffer to put answer */
|
||||
int anslen; /* size of answer */
|
||||
{
|
||||
char nbuf[2*MAXDNAME+2];
|
||||
char nbuf[MAXDNAME];
|
||||
const char *longname = nbuf;
|
||||
int n;
|
||||
|
||||
@ -351,8 +351,8 @@ res_querydomain(name, domain, class, type, answer, anslen)
|
||||
return (res_query(longname, class, type, answer, anslen));
|
||||
}
|
||||
|
||||
char *
|
||||
__hostalias(name)
|
||||
const char *
|
||||
hostalias(name)
|
||||
register const char *name;
|
||||
{
|
||||
register char *cp1, *cp2;
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: res_send.c,v 8.9 1996/08/05 08:31:35 vixie Exp $";
|
||||
static char rcsid[] = "$Id: res_send.c,v 8.12 1996/10/08 04:51:06 vixie Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* change this to "0"
|
||||
@ -94,8 +94,6 @@ static char rcsid[] = "$Id: res_send.c,v 8.9 1996/08/05 08:31:35 vixie Exp $";
|
||||
# include <../conf/options.h>
|
||||
#endif
|
||||
|
||||
void _res_close __P((void));
|
||||
|
||||
static int s = -1; /* socket used for communications */
|
||||
static int connected = 0; /* is the socket connected */
|
||||
static int vc = 0; /* is the socket a virtual ciruit? */
|
||||
@ -320,7 +318,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
struct sockaddr_in *nsap = &_res.nsaddr_list[ns];
|
||||
same_ns:
|
||||
if (badns & (1 << ns)) {
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
|
||||
@ -337,7 +335,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
done = 1;
|
||||
break;
|
||||
case res_nextns:
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
case res_done:
|
||||
return (resplen);
|
||||
@ -372,7 +370,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
truncated = 0;
|
||||
if ((s < 0) || (!vc)) {
|
||||
if (s >= 0)
|
||||
_res_close();
|
||||
res_close();
|
||||
|
||||
s = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (s < 0) {
|
||||
@ -387,7 +385,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
Aerror(stderr, "connect/vc",
|
||||
errno, *nsap);
|
||||
badns |= (1 << ns);
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
vc = 1;
|
||||
@ -404,7 +402,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
terrno = errno;
|
||||
Perror(stderr, "write failed", errno);
|
||||
badns |= (1 << ns);
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
/*
|
||||
@ -421,7 +419,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
if (n <= 0) {
|
||||
terrno = errno;
|
||||
Perror(stderr, "read failed", errno);
|
||||
_res_close();
|
||||
res_close();
|
||||
/*
|
||||
* A long running process might get its TCP
|
||||
* connection reset if the remote server was
|
||||
@ -433,10 +431,10 @@ res_send(buf, buflen, ans, anssiz)
|
||||
*/
|
||||
if (terrno == ECONNRESET && !connreset) {
|
||||
connreset = 1;
|
||||
_res_close();
|
||||
res_close();
|
||||
goto same_ns;
|
||||
}
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
resplen = _getshort(ans);
|
||||
@ -457,7 +455,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
if (n <= 0) {
|
||||
terrno = errno;
|
||||
Perror(stderr, "read(vc)", errno);
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
if (truncated) {
|
||||
@ -504,7 +502,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
|
||||
if ((s < 0) || vc) {
|
||||
if (vc)
|
||||
_res_close();
|
||||
res_close();
|
||||
s = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
#if !CAN_RECONNECT
|
||||
@ -544,7 +542,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
"connect(dg)",
|
||||
errno, *nsap);
|
||||
badns |= (1 << ns);
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
connected = 1;
|
||||
@ -552,7 +550,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
if (send(s, (char*)buf, buflen, 0) != buflen) {
|
||||
Perror(stderr, "send", errno);
|
||||
badns |= (1 << ns);
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
} else {
|
||||
@ -589,7 +587,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
!= buflen) {
|
||||
Aerror(stderr, "sendto", errno, *nsap);
|
||||
badns |= (1 << ns);
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
}
|
||||
@ -612,7 +610,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
if (errno == EINTR)
|
||||
goto wait;
|
||||
Perror(stderr, "select", errno);
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
if (n == 0) {
|
||||
@ -622,7 +620,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
Dprint(_res.options & RES_DEBUG,
|
||||
(stdout, ";; timeout\n"));
|
||||
gotsomewhere = 1;
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
errno = 0;
|
||||
@ -631,7 +629,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
(struct sockaddr *)&from, &fromlen);
|
||||
if (resplen <= 0) {
|
||||
Perror(stderr, "recvfrom", errno);
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
}
|
||||
gotsomewhere = 1;
|
||||
@ -683,7 +681,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
(stdout, "server rejected query:\n"),
|
||||
ans, (resplen>anssiz)?anssiz:resplen);
|
||||
badns |= (1 << ns);
|
||||
_res_close();
|
||||
res_close();
|
||||
/* don't retry if called from dig */
|
||||
if (!_res.pfcode)
|
||||
goto next_ns;
|
||||
@ -696,7 +694,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
Dprint(_res.options & RES_DEBUG,
|
||||
(stdout, ";; truncated answer\n"));
|
||||
v_circuit = 1;
|
||||
_res_close();
|
||||
res_close();
|
||||
goto same_ns;
|
||||
}
|
||||
} /*if vc/dg*/
|
||||
@ -718,7 +716,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
*/
|
||||
if ((v_circuit && (!(_res.options & RES_USEVC) || ns != 0)) ||
|
||||
!(_res.options & RES_STAYOPEN)) {
|
||||
_res_close();
|
||||
res_close();
|
||||
}
|
||||
if (Rhook) {
|
||||
int done = 0, loops = 0;
|
||||
@ -734,7 +732,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
done = 1;
|
||||
break;
|
||||
case res_nextns:
|
||||
_res_close();
|
||||
res_close();
|
||||
goto next_ns;
|
||||
case res_modified:
|
||||
/* give the hook another try */
|
||||
@ -753,7 +751,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
next_ns: ;
|
||||
} /*foreach ns*/
|
||||
} /*foreach retry*/
|
||||
_res_close();
|
||||
res_close();
|
||||
if (!v_circuit)
|
||||
if (!gotsomewhere)
|
||||
errno = ECONNREFUSED; /* no nameservers found */
|
||||
@ -772,7 +770,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
* This routine is not expected to be user visible.
|
||||
*/
|
||||
void
|
||||
_res_close()
|
||||
res_close()
|
||||
{
|
||||
if (s >= 0) {
|
||||
(void) close(s);
|
||||
@ -781,3 +779,26 @@ _res_close()
|
||||
vc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ultrix
|
||||
/* ultrix 4.0 had some icky packaging in its libc.a. alias for it here.
|
||||
* there is more gunk of this kind over in res_debug.c.
|
||||
*/
|
||||
|
||||
void
|
||||
_res_close()
|
||||
{
|
||||
res_close();
|
||||
}
|
||||
|
||||
#undef res_send
|
||||
int
|
||||
res_send(buf, buflen, ans, anssiz)
|
||||
const u_char *buf;
|
||||
int buflen;
|
||||
u_char *ans;
|
||||
int anssiz;
|
||||
{
|
||||
return (__res_send(buf, buflen, ans, anssiz));
|
||||
}
|
||||
#endif /* Ultrix 4.0 hackery */
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)sethostent.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: sethostent.c,v 8.4 1996/08/05 08:31:35 vixie Exp $";
|
||||
static char rcsid[] = "$Id: sethostent.c,v 8.5 1996/09/28 06:51:07 vixie Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -43,8 +43,6 @@ static char rcsid[] = "$Id: sethostent.c,v 8.4 1996/08/05 08:31:35 vixie Exp $";
|
||||
#include <netdb.h>
|
||||
#include <resolv.h>
|
||||
|
||||
void _res_close __P((void));
|
||||
|
||||
void
|
||||
sethostent(stayopen)
|
||||
int stayopen;
|
||||
@ -59,5 +57,5 @@ void
|
||||
endhostent()
|
||||
{
|
||||
_res.options &= ~(RES_STAYOPEN | RES_USEVC);
|
||||
_res_close();
|
||||
res_close();
|
||||
}
|
||||
|
@ -54,82 +54,32 @@ char *argv[];
|
||||
case 'h' : strcpy(name, optarg);
|
||||
break;
|
||||
|
||||
case 'c' : if (!strcasecmp(optarg, "IN"))
|
||||
class = C_IN;
|
||||
else if (!strcasecmp(optarg, "HS"))
|
||||
class = C_HS;
|
||||
else if (!strcasecmp(optarg, "CHAOS"))
|
||||
class = C_CHAOS;
|
||||
else if (!strcasecmp(optarg, "ANY"))
|
||||
class = C_ANY;
|
||||
else {
|
||||
class = T_ANY;
|
||||
fprintf(stderr, "optarg=%s\n", optarg);
|
||||
}
|
||||
break;
|
||||
case 'c' : {
|
||||
int success, proto_class;
|
||||
|
||||
case 't' : if (!strcasecmp(optarg, "A"))
|
||||
type = T_A;
|
||||
else if (!strcasecmp(optarg, "NS"))
|
||||
type = T_NS;
|
||||
else if (!strcasecmp(optarg, "MD"))
|
||||
type = T_MD;
|
||||
else if (!strcasecmp(optarg, "MF"))
|
||||
type = T_MF;
|
||||
else if (!strcasecmp(optarg, "CNAME"))
|
||||
type = T_CNAME;
|
||||
else if (!strcasecmp(optarg, "SOA"))
|
||||
type = T_SOA;
|
||||
else if (!strcasecmp(optarg, "MB"))
|
||||
type = T_MB;
|
||||
else if (!strcasecmp(optarg, "MG"))
|
||||
type = T_MG;
|
||||
else if (!strcasecmp(optarg, "MR"))
|
||||
type = T_MR;
|
||||
else if (!strcasecmp(optarg, "NULL"))
|
||||
type = T_NULL;
|
||||
else if (!strcasecmp(optarg, "WKS"))
|
||||
type = T_WKS;
|
||||
else if (!strcasecmp(optarg, "PTR"))
|
||||
type = T_PTR;
|
||||
else if (!strcasecmp(optarg, "HINFO"))
|
||||
type = T_HINFO;
|
||||
else if (!strcasecmp(optarg, "MINFO"))
|
||||
type = T_MINFO;
|
||||
else if (!strcasecmp(optarg, "MX"))
|
||||
type = T_MX;
|
||||
else if (!strcasecmp(optarg, "TXT"))
|
||||
type = T_TXT;
|
||||
else if (!strcasecmp(optarg, "RP"))
|
||||
type = T_RP;
|
||||
else if (!strcasecmp(optarg, "AFSDB"))
|
||||
type = T_AFSDB;
|
||||
else if (!strcasecmp(optarg, "ANY"))
|
||||
type = T_ANY;
|
||||
else if (!strcasecmp(optarg, "X25"))
|
||||
type = T_X25;
|
||||
else if (!strcasecmp(optarg, "ISDN"))
|
||||
type = T_ISDN;
|
||||
else if (!strcasecmp(optarg, "RT"))
|
||||
type = T_RT;
|
||||
else if (!strcasecmp(optarg, "NSAP"))
|
||||
type = T_NSAP;
|
||||
else if (!strcasecmp(optarg, "SIG"))
|
||||
type = T_SIG;
|
||||
else if (!strcasecmp(optarg, "KEY"))
|
||||
type = T_KEY;
|
||||
else if (!strcasecmp(optarg, "PX"))
|
||||
type = T_PX;
|
||||
else if (!strcasecmp(optarg, "GPOS"))
|
||||
type = T_GPOS;
|
||||
else if (!strcasecmp(optarg, "AAAA"))
|
||||
type = T_AAAA;
|
||||
else if (!strcasecmp(optarg, "LOC"))
|
||||
type = T_LOC;
|
||||
proto_class = sym_ston(__p_class_syms,
|
||||
optarg, &success);
|
||||
if (success)
|
||||
class = proto_class;
|
||||
else {
|
||||
fprintf(stderr, "Bad type (%s)\n", optarg);
|
||||
fprintf(stderr, "Bad class (%s)\n", optarg);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 't' : {
|
||||
int success, proto_type;
|
||||
|
||||
proto_type = sym_ston(__p_type_syms,
|
||||
optarg, &success);
|
||||
if (success)
|
||||
type = proto_type;
|
||||
else {
|
||||
fprintf(stderr, "Bad type (%s)\n", optarg);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'd' : debug++;
|
||||
|
@ -67,7 +67,7 @@ char copyright[] =
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: host.c,v 8.8 1995/12/06 20:34:52 vixie Exp $";
|
||||
static char rcsid[] = "$Id: host.c,v 8.12 1996/10/08 04:51:07 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -121,8 +121,8 @@ int list = 0;
|
||||
int server_specified = 0;
|
||||
|
||||
u_char *pr_cdname();
|
||||
char *pr_class(), *pr_rr(), *pr_type();
|
||||
extern char *hostalias();
|
||||
char *pr_class(), *pr_rr();
|
||||
const char *pr_type();
|
||||
|
||||
main(c, v)
|
||||
int c;
|
||||
@ -268,82 +268,36 @@ main(c, v)
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
parsetype(s)
|
||||
char *s;
|
||||
{
|
||||
if (strcmp(s,"a") == 0)
|
||||
return(T_A);
|
||||
if (strcmp(s,"ns") == 0)
|
||||
return(T_NS);
|
||||
if (strcmp(s,"md") == 0)
|
||||
return(T_MD);
|
||||
if (strcmp(s,"mf") == 0)
|
||||
return(T_MF);
|
||||
if (strcmp(s,"cname") == 0)
|
||||
return(T_CNAME);
|
||||
if (strcmp(s,"soa") == 0)
|
||||
return(T_SOA);
|
||||
if (strcmp(s,"mb") == 0)
|
||||
return(T_MB);
|
||||
if (strcmp(s,"mg") == 0)
|
||||
return(T_MG);
|
||||
if (strcmp(s,"mr") == 0)
|
||||
return(T_MR);
|
||||
if (strcmp(s,"null") == 0)
|
||||
return(T_NULL);
|
||||
if (strcmp(s,"wks") == 0)
|
||||
return(T_WKS);
|
||||
if (strcmp(s,"ptr") == 0)
|
||||
return(T_PTR);
|
||||
if (strcmp(s,"hinfo") == 0)
|
||||
return(T_HINFO);
|
||||
if (strcmp(s,"minfo") == 0)
|
||||
return(T_MINFO);
|
||||
if (strcmp(s,"mx") == 0)
|
||||
return(T_MX);
|
||||
if (strcmp(s,"txt") == 0)
|
||||
return(T_TXT);
|
||||
if (strcmp(s,"rp") == 0)
|
||||
return(T_RP);
|
||||
if (strcmp(s,"afsdb") == 0)
|
||||
return(T_AFSDB);
|
||||
if (strcmp(s,"x25") == 0)
|
||||
return(T_X25);
|
||||
if (strcmp(s,"isdn") == 0)
|
||||
return(T_ISDN);
|
||||
if (strcmp(s,"rt") == 0)
|
||||
return(T_RT);
|
||||
if (strcmp(s,"uinfo") == 0)
|
||||
return(T_UINFO);
|
||||
if (strcmp(s,"uid") == 0)
|
||||
return(T_UID);
|
||||
if (strcmp(s,"gid") == 0)
|
||||
return(T_GID);
|
||||
if (strcmp(s,"unspec") == 0)
|
||||
return(T_UNSPEC);
|
||||
if (strcmp(s,"any") == 0)
|
||||
return(T_ANY);
|
||||
if (strcmp(s,"*") == 0)
|
||||
return(T_ANY);
|
||||
if (atoi(s))
|
||||
return(atoi(s));
|
||||
fprintf(stderr, "Invalid query type: %s\n", s);
|
||||
exit(2);
|
||||
int type, success;
|
||||
|
||||
type = sym_ston(__p_type_syms, s, &success);
|
||||
if (success)
|
||||
return type;
|
||||
if (strcmp(s,"*") == 0)
|
||||
return(T_ANY);
|
||||
if (atoi(s))
|
||||
return(atoi(s));
|
||||
fprintf(stderr, "Invalid query type: %s\n", s);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
parseclass(s)
|
||||
char *s;
|
||||
{
|
||||
if (strcmp(s,"in") == 0)
|
||||
return(C_IN);
|
||||
if (strcmp(s,"hs") == 0)
|
||||
return(C_HS);
|
||||
if (strcmp(s,"any") == 0)
|
||||
return(C_ANY);
|
||||
if (atoi(s))
|
||||
return(atoi(s));
|
||||
fprintf(stderr, "Invalid query class: %s\n", s);
|
||||
exit(2);
|
||||
int class, success;
|
||||
|
||||
class = sym_ston(__p_class_syms, s, &success);
|
||||
if (success)
|
||||
return class;
|
||||
if (atoi(s))
|
||||
return(atoi(s));
|
||||
fprintf(stderr, "Invalid query class: %s\n", s);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
printanswer(hp)
|
||||
@ -438,6 +392,12 @@ switch(errnum) {
|
||||
case T_GID:
|
||||
fprintf(stderr,"a Group ID.\n");
|
||||
break;
|
||||
case T_SRV:
|
||||
fprintf(stderr,"a Server Selector.\n");
|
||||
break;
|
||||
case T_NAPTR:
|
||||
fprintf(stderr,"a URN Naming Authority.\n");
|
||||
break;
|
||||
case T_UNSPEC:
|
||||
fprintf(stderr,"any Unspecified Format data.\n");
|
||||
break;
|
||||
@ -460,7 +420,8 @@ static u_char hostbuf[BUFSIZ+1];
|
||||
gethostinfo(name)
|
||||
char *name;
|
||||
{
|
||||
register char *cp, **domain;
|
||||
char *cp, **domain;
|
||||
const char *tp;
|
||||
u_int n;
|
||||
int hp;
|
||||
int nDomain;
|
||||
@ -479,11 +440,11 @@ gethostinfo(name)
|
||||
cp[-1] = '.';
|
||||
return (hp);
|
||||
}
|
||||
if (n == 0 && (cp = hostalias(name))) {
|
||||
if (n == 0 && (tp = hostalias(name))) {
|
||||
if (verbose)
|
||||
printf("Aliased to \"%s\"\n", cp);
|
||||
printf("Aliased to \"%s\"\n", tp);
|
||||
_res.options |= RES_DEFNAMES;
|
||||
return (getdomaininfo(cp, (char *)NULL));
|
||||
return (getdomaininfo(tp, (char *)NULL));
|
||||
}
|
||||
if (n >= _res.ndots) {
|
||||
asis = 1;
|
||||
@ -549,7 +510,7 @@ getinfo(name, domain, type)
|
||||
querybuf buf, answer;
|
||||
int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen;
|
||||
u_short pref, class;
|
||||
char host[2*MAXDNAME+2];
|
||||
char host[MAXDNAME];
|
||||
|
||||
if (domain == NULL)
|
||||
(void)sprintf(host, "%.*s", MAXDNAME, name);
|
||||
@ -573,7 +534,7 @@ getinfo(name, domain, type)
|
||||
}
|
||||
eom = (char *)&answer + n;
|
||||
return(printinfo(&answer, eom, T_ANY, 0));
|
||||
}
|
||||
}
|
||||
|
||||
printinfo(answer, eom, filter, isls)
|
||||
querybuf *answer;
|
||||
@ -826,6 +787,64 @@ pr_rr(cp, msg, file, filter)
|
||||
fprintf(file, "%s", name);
|
||||
break;
|
||||
|
||||
case T_SRV:
|
||||
/* priority */
|
||||
if (doprint)
|
||||
fprintf(file," %d", _getshort(cp));
|
||||
cp += sizeof(u_short);
|
||||
/* weight */
|
||||
if (doprint)
|
||||
fprintf(file," %d", _getshort(cp));
|
||||
cp += sizeof(u_short);
|
||||
/* port */
|
||||
if (doprint)
|
||||
fprintf(file," %d", _getshort(cp));
|
||||
cp += sizeof(u_short);
|
||||
/* target */
|
||||
cp = (u_char *)pr_cdname(cp, msg, name, sizeof(name));
|
||||
if (doprint)
|
||||
fprintf(file,"%s",name);
|
||||
break;
|
||||
|
||||
case T_NAPTR:
|
||||
/* order */
|
||||
if (doprint)
|
||||
fprintf(file," %d", _getshort(cp));
|
||||
cp += sizeof(u_short);
|
||||
/* preference */
|
||||
if (doprint)
|
||||
fprintf(file," %d", _getshort(cp));
|
||||
cp += sizeof(u_short);
|
||||
/* Flags */
|
||||
n = *cp++;
|
||||
if (doprint)
|
||||
if(n)
|
||||
fprintf(file,"%c%.*s", punc, n, cp);
|
||||
else
|
||||
fprintf(file,"%c\"\"",punc);
|
||||
cp += n;
|
||||
/* Service */
|
||||
n = *cp++;
|
||||
if (doprint)
|
||||
if(n)
|
||||
fprintf(file,"%c%.*s", punc, n, cp);
|
||||
else
|
||||
fprintf(file,"%c\"\"",punc);
|
||||
cp += n;
|
||||
/* Regexp */
|
||||
n = *cp++;
|
||||
if (doprint)
|
||||
if(n)
|
||||
fprintf(file,"%c%.*s", punc, n, cp);
|
||||
else
|
||||
fprintf(file,"%c\"\"",punc);
|
||||
cp += n;
|
||||
/* replacement */
|
||||
cp = (u_char *)pr_cdname(cp, msg, name, sizeof(name));
|
||||
if (doprint)
|
||||
fprintf(file,"%s",name);
|
||||
break;
|
||||
|
||||
case T_MINFO:
|
||||
case T_RP:
|
||||
cp = (u_char *)pr_cdname(cp, msg, name, sizeof(name));
|
||||
@ -842,31 +861,37 @@ pr_rr(cp, msg, file, filter)
|
||||
fprintf(file, " %s", name);
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
case T_X25:
|
||||
if (n = *cp++) {
|
||||
if (doprint)
|
||||
fprintf(file,"%c%.*s", punc, n, cp);
|
||||
cp += n;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
{
|
||||
int n,j;
|
||||
u_char * end = cp + dlen;
|
||||
|
||||
if (doprint)
|
||||
(void) fputs(" \"", file);
|
||||
while (cp < end) {
|
||||
if (n = *cp++) {
|
||||
for (j = n; j > 0 && cp < end ; j --)
|
||||
if ((*cp == '\n') || (*cp == '"')) {
|
||||
if (doprint){
|
||||
if (doprint)
|
||||
(void) fputs(" \"", file);
|
||||
if (n = *cp++)
|
||||
for (j = n; j > 0 && cp < end ; j --) {
|
||||
if (doprint) {
|
||||
if ((*cp == '\n') || (*cp == '"') || (*cp == '\\'))
|
||||
(void) putc('\\', file);
|
||||
(void) putc(*cp++, file);
|
||||
}
|
||||
} else
|
||||
if (doprint)
|
||||
(void) putc(*cp++, file);
|
||||
}
|
||||
(void) putc(*cp, file);
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
if (doprint)
|
||||
(void) putc('"', file);
|
||||
}
|
||||
if (doprint)
|
||||
(void) fputs("\"", file);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_UINFO:
|
||||
if (doprint)
|
||||
fprintf(file,"%c%s", punc, cp);
|
||||
@ -929,78 +954,33 @@ pr_rr(cp, msg, file, filter)
|
||||
return (char *)cp;
|
||||
}
|
||||
|
||||
static char nbuf[20];
|
||||
|
||||
/*
|
||||
* Return a string for the type
|
||||
* Return a string for the type. A few get special treatment when
|
||||
* not in verbose mode, to make the program more chatty and easier to
|
||||
* understand.
|
||||
*/
|
||||
char *
|
||||
const char *
|
||||
pr_type(type)
|
||||
int type;
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
if (!verbose) switch (type) {
|
||||
case T_A:
|
||||
return(verbose? "A" : "has address");
|
||||
case T_NS: /* authoritative server */
|
||||
return("NS");
|
||||
#ifdef OLDRR
|
||||
case T_MD: /* mail destination */
|
||||
return("MD");
|
||||
case T_MF: /* mail forwarder */
|
||||
return("MF");
|
||||
#endif /* OLDRR */
|
||||
return("has address");
|
||||
case T_CNAME: /* connonical name */
|
||||
return(verbose? "CNAME" : "is a nickname for");
|
||||
case T_SOA: /* start of authority zone */
|
||||
return("SOA");
|
||||
case T_MB: /* mailbox domain name */
|
||||
return("MB");
|
||||
case T_MG: /* mail group member */
|
||||
return("MG");
|
||||
return("is a nickname for");
|
||||
case T_MX: /* mail routing info */
|
||||
return(verbose? "MX" : "mail is handled");
|
||||
return("mail is handled");
|
||||
case T_TXT: /* TXT - descriptive info */
|
||||
return(verbose? "TXT" : "descriptive text");
|
||||
return("descriptive text");
|
||||
case T_AFSDB: /* AFS/DCE info */
|
||||
return(verbose? "AFSDB" : "DCE or AFS service from");
|
||||
case T_X25: /* X25 */
|
||||
return(verbose? "X25" : "X25 address");
|
||||
case T_ISDN: /* ISDN */
|
||||
return(verbose? "ISDN" : "ISDN address");
|
||||
case T_RT: /* Router */
|
||||
return(verbose? "RT" : "router");
|
||||
case T_MR: /* mail rename name */
|
||||
return("MR");
|
||||
case T_NULL: /* null resource record */
|
||||
return("NULL");
|
||||
case T_WKS: /* well known service */
|
||||
return("WKS");
|
||||
case T_PTR: /* domain name pointer */
|
||||
return("PTR");
|
||||
case T_HINFO: /* host information */
|
||||
return("HINFO");
|
||||
case T_MINFO: /* mailbox information */
|
||||
return("MINFO");
|
||||
case T_RP: /* responsible person */
|
||||
return(verbose?"RP":"responsible person");
|
||||
case T_AXFR: /* zone transfer */
|
||||
return("AXFR");
|
||||
case T_MAILB: /* mail box */
|
||||
return("MAILB");
|
||||
case T_MAILA: /* mail address */
|
||||
return("MAILA");
|
||||
case T_ANY: /* matches any type */
|
||||
return("ANY");
|
||||
case T_UINFO:
|
||||
return("UINFO");
|
||||
case T_UID:
|
||||
return("UID");
|
||||
case T_GID:
|
||||
return("GID");
|
||||
default:
|
||||
sprintf(nbuf, "%d", type);
|
||||
return nbuf;
|
||||
return("DCE or AFS service from");
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
return (sym_ntos(__p_type_syms, type, NULL));
|
||||
else
|
||||
return (sym_ntop(__p_type_syms, type, NULL));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1010,18 +990,18 @@ char *
|
||||
pr_class(class)
|
||||
int class;
|
||||
{
|
||||
static char spacestr[20];
|
||||
|
||||
switch (class) {
|
||||
if (!verbose) switch (class) {
|
||||
case C_IN: /* internet class */
|
||||
return(verbose? " IN" : "");
|
||||
case C_HS: /* internet class */
|
||||
return(verbose? " HS" : "");
|
||||
case C_ANY: /* matches any class */
|
||||
return(" ANY");
|
||||
default:
|
||||
(void) sprintf(nbuf," %d", class);
|
||||
return nbuf;
|
||||
return "";
|
||||
case C_HS: /* internet class FIXME? */
|
||||
return "";
|
||||
}
|
||||
|
||||
spacestr[0] = ' ';
|
||||
strcpy (&spacestr[1], p_class (class));
|
||||
return spacestr;
|
||||
}
|
||||
|
||||
u_char *
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)debug.c 5.26 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: debug.c,v 8.4 1996/05/21 07:04:38 vixie Exp $";
|
||||
static char rcsid[] = "$Id: debug.c,v 8.10 1996/12/18 04:09:50 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -141,6 +141,12 @@ Fprint_query(msg, eom, printHeader,file)
|
||||
fprintf(file,", want recursion");
|
||||
if (hp->ra)
|
||||
fprintf(file,", recursion avail.");
|
||||
if (hp->unused)
|
||||
fprintf(file,", UNUSED-QUERY_BIT");
|
||||
if (hp->ad)
|
||||
fprintf(file,", authentic data");
|
||||
if (hp->cd)
|
||||
fprintf(file,", checking disabled");
|
||||
fprintf(file,"\n\tquestions = %d", ntohs(hp->qdcount));
|
||||
fprintf(file,", answers = %d", ntohs(hp->ancount));
|
||||
fprintf(file,", authority records = %d", ntohs(hp->nscount));
|
||||
@ -170,6 +176,11 @@ Fprint_query(msg, eom, printHeader,file)
|
||||
*/
|
||||
if (n = ntohs(hp->ancount)) {
|
||||
fprintf(file," ANSWERS:\n");
|
||||
if (type == T_A && n > MAXADDRS) {
|
||||
printf("Limiting response to MAX Addrs = %d \n",
|
||||
MAXADDRS);
|
||||
n = MAXADDRS;
|
||||
}
|
||||
while (--n >= 0) {
|
||||
fprintf(file, INDENT);
|
||||
cp = Print_rr(cp, msg, eom, file);
|
||||
@ -248,17 +259,17 @@ Print_cdname2(cp, msg, eom, file)
|
||||
* Print resource record fields in human readable form.
|
||||
*/
|
||||
u_char *
|
||||
Print_rr(cp, msg, eom, file)
|
||||
u_char *cp, *msg, *eom;
|
||||
Print_rr(ocp, msg, eom, file)
|
||||
u_char *ocp, *msg, *eom;
|
||||
FILE *file;
|
||||
{
|
||||
int type, class, dlen, n, c;
|
||||
u_int32_t rrttl, ttl;
|
||||
struct in_addr inaddr;
|
||||
u_char *cp1, *cp2;
|
||||
u_char *cp, *cp1, *cp2;
|
||||
int debug;
|
||||
|
||||
if ((cp = Print_cdname(cp, msg, eom, file)) == NULL) {
|
||||
if ((cp = Print_cdname(ocp, msg, eom, file)) == NULL) {
|
||||
fprintf(file, "(name truncated?)\n");
|
||||
return (NULL); /* compression error */
|
||||
}
|
||||
@ -333,6 +344,45 @@ Print_rr(cp, msg, eom, file)
|
||||
cp += INT16SZ;
|
||||
fprintf(file,", mail exchanger = ");
|
||||
goto doname;
|
||||
|
||||
case T_NAPTR:
|
||||
fprintf(file, "\torder = %u",_getshort((u_char*)cp));
|
||||
cp += INT16SZ;
|
||||
fprintf(file,", preference = %u\n", _getshort((u_char*)cp));
|
||||
cp += INT16SZ;
|
||||
/* Flags */
|
||||
n = *cp++;
|
||||
fprintf(file,"\tflags = \"%.*s\"\n", (int)n, cp);
|
||||
cp += n;
|
||||
/* Service */
|
||||
n = *cp++;
|
||||
fprintf(file,"\tservices = \"%.*s\"\n", (int)n, cp);
|
||||
cp += n;
|
||||
/* Regexp */
|
||||
n = *cp++;
|
||||
fprintf(file,"\trule = \"%.*s\"\n", (int)n, cp);
|
||||
cp += n;
|
||||
/* Replacement */
|
||||
fprintf(file,"\treplacement = ");
|
||||
cp = Print_cdname(cp, msg, eom, file);
|
||||
if (cp == NULL) {
|
||||
fprintf(file, "(replacement truncated?)\n");
|
||||
return (NULL); /* compression error */
|
||||
}
|
||||
(void) putc('\n', file);
|
||||
|
||||
break;
|
||||
case T_SRV:
|
||||
fprintf(file, "\tpriority = %u",_getshort((u_char*)cp));
|
||||
cp += INT16SZ;
|
||||
fprintf(file,", weight = %u", _getshort((u_char*)cp));
|
||||
cp += INT16SZ;
|
||||
fprintf(file,", port= %u\n", _getshort((u_char*)cp));
|
||||
cp += INT16SZ;
|
||||
|
||||
fprintf(file,"\thost = ");
|
||||
goto doname;
|
||||
|
||||
case T_PX:
|
||||
fprintf(file,"\tpreference = %u",_getshort((u_char*)cp));
|
||||
cp += INT16SZ;
|
||||
@ -467,19 +517,22 @@ Print_rr(cp, msg, eom, file)
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
(void) fputs("\ttext = \"", file);
|
||||
(void) fputs("\ttext = ", file);
|
||||
cp2 = cp1 + dlen;
|
||||
while (cp < cp2) {
|
||||
(void) putc('"', file);
|
||||
if (n = (unsigned char) *cp++) {
|
||||
for (c = n; c > 0 && cp < cp2; c--)
|
||||
if ((*cp == '\n') || (*cp == '"')) {
|
||||
(void) putc('\\', file);
|
||||
(void) putc(*cp++, file);
|
||||
} else
|
||||
(void) putc(*cp++, file);
|
||||
for (c = n; c > 0 && cp < cp2; c--) {
|
||||
if ((*cp == '\n') || (*cp == '"') || (*cp == '\\'))
|
||||
(void) putc('\\', file);
|
||||
(void) putc(*cp++, file);
|
||||
}
|
||||
}
|
||||
(void) putc('"', file);
|
||||
if (cp < cp2)
|
||||
(void) putc(' ', file);
|
||||
}
|
||||
(void) fputs("\"\n", file);
|
||||
(void) putc('\n', file);
|
||||
break;
|
||||
|
||||
case T_X25:
|
||||
@ -506,8 +559,9 @@ Print_rr(cp, msg, eom, file)
|
||||
case T_AAAA: {
|
||||
char t[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
|
||||
|
||||
fprintf(file, "IPv6 address = %s\n",
|
||||
fprintf(file, "\tIPv6 address = %s\n",
|
||||
inet_ntop(AF_INET6, cp, t, sizeof t));
|
||||
cp += IN6ADDRSZ;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -574,7 +628,9 @@ Print_rr(cp, msg, eom, file)
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(file,"\t??? unknown type %d ???\n", type);
|
||||
fprintf(file,"\trecord type %d, interpreted as:\n", type);
|
||||
/* Let resolver library try to print it */
|
||||
p_rr(ocp, msg, file);
|
||||
cp += dlen;
|
||||
}
|
||||
if (_res.options & RES_DEBUG && type != T_SOA) {
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: getinfo.c,v 8.3 1995/12/29 07:16:27 vixie Exp $";
|
||||
static char rcsid[] = "$Id: getinfo.c,v 8.6 1996/12/02 09:17:24 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -85,11 +85,6 @@ static char rcsid[] = "$Id: getinfo.c,v 8.3 1995/12/29 07:16:27 vixie Exp $";
|
||||
extern char *_res_resultcodes[];
|
||||
extern char *res_skip();
|
||||
|
||||
#define MAXALIASES 35
|
||||
#define MAXADDRS 35
|
||||
#define MAXDOMAINS 35
|
||||
#define MAXSERVERS 10
|
||||
|
||||
static char *addr_list[MAXADDRS + 1];
|
||||
|
||||
static char *host_aliases[MAXALIASES];
|
||||
@ -313,6 +308,11 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (numAddresses >= MAXADDRS) {
|
||||
printf("MAXADDRS exceeded: skipping address\n");
|
||||
cp += dlen;
|
||||
continue;
|
||||
}
|
||||
bcopy(cp, *addrPtr++ = (char *)bp, dlen);
|
||||
bp +=dlen;
|
||||
cp += dlen;
|
||||
@ -570,7 +570,8 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
|
||||
{
|
||||
int n;
|
||||
register int result;
|
||||
register char *cp, **domain;
|
||||
register char **domain;
|
||||
const char *cp;
|
||||
Boolean got_nodata = FALSE;
|
||||
struct in_addr ina;
|
||||
Boolean tried_as_is = FALSE;
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)list.c 5.23 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: list.c,v 8.5 1996/05/21 07:04:38 vixie Exp $";
|
||||
static char rcsid[] = "$Id: list.c,v 8.9 1996/11/26 10:11:26 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -209,6 +209,8 @@ ListHosts(string, putToFile)
|
||||
qtype = T_WKS;
|
||||
} else if (strcmp("-d", option) == 0) {
|
||||
qtype = T_ANY;
|
||||
} else if (strcmp("-n", option) == 0) {
|
||||
qtype = T_NAPTR;
|
||||
} else {
|
||||
qtype = T_A;
|
||||
}
|
||||
@ -339,97 +341,6 @@ ListSubr(qtype, domain, cmd)
|
||||
defaultPtr->servers[0]->name);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (qtype == T_CNAME) {
|
||||
fprintf(filePtr, "%-30s", "Alias");
|
||||
} else if (qtype == T_TXT) {
|
||||
fprintf(filePtr, "%-30s", "Key");
|
||||
} else {
|
||||
fprintf(filePtr, "%-30s", "Host or domain name");
|
||||
}
|
||||
switch (qtype) {
|
||||
case T_A:
|
||||
fprintf(filePtr, " %-30s\n", "Internet Address");
|
||||
break;
|
||||
case T_AAAA:
|
||||
fprintf(filePtr, " %-30s\n", "IPv6 Address");
|
||||
break;
|
||||
case T_HINFO:
|
||||
fprintf(filePtr, " %-30s\n", "CPU & OS");
|
||||
break;
|
||||
case T_CNAME:
|
||||
fprintf(filePtr, " %-30s\n", "Canonical Name");
|
||||
break;
|
||||
case T_MX:
|
||||
fprintf(filePtr, " %-30s\n", "Metric & Host");
|
||||
break;
|
||||
case T_PX:
|
||||
fprintf(filePtr, " %-30s\n", "Mapping information");
|
||||
break;
|
||||
case T_AFSDB:
|
||||
fprintf(filePtr, " %-30s\n", "Subtype & Host");
|
||||
break;
|
||||
case T_X25:
|
||||
fprintf(filePtr, " %-30s\n", "X25 Address");
|
||||
break;
|
||||
case T_ISDN:
|
||||
fprintf(filePtr, " %-30s\n", "ISDN Address");
|
||||
break;
|
||||
case T_WKS:
|
||||
fprintf(filePtr, " %-4s %s\n", "Protocol", "Services");
|
||||
break;
|
||||
case T_MB:
|
||||
fprintf(filePtr, " %-30s\n", "Mailbox");
|
||||
break;
|
||||
case T_MG:
|
||||
fprintf(filePtr, " %-30s\n", "Mail Group");
|
||||
break;
|
||||
case T_MR:
|
||||
fprintf(filePtr, " %-30s\n", "Mail Rename");
|
||||
break;
|
||||
case T_MINFO:
|
||||
fprintf(filePtr, " %-30s\n", "Mail List Requests & Errors");
|
||||
break;
|
||||
case T_UINFO:
|
||||
fprintf(filePtr, " %-30s\n", "User Information");
|
||||
break;
|
||||
case T_UID:
|
||||
fprintf(filePtr, " %-30s\n", "User ID");
|
||||
break;
|
||||
case T_GID:
|
||||
fprintf(filePtr, " %-30s\n", "Group ID");
|
||||
break;
|
||||
case T_TXT:
|
||||
fprintf(filePtr, " %-30s\n", "Text");
|
||||
break;
|
||||
case T_RP:
|
||||
fprintf(filePtr, " %-30s\n", "Responsible Person");
|
||||
break;
|
||||
case T_RT:
|
||||
fprintf(filePtr, " %-30s\n", "Router");
|
||||
break;
|
||||
case T_NSAP:
|
||||
fprintf(filePtr, " %-30s\n", "NSAP address");
|
||||
break;
|
||||
case T_NSAP_PTR:
|
||||
fprintf(filePtr, " %-30s\n", "NSAP pointer");
|
||||
break;
|
||||
case T_NS:
|
||||
fprintf(filePtr, " %-30s\n", "Name Servers");
|
||||
break;
|
||||
case T_PTR:
|
||||
fprintf(filePtr, " %-30s\n", "Pointers");
|
||||
break;
|
||||
case T_SOA:
|
||||
fprintf(filePtr, " %-30s\n", "Start of Authority");
|
||||
break;
|
||||
case T_ANY:
|
||||
fprintf(filePtr, " %-30s\n", "Resource Record Info.");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
dname[0][0] = '\0';
|
||||
for (done = 0; !done; NULL) {
|
||||
unsigned short tmp;
|
||||
@ -810,22 +721,30 @@ PrintListInfo(file, msg, eom, qtype, domain)
|
||||
cp += nameLen;
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
case T_X25:
|
||||
if (n = *cp++) {
|
||||
fprintf(file," %.*s", n, cp);
|
||||
cp += n;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_TXT:
|
||||
{
|
||||
u_char *cp2 = cp + dlen;
|
||||
int c;
|
||||
|
||||
(void) fputs(" \"", file);
|
||||
while (cp < cp2)
|
||||
while (cp < cp2) {
|
||||
(void) putc('"', file);
|
||||
if (n = (unsigned char) *cp++)
|
||||
for (c = n; c > 0 && cp < cp2; c--)
|
||||
if (strchr("\n\"\\", *cp)) {
|
||||
for (c = n; c > 0 && cp < cp2; c--) {
|
||||
if (strchr("\n\"\\", *cp))
|
||||
(void) putc('\\', file);
|
||||
(void) putc(*cp++, file);
|
||||
} else
|
||||
(void) putc(*cp++, file);
|
||||
(void) putc('"', file);
|
||||
(void) putc(*cp++, file);
|
||||
}
|
||||
(void) putc('"', file);
|
||||
if (cp < cp2)
|
||||
(void) putc(' ', file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -838,9 +757,56 @@ PrintListInfo(file, msg, eom, qtype, domain)
|
||||
char t[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
|
||||
|
||||
fprintf(file, " %s", inet_ntop(AF_INET6, cp, t, sizeof t));
|
||||
cp += dlen;
|
||||
break;
|
||||
}
|
||||
|
||||
case T_LOC: {
|
||||
char t[255];
|
||||
|
||||
fprintf(file, "\t%s", loc_ntoa(cp, t));
|
||||
cp += dlen;
|
||||
break;
|
||||
}
|
||||
|
||||
case T_SRV: {
|
||||
u_int priority, weight, port;
|
||||
|
||||
priority = _getshort(cp); cp += INT16SZ;
|
||||
weight = _getshort(cp); cp += INT16SZ;
|
||||
port = _getshort(cp); cp += INT16SZ;
|
||||
fprintf(file, "\t%u %u %u ", priority, weight, port);
|
||||
if ((cp = (u_char *)Print_cdname(cp, msg, eom, file)) == NULL)
|
||||
return (ERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
case T_NAPTR: {
|
||||
u_int order, preference;
|
||||
|
||||
GETSHORT(order, cp);
|
||||
fprintf(file, "\t%u", order);
|
||||
|
||||
GETSHORT(preference, cp);
|
||||
fprintf(file, " %u", preference);
|
||||
|
||||
if (n = *cp++) {
|
||||
fprintf(file, " \"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
if (n = *cp++) {
|
||||
fprintf(file, " \"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
if (n = *cp++) {
|
||||
fprintf(file, " \"%.*s\"", (int)n, cp);
|
||||
cp += n;
|
||||
}
|
||||
if ((cp = (u_char *)Print_cdname(cp, msg, eom, file)) == NULL)
|
||||
return (ERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
case T_MINFO:
|
||||
case T_RP:
|
||||
(void) putc(' ', file);
|
||||
|
@ -61,7 +61,7 @@ char copyright[] =
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91";
|
||||
static char rcsid[] = "$Id: main.c,v 8.3 1996/06/02 08:20:41 vixie Exp $";
|
||||
static char rcsid[] = "$Id: main.c,v 8.4 1996/11/11 06:36:54 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -1102,7 +1102,9 @@ ReadRC()
|
||||
register char *cp;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if ((cp = getenv("HOME")) != NULL) {
|
||||
if ((cp = getenv("HOME")) != NULL &&
|
||||
(strlen(cp) + strlen(_PATH_NSLOOKUPRC)) < sizeof(buf)) {
|
||||
|
||||
(void) strcpy(buf, cp);
|
||||
(void) strcat(buf, _PATH_NSLOOKUPRC);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$Id: nslookup.help,v 8.3 1996/08/05 08:31:39 vixie Exp $
|
||||
$Id: nslookup.help,v 8.4 1996/10/08 04:51:08 vixie Exp $
|
||||
|
||||
Commands: (identifiers are shown in uppercase, [] means optional)
|
||||
NAME - print info about the host/domain NAME using default server
|
||||
@ -16,7 +16,7 @@ set OPTION - set an option
|
||||
root=NAME - set root server to NAME
|
||||
retry=X - set number of retries to X
|
||||
timeout=X - set initial time-out interval to X seconds
|
||||
querytype=X - set query type, e.g., A,ANY,CNAME,HINFO,MX,PX,NS,PTR,SOA,TXT,WKS
|
||||
querytype=X - set query type, e.g., A,ANY,CNAME,HINFO,MX,PX,NS,PTR,SOA,TXT,WKS,SRV,NAPTR
|
||||
port=X - set port number to send query on
|
||||
type=X - synonym for querytype
|
||||
class=X - set query class to one of IN (Internet), CHAOS, HESIOD or ANY
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
/*
|
||||
* @(#)res.h 5.10 (Berkeley) 6/1/90
|
||||
* $Id: res.h,v 8.1 1994/12/15 06:24:31 vixie Exp $
|
||||
* $Id: res.h,v 8.3 1996/12/02 09:17:24 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -77,6 +77,11 @@
|
||||
#define FALSE 0
|
||||
typedef int Boolean;
|
||||
|
||||
#define MAXALIASES 35
|
||||
#define MAXADDRS 35
|
||||
#define MAXDOMAINS 35
|
||||
#define MAXSERVERS 10
|
||||
|
||||
/*
|
||||
* Define return statuses in addtion to the ones defined in namserv.h
|
||||
* let SUCCESS be a synonym for NOERROR
|
||||
@ -159,8 +164,8 @@ extern int Print_query();
|
||||
extern unsigned char *Print_cdname();
|
||||
extern unsigned char *Print_cdname2(); /* fixed width */
|
||||
extern unsigned char *Print_rr();
|
||||
extern char *DecodeType(); /* descriptive version of p_type */
|
||||
extern char *DecodeError();
|
||||
extern const char *DecodeType(); /* descriptive version of p_type */
|
||||
extern const char *DecodeError();
|
||||
extern char *Calloc();
|
||||
extern char *Malloc();
|
||||
extern void NsError();
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)subr.c 5.24 (Berkeley) 3/2/91";
|
||||
static char rcsid[] = "$Id: subr.c,v 8.5 1996/05/21 07:04:38 vixie Exp $";
|
||||
static char rcsid[] = "$Id: subr.c,v 8.6 1996/08/08 06:54:51 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -84,6 +84,7 @@ static char rcsid[] = "$Id: subr.c,v 8.5 1996/05/21 07:04:38 vixie Exp $";
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include "resolv.h"
|
||||
#include "res.h"
|
||||
#include "../../conf/portability.h"
|
||||
|
||||
@ -371,28 +372,35 @@ OpenFile(string, file)
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
char *
|
||||
const struct res_sym error_syms[] = {
|
||||
{ NOERROR, "Success" },
|
||||
{ FORMERR, "Format error" },
|
||||
{ SERVFAIL, "Server failed" },
|
||||
{ NXDOMAIN, "Non-existent host/domain" },
|
||||
{ NOTIMP, "Not implemented" },
|
||||
{ REFUSED, "Query refused" },
|
||||
#ifdef NOCHANGE
|
||||
{ NOCHANGE, "No change" },
|
||||
#endif
|
||||
{ TIME_OUT, "Timed out" },
|
||||
{ NO_INFO, "No information" },
|
||||
{ ERROR, "Unspecified error" },
|
||||
{ NONAUTH, "Non-authoritative answer" },
|
||||
{ NO_RESPONSE, "No response from server" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
const char *
|
||||
DecodeError(result)
|
||||
int result;
|
||||
{
|
||||
switch (result) {
|
||||
case NOERROR: return("Success"); break;
|
||||
case FORMERR: return("Format error"); break;
|
||||
case SERVFAIL: return("Server failed"); break;
|
||||
case NXDOMAIN: return("Non-existent host/domain"); break;
|
||||
case NOTIMP: return("Not implemented"); break;
|
||||
case REFUSED: return("Query refused"); break;
|
||||
#ifdef NOCHANGE
|
||||
case NOCHANGE: return("No change"); break;
|
||||
#endif
|
||||
case TIME_OUT: return("Timed out"); break;
|
||||
case NO_INFO: return("No information"); break;
|
||||
case ERROR: return("Unspecified error"); break;
|
||||
case NONAUTH: return("Non-authoritative answer"); break;
|
||||
case NO_RESPONSE: return("No response from server"); break;
|
||||
default: break;
|
||||
}
|
||||
return("BAD ERROR VALUE");
|
||||
const char *string;
|
||||
int success;
|
||||
|
||||
string = sym_ntos(error_syms, result, &success);
|
||||
if (success)
|
||||
return string;
|
||||
return ("BAD ERROR VALUE");
|
||||
}
|
||||
|
||||
|
||||
@ -402,15 +410,12 @@ StringToClass(class, dflt, errorfile)
|
||||
int dflt;
|
||||
FILE *errorfile;
|
||||
{
|
||||
if (strcasecmp(class, "IN") == 0)
|
||||
return(C_IN);
|
||||
if (strcasecmp(class, "HESIOD") == 0 ||
|
||||
strcasecmp(class, "HS") == 0)
|
||||
return(C_HS);
|
||||
if (strcasecmp(class, "CHAOS") == 0)
|
||||
return(C_CHAOS);
|
||||
if (strcasecmp(class, "ANY") == 0)
|
||||
return(C_ANY);
|
||||
int result, success;
|
||||
|
||||
result = sym_ston(__p_class_syms, class, &success);
|
||||
if (success)
|
||||
return result;
|
||||
|
||||
if (errorfile)
|
||||
fprintf(errorfile, "unknown query class: %s\n", class);
|
||||
return(dflt);
|
||||
@ -434,67 +439,15 @@ StringToType(type, dflt, errorfile)
|
||||
int dflt;
|
||||
FILE *errorfile;
|
||||
{
|
||||
if (strcasecmp(type, "A") == 0)
|
||||
return(T_A);
|
||||
if (strcasecmp(type, "NS") == 0)
|
||||
return(T_NS); /* authoritative server */
|
||||
if (strcasecmp(type, "MX") == 0)
|
||||
return(T_MX); /* mail exchanger */
|
||||
if (strcasecmp(type, "PX") == 0)
|
||||
return(T_PX); /* mapping information */
|
||||
if (strcasecmp(type, "CNAME") == 0)
|
||||
return(T_CNAME); /* canonical name */
|
||||
if (strcasecmp(type, "SOA") == 0)
|
||||
return(T_SOA); /* start of authority zone */
|
||||
if (strcasecmp(type, "MB") == 0)
|
||||
return(T_MB); /* mailbox domain name */
|
||||
if (strcasecmp(type, "MG") == 0)
|
||||
return(T_MG); /* mail group member */
|
||||
if (strcasecmp(type, "MR") == 0)
|
||||
return(T_MR); /* mail rename name */
|
||||
if (strcasecmp(type, "WKS") == 0)
|
||||
return(T_WKS); /* well known service */
|
||||
if (strcasecmp(type, "PTR") == 0)
|
||||
return(T_PTR); /* domain name pointer */
|
||||
if (strcasecmp(type, "HINFO") == 0)
|
||||
return(T_HINFO); /* host information */
|
||||
if (strcasecmp(type, "MINFO") == 0)
|
||||
return(T_MINFO); /* mailbox information */
|
||||
if (strcasecmp(type, "AXFR") == 0)
|
||||
return(T_AXFR); /* zone transfer */
|
||||
if (strcasecmp(type, "MAILA") == 0)
|
||||
return(T_MAILA); /* mail agent */
|
||||
if (strcasecmp(type, "MAILB") == 0)
|
||||
return(T_MAILB); /* mail box */
|
||||
if (strcasecmp(type, "ANY") == 0)
|
||||
return(T_ANY); /* matches any type */
|
||||
if (strcasecmp(type, "UINFO") == 0)
|
||||
return(T_UINFO); /* user info */
|
||||
if (strcasecmp(type, "UID") == 0)
|
||||
return(T_UID); /* user id */
|
||||
if (strcasecmp(type, "GID") == 0)
|
||||
return(T_GID); /* group id */
|
||||
if (strcasecmp(type, "TXT") == 0)
|
||||
return(T_TXT); /* text */
|
||||
if (strcasecmp(type, "RP") == 0)
|
||||
return(T_RP); /* responsible person */
|
||||
if (strcasecmp(type, "X25") == 0)
|
||||
return(T_X25); /* x25 address */
|
||||
if (strcasecmp(type, "ISDN") == 0)
|
||||
return(T_ISDN); /* isdn address */
|
||||
if (strcasecmp(type, "RT") == 0)
|
||||
return(T_RT); /* router */
|
||||
if (strcasecmp(type, "AFSDB") == 0)
|
||||
return(T_AFSDB); /* DCE or AFS server */
|
||||
if (strcasecmp(type, "NSAP") == 0)
|
||||
return(T_NSAP); /* NSAP address */
|
||||
if (strcasecmp(type, "NSAP_PTR") == 0)
|
||||
return(T_NSAP_PTR); /* NSAP reverse pointer */
|
||||
if (strcasecmp(type, "AAAA") == 0)
|
||||
return(T_AAAA); /* IPv6 address */
|
||||
int result, success;
|
||||
|
||||
result = sym_ston(__p_type_syms, type, &success);
|
||||
if (success)
|
||||
return (result);
|
||||
|
||||
if (errorfile)
|
||||
fprintf(errorfile, "unknown query type: %s\n", type);
|
||||
return(dflt);
|
||||
return (dflt);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -509,75 +462,10 @@ StringToType(type, dflt, errorfile)
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
static char nbuf[20];
|
||||
|
||||
char *
|
||||
const char *
|
||||
DecodeType(type)
|
||||
int type;
|
||||
{
|
||||
switch (type) {
|
||||
case T_A:
|
||||
return("address");
|
||||
case T_AAAA:
|
||||
return("IPv6 address");
|
||||
case T_NS:
|
||||
return("name server");
|
||||
case T_CNAME:
|
||||
return("canonical name");
|
||||
case T_SOA:
|
||||
return("start of authority");
|
||||
case T_MB:
|
||||
return("mailbox");
|
||||
case T_MG:
|
||||
return("mail group member");
|
||||
case T_MR:
|
||||
return("mail rename");
|
||||
case T_NULL:
|
||||
return("null");
|
||||
case T_WKS:
|
||||
return("well-known service");
|
||||
case T_PTR:
|
||||
return("domain name pointer");
|
||||
case T_HINFO:
|
||||
return("host information");
|
||||
case T_MINFO:
|
||||
return("mailbox information");
|
||||
case T_MX:
|
||||
return("mail exchanger");
|
||||
case T_PX:
|
||||
return("mapping information");
|
||||
case T_TXT:
|
||||
return("text");
|
||||
case T_RP:
|
||||
return("responsible person");
|
||||
case T_AFSDB:
|
||||
return("DCE or AFS server");
|
||||
case T_X25:
|
||||
return("X25 address");
|
||||
case T_ISDN:
|
||||
return("ISDN address");
|
||||
case T_RT:
|
||||
return("router");
|
||||
case T_NSAP:
|
||||
return("nsap address");
|
||||
case T_NSAP_PTR:
|
||||
return("domain name pointer");
|
||||
case T_UINFO:
|
||||
return("user information");
|
||||
case T_UID:
|
||||
return("user ID");
|
||||
case T_GID:
|
||||
return("group ID");
|
||||
case T_AXFR:
|
||||
return("zone transfer");
|
||||
case T_MAILB:
|
||||
return("mailbox-related data");
|
||||
case T_MAILA:
|
||||
return("mail agent");
|
||||
case T_ANY:
|
||||
return("\"any\"");
|
||||
default:
|
||||
(void) sprintf(nbuf, "%d", type);
|
||||
return (nbuf);
|
||||
}
|
||||
|
||||
return (sym_ntop(__p_type_syms, type, (int *)0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user