----------------------------------------------------------------------------
BIND v4.9.7 Release                                         May 15th, 1998
						  
----------------------------------------------------------------------------
	NOTE:  This is user-supported, freeware

	A relevant book on the topic is "Bind and DNS", O'Reilly Publishing,
	which can be found at www.ora.com (second edition).
        There is also documentation with
	this release, in the file BOG.WRI.  It is in Windows Write format.

        NOTE: don't run uninstall to remove or update the bind service to 
              a new version just run the setup program again.

        NOW: A full win95 version.. ndc95, named95, ipadr95 xfer95 and a
             control panel applet are available... see notes below, 
             However ther is still a memory leak in the kernel relating 
             to networking...even after installing the kernel fix, and 
             an unreleased winsock32 fix. Although the memory leak is
             much smaller. 
             Also added a new patch to win95 for wsock32 ... which is supposed
             to fix a memory leak in multi-threaded socket apps (ie bind)..
             See the notes below about additional settings under WIN95 that
             may be necessary for the mail slot communications to work correctly.
             ALSO DO NOT EVEN ATTEMPT TO RUN BIND ON LESS THAN A 486 with 
             12 Megabytes of memory under WIN95, and less that 16 MEG on 
             Windows NT. 

NOTE: It has also been brought to our attention that the gui install does
not setup the zones 100% correctly for a CLASS A or CLASS B network. For now,
if you have either a Class A or B ..  you will have to manually edit the zones.
In general the reverse zone will look like a Class C (3 octets) instead of a 
2 octet Class B.  If you have a Class A or B network you should know what you
are doing anyway and be able to manually edit your zone files or you are in
big trouble :) ...

---------------------------------------------------------------------------------
WARNING:
The gui install program will NOW RUN on nt 4.0,
BUT you should NOT run bind on nt 4.0 workstation Beta 2 or RC 1 or 2
(server is ok) 
there is a new socket limit in 4.0 workstation Beta 2, or rc 1, 2
that lets you have only 10 sockets from differing ip's open before connections 
are rejected ... so until microsoft changes something (there is currently a big 
uproar over this.. they have changed their licensing.. and I hear some lawsuits 
are in the works).. 
This restriction has been removed as per the following microsoft announcement:
so for 4.0 final release Workstation or Server should be alright...

ALSO: there is still an intermittant bug in NT 4.0 where services will
not start correctly and you get an error in user32.dll .. due to this
upgrades may not work and you may have to reboot after an upgrade/install
to restart the server.

ADDENDUM: A registry change is in my guest\nt40postsp1 directory on how
to fix the above problem.


NOTE: on win95 socket limitation
To upgrade win95 to have more sockets making it more suitable to run bind under..


Open the Registry to:

Hkey_Local_Machine\System\CurrentControlSet\Services\VxD\MSTCP

MaxConnections = 32-bit number

Specifies the maximum number of concurrent connections. The default is 100.


NOTE: on win95 changes that may be neccessary to get reliable mailslots
(ie communication between the server and ndc or control panel applet working):

Yes the fixes were installed.  TCP/IP installed and running since May
'96 - no problems.  NetBEUI installed just prior to BIND.  This protocol
was bound to my network adapter.

This is what I did:
  Set NetBEUI Properties / Advanced / Maximum Sessions from 10 to 100
  Set NetBEUI Properties / Advanced / NCBS from 12 to 100
  Installed Client for Microsoft Windows
  Bound NetBEUI to Client for Microsoft Windows

I now can start / stop / and get a status report from the DNS.  I
don't know just which one of the above actions allowed it to work,
but I'm on my way.  Thanks for your assistance. 



The entire web page for this reference is :
http://www-dccs.stanford.edu/Win95Net/faq-c.html#c16



Brief Installation Instructions

1.  If you currently have BIND on this machine (a different version than our
    freeware port i.e. metainfo, fbli, microsoft), you must STOP NOW, 
    and REMOVE IT from your system
    before running this install program.  There is no way for us to figure out
    what every other version of BIND might do when it installs itself.

2.  This installation program will create what it thinks are sensible defaults 
    for the configuration files for BIND.  If you have a tricky setup, let it 
    finish, then go back and stop the service (try the control panel applet) 
    and edit the configuration files.  The files will all be in the directory 
    you install (default is c:\var\named) and will be named as follows:
    
    	NAMED.BOOT - 		         the boot configuration file.
    	DB.127.0.0 -		         the loopback identity file.
	DB.CACHE   -		         the root server hint file, from 
                                         InterNIC.
    	DB.ZONEINFO -	                 the data file containing the zone RRs 
                                         (for primaries).
    	DB.X.Y.Z (eg. db.199.72.93.0). - the data file containing the PTR 
                                         address definitions (ditto).

NOTE: the current version of bind is compiled for speed and requires a
Pentium or better chip (it will run on 486's, but is optimized for
Pentiums.) If you want to run optimally on a 486 you can recompile the sources
after changing the makefile.

--------------------------------------------------------------------------------
Building/compiling BIND 4.9.3 for Windows NT

NEW: the below is really obsolete to build you simply find open
the filename.mdp in each directory outlined below and build using vc++ 4.2

To automate the build run the file buildallnt.bat... then run the
file install.bat in the contrib\winnt-dist directory, or run the build.bat
file in step 13 below to repackage using install shield SDK edition.
To rebuild BIND manually follow these steps...

NOTE: For installing binaries only skip to step 14...

1)  Run         bind\compat\lib\makemc.bat
2)  Build       bind\compat\lib\lib44bsd.mak
3)  Build       bind\res\resolve.mak
4)  Build       bind\named\named.mak
5)  Build       bind\named\ndc.mak
6)  Build       bind\cpl\ndc.mak
7)  Build       bind\named\xfer.mak
8)  Build       bind\tools\nslookup\nslookup.mak
9)  Build       bind\tools\nslookup\dig.mak
10) Build       tools\instsrv.mak    (Win NT Service installer)
11) Build       bind\install\builddll.mak (new install shield helper dll)
12) Copy        all *.exe's and .cpl and binddll.dll to bind\dns-dist
13) run         bind\install\build.bat (to make and package the stuff)
14) Run         disk1\setup.exe (To install it all)

NOTE: You will now have to modify the database files installed by the
install.bat or setup.exe  program and also the named.boot file (boot file) 
installed in the WinNT home directory.  Also see the bind operations guide
(bog.wri) in the system32 directory.

If using the manual install program (ie install.bat)..
****YOU MUST ****** modify the directory line in the named.boot or named.ini 
(it will accept either name)... and change the single slash to double slashes
ie. c:\var\named becomes c:\\var\\named. The new gui install program 
automatically does this for you.


Possible Enhancements:

There are many enhancements that could be done to this port. We encourage 
everyone who plans to enhance this code to contribute as much of their 
enhancements as possible back into the mainline code stream.  This has 
the benefit of making BIND under Windows NT better for everyone.

Here is a partial list of possible enhancements.

(DONE) - * GUI control panel version of the ndc (bind control program).
(DONE - Done by L. Kahn)
* GUI interface to nslookup (done thanks to Leon & Larry).
* A Setup Wizard to help with setting up database files. 
  (done.. at least initial files).
* An SNMP module for remote monitoring.
* Port of Eventlib to Windows NT
* Some Integration with Microsoft's dynamic name service for PCs WINS.
   (The Samba tool suite includes nmbd a Netbios Name service that 
    acts as a WINS server, and can probably be used to better under
    stand what is going on with WINS.) Also anybody care to elaborate
    exactly how this should work.. ie does the wins get its info from the dns
    or vice versa...
* PORTS of additional software such as dig (done), 
   dnsquery, host, named_lint and other supporting tools.

* Port of Bind 8.x to NT ....

Any one wishing to undertake these or other significant enhancements should 
coordinate with either:

   kahn@drcoffsite.com or schueman@acm.org
   kahn@lgk.com


Mailing list:

A mailing list dedicated to this Windows NT port of bind 4.9.3, 4.9.4  has been 
created by Larry Kahn... anyone wishing to join should send an email message to 
	listserv@drcoffsite.com 

and in the body of the message put:

	subscribe bindnt your name

Your subscription email address will be the one from which the mail was 
received.

General discussion, problems encountered, or suggestions for this port 
should be addressed to this mailing list.


NOTE: Unless your peers on this list wish to help with nt specific problems
or configuration issues, do not expect significant assistance, 
as these sorts of problems are better addressed to the bind-users list, 
or the appropriate news groups. A good resource for resolving BIND database
problems is the O'Reilly Associates' DNS and BIND book.  

Another good resource is the web page set up by Randall G. at Telemark systems.
http://www.telemark.net/~randallg/ntdns.htm

And the bog (bind operations guide) is now online in html format:
http://www.dns.net/dnsrd/docs/bog/bog.html

And the dns resource guide here is also a good reference on bind..
but not on the NT port specifically: http://www.dns.net/dnsrd/

Problems unrelated to the Windows NT port will be forwarded to the 
bind-users mailing list.  Also people downloading this version of BIND will 
not automatically be placed on this mailing list.

The <bind-users@vix.com> mailing list is for discussion
of more general BIND and/or DNS issues, and if you have
joined the above <ntbind@drcoffsite.com> list and found
that your questions are more general than those addressed
there, you should send a message of the following form:
(NOTE: please try the above drcoffsite.com list FIRST as to
not post obvious specific NT related questions to the bind
users list..)

To: bind-users-request@vix.com
Subject: subscribe

subscribe

In either case, you will be informed by the mailing list
maintainer that your subscription has become active, and
at that point you ought to "listen in" for a few days
before posting any questions (or answers).

NOTE: sending NT, BIND NT, BIND or DNS questions directly
to the *-request address will be fruitless, since the
robots who answer such mail cannot help you with your
technical problem, whatever it may be.


Contributors:


Internet Software
Consortium 	 Current maintainer of the BIND distribution, which was
		 originally developed as part of 4.3BSD by the Computer
		 Science Research Group at the University of California
		 at Berkeley, under a grant from the National Science
		 Foundation.
