----------------------------------------------------------------------------
BIND v4.9.5 Release                                       November 11th, 1996
						  
----------------------------------------------------------------------------
	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.  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. 
             For this reason I/We don't recommend running bind on win95 
             and will not support bind on win95 relating 
             to this problem until it is fixed by microsoft (if ever).
             i.e.
             Also added a new patch to win95 for wsock32 ... which is supposed
             to fix a memory leak in multi-threaded socket apps (ie bind)..
             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.


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

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

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

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