Laurence G. Kahn provided a number of fixes to the Windows NT Beta 24 port
                 and the initial nslookup port. Also added the new
                 code to lookup all interfaces in an NT box and bind to them.
                 kahn@drcoffsite.com, Also did the Beta27/32/release ports.., 
                 modified the install shield scripts to work with vc++ 4.0 
                 sdk version and also wrote our own helper dll. Also rewrote 
                 many of the fx's that free install shield does not provide.,
                 Also parts of Win95 port with help from Leon, and help with
                 the GUI Nslookup port.
Greg Schueman    provided the BIND Beta 26 port for NT based on Viraj and
                 Larry's work, and also the installation routines.
                 schueman@acm.org, and misc. fixes
Paul Wren        software.com ... the original control panel applet.. modified
                 by l. kahn for the freeware version.. and a installshield 
                 scripts also modified for the freeware version.
Kevin Dunlap     nic card not bound to tcpip fix.
John Neystadt    ndc for remote machine support.
Dr. M Jackson    Initial dig port using my nslookup port... completed by me...
                 l. kahn
Leon McCalla     Did much of the legwork for the initial port to WIN95 ...
                 we wouldn't have had this port without him. Developed 
                 Gui Nslookup.

Changes for 15th May 1998

4.9.7 release was release by isc and I have completed the nt port...
see no nt specific changes.. 

Changes for 8th April 1998

first version of 4.9.7t1 out.. port changes to NT including adding new
errno changes in res_comp.c and gethnamaddr.c, res_send

also add fix in res_send.c to close socket correctly in error case for nt..

also fixed a failure in installing that creeped into the bind95 version
somehow even though the service started ok the install program didn't
think so.. this used to work...

changed netdb.h so that it looks for the win95 hosts and services files
in the win95 root instead of the nt system32\etc directory

these are the only files that changed from 4.9.6rel to 4.9.7t1 as figured
out by doing a diff between versions...

diff --recurs m:\bind496rel/BSD/README m:\bind497t1/BSD/README
diff --recurs m:\bind496rel/CHANGES m:\bind497t1/CHANGES
diff --recurs m:\bind496rel/INSTALL m:\bind497t1/INSTALL
diff --recurs m:\bind496rel/Makefile m:\bind497t1/Makefile
diff --recurs m:\bind496rel/README m:\bind497t1/README
diff --recurs m:\bind496rel/doc/bog/file.psf m:\bind497t1/doc/bog/file.psf
diff --recurs m:\bind496rel/named/named-xfer.c m:\bind497t1/named/named-xfer.c
diff --recurs m:\bind496rel/named/ns_ncache.c m:\bind497t1/named/ns_ncache.c
diff --recurs m:\bind496rel/named/ns_req.c m:\bind497t1/named/ns_req.c
diff --recurs m:\bind496rel/named/ns_resp.c m:\bind497t1/named/ns_resp.c
diff --recurs m:\bind496rel/res/gethnamaddr.c m:\bind497t1/res/gethnamaddr.c
diff --recurs m:\bind496rel/res/res_comp.c m:\bind497t1/res/res_comp.c
diff --recurs m:\bind496rel/res/res_send.c m:\bind497t1/res/res_send.c
diff --recurs m:\bind496rel/shres/linux/Makefile m:\bind497t1/shres/linux/Makefi

NT Specific bug...

Added fix to bug in zone transfer for bind when secondarying root.. would
generate incorrect zone for xfer command line of empty string.. ie.

i.e.
tryxfer start zp=00CE1658 stopzp=00CE19BC def=1 running=0
startxfer() 
 xfer -z  -f db.dot -s 0 -C 1 -P 13568 -d 10 -l n:\temp\XFER.DDT -t n:\temp\XFER.TRC 198.41.0.4
started xfer child 136
tryxfer stop mark

needed to have . added.. this was found by

Ben Coleman


here are the other bugs fixed from the ISC

$Id: CHANGES,v 8.56 1998/04/07 04:59:42 vixie Exp $

	--- 4.9.7-T1A released ---

808. [security]	A number of routines did insufficient bounds checking which
		could cause crashes by reading from an invalid memory
		location. (From BIND-8).

807. [bug]	The server sometimes leaked the flushset (ns_resp.c).
		(From BIND-8).

806. [bug]	add_related_additional() leaked memory if the name
		was already in the related array.  (From BIND-8).



Changes for 4th July 1997

doing a reload or restart in the middle of the zone xfer screws up the
zone xfer ... that is a given.. same in stock bind.. (Because the
structures being changed during a reload are also being accessed by
the xfer thread/process however there was
a bug in the code where the thread that starts the outgoing xfer if it is
in a particular spot before the xfer occurs
there was an exit(1) instead of the _exit(1) in ns_Req. since
_exit(1) is defined as ExitThread(1) whereas exit(1) was exiting the
entire server...

Only named.exe and named95.exe changed.. you can run the update procedures
or manually replace the file


version upped to 4.9.6a 

Changes for 24th June 1997

compared 4.9.6t1a and 4.9.6rel to generate a diff/patch file and patched
this agains 4.9.6t1a nt version...

only a few minor interventions were necessary

see the changes. file for bind specific changes.. no nt specific changes
were made..


Changes for 28th May 1997

Port changes for v 4.9.6t1a to nt..
this was harder than I expected... some additional changes needed to be ported
and I LEFT the code in to return the version number with the (chaos,txt)
query for nt so I can verify what version is running on remote peoples
machines..

All binaries but ipaddr*.exe and ndc.exe regenerated.
see the changes. file for specific bind (not nt related changes)...

also found a bug in the nt compiler with optimizations for nslookup
if you turn optimization off this query works as follows:


M:\bind>nslookup
Default Server:  dns1.drcoffsite.com
Address:  199.72.93.10

> test.lgk.com
Server:  dns1.drcoffsite.com
Address:  199.72.93.10

MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
Name:    test.lgk.com
Addresses:  199.72.93.63, 199.72.93.64, 199.72.93.65, 199.72.93.66
          199.72.93.67, 199.72.93.68, 199.72.93.69, 199.72.93.70, 199.72.93.71
          199.72.93.72, 199.72.93.73, 199.72.93.74, 199.72.93.75, 199.72.93.76
          199.72.93.77, 199.72.93.78, 199.72.93.79, 199.72.93.80, 199.72.93.81
          199.72.93.82, 199.72.93.83, 199.72.93.84, 199.72.93.85, 199.72.93.86
          199.72.93.87, 199.72.93.88, 199.72.93.89, 199.72.93.90, 199.72.93.91
          199.72.93.92, 199.72.93.93, 199.72.93.94, 199.72.93.95, 199.72.93.96
          199.72.93.97

>


but with it on it fails as follows:

Default Server:  dns1.drcoffsite.com
Address:  199.72.93.10

> test.lgk.com
Server:  dns1.drcoffsite.com
Address:  199.72.93.10

MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
MAXADDRS exceeded: skipping address
*** dns1.drcoffsite.com can't find test.lgk.com: Unspecified error
> exit


Changes for 18th Mar. 1997

change is_running in ndc95.cpl to not return an error when checking if the
server is already started... only ndc95.cpl changed so didn't up version

also there are now L and M root servers so updated db.cache

Changes for 10th Feb. 1997

since the mailslot inteface has proved to be fairly reliable I have
also enabled the mailslot thread under a winnt server..
so now you can control the server both using the ndc interface 
(with and without the mailslot option).  Using mailslots offers
more info since the status messages can return text.. and previously
there was no way to control an NT server started in non-sevice mode
ie. "named -d 1" from the command line... now you can control this
using the new mailslot ndc interface... where previously ndc and the 
cpl applet did not work since it was started up in NON service mode...

however, for security reasons the ndc start, stop and restart will
not work against a NT server (in mailslot mode) if you want to do
these operations it must be started in non-debug service mode.. and use
the normal ndc (Service) interface...

Related to this changed the option ndc flag from -95 to -MS (MS stands for 
Mail Slot) since it is now more general...

i.e.
to get status under the various interfaces do as follows: 
(NOTE: a machine name is necessary under NT to use the optional -MS interface)


M:\bind>ndc status

Status of Domain Name Service:
  Service Type: 0x10
  Current State: 0x4
  Controls Accepted: 0x1
  Exit Code: 0
  Service Specific Exit Code: 0
  Check Point: 0
  Wait Hint: 0

M:\bind>ndc status \\p6dnf -MS

Status of Domain Name Service:
named 4.9.5-P1b-Monday-10-February-97
        GregSchueman-LarryKahn-VirajBais
Query log off!
NoLog Flag on!
Debuging Off!

M:\bind>


As you can see also added the version info to the mailslot status command

finally you can now use the normal ndc.cpl as always but now the
ndc95.cpl will also work under NT just fill in your own machine name
as part of this had to change the nolog/log set in registry since
the key is different under nt and win95 (now should work ok under either)
also had to disable the start/stop/restart if running the ndc95.cpl
on an NT machine and pointing it to yourself

also had to disable the edit log (no log file under nt it is in the registry)
for the same reason as above.

Also fixed the two cpl applets so that the running buttons reset after
switch servers 

Also changed the buttons slightly on the cpl applets so they are smarter
ie start and restart are disabled when the server is running and
stop is disabled when the server is stopped (for all servers using 
NT api's ndc.cpl) and only for local servers when using mailslots 
(ndc95.cpl) since for mailslots start/restart dont work anyway on
remote machines..


Changes for 7th Feb. 1997

fixed crash on win95 ... too many 4.9.5p1a versions upped to 4.95.p1b

yet more changes the thead changes wouldn't work correctly for reloads
and stops.. sometimes it wouldn't terminate.. found out the main service
wait on the temrination object must be in the main thread.. if it is
in a secondary thread... even if you call exitprocess it sometimes
fails (sounds like a bug to me).. so rewrote it so the ns_init gets called
in a thread but the service and wait happens in the main thread as it used
to ... which in turn calls worker_thread just like before...
seems to start, restart, stop ok now.. also since the service is up
before the database/zones are loaded needed to check to make sure
we are completely done with init before allowing a db dump, stats or
reload otherwise we could crash... you can set flags (ie querylog, nolog,
and stop the service before all zone loading is complete)...


yet another round of changes.. realized that with my changes below the
service now started up before all zones were loaded.. but actually
started ok when there was no named.boot or the directory line was bad etc.
etc... ok it actually started ok and immediately terminated.. but it shouldn't
start up correctly at all with these types of conditions.. so I had to add
a new event object BootFileOkEvent that gets signaled part way through
the boot file processing in ns_init whenever we are done.. or a 
real directive is hit.. ie "secondary", "primary" "cache"... etc. etc.
the waitforsingleobject on this object will time out in 15 seconds if
this does not occur... and the server won't start up correct which
is what should happen... 

changes to ns_main.c and ns_init.c

I have tested this with a bad directory line.. garbage in the boot file
or no boot file... and it seems to work ok...

hopefully this will be it for changes...


Changes for 6th Feb. 1997

well I guess the other changes are going out as some major changes
are necessary here...

1. k root server.. is out so changed the db.cac BUT FOR EXISTING installations
get the db.cache file from my ftp site  or internic and update manually
This will only be installed on new installations as I don't want to overwrite
your cache file you may have customized it or have internal root servers..

2. major bug found by Jerry Sumpton

i.e.

Bind is timing out on start. The problem stems from our vary large
named.boot that is primary for several thousand domains. The mystery is
that it ran on two of our servers, but not the third. We were blaming the
problem on that particular machine, but now, it will not restart on one of
the computers where it was working.

Event ID: 7000
The DomainNameService service failed to start due to the following error: 
The service did not respond to the start or control request in a timely
fashion.  


---- yes it was starting the service after calling ns_init the same
way unix did its fork after calling ns_init but there is no control over
how long nt gives you to start the service.. so now the service
is started before but the actuall worker thread is not called till
after ns_init() completes...

should fix the problem major rewrite of sections of ns_main.c

Change to gui.c to incorporate j and k root servers


Changes for 5th feb. 1997

noticed that with logging off qrylog messages don't make it into
the logs... changed the level of these messages from log_info to log_notice
so they make it into the log and querylogging works with logging off
also modified a few other messages from log_info to log_notice


Changes for 3rd Feb. 1997 version 4.9.5P1a


A new version of ipaddr95.exe and integrated the changes to this
into ns_main.c so that the server now uses the new ipaddr lookup routines
for win95 only. 

Gnslookup.exe is now distributed with the install.. see description of
changes below...

Added a new flag called nologflag which disables logging of the
informational messages... ie. to stop lame server and points to CNAME messages
from going into the application log (under nt) or the file under WIN95.
WARNING: there are some informational messages that impart marginal error
(non-normal conditions) and I didn't feel like going through and changing
all messages... so if you are having problems make sure this flag is OFF
before posting to the list with your problem.
The turning of the nolog flag on via ndc.exe ndc.cpl or during startup
from the registry results in a WARNING message to the application event
log telling you that this flag is on... and not all informational messages
will be logged.... what we really need under nt is more levels available
in the log...

This new flag can be changed with the new ndc.exe command i.e.

ndc nlog
and 
ndc log

which sets it temporarily in the running service.
it can also be set similiarly through the "disable logging" and the "enable logging"
buttons on the control panel applet...


HOWEVER ... If you want to set it permanently so it takes effect next time
the server starts/restarts there is a checkbox field now on the control
panel applet to set this... changing the value here also changes
it in the running service as well as setting it in the registry.

ALSO uncovered and fixed a couple of bugs that may have been causing
the mail slots not to work on some win95 machines.. it was an overflow
of the buffer if you had a long machine name (ie >= 20 characters or so)...


Changes for 25 Jan. 1996 (no new version releases)

1. Gui nslookup version 1.2 original work done by Leon McCalla with
additions/changes by L. Kahn...
This purposely leaves the console window up as well as it is impossible to
redirect all messages to the GUI (since some come from the resolver etc.)
without rewritting all of bind.  Also this should be a full implementation
i.e. LS and FINGER commands also work .. just type them in the query window.
Recent changes from 1.1. to 1.2:

when querying it will automatically add all NS record names to the server list
so that you can use them in navigation.

The temporary nslookup.tmp file is now removed.

The output window scrolls to the beginning of a query or a nameserver change.

Please report any problems with this port immediately as it is a new program

Bind Changes:

1. new ipaddr95.exe and changes to ns_main.c to incorporate this..
this is mostly to fix bugs in the original implementation where if people
changed the bindings it would not find the correct ip addresses... also
didn't work on some foreign versions of win95.

2. change in ndc.c in the help message to clarify that the -95 flag is only
needed to communicate with a win95 server when running ndc on a non-win95 machine
i.e. Windows Nt.


Changes for 18th Dec. 1996

Port official release of 4.9.5p1 changes to NT..
no diff file from 4.9.5p1c2 to created my own to ease the patch process..
no manual intervention necessary...
 

Changes for 16th Dec. 1996

changes to ipadr95.exe (ipaddr95.c)
and ns_main.c (named95.exe) for support for mutli-homed
Windows 95 machines... it was reported that this was possible
under win95 by editing the registry and putting commas between the ip
addresses and subnet masks as opposed to the spaces under Windows NT..

In my testing win95 does indeed work this way (at least with two ip addresses)
and both are active... changed the code that gets the ip's out of the 
registry to support this... instead of doing this against 4.9.5 release
performed changes against 4.9.5 p1 since this fixed a few bugs..


Changes for 3rd Dec 1996

Ported the fixes for 4.9.5 p1 c2 (2 manual changes necessary)
fix for bug 770 was submitted by me...

	--- 4.9.5-p1 released ---

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*.



Changes for 26th Nov 1996

Ported the fixes for 4.9.5 p1 c1 (post release 1, cut 1)

	--- 4.9.5-p1 released ---

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.


Also although the nslookup bug was found by me... I prefer to increase
the amount of records from 25 to 60 that it handles so this fix is in
there as well..


Changes for 24th Nov 1996

Added compile flag MSN_LIMIT which will limit A records (type T_A class C_IN)
to a max of 28 records returned without the truncation bit set.  This is
a workaround to get around a bug in the current Win95 resolver where if more
than 28 Address records are returned and/or the truncation bit is set the
Win95 resolver fails...  You can set this in the makefile.. The default
is Off.. This is being used by MSN.com


Changes for 22nd Nov 1996

Thanks to Dave Whipple of MSN for bringing to my attention that
nslookup was failing for queries that returned more than 25 A records...
the problem was an original porting issue where some read() needed to
be redone as recv() calls... version number is the same but new date.
changes in send.c in tools\nslookup

This bug has been in the nslookup port all along back to 4.9.3 version...


there still is another bug here.. i.e.
the previous problem with nslookup was due to an nt porting issue but
this is a stock bind problem

nslookup in getinfo.c has maxaddrs and maxaliases
defined to be 35
and when running against the local machine it will happily return more than 35 
resource records with garbage in the first few locations over 35 

i.e.

I:\WINNT\System32>nslookup
Default Server:  dns1.drcoffsite.com
Address:  199.72.93.10

> test-gateway-moswest-msn-net.lgk.com
Server:  dns1.drcoffsite.com
Address:  199.72.93.10

Name:    test-gateway-moswest-msn-net.lgk.com
Addresses:  224.110.67.0, 228.110.67.0, 232.110.67.0, 199.72.93.21
          199.72.93.22, 199.72.93.23, 199.72.93.24, 199.72.93.25, 199.72.93.26
          199.72.93.27, 199.72.93.28, 199.72.93.29, 199.72.93.30, 199.72.93.31
          199.72.93.32, 199.72.93.33, 199.72.93.34, 199.72.93.35, 199.72.93.36
          199.72.93.37, 199.72.93.38, 199.72.93.39, 199.72.93.40, 199.72.93.41
          199.72.93.42, 199.72.93.43, 199.72.93.44, 199.72.93.45, 199.72.93.46
          199.72.93.47, 199.72.93.48, 199.72.93.49, 199.72.93.50, 199.72.93.51
          199.72.93.52, 199.72.93.53, 199.72.93.54, 199.72.93.16, 199.72.93.17

see the first 3 ip addresses are bogus as there are more than 35 here...


this was fixed by changing the above two constants... and now nslookup
seems to return the max (around 60) correctly 
i.e.

> test-gateway-moswest-msn-net.lgk.com
Server:  dns1.drcoffsite.com
Address:  199.72.93.10

Name:    test-gateway-moswest-msn-net.lgk.com
Addresses:  199.72.93.58, 199.72.93.59, 199.72.93.60, 199.72.93.61
          199.72.93.62, 199.72.93.63, 199.72.93.64, 199.72.93.65, 199.72.93.66
          199.72.93.67, 199.72.93.68, 199.72.93.69, 199.72.93.70, 199.72.93.71
          199.72.93.72, 199.72.93.73, 199.72.93.74, 199.72.93.75, 199.72.93.76
          199.72.93.77, 199.72.93.78, 199.72.93.79, 199.72.93.80, 199.72.93.81
          199.72.93.82, 199.72.93.83, 199.72.93.84, 199.72.93.85, 199.72.93.86
          199.72.93.87, 199.72.93.88, 199.72.93.89, 199.72.93.90, 199.72.93.91
          199.72.93.92, 199.72.93.93, 199.72.93.94, 199.72.93.95, 199.72.93.96
          199.72.93.97, 199.72.93.98, 199.72.93.99, 199.72.93.100, 199.72.93.101

          199.72.93.102, 199.72.93.103, 199.72.93.104, 199.72.93.105, 199.72.94.
15
          199.72.94.16, 199.72.94.17, 199.72.94.18, 199.72.94.19, 199.72.94.20
          199.72.94.21, 199.72.94.22, 199.72.94.23, 199.72.94.24, 199.72.94.25
          199.72.94.26

> test-gateway-moswest-msn-net.lgk.com
Server:  dns1.drcoffsite.com
Address:  199.72.93.10

Name:    test-gateway-moswest-msn-net.lgk.com
Addresses:  199.72.93.60, 199.72.93.61, 199.72.93.62, 199.72.93.63
          199.72.93.64, 199.72.93.65, 199.72.93.66, 199.72.93.67, 199.72.93.68
          199.72.93.69, 199.72.93.70, 199.72.93.71, 199.72.93.72, 199.72.93.73
          199.72.93.74, 199.72.93.75, 199.72.93.76, 199.72.93.77, 199.72.93.78
          199.72.93.79, 199.72.93.80, 199.72.93.81, 199.72.93.82, 199.72.93.83
          199.72.93.84, 199.72.93.85, 199.72.93.86, 199.72.93.87, 199.72.93.88
          199.72.93.89, 199.72.93.90, 199.72.93.91, 199.72.93.92, 199.72.93.93
          199.72.93.94, 199.72.93.95, 199.72.93.96, 199.72.93.97, 199.72.93.98
          199.72.93.99, 199.72.93.100, 199.72.93.101, 199.72.93.102, 199.72.93.1
03
          199.72.93.104, 199.72.93.105, 199.72.94.15, 199.72.94.16, 199.72.94.17

          199.72.94.18, 199.72.94.19, 199.72.94.20, 199.72.94.21, 199.72.94.22
          199.72.94.23, 199.72.94.24, 199.72.94.25, 199.72.94.26, 199.72.94.27
          199.72.94.28

> exit


Changes for 11th Nov 1996

ported changes from 4.9.5 t6b to release from paul vixe...
used normal patch and diff... two places needed manual intervention...

i.e.

	--- 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.


only a couple of these new changes from paul.. seemed to cause problems
minor changes in main.c for nslookup (changed null to 0 etc.)

in progress: Greg is working on a version where are not separate
named95 and xfer95 executables... and also 

Changes for 4th Nov 1996

change to ns_req.c so requests for a zone transfers that are rejected
because the site is not in the xfrnets are now logged at the warning level
to draw your attention to them instead of the info level..

Also now updated install shield 3 to a new version so let me know if
there are problems with the install...

Changes for 3rd Nov 1996

in ns_init.c and db_load.c changed a bunch of syslog commands which were
just log_info to log_warning as they had to do with bad records in the
db files that were rejected i.e. underscores and these should at least
be at the warning level.. so under NT they come out yellow in the log..
Just about every message in db_load.c was changed to the warning level
as they all have to do with some abnormal condition in the database file
that is being loaded.. and the user show at least be warned about it.


also here is some info on the check-names directive..

>The ``check-names'' directive tells BIND to check names in either
>``primary'' or ``secondary'' zone files, or in messages (``response'')
>received during recursion (for example, those which would be forwarded back
>to a firewalled requestor).  For each type of name,
>BIND can be told to ``fail'', such that a zone would not be loaded
>or a response would not be cached or forwarded, or merely ``warn'' which
>would cause a message to be emitted in the system operations logs, or to
>``ignore'' the badness of a name and process it in the traditional fashion.
>Names are considered good if they match RFC 952's expectations (if they are
>host names), or if they consist only of printable ASCII characters
>(if they are not host names).


Changes for 1st Nov 1996

It appears the crashes for outgoing zone transfers with a lot
of zones (see below) has been fixed but in further testing it appears
occasionally if an outgoing zone xfer was interrupted at just the right
point... bind would keep processing normally but would never close the socket
from my observations (they have known to have been wrong) it appears this
could occur in Unix also.. The problem was that before the result from
the read/recv is checked for an error case... a check for a 
a too short message to contain a valid header was done.. and since 
the s_bufp and the s_buf were both == it would go into the block
below but since (s_bufp - s_buf) = 0 the second if would not fire
and the continue statement was hit... so this would go on for ever..
even though the recv was returning (invalid_socket under nt) i.e. the
socket was closed on the other end...

To fix this I copied the check for an invalid socket before executing
the continueing and logged to the debugging log that a bad socket
was closed... everything else seems to work as before but this
seems to catch this problematic case...

The behavior was bind still working normally but chewing up 100% (50% on a dual)
of your cpu... this was hard to reproduce so most of you probably never saw
it...

In my analysis this would occur if the xfer was interrupted (disconnected)
after the soa was responded to but before the a_xfer query was initiated...

			/*
			 * 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;
#ifndef WINNT
				(void) writemsg(sp->s_rfd, sp->s_buf,
						HFIXEDSZ);
#else

		    /* lgk new code here so that if the write failed.. we close the socket.. */
		    if (writemsg_sock(sp->s_rfd, sp->s_buf,HFIXEDSZ) < 0)
		      {
                        dprintf(1, (ddt, "writemsg: failed so closing bad socket!\n"));
                        sqrm(sp);
                      }
#endif
			    }
                   /* lgk the following continue is incorrect it stops the code from checking for
                      a socket error i.e. -1 if message is too short that is ok but if we
                      have a socket error we need to check this first and close the socket if so..
                      otherwise we get a runaway socket and an endless loop when you disconnect
                      a connection at just the right time and no data is on the socket.. and
                       s_bufp = s_buf so the above if is true */

#ifndef WINNT
			if ((n == -1) && (errno == PORT_WOULDBLK))
#else
			if ((n == SOCKET_ERROR) && (errno == PORT_WOULDBLK))
#endif
			   continue;


			if (n <= 0) {
				sqrm(sp);
				continue;
			}


			    continue;
			}



Changes for 31st Oct 1996

Whew where to start... 
Richard Mayston has been having intermittant problems for a while now and
it has been very hard to reproduce.. finally I was able to repro it
by having 2 or more recursive batch files continually do xfers against
the server... it actually had nothing to do with the zones in question..

There were bugs with the original porting of the outgoing zone xfer code..
this went way back to the original 4.9.3 beta 24 freeware port...

(I didn't do the original port remember)... there were many problems found
here:

1. a handle leak... the correct cleanup routine sqrm was not being called..

2. an intermittant crash because stock bind uses fork.. which makes copies
of the environment and in NT no such animal exists and you cannot use
createprocess like for incomming zone xfers as the code needs access to
the loaded zone structures.. It used createthread.. which is ok but
since all variables are shared.. some global variables were being used/modified
which caused problems when multiple concurrent outgoing zone transfers occur
or a zone transfers occur with incomming queries.. not often but at times
the multiple threads could clober each others data structures causing an
access violation.. I had to copy some structures and make new copies of
certain functions to pass the copied structure into (dnptrs, and make_rr).

Also the qstream structure is shared and when now correctly closing the
stream after a xfer using sqrm it would occasionally cause a new crash if
the main thread was accessing this info at the same time... So added a
critical section around this code... Now have run it over a half an hour
with 4 concurrent recursive batch files... all doing xfers against the server
with no problems.. and there is no longer a handle/memory leak.. seems
to have been fixed :).....


You probably would only intermittantly see this problem if you had a LOT
of zones and they change regularly i.e. 20 or more... 

Most people should upgrade to the new Oct. 31st version of 4.9.5t6b


Changes for 26th Oct 1996

Found a porting bug to nt that has been in since the beginning...
missed some unix to nt specific changes...
Needless to say in named-xfer and also in ns_main if some error conditions
occured and you were running the server with debugging on.. it could go into
and endless loop... and fill up the log very quickly.. no one found this
but I did when doing some other testing... 

EVERYONE should upgrade immediately as if you are running with debugging on
(not likely) a hacker can capitalize on this bug and initiate a denial of 
service attack on you.  I'm not going to tell you how... 
but if suffices to say UPGRADE....  This also affects the Windows 95 version.


Changes for 23rd Oct 1996

no official version change.. fixed ns_main.c to use a different function
so that eventlogging gets registered correctly every time you start up
named... something changed in vc++ from older versions...

 
Changes for 22nd Oct 1996

1. Greg found a bug where there was an #ifndef WINNT rather than a #ifdef WINNT
   trying to track down an crash on very few machines.. don't think this
   is it but fixed it..
    
   Greg also updated the bog.wri.
   we also colaborated on a change to create an initial resolv.conf (modified
   the install procedure) and greg cleaned up the manual install and the h2n
   perl program.

   The domain and nameserver directive are added in the default resolv.conf file..
   however you may want to delete the domain line.. I don't use it on my server
   as it can cause extra work for your server by appending your domain and doing an 
   extra query to any name that fails lookup that doesn't end in a dot.

Changes for 8th Oct 1996.

Simply porting of t6b to windows nt.. see the changes. file for changes
since t5b

Changes for 4th Oct. 1996

This release is dedicated to my younger Brother Ron Kahn...
his birthday was Oct. 4th ... he was killed in a snowmobile accident last Feb.

This is an interim release to fix a wildcard mx problem brought to my
attention by Dieter Gebhardt.

the fix was submitted by Mark Andrews .. this should be folded in the next
official release by Paul Vixie but it doesn't seem to be coming anytime soon.

i.e.

	It's a bug.

	Mark

*** res_comp.c.001	Sun Sep 22 10:13:29 1996
--- res_comp.c	Wed Oct  2 10:59:45 1996
***************
*** 394,401 ****
  res_ownok(dn)
  	const char *dn;
  {
! 	if (asterchar(dn[0]) && periodchar(dn[1]))
  		dn += 2;
  	return (res_hnok(dn));
  }

--- 394,405 ----
  res_ownok(dn)
  	const char *dn;
  {
! 	if (asterchar(dn[0]) && periodchar(dn[1])) {
  		dn += 2;
+ 	} else if (asterchar(dn[0]) && (dn[1] == '\0')) {
+ 		/* "*." is legal */
+ 		return(1);
+ 	}
  	return (res_hnok(dn));
  }





Changes for 28th Sep. 1996

Just changes for porting of 4.9.5 t5b  for 4.9.5
The changes below are already incorporated into this version

Changes for 22nd Sep. 1996

post 495t4b changes to ns_resp.c sent to me by Paul Vixie for the problem
of cnames in a different domain being rejected with the follwing message

there still is the problem with getting the bad referal message in 4.9.5 t4b 
for perfectly good CNAMES... do you intend to fix this or is the net effect
that these records are returned but simply not cached ???

i.e.

lookup msnews.microsoft.com and you get the following in the log:

bad referral (msn.com !< MICROSOFT.com)    


i.e.

I thought I was fixing that but now I see that I didn't.  Try this:

*** ns_resp.c	1996/09/22 00:13:10	8.33
--- ns_resp.c	1996/09/22 07:08:47
***************
*** 113,117 ****
  			outofDataAFinal[] =	"out of data after final pass",
  			badNameFound[] =	"found an invalid domain name",
! 			wrongQuestion[] =	"answer to wrong question";
  
  struct db_list {
--- 113,118 ----
  			outofDataAFinal[] =	"out of data after final pass",
  			badNameFound[] =	"found an invalid domain name",
! 			wrongQuestion[] =	"answer to wrong question",
! 			danglingCname[] =	"dangling CNAME pointer";
  
  struct db_list {
***************
*** 234,238 ****
  	int restart;	/* flag for processing cname response */
  	int validanswer;
! 	int cname;
  	int count, founddata, foundname;
  	int buflen;
--- 235,239 ----
  	int restart;	/* flag for processing cname response */
  	int validanswer;
! 	int cname, lastwascname;
  	int count, founddata, foundname;
  	int buflen;
***************
*** 748,751 ****
--- 749,753 ----
  	nscount = 0;
  	cname = 0;
+ 	lastwascname = 0;
  	strcpy(aname, qname);
  
***************
*** 787,792 ****
  				strcpy(aname, (char *)dp->d_data);
  				cname = 1;
! 			} else
  				validanswer = 1;
  
  			dp->d_cred = (hp->aa && !strcasecmp(name, qname))
--- 789,797 ----
  				strcpy(aname, (char *)dp->d_data);
  				cname = 1;
! 				lastwascname = 1;
! 			} else {
  				validanswer = 1;
+ 				lastwascname = 0;
+ 			}
  
  			dp->d_cred = (hp->aa && !strcasecmp(name, qname))
***************
*** 795,803 ****
  		} else {
  			/* After answer section. */
  			if (i < ancount + aucount && type == T_NS) {
  				/* Authority section. */
! 				if ((!samedomain(name, qp->q_domain))
! 				    || (cname &&
! 					!samedomain(aname, qp->q_domain))
  				    ) {
  					syslog(LOG_DEBUG,
--- 800,812 ----
  		} else {
  			/* After answer section. */
+ 			if (lastwascname) {
+ 				syslog(LOG_DEBUG, "dangling cname (%s)",
+ 				       aname);
+ 				break;
+ 			}
  			if (i < ancount + aucount && type == T_NS) {
  				/* Authority section. */
! 				if (!samedomain(aname, name) ||
! 				    (!cname && !samedomain(name, qp->q_domain))
  				    ) {
  					syslog(LOG_DEBUG,
***************
*** 820,823 ****
--- 829,837 ----
  				free(flushset[i].fs_name);
  		free((char*)flushset);
+ 	}
+ 	if (lastwascname) {
+ 		syslog(LOG_DEBUG, "dangling cname (%s)", aname);
+ 		formerrmsg = danglingCname;
+ 		goto formerr;
  	}
  


Changes for 21st Sep. 1996

Just changes for porting of 4.9.5 t4b RC1 for 4.9.5


Changes for 29th Aug 1996

no version change fix in main.c and pathnames.h for nslookup so
help works under win95

Changes for 28th Aug 1996

got the t3a-t3b diff file and applied it and also applied a diff 
sent to me directly from paul to fix the problem with the new code
checking for the pollute-o-gram rejecting cnames i.e msn.com < micrsoft.com

this is a post t3b fix hence the t3b+ designation..

Also changed the build stuff to only say version t3 just like the ndc
stuff so that I don't have to recompile for small releases

Changes for 27th Aug. 1996

second release on 27th also added code so under windows NT
the following message only comes out in the logs if debugging on..
ns_main.c:                             "IP/TCP connection from %s (fd %d)\n",

because under nt logging goes to the event log (all logging) and at least
in my case I have a special service checking every so often to make sure
my dns is up and running and it generates these messages... and they soon
fill up the log.. i.e. one every 10 minutes..


patch build of 4.9.5 t3a release see the changes. file for all changes.
no nt specific patching done.. 3 files failed the patch and needed manual
intervention ...


Changes for 21st Aug. 1996

some lint changes to fix the problem I found with truncation of
unsigned long to short as submitted by john gilmore.

Changes for 20th Aug. 1996.

do_reload is not declared so a patch mark worked out for a bug
I submitted is not enabled.. for now #defined it in conf\options.h

also added a patch for the variable type being used before set in 
ns_resp.c as submitted by Mark Andrews

Changes for 19th Aug. 1996

patch added from mark andrews for problems when i.root went offline
and b.root gave incorrect info ... i.e.

	This should harden BIND against similar problems in the future.
	We keep trying the other root servers if we are missing A
	records for any root server.

	This is a extension of the earlier hardening were were we keep
	going if we don't have any A records. The check is rolled back
	into the main loop.

	Mark

*** ns_resp.c.001	Thu Aug  8 16:54:42 1996
--- ns_resp.c	Sat Aug 10 15:37:19 1996
***************
*** 2311,2316 ****
--- 2311,2317 ----
  	int found_arr, tot_arr = 0;
  	const char *fname;
  	time_t curtime;
+ 	int answer = 1;
  
  	dprintf(2, (ddt, "check_ns()\n"));
  
***************
*** 2326,2373 ****
  			dname = (caddr_t) dp->d_data;
  			htp = hashtab;
  			tnp = nlookup(dname, &htp, &fname, 0);
- 			if (tnp == NULL || fname != dname)
- 				continue;
- 
- 			/* look for name server addresses */
- 			found_arr = 0;
- 			for (tdp=tnp->n_data; tdp != NULL; tdp=tdp->d_next) {
- 				if (tdp->d_type != T_A ||
- 				    tdp->d_class != dp->d_class)
- 					continue;
- 				if ((tdp->d_zone == 0) &&
- 				    (tdp->d_ttl < curtime)) {
- 					found_arr = 0;
- 					break;
- 				}
- 				goto found_some;
- 			}
- 	        }
- 	}
- 
- 	/* No A RRs were found for the root servers
- 	 * The response must have been bogus
- 	 */
- 	return (0);
- 
-   found_some:
- 	for (np = hashtab->h_tab[0]; np != NULL; np = np->n_next) {
- 		if (NAME(*np)[0] != '\0')
- 			continue;
- 		for (dp = np->n_data; dp != NULL; dp = dp->d_next) {
- 			if (dp->d_type != T_NS)
- 				continue;
- 
- 	        	/* look for A records */
- 			dname = (caddr_t) dp->d_data;
- 			htp = hashtab;
- 			tnp = nlookup(dname, &htp, &fname, 0);
  			if (tnp == NULL || fname != dname) {
  				dprintf(3, (ddt,
  					    "check_ns: %s: not found %s %#lx\n",
  					    dname, fname, (u_long)tnp));
  				sysquery(dname, dp->d_class, T_A, NULL,
  					 0, QUERY);
  				continue;
  			}
  			/* look for name server addresses */
--- 2327,2339 ----
  			dname = (caddr_t) dp->d_data;
  			htp = hashtab;
  			tnp = nlookup(dname, &htp, &fname, 0);
  			if (tnp == NULL || fname != dname) {
  				dprintf(3, (ddt,
  					    "check_ns: %s: not found %s %#lx\n",
  					    dname, fname, (u_long)tnp));
  				sysquery(dname, dp->d_class, T_A, NULL,
  					 0, QUERY);
+ 				answer = 0;
  				continue;
  			}
  			/* look for name server addresses */
***************
*** 2389,2401 ****
  				tot_arr++;
  				found_arr++;
  			}
! 			if (!found_arr)
  				sysquery(dname, dp->d_class, T_A, NULL,
  					 0, QUERY);
  	        }
  	}
  
! 	return (1);
  }
  
  /* int findns(npp, class, nsp, countp, flag)
--- 2355,2369 ----
  				tot_arr++;
  				found_arr++;
  			}
! 			if (!found_arr) {
  				sysquery(dname, dp->d_class, T_A, NULL,
  					 0, QUERY);
+ 				answer = 0;
+ 			}
  	        }
  	}
  
! 	return (answer);
  }
  
  /* int findns(npp, class, nsp, countp, flag)
--
Mark Andrews, CSIRO Div Maths & Stats
Locked Bag 17, North Ryde, NSW 2113, Australia.
PHONE:	+61 2 9325 3148			     INTERNET: marka@syd.dms.csiro.au
MOBIL:  +61 41 942 9884               UUCP:....!uunet!syd.dms.csiro.au!marka


port of 4.9.5 t1 to windows NT.. 
some new files needed to be ported along with many other misc. changes
warning: this port will not be released to the general public...
do not release this to the general public it is a working port
as per Paul Vixies instructions... also there are two serious warnings
1. truncation of a short to a long
and 2. a varible type used but never sent... looking into resolving these
issues.

also ndc95 is now just ndc with a -95 flag

fix in install stuff to update on winnt correctly

Changes for 7th Aug 1996

Patched version for 4.9.4 p1 official release.. a few files
needed manual intervention.. see the changes. file for new changes


Changes for 3 Aug 1996

As brought to me attention when I modified the install script for win95
I pulled out the following line which put a copy of named.exe in your
system32 directory..
	CopyFile("named.exe",    "named.exe");		// the server
this has the effect that event logging may not work correctly you will
get a message ... 
The description for Event ID ( 3 ) in Source ( DNS ) could not be found. It
> >> >contains the following insertion string(s):

and then the message text instead of the way it is supposed to work..
I have fixed this in the install script and anyone who is getting
this should put a copy of the named.exe from your install directory
into the system32 subdirectory...
sorry... nothing but trouble lately with this install script..
I never noticed this on my machine since my server is installed in system32
anyway... A new version is not needed as this didn't effect any of the
executables only the install script.. but the md5 and checksums will change.



Changes for 30 Jul 1996

install shield would take forever on nt 4.0 RC 2... so got new
version from them... rebuilt with it.. and fixed a bug in the 2 disk
install stuff

Changes for 24th July 1996

changed the startup code in the install stuff to try four times to check if
running after startup on win95 sleeping exponentially longer.. on my machine
a p60 the stock startup with a 2 second wait worked fine but on slower 486's
it appears now to.. Since didn't change anything else and we havent' release
yet didn't up version.


Changes for 26th July 1996 

no change to the version just the install shield stuff to put it
in two directories on two disks as someone complained it didn't fit on one
disk any longer.


Changes for 23rd July 1996

YEa Yea finally got a reproduceable site to track down the errant
runaway xfer bug (where it would occasionally chew up 100% of the cpu..)
it actually was  a problem with the remote machines server closing the
connection ... and xfer still going on its merry way in the select/recv
loop... now it will sense this case and log a warning message and the xfer
will terminate... as it should!

Also changed some info messages that were really error cases inside named-xfer.c
and inside ns_maint.c ... 


Changes for 22nd July 1996

4.9.4a officially release..
Leon changed the status command to return more usefull info under win95
i.e debug level and whether querylog is on or not. Also added debugging
info about ndc commands received if debugging is on.

Changed warnings about memory leak in win95 as it is better with the
Service pack1, kernel32 and WInsock32 fixes.

Also recompiled all under VC++ 4.2

Removed extraneous winntport. and winntport.txt files.. only file now
is readme.nt

Also there have been intermittant reports of the editing after
dumping stats, database etc. files not working.. apparently after
more testing in NT 4.0 beta 2 and up the files were being dumped
in a different location than under 3.51 so I changed the code
slightly to force them to be dumped in the system32 directory
where ndc.cpl expects them.

Also noticed if you don't have your temp or tmp variables at the
system level than services don't find it and instead dump
files in the winnt (under 4.0) or winnt\system32 under 3.51 ..
this was causing the above problem.. put your temp variables at the
system level. (and you must reboot since the services environment
don't get these changes until you do)...


Changes for 11th July 1996

change the gethostname to getcomputername call to get around the problem
with win95 returning a different host name than windows nt...

Also fixed a bug in ndc95.cpl in setting the server name...

Also added a new patch to win95 for wsock32 ... which is supposed
to fix a memory leak in multi-threaded socket apps (ie bind)..
this works better than previously but there still is a leak.. ableit
slower (system stays up for 1-2 weeks instead of 2 days)...


Changes for 10th July 1996

Still haven't found the memory leak in win95.. It is related to networking
made it a little better by not using the readfile on a mailslot as often
as this accelerates the leak. However for this reason do not recommend
running bind on win95 currently and will not support it relating to this
problem.

Modified the bindll.c and bindll.dll and setup.rul i.e. gui install to now
work under windows 95 as well as NT...

Changes for 8th July 1996

there is a memory leak in win95 that we are still trying to track down..
and consuquently the tcpip stack goes down... However in the process of
monitoring the code on win95 noticed 100% cpu utilization. Apparently the
readfile api on a mailslot even with timeout set to infinite does a
busy wait... to get around this did a loop with getmailslotinfo and my
own sleep statement.... this worked but then decided to try waitforsingleobject
(the correct call to use) even though the documentation specifically fails
to mention this working on mailslot handles.. appparently it works so
using this method..

Oh well back to the getmailslotinfo with sleep solution.. WIN95 is a piece
of **** in my opinion.. IT does a BUSY wait on waitforsingleobject on a 
mailslot.. what kind of hairbraind OS would do a busy wait on a waitforsingleobject
call.....

Also believe the memory leak is either in the readfile api on a mailslot or
a select call on a socket under win95.. haven't figured out which yet.


Changes for 5th July 1996

no change to version number but changed the bind icon to be more
*like* the bind book.. (as close as you can get in 32X32... we really need
bigger icons.. Leon and I are looking at icon tray support under win95 and
nt 4.0 so we can have a bind status icon on the toolbar and a popup to
the control panel. 


Changes for 3/4 July 1996


Where to start... Leon did much of the initial work on the win95 port. Even
though I really don't like running bind on win95 and feel winnt is a better
platform I've gotten tired of everyone complaining about winbind and decided
to do the port corretly... We wrote a version of the get_Winnt_interfaces
for winn95. Had to change about 10 files.. No security support, no services
no application log. etc. you get the idea. But it does run hidden so it is
a pseudo sevice and logging is to a file.  I wrote code for a special thread
to run under bind/under win95 to wait for a connection so a variant of the
ndc program (talks to the service manager under nt) would work under win95.
Unfortunately I had this all working with named pipes to find out win95 does
not support the server side of named pipes... pain in the ass.. re-wrote it
with much difficulty to use mailslots.. so ndc95.exe and ndc95.cpl (control
panel applet) now work using mailslots. Unfortanately due to this you
cannot start/restart a server on a remote machine as I had to use createprocess
to start up the server.. instead of the service manager calls.  So these
are greyed out when using the cpl applet for a remote machine.

Also it will not let you edit the files when connecting via the
control panel applet to a remote machine. This gave me Ideas and I made
the same change for the NT version of the cpl applet so it does not
try to edit the files when dumping them on a remote machine... since it
would just be editing local files.. or nothing at all.

so there are some changes for nt also.. but mostly just in the code
base with ifdefs... will get to finishing the gui install for win95 when
I get more time.. any takers.

 (note I still do not recommend running bind
     under win95.. nt is a much better platform (save nt 4.0 beta ii
     workstation)... there also is no security in the win95 ndc95.exe
     or control panel applets.. this is due to the fact there is no
     security in win95 :)... another reason to use nt.. there is
     as off yet no gui install for win95 yet.. I haven't had time
     so just unzip the bind95.zip and make sure the exe's are in your
     path.. or in your system directory. Also copy/move the .cpl applet
     into the system directory where it must reside.  There is no
     application log so logging is written into a file called 
     named95.log in the system directory... there is an option on the
     control panel applet to edit it. 

Changes for 29th June 1996

added license agreement.. to protect the innocent and am including a checksum
program and also making it avail. on my site ... if you are not sure
where you got your version of this please get the checksum file from
my ftp site (ftp.drcoffsite.com) bindchecksums.txt or 
finger bindinfo@dns1.drcoffsite.com

Also I added the call to sdlicense in the install script and recompiled
using the purchased version of installshield 3 that I have.. however
the sdlicense call I use is not supported in the SDK version of install
shield that comes with VC++ so if you use this you must comment it out..


Changes for 27th June 1996

patched so 4.9.4 release from 4.94t5b is now ported to NT.. since it is
public will widely distribute this version..


Changes for 23rd June 1996

patched and recompiled for build 4.9.4 t5b Beta..

Also fixed a bug brought  to my attention by David Favor...
if you installed bind other than in system32 the database and statistics
dump did not work correctly from the control panel applet.. actually the
dump worked ok but I incorrectly assumed they would be dumped in the
directory in which bind was installed.. but they are always dumped in system32
so I changed the location the editor looks for these files...

Also a fix to dig so it works ok even if you don't have a resolv.conf file
lookups were failing.. however it still needs to be changed so that
the default server is not 0.0.0.0 on nt but 127.0.0.1 ...


Changes for 19th june 1996

Installed the new install shield update to the SDK edition and rebuilt
so that bind will now install under nt 4.0 but WARNING

The gui install program will NOW RUN on nt 4.0,
BUT you should NOT run bind on nt 4.0 workstation (server is ok) 
there is a new socket limit in 4.0 workstation
that lets you have only 10 sockets from differing ip's open before connections 
are rejected ... so until microsoft changes something (there is currently a big 
uproar over this.. they have changed their licensing.. and I hear some lawsuits 
are in the works).. 
NT 3.51 workstation/server and 4.0 server are 
the only platforms you should be running dns/bind on..

If you want to rebuild you will have to get the update to the SDK install
shield from their web site or my ftp site.. assuming you want to build a version
that installs under nt 4.0.

Changes for 7th june 1996

simple port of 494t4a to 494t4b changes...

Changes for 31st may 1996

moved from vc++ 2.2 to vc++ 4.1... 
also changes for 4.9.4. beta t4a integrated
thats it...

Changes for 24th may 1996

ported 4.9.4 t3 beta 2

in order to support ip2 I needed to port gethostbyname and gethostbyaddr
instead of using stock vc++ functions... not sure this needs further testing..
also ported a few new files related to ip6...


Changes for 10 May 1996

reintegrate 4.9.3 release patch 2 cut 3... found some problems that paul
vixie is addressing.. also had to port one change in the patch and found
one problem with checking eintr instead of wsaeintr in one place
related to this.  many files changes entire product rebuilt.. now going
out to our beta testers.


Changes for 6 May 1996

Integration of gui control panel stuff from s/w.com for the freeware
version. Uses the sdk install shield that comes with Vc++ 4.0.
Much functionality had to be pulled out that this version does not
support. Also wrote a dll to provide some of the functionality necessary
(i.e. installing the service .. etc.) . I also had to rewrite much of the
functionality that the free install shield does not provide ie. lauchapp
etc. etc.

a few fixes from greg.. 2. variables that should have been ifdefed out
if validate is not on.. no big deal here..
and one major find a call to socket in ns_main.c (only a bug for nt)
i.e. BUG ns_main.c in function opensocket there is a
    call to socket(AF_INET,...) 
    that is not ifdef'd for NT to test if == INVALID_SOCKET.

Changes for 26 feb 96 ... 

thanks to Kevin Dunlap for changes to get_winnt_interfaces (with additions by me)
for a fix to lookup ip addresses slightly different so that nic cards not
bound to tcpip will not crash the server... this changes named.exe and ipaddr.exe

thanks to John Neystadt for changes to ndc.c so that it works with remote machines
I changed ndc.cpl to have similiar functionality...

thanks to Dr. M. Jackson for the initial port of dig.... which I cleaned up and
modified to work correctly with names...

I also checked to make sure everything still works with nt 4.0 beta 1... build 1234
However there is a problem when you terminate the server with ndc stop command
an access violation occurs... this is a new problem and I double checked and
the code is correct... it appears to be an nt 4.0 problem... I will look into
this further but if anyone else can figure out what is going on or more info
here please let me know... Also the older verison also does this under nt 4.0
whereas it didn't under 3.51 which confirms it is an nt 4.0 problem.


To install the new version you can simply shutdown and
copy the .exe and .cpl program over the old ones and restart...


Changes for 15 jan 96 ... 

Ok tracked down the last cause for the waitforsingleobject() or getexitstatus()
failures (other than doing restarts in the middle of transfers)... regardless
when these occur they are now gracefully handled and the zone is resched. 
Anyway the problem was twofold (1. entercriticalsection only blocks between 
threads..ie. the same thread can enter the critical section more than once)... 
and 2)
I was trying to close all handles and closed one called

		     CloseHandle(zp->z_xferpid); 

in the endxfer function... not a problem in among itself but
then in the named_xfer which calls the endxfer there is the following code

 EnterCriticalSection(&protected_zp);
    endxfer((*proc_info).hProcess);
    /* dont try the close if the wait failed for some reason */
    /* if we have an extra handle around so be it but if the handle is bad ie wait failed not sure what close will do */
    if (dwWait == WAIT_OBJECT_0)
      {
       CloseHandle((*proc_info).hProcess);
       CloseHandle((*proc_info).hThread);
      }
    free((char *)proc_info);
    LeaveCriticalSection(&protected_zp);

well it just so happens that (*proc_info).hProcess  and zp->z_xferpid both
point to the same handle in this case... but apparently nt doesn't know that
zp->z_xferpid points to it since it is releasing the handle at this point
and at times reusing the same handle # immediately and then when I free it
again in the named_xfer routine the next time this new transfer terminates the
handle is bad... I guess you cannot just assign a handle to another variable
because apparently nt does recognize it as a handle... i.e. the docs from vc++
say:

  The created process remains in the system until all threads within 
  the process have terminated and all handles to the process and any
  of its threads have been closed through calls to CloseHandle.
  The handles for both the process and the main thread must be closed
  through calls to CloseHandle. If these handles are not needed,
  it is best to close them immediately after the process is created. 

well 

zp->z_xferpid is delclared as a HANDLE under nt so I just assumed that

  zp->z_xferpid = proc_info_copy->hProcess;

and nt would know that there were two handles open to this and not reuse
the handle id until both were closed ... well apparently NOT...


Changes for 14 jan 96 ... 

Integrated Software.coms changes to pull the directory and other settings
out of the registry instead of the named.boot file... This is to make it
easier on them every time a new version comes out.
If you want to use this option set a compile flag called REGISTRY_PATHS

Personally I think we should stick with the standard bind method of putting
stuff in the named.boot... otherwise support gets confusing.. and also all the
bind documentation references setting things here. In addition if we start with
xfrnets and directory settings in the registry what about stubs, forwarders and the variety
of other settings.. basically if we want to do it this way the entire named.boot and
should be stored in the registry with gui apps to maintain the... but again
I prefer to be compatible with the unix method... NOTE: if you set this option you
most likely will want to use their control panel applet which allows you to edit
these settings instead of the one bundled with this distribution.

What we really need in this department is a smart application that reads in the
named.boot and the database files, parses them and reports on problems and allows you
to edit things like these directives... and rewrites the files back out... leave the
files as is with unix versions but some smart system admin editting tools...


Changes for 13 jan 96 ... 

The new control panel applet ndc.cpl is thanks to paul Wren and software.com
I took theirs and modified it for the freeware version...

Also the waitforsingelobject happened once on me again only when doing 
a restart at the exact time a zone transfer was terminated... 
and the zone didn't get resheduled... I can now repro it.. 
This seems ok since the handle it is waiting on is now gone...
(we have restarted ... but the xfer is still running out there and so is
the thread waiting for it to terminate...)
but now I changed the code so no matter what even if the unlikely even 
this happens it will still go into endxfer and reschedule the zone...

Changes for 12 jan 96 ... No new version increase

A bug in the instsrv.exe program for installation was brought to my attention
it was registering the eventlog key as domainnameservice... but the first time
you run (and everytime) named or ndc it reregisters the correct key as DNS so
that the messages come out with the source of DNS which is clearer...

I didn't increase the version number since it is a minor problem..


Changes for the 10 Jan. 96 version (4.9.3 Release-P1)

some minor changes to the named xfer code in ns_maint in trying to isolate 
why the waitforsingleobject is timing out... this is ok after the xfer times out and
is killed but sometimes this doesn't seem to be occuring... still looking..
it appears that nt is reusing the process handles even before the old ones are
closed.. .the only thing I can think off is that because the handles are copied
with a bcopy nt does not know that there are still handles open... changed this
code to see if it helps.. seems to be working so far...
Also serialized startxfer so that in case the problem is that one thread is in here
from addxfer and a second thread is in from endxfer ...
Sees to have fixed it... This bug has been in the produce all along... it
was some kind of a race condition or timing issue and on some machines you would
get a failure in the waitforsingleobject every 100-200 transfers on others
not until 5000-10000 transferes... I think I have it fixed now... not 100% sure..
Also tracked down the errant handles in a transfer so now all is ok in this
department..

however I have encountered a bug in the debugging
code where I got a access violation ... while logging a query... I have reported
it to the bind workers and am waiting on resolution ... I have not duplicated it..
lso changed the named-xfer code since if called with debugging or called when
running named in debug mode it would not close the trace files hence 0 length files..
I also changed it to delete the trace file if the xfer completed ok...

Changes for the 09 Jan. 96 version (4.9.3 Release)

some minor changes to the named xfer code in ns_maint in trying to isolate 
why the waitforsingleobject is timing out... this is ok after the xfer times out and
is killed but sometimes this doesn't seem to be occuring... still looking..


Changes for the 06 Jan. 96 version (4.9.3 Release)

Some changes posted the the bind workers mailing list regarding..

+ 	--- 4.9.3-p1 released ---
+ 
+ 575. [port]	Ultrix/Hesiod named responses are oversized, we were
+ 		incorrectly accepting them and then overwriting the stack.
+ 
+ 574. [port]	BSD/OS 2.1 required some ./BSD/Makefile changes.
+ 

Changes for the 05 Jan. 96 version (4.9.3 Release)

Slight changes so this version would compile under unix... cr/lf variables not
inside ifdefs's etc.

Also a slight change to the abort xfer code so that messages that are not warnings
come up ok... also frees a structure that was not being freed.

Changes for the 03 Jan. 96 version (4.9.3 Release build 2:
01/03/96  02:32p               251,392 named.exe

A bug was found by  Hans Karl May Zimmer which was introduced by me all the
way back at beta 27... with more than one zone transfer occuring at a time I 
was incorrectly overwritting vital information... this has now been fixed..
  
Changes for the 03 Jan. 96 version (4.9.3 Release)
  
Reapplied diffs to the 4.9.3 release ... two files are all that needed manual
intervention... recompiled everything..

Changes for the 28 Dec. 95 version

A minor diff posted to the bind workers mailing list for ns_Resp.c
new named.exe and xfer.exe only.

Changes for the 25 Dec. 95 version

reporting of changes to beta 32 using diff/patch... no failures...
recompile all for new version... this is a release candidate...


Changes for the 24 Dec. 95 version

reporting of changes to beta 31 using diff/patch... no failures...
recompile all for new version... this is a release candidate...


Changes for the 23 Dec. 95 version

reporting of changes to beta 30 using diff/patch and also patches to beta 30...



Changes for the 22 Dec. 95 version


reporting of changes to beta 29 using diff/patch only 5 files needed manual
intervention...

Scheduling ok ... yeah,.... still trying to track down the failure for xfers
on a machine with a lot of ip address... found one problem and fixing..
#define FD_SETSIZE 512 added before including winsock as per found documentation
apparently MS defines this as only 64 and therefore the max sockets we could
bind and listen on was 64 and the others were being ignored... god knows what
was happening with the other FD_SET calls... maybe this was writing over memroy????
this change forced recompiling of everything since the libs changed also..

Success this change fixed being able to communicate on all bound ip addresses
(up to 512 now)... and also fixed the zone transfer problem... apparently
microsoft in its infinite wisdome when you try to add more than the limit 
(used to be 64) sockets to a fd_set ... just ignores it (bad enough) but also
writes over memory beyone the end of the socket set.. .thanks microsoft and
this was corrupting the server...


Changes for the 20 Dec. 95 version

Additional fix submitted by Mark Andrews in response to my query about the
named xfers failing on the test site with 91 ip addresses... apparently there
was a bug calculating packet sizes over 16 bit max with an htons that needed
to be changed to an ntohs... verifying the fix now... changes in ns_main.c i.e.

	htons <-> ntohs bug.
	additional debugging.

	Mark

*** ns_main.c.001	Thu Dec  7 07:34:47 1995
--- ns_main.c	Thu Dec 21 14:16:16 1995
***************
*** 851,857 ****
  			        }
  			        if ((sp->s_bufp - (u_char *)&sp->s_tempsize) ==
  					INT16SZ) {
! 					sp->s_size = htons(sp->s_tempsize);
  					if (sp->s_bufsize == 0) {
  					    if (!(sp->s_buf = (u_char *)
  						  malloc(rbufsize))
--- 851,860 ----
  			        }
  			        if ((sp->s_bufp - (u_char *)&sp->s_tempsize) ==
  					INT16SZ) {
! 					sp->s_size = ntohs(sp->s_tempsize);
! 					dprintf(5, (ddt,
! 					    "sp x%lx expecting %d bytes\n",
! 					    (u_long)sp, sp->s_size));
  					if (sp->s_bufsize == 0) {
  					    if (!(sp->s_buf = (u_char *)
  						  malloc(rbufsize))
--
Mark Andrews, CSIRO Div Maths & Stats
Locked Bag 17, North Ryde, NSW 2113, Australia.
PHONE:	+61 2 325 3148			     INTERNET: marka@syd.dms.csiro.au
UUCP: ....!uunet!syd.dms.csiro.au!marka


The current code that fetches the ip address for nt only handle a max of 62
ip addresses... one users was trying to use 91 (why)... anyway I have increased
the code here and it will handle up to 512 now... it looks like bind (a rouch
estimate will only be able to handle a max of about 412. 
Also tracked down a memory leak in xfer's where (the original port) was mallocing
a structure each time but not freeing it... made it global...
Also found a handle in the named xfer (from our server) code
that was not being closed.

Also fixed a bug
in my code where it would not fetch ip addresses correctly from 
the second nic card.

Also another go-around on the maintenance scheduling code... here is an excerpt
from a mail message from Kevin Dunlap at Attachmate...

------------------------------------------------------------------
 Yesterday, I got my mods merged into the beta version. It stayed
 up and running all night, the system didn't lockup and named's 
 memory usage looks reasonable.  We had about 865 zone transfers 
 over the night.

 I have't looked at the RFC's lately, is it legal to have a
 domain that needs refreshing in less than 50 minutes.  If it is 
 then there may a problem.   The sched_maint() only schedules the 
 timer thread to sleep for 3540*1000. Anything less than that
 appears not to get scheduled and i get the syslog message

 "sched_maint: Attemp: to rescheduling maint. from 3540 sec to 60 
 sec. ignored!"
 
 I am not sure if my changes effected this or if there is really 
 a problem in sched_maint().  I'll be looking more into this.
---------------------------------------------------------------

response: it does schedule at other increments but will not kill the running
timer thread... 

Based on this info... I Again rewrote the maintenance timer stuff this time
it should exactly mimic the unix behavior... I figured out a way to kill the
current sleeping thread when a reschedule request comes in (without the memory
leak that would be associated with using TerminateThread)... basically changed
the sleep to a waitforsingleobject that waits on an event object... if the event
gets signaled it means we want to terminate since a reschedule is occuring and a
new thread will be started up... If the timout occurs we proceed as we previously
did and reschedule the next maintenance cycle... Note however since this works
exactly like unix (quirky) sometimes a thread will get rescheduled immediately..
i.e. if you startup your server needed two secondary zone transfers (ie empty zone
files)... it may reschedule 15 mintes for the first transfer and immediately 
reschedule 900 seconds or 15 minutes for the second zone... these are in case the
zones timeout... then if they transfer ok it reschedules for 1 hour...
Hopefully this will be it for the scheduling problems... 
However if anyone can find this there is an errant handle... as shown by pmon..
when doing transfers (incomming) there is one additional handle each time 
that is not getting freed... I have been unable to track it down... 
it is strange since if it was a handle to one of the threads they shouldn't 
totally exit the system and you should still see the thread count higher...
If someone tracks this down please let me know... if you are doing a million
transfers as Kevin you will now get an extra 4 bytes lost each time... but
there probably is a limitation to the max number of open handles also and
you may hit this eventually... This problem has been in the port all along
and was worse when there were actually extra threads running...
It doesn't appear to be related to the maintenance scheduling threads but to
the zone transfer process/thread...

Changes for the 19 Dec. 95 version

From Paul Wren/software.com added ifdefs around some nt specific code
so that it would compile correctly with xstats turned off.

Changes for the 16 Dec. 95 version

There was a problem in the maintenance scheduling in that it is for some reason
called multiple times (i.e. every time after a zone transfers etc.) and we
would as a result get multiple threads running all waiting a specified amount of
time to activate the maintenance alarm... this tended to grow if you transfer
zones alot as one user was doing... making it look like a memory leak... most
people did not see this problem.. I have fixed this by using a status variable in
a critical section so only one thread is ever waiting to perform maintenance..
This a a version of beta 27 without the addition fixes sent to the bind workers
list since these had some bugs relating to intermittant cname lookup failures
and problems with debugging on the the validataion stuff..., Also fixed a race
condition in the new maintenance stuff describe above...


Changes for 08 dec 95 version

many changes this is a report of bind 4.9.3 beta 27 for limited distribution..
also back to vc++ 2.2 getting ready for bet28/release....

I used diff with the context switch to determine the differences between
beta 26 and beta27 and applied these to nt using patch.. however just about
every file needed some manual intervention... Also some of the changes caused
compiler warnings under nt and some types needed to be changed... 
I also looked and doing this by determining the changes from beta26 to the nt
port and redoing these changes to beta27.. however the amount of change was
greater.. and I didn't keep the original port of beta 26 and the one on vixie
now is slightly different...

I had significant problems with vc++ 4.0 (cannot mix and match stuff that
uses 2.0 and 4.0 runtime, it would crash, and debugging would go into assembler
instead of walking over code, as the /Tp option did not work... For this
reason I'm back to vc++ 2.2 for now...


Changes for version 05 dec 95 version.

the fix for wks records (Nov 4th version) 
while working ok under nt did not work under other os's
thanks to Paul Vixie (vix.com)and Paul Wren (software.com) 
for help identifying and resolving on this problem..

This fix is only for compatability to compile this version of bind on non NT
platforms and really does not address an NT intel problem so you may not wish 
to upgrade to it... 

i.e.

From Paul ...

You're right, but it's not NT's problem.  In the compat/ntmisc.c file, the
getservent() function manually parses the SERVICES file in the
system32/drivers/etc, and returns the port as "(short)atoi(cp)" which is in
machine-byte-order.  Then when db_glue.c does a ntohs() on it, it gets
scrambled but ONLY if the machine byte order is not equal to network byte
order. 

So the "real" solution probably should be that on line 273 of ntmisc.c where
it does:

	serv.s_port = (short)atoi(cp);

we should say instead:

        serv.s_port = htons((short) atoi(cp));

so that getservent() acts like BSD, and put db_glue.c back the way it was.

-- Paul@software.com

--------------------------------------------------------------------------

CHANGES for compiling under VC++ 4.0

WARNING fstat without the _ no longer works... I had to add some defines
in portability.h to resolve this... microsoft basically said since the documentation
states fstat not _fstat  that I'm out of luck... hopefully there were no 
other such changes that will make code fail... the function still works 
(fstat) but just returns an error condition... (in a small test case fstat
still works???)

new .mdp files as well as makefiles... 


CHANGES for the Windows NT port of BIND Beta 26 11/09/95

The named xfers were not getting updated correctly when they terminated and
hence secondaries zones would become stale eventually
Thanks to Kevin Dunlap for finding this... in addition for synchronization
(just in case) critical sections were added around the code manipulating the
zp zone variables as originally specified by vbais... A new debug message
was added for the nt vesion so you can verify that your zone was loaded correctly.
For those of you running secondary servers... I'm suprised you missed this..
it would only affect you when downloading zones... once the zone was downloaded 
if you stopped and restarted the server you were ok... 

Only named.exe was regenerated you can just copy the new one over the old one..
the only two source changes were in ns_maint.c and ns_main.c


CHANGES for the Windows NT port of BIND Beta 26 11/04/95

1. WKS records did not work correct as some dirctory paths were not 
expanded.  Related to this the resolv.conf (in our case \winnt\resov.ini
also did not work.  And a bug was found related to this in the stock bind
code that incorrectly converted port numbers to host format. So that 
information from the WKS records was rejected.  L. Kahn
All new executables are generated. Just copy over the old ones... no 
reinstall is necessary.


CHANGES for the Windows NT port of BIND Beta 26  10/15/1995

1. fixed the binding so that the server will now bind to all relevent ip
addresses instead of just 0.0.0.0 otherwise some queryies would come in
on one ip address and go out on another causing some nslookup programs to fail...
The server will not bind to a RAS ip addresses since this causes problems if the
interface goes down and comes back up.  Even so everything works ok if the server binds
to other ip addresses... you can still do queries on the ras interface, also if you 
have only ras it should bind to the msloopback ip addresses... It has been tested
to work correctly with subnet masks and also multiple ip addresses on one nic card,
or across multiple cards.

2. also fixed some miscelaneous bugs with attempts to set null variables.

3. Also fixed problem with recvfrom failure with error 10040 wsamsgsize
   BUFSIZ was declared as only 512 in stdio.h but it is 1024 on most unixes...
 

- Larry


CHANGES for the Windows NT port of BIND Beta 26  10/15/1995


Many Windows NT Beta 24 port modifications were applied to the Beta 26 code
base, semi-automatically via CVS merge facilities.  Only five files
required manual intervention.  Many type inconsistencies and minor build
or configuration problems were fixed under Visual C++.  Also, a number of
minor bugs were corrected.

This release still needs additional testing, and at least one site is 
running it as a primary DNS server in production, so this gives us some 
confidence that the port is fairly close to a "production-use" version.

-Greg

Addendum: Type Changes

10/10/1995 Greg Schueman from the files: named/db_defs.h, named/ns_defs.h


File: db_defs.h: (was type u_int32_t)
      int32_t d_ttl;          /* time to live */

File: ns_defs.h: (was type u_int32_t)
      int32_t z_refresh;      /* refresh interval */
      int32_t z_expire;       /* expiration time for cached info */
      int32_t z_minimum;      /* minimum TTL value */

File: ns_defs.h: (was type int)
      u_int           dq_dfd;         /* datagram file descriptor */


