Only in m:\bind: 494p1
Only in m:\bind: 495_to_495p1
Only in m:\bind: 495relpatch.log
Only in m:\bind: 495t6bpatch.log
Only in m:\bind496rel/BSD: BIND
Only in m:\bind/BSD: Diffs
diff --recurs m:\bind496rel/CHANGES m:\bind/CHANGES
30a31,32
>                 note: not true under windows NT as I consider this usefull
>                 and not a security risk.
Only in m:\bind: IBM
Only in m:\bind496rel: INSTALL
Only in m:\bind: INSTALL.txt
Only in m:\bind: MIRRORS
Only in m:\bind: bind-4.9.3-BETA26.tar.gz
Only in m:\bind: bind-4.9.3-BETA29.tar.gz
Only in m:\bind: bind-4.9.3-BETA30.tar.gz
Only in m:\bind: bind-4.9.3-BETA31.tar.gz
Only in m:\bind: bind-4.9.3-BETA32.tar.gz
Only in m:\bind: bind-4.9.3-REL.tar.gz
Only in m:\bind: bind-4.9.4-P1.tar.gz
Only in m:\bind: bind-4.9.4-REL.tar.gz
Only in m:\bind: bind-4.9.4-T3B.tar.gz
Only in m:\bind: bind-4.9.4-T4B.tar.gz
Only in m:\bind: bind-4.9.4-T5B.tar.gz
Only in m:\bind: bind-4.9.5-P1.tar.gz
Only in m:\bind: bind-4.9.5-REL.tar.gz
Only in m:\bind: bind-4.9.5-T1A.tar.gz
Only in m:\bind: bind-4.9.5-T3A.tar.gz
Only in m:\bind: bind-4.9.5-T5B.tar.gz
Only in m:\bind: bind-4.9.5-T6B.tar
Only in m:\bind: bind-4.9.5-T6B.tar.gz
Only in m:\bind496rel: bind-4.9.6-REL.tar
Only in m:\bind496rel: bind-4.9.6-REL.tar.gz
Only in m:\bind: bind-4.9.6-T1A.tar
Only in m:\bind: bind-4_9_5-T4B_tar.gz
Only in m:\bind: bs.exe
Only in m:\bind: buildallnt.bat
diff --recurs m:\bind496rel/compat/include/sys/cdefs.h m:\bind/compat/include/sys/cdefs.h
87,96c87,98
< #ifndef __GNUC__
< #define	__const				/* delete pseudo-ANSI C keywords */
< #define	__inline
< #define	__signed
< #define	__volatile
< /*
<  * In non-ANSI C environments, new programs will want ANSI-only C keywords
<  * deleted from the program and old programs will want them left alone.
<  * When using a compiler other than gcc, programs using the ANSI C keywords
<  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
---
> #ifndef WINNT
> #ifndef __GNUC__
> #define	__const				/* delete pseudo-ANSI C keywords */
> #define	__inline
> #define	__signed
> #define	__volatile
> #endif
> /*
>  * In non-ANSI C environments, new programs will want ANSI-only C keywords
>  * deleted from the program and old programs will want them left alone.
>  * When using a compiler other than gcc, programs using the ANSI C keywords
>  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
100c102
< #ifndef	NO_ANSI_KEYWORDS
---
> #ifndef NO_ANSI_KEYWORDS
105c107
< #endif
---
> #endif /* WINNT */
Only in m:\bind/compat/lib: MSG00001.bin
Only in m:\bind496rel/compat/lib: Makefile.orig
Only in m:\bind/compat/lib: WinRel
diff --recurs m:\bind496rel/compat/lib/ftruncate.c m:\bind/compat/lib/ftruncate.c
44,53c44,56
< 
< 	/* maybe shorten... */
< 	if (wantsize < cursize) {
< 		struct flock fl;
< 
< 		fl.l_whence = 0;
< 		fl.l_len = 0;
< 		fl.l_start = wantsize;
< 		fl.l_type = F_WRLCK;
< 		return (fcntl(fd, F_FREESP, &fl));
---
> 	/* maybe shorten... */
> 	if (wantsize < cursize) {
> #ifndef WINNT
> 		struct flock fl;
> 
> 		fl.l_whence = 0;
> 		fl.l_len = 0;
> 		fl.l_start = wantsize;
> 		fl.l_type = F_WRLCK;
> 		return (fcntl(fd, F_FREESP, &fl));
> #else
> 		return (lseek(fd, wantsize, 0) && SetEndOfFile((HANDLE)fd));
> #endif
diff --recurs m:\bind496rel/compat/lib/gettimeofday.c m:\bind/compat/lib/gettimeofday.c
15,21c15,22
< 	time_t clock, time __P((time_t *));
< 
< 	if (time(&clock) == (time_t) -1)
< 		return (-1);
< 	if (tvp) {
< 		tvp->tv_sec = clock;
< 		tvp->tv_usec = 0;
---
> #ifndef WINNT
> 	time_t clock, time __P((time_t *));
> 
> 	if (time(&clock) == (time_t) -1)
> 		return (-1);
> 	if (tvp) {
> 		tvp->tv_sec = clock;
> 		tvp->tv_usec = 0;
23,24c24,25
< 	if (tzp) {
< 		tzp->tz_minuteswest = 0;
---
> 	if (tzp) {
> 		tzp->tz_minuteswest = 0;
26a28,33
> #else
> 	struct _timeb timebuffer;
> 	_ftime(&timebuffer);
> 	tvp->tv_sec = (long) timebuffer.time;
> 	tvp->tv_usec = (long) (1000 * (timebuffer.millitm));
> #endif
Only in m:\bind/compat/lib: lib44bsd.mak
Only in m:\bind/compat/lib: lib44bsd.mdp
Only in m:\bind/compat/lib: lib44bsd.ncb
Only in m:\bind/compat/lib: lib44bsd.vcp
Only in m:\bind/compat/lib: lib44bsd95.mak
Only in m:\bind/compat/lib: lib44bsd95.mdp
Only in m:\bind/compat/lib: lib44bsd95.ncb
Only in m:\bind/compat/lib: lib44bsd_vc22.mak
Only in m:\bind/compat/lib: lib44bsd_vc22.vcp
Only in m:\bind/compat/lib: log.c
Only in m:\bind/compat/lib: log.h
Only in m:\bind/compat/lib: makemc.bat
Only in m:\bind/compat/lib: messages.aps
Only in m:\bind/compat/lib: messages.h
Only in m:\bind/compat/lib: messages.mc
Only in m:\bind/compat/lib: messages.rc
diff --recurs m:\bind496rel/compat/lib/mktemp.c m:\bind/compat/lib/mktemp.c
101,104c101,106
< 	extern int errno;
< 	register char *start, *trv;
< 	struct stat sbuf;
< 	u_int pid;
---
> #ifndef WINNT
> 	extern int errno;
> #endif
> 	register char *start, *trv;
> 	struct stat sbuf;
> 	u_int pid;
106,110c108,112
< 	pid = getpid();
< 	for (trv = path; *trv; ++trv);		/* extra X's get set to 0's */
< 	while (*--trv == 'X') {
< 		*trv = (pid % 10) + '0';
< 		pid /= 10;
---
> 	pid = getpid();
> 	for (trv = path; *trv; ++trv);		/* extra X's get set to 0's */
> 	while (*--trv == 'X') {
> 		*trv = (pid % 10) + '0';
> 		pid /= 10;
124a127
> #ifndef WINNT
125a129,131
> #else
> 				WSASetLastError(ENOTDIR);
> #endif
Only in m:\bind/compat/lib: ntmisc.c
diff --recurs m:\bind496rel/compat/lib/strcasecmp.c m:\bind/compat/lib/strcasecmp.c
61,65c61,67
< #include <sys/param.h>
< #include <sys/types.h>
< #include <sys/cdefs.h>
< #if (!defined(BSD)) || (BSD < 199306)
< #include "../../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <sys/cdefs.h>
> #endif
> #if (!defined(BSD)) || (BSD < 199306)
> #include "../../conf/portability.h"
67,68c69,70
< #include <string.h>
< #endif
---
> #include <string.h>
> #endif
70c72
< #ifndef NEED_STRCASECMP
---
> #ifndef NEED_STRCASECMP
116c118
< 	const char  *s1, *s2;
---
> 	const char *s1, *s2;
diff --recurs m:\bind496rel/compat/lib/strerror.c m:\bind/compat/lib/strerror.c
61c61,63
< #include <sys/param.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
Only in m:\bind/compat/lib: strip.bat
diff --recurs m:\bind496rel/compat/lib/strpbrk.c m:\bind/compat/lib/strpbrk.c
61c61,63
< #include <sys/param.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
diff --recurs m:\bind496rel/compat/lib/strtoul.c m:\bind/compat/lib/strtoul.c
64c64,66
< #include <sys/param.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
diff --recurs m:\bind496rel/compat/lib/writev.c m:\bind/compat/lib/writev.c
9c9,10
<  */
---
>  *  WindowsNT
>  */
11c12
< #if defined(_CRAY)
---
> #if defined(_CRAY)
15,16c16,17
< #include <sys/stat.h>
< #include <sys/socket.h>
---
> #include <sys/stat.h>
> #include <sys/socket.h>
84a86,160
> 
> #ifdef WINNT
> #define OWN_WRITEV
> #define TIMEOUT_SEC 120
> #include <stdarg.h>
> #include "../../conf/portability.h"
> 
> 
> /*
>  * writev --
>  * simplistic writev implementation for WindowsNT using the WriteFile WIN32API.
>  */	
> /* lgk win95 does not support overlapped/async file operations so change it to
>    synchronous */
> #ifndef WIN95
>  
> int
> writev(fd, iov, iovcnt)
> 	int fd;
> 	struct iovec *iov;
> 	int iovcnt;
> {
> 	int i;
> 	char *base;
> 	DWORD BytesWritten, TotalBytesWritten = 0, len, dwWait;
> 	extern HANDLE hReadWriteEvent;
> 	OVERLAPPED overlap;
> 	BOOL ret; 
> 
> 	for (i=0; i<iovcnt; i++) {
> 		base = iov[i].iov_base;
> 		len = (DWORD)iov[i].iov_len;
> 		overlap.Offset = overlap.OffsetHigh = (DWORD)0;
> 		overlap.hEvent = hReadWriteEvent;
> 		ret = WriteFile((HANDLE)fd, (char *)base, len,
> 		              (LPDWORD)&BytesWritten, (LPOVERLAPPED)&overlap);
> 		if ((ret == FALSE) && (errno != ERROR_IO_PENDING)) {
> 				return (-1);
> 		}
> 		dwWait = WaitForSingleObject((HANDLE)hReadWriteEvent, (DWORD)TIMEOUT_SEC * 1000);
> 		if ((dwWait == WAIT_FAILED) || (dwWait == WAIT_TIMEOUT)){
> 			return (-1);
> 		}
> 		TotalBytesWritten += BytesWritten;
> 	}
> 	return((int)TotalBytesWritten);
> }
> 
> #else // is win95 ... no async overlapped io
>  
> int
> writev(fd, iov, iovcnt)
> 	int fd;
> 	struct iovec *iov;
> 	int iovcnt;
> {
> 	int i;
> 	char *base;
> 	DWORD BytesWritten, TotalBytesWritten = 0, len, dwWait;
> 	BOOL ret; 
> 
> 	for (i=0; i<iovcnt; i++) {
> 		base = iov[i].iov_base;
> 		len = (DWORD)iov[i].iov_len;
> 		ret = WriteFile((HANDLE)fd, (char *)base, len,
> 		              (LPDWORD)&BytesWritten, NULL);
> 		if (ret == FALSE)
> 		   return (-1);
> 		TotalBytesWritten += BytesWritten;
> 	}
> 	return((int)TotalBytesWritten);
> }
> 
> #endif // win95 or not
> #endif // winnt
diff --recurs m:\bind496rel/conf/options.h m:\bind/conf/options.h
117c117,119
< #define RENICE  	/* named-xfer should run at normal priority */
---
> #ifndef WINNT
> #define RENICE  	/* named-xfer should run at normal priority */
> #endif
diff --recurs m:\bind496rel/conf/portability.h m:\bind/conf/portability.h
81,84c81,87
< #include <sys/param.h>
< #include <signal.h>
< #include <string.h>
< #ifndef TIME_H_INCLUDED
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
> #include <string.h>
> #include <signal.h>
> #ifndef WINNT
> #ifndef TIME_H_INCLUDED
86c89
< # define TIME_H_INCLUDED
---
> # define TIME_H_INCLUDED
87a91
> #endif /* WINNT */
89,90c93,181
< /* (ISC = INTERACTIVE Systems Corporation in the next #ifdef, btw.) */
< #ifdef ISC
---
> #ifdef WINNT
> #ifndef _PORTABILITY_H
> #define _PORTABILITY_H
> #include <stdio.h>
> #ifdef BUFSIZ
> #undef BUFSIZ
> #endif
> #define BUFSIZ 1024  /* GMS - added since Unix used 1K and NT 512B */
> #include <string.h>
> #include <process.h>
> #include <sys/timeb.h>
> #include <time.h>
> #include <io.h>
> #include <stdlib.h>
> #define FD_SETSIZE 512
> #include <winsock.h>
> #include <windows.h>
> #include <limits.h>
> 
> #define NOWAIT
> #define HAVE_SETVBUF
> #define NEED_GETTIMEOFDAY
> #define USE_MEMCPY
> #undef IP_OPTIONS
> #define PATH_MAX MAX_PATH
> #define ETIMEDOUT WSAETIMEDOUT
> #define ECONNRESET WSAECONNRESET
> #define ECONNREFUSED WSAECONNREFUSED
> #define EADDRINUSE WSAEADDRINUSE
> #define PORT_WOULDBLK WSAEWOULDBLOCK
> #define _TIMEZONE timezoneBSD
> 
> struct timezoneBSD {
> 	int tz_minuteswest;
> 	int tz_dsttime;
> };
> struct iovec {
> 	char *  iov_base;
> 	int 	iov_len;
> };
> typedef char *	caddr_t;
> typedef long pid_t;
> #define sleep(t) Sleep(t*1000)
> #ifdef errno
> #undef errno
> #endif
> #define errno WSAGetLastError()
> /* #define close(s) closesocket(s) */
> #define chdir(path) SetCurrentDirectory(path)
> #define dup2(s1, s2) DuplicateHandle(GetCurrentProcess(), (HANDLE)(s1), \
> 					GetCurrentProcess(), (LPHANDLE)&(s2), \
> 					0, FALSE, DUPLICATE_SAME_ACCESS);
> #define strcasecmp(x, y) stricmp(x, y)
> #define strncasecmp(x, y, z) strnicmp(x, y, z)
> 
> void  	service_main(DWORD, LPTSTR *);
> void  	service_ctrl(DWORD);
> void    worker_thread(void *);
> void    dispatch_thread(void *);
> void syslog(int, char *, ...);
> void expand_paths(void);
> int writev(int, struct iovec *, int);
> int mkstemp(char *);
> 
> #define MAXALIASES 35
> #define LOG_EMERG       0       /* system is unusable */
> #define LOG_ALERT       1       /* action must be taken immediately */
> #define LOG_CRIT        2       /* critical conditions */
> #define LOG_ERR         3       /* error conditions */
> #define LOG_WARNING     4       /* warning conditions */
> #define LOG_NOTICE      5       /* normal but signification condition */
> #define LOG_INFO        6       /* informational */
> #define LOG_DEBUG       7       /* debug-level messages */
> /* control codes that the service will accept */
> #define SERVICE_CONTROL_DUMPDB  128
> #define SERVICE_CONTROL_RELOAD  129
> #define SERVICE_CONTROL_STATS   130
> #define SERVICE_CONTROL_TRACE   131
> #define SERVICE_CONTROL_NOTRACE 132
> #define SERVICE_CONTROL_QRYLOG  133
> #define SERVICE_CONTROL_CHKPT   134
> #define SERVICE_CONTROL_EXIT    135
> #define SERVICE_CONTROL_NOLOG   136
> #define SERVICE_CONTROL_LOG     137
> #endif /* _PORTABILITY_H */
> #endif /* WINNT */
> 
> /* (ISC = INTERACTIVE Systems Corporation in the next #ifdef, btw.) */
> #ifdef ISC
224c315
< # if !defined(NeXT)
---
> # if !defined(NeXT)	&& !defined(WINNT)
288c379
< # ifndef NeXT
---
> # if !defined(NeXT) && !defined(WINNT)
294c385
< # if !defined(DMALLOC) && !defined(NeXT)
---
> # if !defined(DMALLOC) && !defined(NeXT) && !defined(WINNT)
309a401
> #ifndef WINNT
310a403
> #endif
349c442
< #if !defined(__STDC__) && !defined(const)
---
> #if !defined(__STDC__) && !defined(const) && !defined(WINNT)
359a453
> 	!defined(WINNT) && \
373,374c467,468
< #if !defined(bcopy)	/* some machines have their own macros for this */
< # if (defined(USE_POSIX) && !defined(SUNOS4)) || \
---
> #if !defined(bcopy) /* some machines have their own macros for this */
> #if (defined(USE_POSIX) && !defined(SUNOS4)) || defined(WINNT) ||\
398c492
< 	&& !defined(M_UNIX)
---
> 	&& !defined(M_UNIX)	&& !defined(WINNT)
415c509
< # if !defined(__ultrix) && !defined(apollo)
---
> # if !defined(__ultrix) && !defined(apollo) && !defined(WINNT)
466a561
> #if !defined(WINNT)
469a565
> #endif
479c575
< #if !defined(USE_POSIX)
---
> #if !defined(USE_POSIX) && !defined(WINNT)
494a591
> #ifndef WINNT
506a604
> #endif
539c637
< 	(defined(__ultrix) || defined(__osf__) || defined(NeXT))
---
> 	(defined(__ultrix) || defined(__osf__) || defined(NeXT) || defined(WINNT))
598c696
< #if !defined(HAVE_FCHMOD)
---
> #if !defined(HAVE_FCHMOD) && !defined(WINNT)
650a749,755
> 
> #ifdef WINNT /* l kahn new definitions needed for vc++4.0 */
> #define fstat _fstat
> #define stat _stat
> #define fileno _fileno
> extern BOOL OnWinnt();
> #endif
Only in m:\bind496rel/contrib/arlib: arlib.3.orig
Only in m:\bind/contrib/decwrl: gethost.o
Only in m:\bind/contrib: host.tar.Z
Only in m:\bind/contrib/nutshell: ch09.check_del.c~
Only in m:\bind/contrib: winnit-dist
Only in m:\bind/contrib: winnt-dist
Only in m:\bind: cpl
Only in m:\bind: creadme.bat
Only in m:\bind: csums.bat
Only in m:\bind: d1.bat
Only in m:\bind: diffs.ksh
Only in m:\bind: diffs493relP1tont_context.txt
Only in m:\bind: diffs493relP1tont_nocontext.txt
Only in m:\bind: diffs493reltont_nocontext.txt
Only in m:\bind: diffs494p1tont_context.txt
Only in m:\bind: diffs494p1tont_nocontext.txt
Only in m:\bind: diffs494reltont_context.txt
Only in m:\bind: diffs494reltont_nocontext.txt
Only in m:\bind: diffs494t4atot4b_context.txt
Only in m:\bind: diffs494t4atot4b_nocontext.txt
Only in m:\bind: diffs494t5b_to_494rel_context.txt
Only in m:\bind: diffs495p1btont_context.txt
Only in m:\bind: diffs495p1btont_nocontext.txt
Only in m:\bind: diffs495p1tont_context.txt
Only in m:\bind: diffs495p1tont_nocontext.txt
Only in m:\bind: diffs495relmsntont_context.txt
Only in m:\bind: diffs495relmsntont_nocontext.txt
Only in m:\bind: diffs495reltont_context.txt
Only in m:\bind: diffs495reltont_nocontext.txt
Only in m:\bind: diffs496t1ato496rel_context.txt
Only in m:\bind: diffs496t1atont_context.txt
Only in m:\bind: diffs496t1atont_nocontext.txt
Only in m:\bind/doc: i-d
Only in m:\bind/doc/info: Linux-ELF
Only in m:\bind/doc/info: Linux-again
Only in m:\bind/doc/info: Linux-and-more
Only in m:\bind496rel/doc/info: Linux-elf
Only in m:\bind/doc/info: Linux-more
Only in m:\bind/doc/info: Linux-still-more
Only in m:\bind/doc/info: sunshlib.3
Only in m:\bind/doc/misc: notify.txt
Only in m:\bind: eventlib.zip
Only in m:\bind: getfiles.bat
diff --recurs m:\bind496rel/include/arpa/inet.h m:\bind/include/arpa/inet.h
66,75c66,84
< #include <sys/param.h>
< #if (!defined(BSD)) || (BSD < 199306)
< # include <sys/bitypes.h>
< #else
< # include <sys/types.h>
< #endif
< #include <sys/cdefs.h>
< 
< __BEGIN_DECLS
< unsigned long	 inet_addr __P((const char *));
---
> #ifndef WINNT
> #include <sys/param.h>
> #if (!defined(BSD)) || (BSD < 199306)
> # include <sys/bitypes.h>
> #else
> # include <sys/types.h>
> #endif
> #else
> #define FD_SETSIZE 512
> #include <winsock.h>
> #endif /* WINNT */
> 
> #include <sys/cdefs.h>
> 
> __BEGIN_DECLS
> #ifndef WINNT
> unsigned long	 inet_addr __P((const char *));
> #endif
> 
83a93
> #ifndef WINNT
84a95
> #endif
diff --recurs m:\bind496rel/include/arpa/nameser.h m:\bind/include/arpa/nameser.h
86,88c86,90
< #include <sys/param.h>
< #if (!defined(BSD)) || (BSD < 199306)
< # include <sys/bitypes.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
> #if (!defined(BSD)) || (BSD < 199306)
> # include <sys/bitypes.h>
90c92
< # include <sys/types.h>
---
> # include <sys/types.h>
92c94
< #include <sys/cdefs.h>
---
> #include <sys/cdefs.h>
94,95c96,97
< #ifdef _AUX_SOURCE
< # include <sys/types.h>
---
> #ifdef _AUX_SOURCE
> # include <sys/types.h>
138a141
> #if !(defined(WINNT) && defined(NOERROR))
139a143
> #endif
377,378c381,382
< 	*t_cp++ = t_s >> 8; \
< 	*t_cp   = t_s; \
---
> 	*t_cp++ = (char) (t_s >> 8); \
> 	*t_cp   = (char) t_s; \
diff --recurs m:\bind496rel/include/netdb.h m:\bind/include/netdb.h
64,73c64,76
< #include <sys/param.h>
< #if (!defined(BSD)) || (BSD < 199306)
< # include <sys/bitypes.h>
< #endif
< #include <sys/cdefs.h>
< 
< #define	_PATH_HEQUIV	"/etc/hosts.equiv"
< #define	_PATH_HOSTS	"/etc/hosts"
< #define	_PATH_NETWORKS	"/etc/networks"
< #define	_PATH_PROTOCOLS	"/etc/protocols"
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif /* WINNT */
> #if (!defined(BSD)) || (BSD < 199306)
> #include <sys/bitypes.h>
> #endif
> #include <sys/cdefs.h>
> 
> #ifndef WINNT
> #define	_PATH_HEQUIV	"/etc/hosts.equiv"
> #define	_PATH_HOSTS	"/etc/hosts"
> #define	_PATH_NETWORKS	"/etc/networks"
> #define	_PATH_PROTOCOLS	"/etc/protocols"
76a80,93
> #else /* WINNT */
> 
> #ifndef WIN95
> #define	_PATH_HOSTS	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\HOSTS"
> #define	_PATH_NETWORKS	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\NETWORKS"
> #define	_PATH_PROTOCOL	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\PROTOCOL"
> #define	_PATH_SERVICES	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\SERVICES"
> #else
> #define	_PATH_HOSTS	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\HOSTS"
> #define	_PATH_NETWORKS	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\NETWORKS"
> #define	_PATH_PROTOCOL	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\PROTOCOL"
> #define	_PATH_SERVICES	"%windir%\\SYSTEM32\\DRIVERS\\ETC\\SERVICES"
> #endif /* WIN95 */
> #endif /* WINNT */
77a95
> #ifndef WINNT
114a133
> #endif /* WINNT */
122a142
> #ifndef WINNT
127a148
> #endif /* WINNT */
133a155
> #ifndef WINNT
138c160,167
< struct netent	*getnetbyaddr __P((unsigned long, int));
---
> struct netent	*getnetbyaddr __P((unsigned long, int)); /* u_long? */
> struct netent	*getnetbyname __P((const char *));
> #else
> struct hostent	*gethostbyaddr_nt __P((const char *, int, int));
> struct hostent	*gethostbyname_nt __P((const char *));
> struct hostent	*gethostbyname2 __P((const char *, int));
> struct hostent	*gethostent __P((void));
> struct netent	*getnetbyaddr __P((unsigned long, int)); /* u_long? */
139a169,170
> #endif
> 
140a172
> #ifndef WINNT
142a175
> #endif
143a177
> #ifndef WINNT
145a180
> #endif
174c209,212
< #ifdef __m88k__
---
> #ifdef __m88k__ 
> #define MAXHOSTNAMELEN 64
> #endif
> #ifdef WINNT 
diff --recurs m:\bind496rel/include/resolv.h m:\bind/include/resolv.h
64,71c64,78
< #include <sys/param.h>
< #if (!defined(BSD)) || (BSD < 199306)
< # include <sys/bitypes.h>
< #else
< # include <sys/types.h>
< #endif
< #include <sys/cdefs.h>
< #include <stdio.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
> #if (!defined(BSD)) || (BSD < 199306)
> #include <sys/bitypes.h>
> #else
> #include <sys/types.h>
> #endif
> #include <sys/cdefs.h>
> #include <stdio.h>
> #ifdef WINNT
> #define FD_SETSIZE 512
> #include <winsock.h>
> #include "..\conf\portability.h"
> #endif
89a97
> #ifndef WINNT
90a99,102
> #else
> #define _PATH_RESCONF		 "%windir%\\RESOLV.CONF"
> #define _ALT_PATH_RESCONF	 "%windir%\\RESOLV.INI"
> #endif /* WINNT */
Only in m:\bind: install
Only in m:\bind: leon.zip
Only in m:\bind: lib44bsd_vc22.mak
Only in m:\bind: mkbeta.bat
Only in m:\bind: mkdist.bat
Only in m:\bind: mkmsnsrc.bat
Only in m:\bind: mkmsntxt.bat
Only in m:\bind: mksrc.bat
Only in m:\bind: mktxt.bat
Only in m:\bind: mktxt2.bat
Only in m:\bind/named: TAGS
diff --recurs m:\bind496rel/named/Version.c m:\bind/named/Version.c
11,12c11,17
< char Version[] = "named %VERSION% %WHEN%\n\t%WHOANDWHERE%";
< char ShortVersion[] = "%VERSION%";
---
> #ifndef WINNT
> char Version[] = "named %VERSION% %WHEN%\n\t%WHOANDWHERE%";
> char ShortVersion[] = "%VERSION%";
> #else /* for windows nt want to get the full version remotely don't think this is a security risk */
> char Version[] = "named 4.9.6-Rel-Tuesday-24-June-97\n\tGregSchueman-LarryKahn-VirajBais-LeonMcCalla";
> char ShortVersion[] = "named 4.9.6-Rel-Tuesday-24-June-97\n\tGregSchueman-LarryKahn-VirajBais-LeonMcCalla";
> #endif
Only in m:\bind/named: WinRel
Only in m:\bind/named: bindtray.ico
Only in m:\bind/named: cnamefix
diff --recurs m:\bind496rel/named/db_defs.h m:\bind/named/db_defs.h
82,83c82,87
< 	u_int32_t	d_ttl;		/* time to live */
< 					/* if d_zone == DB_Z_CACHE, then
---
> #ifndef WINNT
> 	u_int32_t	d_ttl;		/* time to live */
> #else
> 	int32_t 	d_ttl;		/* time to live */
> 
> #endif					/* if d_zone == DB_Z_CACHE, then
diff --recurs m:\bind496rel/named/db_dump.c m:\bind/named/db_dump.c
84,93c84,97
< #include <sys/param.h>
< #include <sys/stat.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <netdb.h>
< #include <stdio.h>
< #include <syslog.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/stat.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <netdb.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <resolv.h>
104a109,111
> char * inet_nsap_ntoa();
> const char * inet_ntop();
> 
417c424
< 			    dp->d_ttl != zones[dp->d_zone].z_minimum)
---
> 			    (u_int32_t)dp->d_ttl != zones[dp->d_zone].z_minimum)
636c643
< 					n = -2;		/* XXX - hack */
---
> 					n = (u_int32_t) -2;		/* XXX - hack */
diff --recurs m:\bind496rel/named/db_func.h m:\bind/named/db_func.h
64a65,68
> 
> #ifdef WINNT
>                writemsg_sock __P((SOCKET, u_char *, int)),
> #endif
diff --recurs m:\bind496rel/named/db_glue.c m:\bind/named/db_glue.c
62,71c62,75
< #include <sys/uio.h>
< #include <sys/param.h>
< #include <sys/stat.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< #include <stdio.h>
< #include <syslog.h>
< #include <ctype.h>
< #include <netdb.h>
---
> #ifndef WINNT
> #include <sys/uio.h>
> #include <sys/param.h>
> #include <sys/stat.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <ctype.h>
> #include <netdb.h>
124a129
> #ifndef WINNT
126a132,137
> #else
>   	/* under Windows, abort() does not call raise(SIGABRT)
>   	 * or flush stream buffers
>   	 */
>   	 exit(3);
>   #endif
142,144c153,155
< 		if (!slp)
< 			panic(errno, "malloc(servent)");
< 		slp->name = savestr(sp->s_name);
---
>  		if (!slp)
>   			panic(errno, "malloc(servent)");
>  		slp->name  = savestr(sp->s_name);
146,148c157,159
< 		slp->port = ntohs((u_int16_t)sp->s_port);  /* host byt order */
< 		slp->next = servicelist;
< 		slp->prev = NULL;
---
> 		slp->port = ntohs((u_int16_t)sp->s_port); /* host byte order */
> 		slp->next  = servicelist;
> 		slp->prev  = NULL;
370a382
> #ifndef WINNT
371a384,387
> #else
> 		WSASetLastError(0);
> #endif
> #ifndef WINNT
373a390,393
> #else
> 		s = closesocket(fd);
> 	} while (s < 0 && errno == WSAEINTR);
> #endif
374a395
> #ifndef WINNT
375a397,399
> #else
> 	if (s < 0 && errno != WSAEBADF)
> #endif
461a486,504
> #ifdef WINNT
> int writemsg_sock(rfd, msg, msglen)
> 	SOCKET rfd;
> 	u_char *msg;
> 	int msglen;
> {
> 	u_char len[INT16SZ];
> 	__putshort(msglen, len);
> 
> 	if (send(rfd, len, INT16SZ, 0) != INT16SZ ||
> 		send(rfd, msg, msglen, 0) != msglen) {
> 		dprintf(1,(ddt, "writemsg_sock failed: %d\n",errno));
> 		return(-1);
> 	}
> 	return (0);
> }
> 
> #endif
> 
850a894
> #ifndef WINNT
893a938
> #endif /* WINNT */
diff --recurs m:\bind496rel/named/db_load.c m:\bind/named/db_load.c
88,90c88,91
< #include <sys/param.h>
< #include <sys/stat.h>
< #include <sys/socket.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/stat.h>
> #include <sys/socket.h>
92,94c93,96
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
---
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
96,97c98,104
< #include <ctype.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <syslog.h>
> #else
> #include <sys/types.h>
> #include <sys/stat.h>
> #endif
> #include <ctype.h>
101,102c108,109
< #include <syslog.h>
< #include <time.h>
---
> #include <errno.h>
> #include <time.h>	/* for gmtime() */
129a137,138
> u_int inet_nsap_addr();
> int inet_pton();
181a191
> #ifndef WINNT
182a193,195
> #else
> 	struct _stat sb;
> #endif
246a260
> #ifndef WINNT
247a262,264
> #else
> 	if (_fstat(fileno(fp), &sb) < 0) {
> #endif
316c333
< 				    if (n > (INT_MAX - (*cp - '0')) / 10) {
---
> 				    if (n > (((u_int32_t)INT_MAX - (u_int32_t)(*cp - '0')) / (u_int32_t)10)) {
336c353
< 				    if (n > max_cache_ttl)
---
> 				    if (n > (u_int32_t)max_cache_ttl)
361c378
< 			    syslog(LOG_INFO, "%s: Line %d: Unknown type: %s.\n",
---
> 			    syslog(LOG_WARNING, "%s: Line %d: Unknown type: %s.\n",
370c387
< 				syslog(LOG_NOTICE,
---
> 				syslog(LOG_WARNING,
451c468
< 					syslog(LOG_INFO,
---
> 					syslog(LOG_WARNING,
481c498
< 					syslog(LOG_NOTICE,
---
> 					syslog(LOG_WARNING,
541c558
< 				if (zp->z_expire < 
---
> 				if ((u_int32_t)zp->z_expire < 
543c560
< 				    syslog(LOG_NOTICE,
---
> 				    syslog(LOG_WARNING,
550c567
< 				    syslog(LOG_NOTICE,
---
> 				    syslog(LOG_WARNING,
555c572
< 				if (zp->z_refresh < maint_interval) {
---
> 				if (zp->z_refresh < (unsigned)maint_interval) {
561c578
< 				if (zp->z_retry < maint_interval) {
---
>  				if ((u_int32_t)zp->z_retry < (unsigned)maint_interval) {
567c584
< 				if (zp->z_expire < 
---
> 				if ((u_int32_t)zp->z_expire < 
1218c1235
< 		if (signtime > now) {
---
> 		if (signtime > (u_int32_t)now) {
1224c1241
< 		if (exptime <= now) {
---
> 		if (exptime <= (u_int32_t)now) {
1316c1333
< 						syslog(LOG_INFO,
---
> 						syslog(LOG_WARNING,
1320c1337
< 						syslog(LOG_INFO,
---
> 						syslog(LOG_WARNING,
1344c1361
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
1377c1394
< 		syslog(LOG_NOTICE, "%s: line %d: database format error (%s)",
---
> 		syslog(LOG_WARNING, "%s: line %d: database format error (%s)",
1414c1431
< 		syslog(errs ? LOG_WARNING : LOG_INFO,
---
> 		syslog(errs ? LOG_WARNING : LOG_NOTICE,
1457c1474
< 			syslog(LOG_NOTICE,
---
> 			syslog(LOG_WARNING,
1756c1773
< 				syslog(LOG_NOTICE, "%s:%d: expected a number",
---
> 				syslog(LOG_WARNING, "%s:%d: expected a number",
1785c1802
< 		syslog(LOG_INFO, 
---
> 		syslog(LOG_WARNING, 
1821c1838
< 	syslog(LOG_INFO, "%s: line %d: unexpected EOF", src, lineno);
---
> 	syslog(LOG_WARNING, "%s: line %d: unexpected EOF", src, lineno);
1877c1894
< 		syslog(LOG_INFO, "%s:%d: database naming error\n",
---
> 		syslog(LOG_WARNING, "%s:%d: database naming error\n",
1915c1932
< 		syslog(LOG_INFO, "%s: line %d: unknown protocol: %s.",
---
> 		syslog(LOG_WARNING, "%s: line %d: unknown protocol: %s.",
1957c1974
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
1968c1985
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
1977c1994
< 		syslog(LOG_INFO, "%s: line %d: missing close paren",
---
> 		syslog(LOG_WARNING, "%s: line %d: missing close paren",
2017c2034
< 			syslog(LOG_INFO, "%s contains bogus element (%s)",
---
> 			syslog(LOG_WARNING, "%s contains bogus element (%s)",
2023c2040
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
2044c2061
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
2259c2276
< 				data[n] = MAXCHARSTRING;
---
> 				data[n] = (char)MAXCHARSTRING;
2268c2285
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
2274c2291
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
2286c2303
< 		syslog(LOG_INFO,
---
> 		syslog(LOG_WARNING,
Only in m:\bind/named: db_load.sav
diff --recurs m:\bind496rel/named/db_lookup.c m:\bind/named/db_lookup.c
65,72c65,76
< #include <sys/types.h>
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <ctype.h>
< #include <stdio.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/types.h>
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <ctype.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
74c78
< #include "named.h"
---
> #include "named.h"
137c141
< 		    ((size_t)NAMELEN(*np) == (cp - name)) && 
---
> 		    ((size_t)NAMELEN(*np) == (size_t)(cp - name)) && 
diff --recurs m:\bind496rel/named/db_reload.c m:\bind/named/db_reload.c
62,67c62,71
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <stdio.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
diff --recurs m:\bind496rel/named/db_save.c m:\bind/named/db_save.c
66,70c66,74
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
diff --recurs m:\bind496rel/named/db_secure.c m:\bind/named/db_secure.c
9,14c9,19
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <syslog.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #ifndef WINNT
> #include <syslog.h>
> #include <errno.h>
> 
> #endif
diff --recurs m:\bind496rel/named/db_update.c m:\bind/named/db_update.c
62c62,63
< #include <syslog.h>
---
> #ifndef WINNT
> #include <syslog.h>
64,70c65,72
< #include <sys/types.h>
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< #include <resolv.h>
---
> #include <sys/types.h>
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> #include <resolv.h>
645c647
< 		else if (dp->d_ttl < tt.tv_sec+min_cache_ttl)
---
> 		else if ((u_int32_t)dp->d_ttl < tt.tv_sec+min_cache_ttl)
647c649
< 		else if (dp->d_ttl > tt.tv_sec+max_cache_ttl)
---
> 		else if ((u_int32_t)dp->d_ttl > tt.tv_sec+max_cache_ttl)
Only in m:\bind/named: dmalloc.c
Only in m:\bind/named: dmalloc.h
Only in m:\bind/named: icon1.ico
Only in m:\bind/named: ipaddr.mak
Only in m:\bind/named: ipaddr.mdp
Only in m:\bind/named: ipaddr.ncb
Only in m:\bind/named: ipaddr.vcp
Only in m:\bind/named: ipaddr95.mak
Only in m:\bind/named: ipaddr95.mdp
Only in m:\bind/named: ipaddr95.ncb
Only in m:\bind/named: ipadr.c
Only in m:\bind/named: ipadr95.c
Only in m:\bind/named: ipadr95.sav
Only in m:\bind/named: leon.zip
diff --recurs m:\bind496rel/named/named-xfer.c m:\bind/named/named-xfer.c
99,107c99,108
< #include <sys/param.h>
< #include <sys/file.h>
< #include <sys/stat.h>
< #include <sys/socket.h>
< 
< #include <netinet/in.h>
< #if defined(__osf__)
< # include <sys/mbuf.h>
< # include <net/route.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/file.h>
> #include <sys/stat.h>
> #include <sys/socket.h>
> 
> #include <netinet/in.h>
> #if defined(__osf__)
> # include <sys/mbuf.h>
> # include <net/route.h>
113a115,119
> 
> #else
> #include <sys/stat.h>
> #include <limits.h>
> #endif /* WINNT */
120a127
> #ifndef WINNT
121a129,131
> #else
> #include <stdlib.h>
> #endif
123c133
< # include <math.h>
---
> #include <math.h>
135a146,151
> #ifdef WINNT
> #define exit(x) ExitProcess(x);
> HANDLE hReadWriteEvent = NULL;
> char pathtmpxfer[MAX_PATH], pathtmpdir[MAX_PATH];
> #endif
> 
136a153,154
> char * inet_nsap_ntoa();
> const char * inet_ntop();
137a156
> #ifndef WINNT
139a159,161
> #else
> static char	*ddtfile = pathtmpxfer,
> #endif
157a180
> #ifndef WINNT
158a182
> #endif
161d184
< 
184c207,210
< 	int dbfd, ddtd, result, c, fd, closed = 0;
---
> 	int dbfd, ddtd, result, c, closed = 0;
> #ifndef WINNT
> 	int fd;
> #endif
194a221,232
> #ifdef WINNT
>  	WORD wVersionRequested;
> 	WSADATA wsaData;
> 	
> 	wVersionRequested = MAKEWORD(1,1);
> 	if (WSAStartup(wVersionRequested, &wsaData)) {
> 		syslog(LOG_ERR, "No useable winsock.dll: %m");
> 		exit(XFER_FAIL); 
> 	}
> 
> #endif
> 
201a240
> #ifndef WINNT
204a244
> #endif
210a251,259
> #ifdef WINNT
> 	(void) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
> 	if (!GetTempPath(MAX_PATH, pathtmpdir))
> 		syslog(LOG_ERR, "GetTempPath() failed: %m");
> 	else {
> 		strcpy(pathtmpxfer, pathtmpdir);
> 		strcat(pathtmpxfer, _PATH_TMPXFER);
> 	}
> #endif
211a261
> #ifndef WINNT
216a267
> #endif /* WINNT */
363a415
> #ifndef WINNT
383a436
> #endif WINNT
416c469,479
< 			hp = gethostbyname(tm);
---
> /*#ifndef WINNT
> 		   hp = gethostbyname(tm);
> #else
> 		   hp = gethostbyname_nt(tm);
> #endif
> */
> /* lgk we may want the above code someday but for now use gethostbyname under nt
> (not the new version which will not resolve localhost or names in the host file ..
> this means ip6 will not work with xfer for now */
> 
>             hp = gethostbyname(tm);
420c483,484
< 				       tm, zp->z_origin);
---
> 				       tm, zp->z_origin); 
> 
423c487
< 			bcopy(hp->h_addr,
---
>                   bcopy(hp->h_addr,
426a491
> 
445a511,517
> 
>     /* lgk add code to close ddtfile here */
> #ifdef DEBUG
> 	if (debug)
>       (void) my_fclose(ddt);
> #endif
> 
447a520,523
> #ifdef WIN95
> BOOL moveok;
> #endif
> 
448a525
> #ifndef WINNT
449a527,546
> #else /* lgk get rid of the ddt file if txfer ok in debug mode */
> #ifdef DEBUG
>         if (debug)
>           (void) unlink(ddtfile);
> #endif
> 
> /* lgk movefileex doesn't work on win95 so replace it */
> #ifndef WIN95
> 		/* C run time rename function under NT does not overwrite */
> 		if(!MoveFileEx(tmpname, dbfile, MOVEFILE_REPLACE_EXISTING)) {
> #else
> 		moveok = CopyFile(tmpname, dbfile, FALSE);
>                 if (moveok)
>                   moveok = DeleteFile(tmpname);
>                 if (!moveok) {
>                     
> #endif /* winnt or 95 versions */
> 
> #endif
> 
457a555
> /* lgk add code to get rid of the ddt files if not in debug mode.. */
459a558,561
> #ifdef DEBUG
>         if (debug)
>           (void) unlink(ddtfile);
> #endif
526d627
< 	u_int32_t serial;
532c633
< 	char name[MAXDNAME], name2[MAXDNAME];
---
> 	char name2[MAXDNAME];
533a635
> #ifndef WINNT
539c641,643
< 	int qdcount, ancount, aucount, class, type;
---
> #endif
> 	u_short qdcount, ancount, aucount;
>         int class, type;
541a646,651
> #ifdef WINNT
> /* lgk moved startup to beginning.. */
> 
> 	hReadWriteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
> #endif /* WINNT */
> 
556a667,668
> 
> #ifndef WINNT
578a691
> #endif /* WINNT */
594c707
< 				syslog(LOG_INFO, "malloc(%u) failed",
---
> 				syslog(LOG_WARNING, "malloc(%u) failed",
600a714
> 
606c720
< 			syslog(LOG_INFO, "socket: %m");
---
> 			syslog(LOG_WARNING, "socket: %m");
609c723
< 		}	
---
> 		}
615c729
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
629c743
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
632a747
> #ifndef WINNT
637a753
> #endif /* WINNT */
642a759
> #ifndef WINNT
644c761,764
< 			syslog(LOG_INFO, "writemsg: %m");
---
> #else
> 		if (writemsg_sock(s, buf, n) < 0) {
> #endif
> 			syslog(LOG_WARNING, "writemsg: %m");
663c783
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
685,687c805,807
< 		qdcount = ntohs(hp->qdcount);
< 		ancount = ntohs(hp->ancount);
< 		aucount = ntohs(hp->nscount);
---
> 		qdcount = ntohs( (u_short) hp->qdcount);
> 		ancount = ntohs( (u_short) hp->ancount);
> 		aucount = ntohs( (u_short) hp->nscount);
706c826
< 			syslog(LOG_NOTICE,
---
> 			syslog(LOG_WARNING,
723c843
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
747c867
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
790c910
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
851c971
< 							syslog(LOG_INFO,
---
> 							syslog(LOG_WARNING,
858c978
< 							syslog(LOG_INFO,
---
> 							syslog(LOG_WARNING,
862a983
> #ifndef WINNT
869a991
> #endif /* WINNT */
874a997,998
> 					 
> #ifndef WINNT
876c1000,1003
< 						syslog(LOG_INFO,
---
> #else
> 					if (writemsg_sock(s, buf, n) < 0) {
> #endif
> 						syslog(LOG_WARNING,
897c1024
< 						syslog(LOG_INFO,
---
> 						syslog(LOG_WARNING,
925c1052
< 					syslog(LOG_INFO,
---
> 					syslog(LOG_WARNING,
944,945c1071,1072
< 				ancount = ntohs(hp->ancount);
< 				for (n = cnt = 0 ; cnt < ancount ; cnt++) {
---
> 				ancount = ntohs( (u_short) hp->ancount);
> 				for (n = cnt = 0 ; cnt < (u_int)ancount ; cnt++) {
969c1096
< 					ancount = ntohs(hp->nscount);
---
> 					ancount = ntohs((u_short)hp->nscount);
979c1106
< 				ancount = ntohs(hp->arcount);
---
> 				ancount = ntohs((u_short)hp->arcount);
986c1113
< 					syslog(LOG_INFO,
---
> 					syslog(LOG_WARNING,
993c1120
< 					syslog(LOG_INFO,
---
> 					syslog(LOG_WARNING,
1001,1002c1128,1129
< 				ancount = ntohs(hp->ancount);
< 				for (n = cnt = 0; cnt < ancount; cnt++) {
---
> 				ancount = ntohs( (u_short) hp->ancount);
> 				for (n = cnt = 0; cnt < (u_int)ancount; cnt++) {
1010c1137
< 					syslog(LOG_INFO,
---
> 					syslog(LOG_WARNING,
1017c1144
< 					syslog(LOG_INFO,
---
> 					syslog(LOG_WARNING,
1033a1161
> #ifndef WINNT
1039a1168
> #endif /* WINNT */
1052c1181
< 		    syslog(LOG_NOTICE,
---
> 		    syslog(LOG_WARNING,
1059,1063c1188,1194
< #ifdef POSIX_SIGNALS
< 	(void) sigaction(SIGALRM, &osv, (struct sigaction *)0);
< #else
< 	(void) sigvec(SIGALRM, &osv, (struct sigvec *)0);
< #endif
---
> #ifndef WINNT
>   #ifdef POSIX_SIGNALS
>   	(void) sigaction(SIGALRM, &osv, (struct sigaction *)0);
>   #else
>   	(void) sigvec(SIGALRM, &osv, (struct sigvec *)0);
>   #endif
> #endif /* WINNT */
1093d1223
< 	struct itimerval ival, zeroival;
1097a1228,1229
> #ifndef WINNT
> 	struct itimerval ival, zeroival;
1101a1234,1239
> #else
> 	int ret;
> 	struct timeval tvout;
>  	fd_set fdset;	
> #endif
> 
1102a1241
> #ifndef WINNT
1107a1247
> 
1114c1254
< 			syslog(LOG_INFO, "premature EOF, fetching \"%s\"",
---
> 			syslog(LOG_WARNING, "premature EOF, fetching \"%s\"",
1138a1279,1333
> #else /* WINNT */
> 		/* our socket is kept nonblocking due to timeout considerations
> 		 * there are two ways to ensure that a recv on the nonblocking
> 		 * socket will not return prematurely:
> 		 * 1) use select() to wait (with timeout) for the socket to be ready
> 		 * 2) use the ReadFile() win32 API to do asynchronous I/O using
> 		 *    signalled events (as has been done in writev() implementation
> 		 * The first is being used here because it will work for Unix
> 		 * systems also, and some day the setitimer() alarms may be 
> 		 * replaced by select() to create a single scheme for both
> 		 * Unix and NT
> 		 */
> 		 tvout.tv_sec = timeout;
> 		 tvout.tv_usec = 0;
> 		 FD_ZERO(&fdset);
> 		 FD_SET(fd, &fdset);
> 		 ret = select(fd+1, &fdset, (fd_set *)0, (fd_set *)0, &tvout);
> 		 if ((ret != SOCKET_ERROR) && (ret > 0)) 
> 		    {
> 		 	n = recv(fd, buf, len, 0);	 
> 
> 			if (n == SOCKET_ERROR)
> 			  {
> 				if (WSAGetLastError() == WSAEWOULDBLOCK)
> 					continue;
> 				else 
> 				   {
> 					syslog(LOG_ERR, "recv (in xfer) (len=%d): %m", len);
> 					return (-1);
> 				   }
> 		       
> 		       }
> 		    else if (n == 0)
> 			 {
> 			   syslog(LOG_WARNING,"recv (in xfer) (connection closed by remote) : %m");
> 			   return(-1);
> 			 }
> 		   }
> 	        else /* error case on select */ 
> 				{
> 				  if (ret == SOCKET_ERROR)
> 				  {
> 					  syslog(LOG_ERR,"select (in xfer) error: %m");
> 					  return(-1);
> 				  }
> 
> 		 	      if (ret == 0) 
> 				    { 
> 				     WSASetLastError(WSAETIMEDOUT);
> 			             syslog(LOG_WARNING, "select (in xfer timed out) error: %m");
> 			             return (-1);
> 				    }
> 				 }
> 
> #endif /* WINNT */
1141a1337
> #ifndef WINNT
1145a1342
> #endif
1426c1623
< 		if (n > (sizeof data) - (cp1 - (u_char *)data))
---
> 		if ((unsigned)n > (sizeof data) - (cp1 - (u_char *)data))
1438c1635
< 		syslog(LOG_INFO, "\"%s %s %s\" - unknown type (%d)",
---
> 		syslog(LOG_WARNING, "\"%s %s %s\" - unknown type (%d)",
1460c1657
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_WARNING,
1469c1666
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
1479c1676
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
1486c1683
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
1507a1705
> #ifndef WINNT
1508a1707,1710
> #else
> 					if (fseek(dbfp, 0L, SEEK_SET) || 
> 						!SetEndOfFile((HANDLE)fileno(dbfp))) {
> #endif
1510c1712
< 						syslog(LOG_INFO,
---
> 						    syslog(LOG_ERR,
1545c1747
< 		syslog(LOG_INFO, "%s in zone %s", gripe, zp->z_origin);
---
> 		syslog(LOG_WARNING, "%s in zone %s", gripe, zp->z_origin);
Only in m:\bind/named: named.aps
Only in m:\bind/named: named.mak
Only in m:\bind/named: named.mdp
Only in m:\bind/named: named.ncb
Only in m:\bind/named: named.rc
Only in m:\bind/named: named.vcp
Only in m:\bind/named: named95.mak
Only in m:\bind/named: named95.mdp
Only in m:\bind/named: named95.ncb
Only in m:\bind/named: ndc.c
Only in m:\bind/named: ndc.mak
Only in m:\bind/named: ndc.mdp
Only in m:\bind/named: ndc.ncb
Only in m:\bind/named: ndc.vcp
Only in m:\bind/named: ns_REsp.sav
diff --recurs m:\bind496rel/named/ns_defs.h m:\bind/named/ns_defs.h
122,131c122,136
< 	u_int32_t	z_expire;	/* expiration time for cached info */
< 	u_int32_t	z_minimum;	/* minimum TTL value */
< 	u_int32_t	z_serial;	/* changes if zone modified */
< 	char		*z_source;	/* source location of data */
< 	time_t		z_ftime;	/* modification time of source file */
< 	struct in_addr	z_xaddr;	/* override server for next xfer */
< 	struct in_addr	z_addr[NSMAX];	/* list of master servers for zone */
< 	u_char		z_addrcnt;	/* number of entries in z_addr[] */
< 	u_char		z_type;		/* type of zone; see below */
< 	u_int16_t	z_flags;	/* state bits; see below */
---
> #ifndef WINNT
> 	u_int32_t	z_expire;	/* expiration time for cached info */
> #else
> 	int32_t	z_expire;	/* expiration time for cached info */
> #endif
> 	u_int32_t	z_minimum;	/* minimum TTL value Changes */
> 	u_int32_t	z_serial;	/* changes if zone modified */
> 	char		*z_source;	/* source location of data */
> 	time_t		z_ftime;	/* modification time of source file */
> 	struct in_addr	z_xaddr;	/* override server for next xfer */
> 	struct in_addr	z_addr[NSMAX];	/* list of master servers for zone */
> 	u_char		z_addrcnt;	/* number of entries in z_addr[] */
> 	u_char		z_type;		/* type of zone; see below */
> 	u_int16_t	z_flags;	/* state bits; see below */
> #ifndef WINNT
132a138,140
> #else
> 	HANDLE		z_xferpid;	/* handle for thread doing xfer */
> #endif
177a186,188
> #ifdef WINNT
> #define XFER_KILLED 	4
> #endif
178a190
> #ifndef WINNT
179a192
> #endif
253a267
> #ifndef WINNT
254a269,271
> #else
> 	SOCKET	s_rfd;
> #endif
268a286
> #ifndef WINNT
269a288,290
> #else
> 	u_int		dq_dfd;		/* datagram file descriptor */
> #endif
diff --recurs m:\bind496rel/named/ns_forw.c m:\bind/named/ns_forw.c
62,66c62,68
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
68,71c70,78
< #include <syslog.h>
< #include <resolv.h>
< #include <stdio.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <syslog.h>
> #else
> #include <stdlib.h>
> #include <search.h>
> #endif
> #include <resolv.h>
> #include <stdio.h>
> #include <errno.h>
74a82,85
> #ifdef WINNT
> int qcomp(const void *, const void *);
> #endif
> 
383c394
< 	register int n;
---
> 	register unsigned int n;
659a671
> #ifndef WINNT
661a674,676
> #else
> 		qsort((char *)qp->q_addr, n, sizeof(struct qserv), qcomp);
> #endif
1070d1084
< 	struct databuf *dp;
diff --recurs m:\bind496rel/named/ns_func.h m:\bind/named/ns_func.h
106,109c106,113
< extern void		holdsigchld __P((void));
< extern void		releasesigchld __P((void));
< extern SIG_FN		reapchild __P(());
< extern void		endxfer __P((void));
---
> #ifndef WINNT
> extern void		holdsigchld __P((void));
> extern void		releasesigchld __P((void));
> extern SIG_FN		reapchild __P(());
> extern void		endxfer __P((void));
> #else
> extern	void		endxfer __P((DWORD));
> #endif
diff --recurs m:\bind496rel/named/ns_glob.h m:\bind/named/ns_glob.h
89,90c89,93
< DECL	int			vs		INIT(-1);
< 
---
> #ifndef WINNT
> DECL	int			vs		INIT(-1);
> #else
> DECL	int			vs		INIT(INVALID_SOCKET);
> #endif
diff --recurs m:\bind496rel/named/ns_init.c m:\bind/named/ns_init.c
62,71c62,75
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/stat.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <syslog.h>
< #include <resolv.h>
< #include <stdio.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <sys/stat.h>
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <resolv.h>
> #include <stdio.h>
> #include <errno.h>
98a103,106
> #ifdef WINNT
>      BOOLEAN BootFileOkSignaled = FALSE;
> #endif
> 
108,111c116,119
< {
< 	u_long refresh = (zp->z_refresh > 0) ? zp->z_refresh : INIT_REFRESH;
< 	time_t half = (refresh + 1) / 2;
< 
---
>    {
>   	u_long refresh = (zp->z_refresh > 0) ? zp->z_refresh : INIT_REFRESH;
>   	time_t half = (refresh + 1) / 2;
>  
244a253,256
> #ifdef WINNT
> 	extern char *pathtmpdir;
>         extern HANDLE hBootFileOkEvent;
> #endif
246a259,267
> 	
> #if defined(WINNT) && defined(REGISTRY_PATHS)
> 	/* software.com specific 
> 	   PIW:  change to the temp dir that we got from the registry */
> 	if (chdir(pathtmpdir) != TRUE)
> 	{
> 		syslog(LOG_CRIT, "Can't chdir to %s: %m\n",buf);
> 		exit(1);
> 	}
247a269
> #endif
268a291
> #ifndef WINNT
270,271c293,307
< 				syslog(LOG_CRIT, "directory %s: %m\n",
< 					buf);
---
> #else
> #ifdef REGISTRY_PATHS
>             /* software.com specific 
> 		       PIW Software.com: ignore the directory, we got it from
> 			   the registry already in ns_main.c, and it is stored
> 			   in the global 'pathtmpdir'. */
> 
> 			syslog(LOG_NOTICE,"Ignoring directory entry in startup\n");
> 
> 			if (chdir(pathtmpdir) != TRUE) {
> #else
> 			if (chdir(buf) != TRUE) {
> #endif /* registry paths */
> #endif /* winnt */
> 				syslog(LOG_CRIT, "directory %s: %m\n",buf);
320a357,361
> 
> /* lgk if we hit a primary secondary cache or stub line here the previous directives 
>    should be ok.. ie would have already processed the directory etc. so signal even ok
>    to proceed... */
> 
321a363,369
> #ifdef WINNT   
>    if (!BootFileOkSignaled)
>      { 
>        BootFileOkSignaled = TRUE;
>        SetEvent(hBootFileOkEvent);
>      }
> #endif
336a385,391
> #ifdef WINNT
>    if (!BootFileOkSignaled)
>      { 
>        BootFileOkSignaled = TRUE;
>        SetEvent(hBootFileOkEvent);
>      }
> #endif
343a399,405
> #ifdef WINNT
>    if (!BootFileOkSignaled)
>      { 
>        BootFileOkSignaled = TRUE;
>        SetEvent(hBootFileOkEvent);
>      }
> #endif
351a414,420
> #ifdef WINNT
>    if (!BootFileOkSignaled)
>      { 
>        BootFileOkSignaled = TRUE;
>        SetEvent(hBootFileOkEvent);
>      }
> #endif
377c446
< 			syslog(LOG_INFO,
---
> 			syslog(LOG_NOTICE,
562a632
> #ifndef WINNT
563a634,636
> #else
> 				sprintf(buf, "%sNsTmp%ld.%d", pathtmpdir,
> #endif
636a710,717
> /* make sure event is signaled here in case there are no zones */
> #ifdef WINNT
>    if (!BootFileOkSignaled)
>      { 
>        BootFileOkSignaled = TRUE;
>        SetEvent(hBootFileOkEvent);
>      }
> #endif
943c1024
< 	syslog(LOG_INFO, "check-names %s %s", transport_str, severity_str);
---
> 	syslog(LOG_NOTICE, "check-names %s %s", transport_str, severity_str);
998c1079
< 	int ok;
---
> 	int ok = 0;
1041c1122
< 		syslog((transport == response_trans) ? LOG_INFO : LOG_NOTICE,
---
> 		syslog((transport == response_trans) ? LOG_WARNING : LOG_WARNING,
diff --recurs m:\bind496rel/named/ns_main.c m:\bind/named/ns_main.c
1,3c1,3
< #if !defined(lint) && !defined(SABER)
< static char sccsid[] = "@(#)ns_main.c	4.55 (Berkeley) 7/1/91";
< static char rcsid[] = "$Id: ns_main.c,v 8.25 1997/06/01 20:34:34 vixie Exp $";
---
>  #if !defined(lint) && !defined(SABER)
> static char sccsid[] = "@(#)ns_main.c	4.55 (Berkeley) 7/1/91";
> static char rcsid[] = "$Id: ns_main.c,v 8.25 1997/06/01 20:34:34 vixie Exp $";
7c7
<  * ++Copyright++ 1986, 1989, 1990
---
>  * ++Copyright++ 1986, 1989, 1990
9,10c9,10
<  * Copyright (c) 1986, 1989, 1990
<  *    The Regents of the University of California.  All rights reserved.
---
>  * Copyright (c) 1986,  1989, 1990
>  *    The Regents of the University of California.  All rights reserved.
73a74
> #ifndef WINNT
75a77
> #endif
84a87
> #ifndef WINNT
87a91
> #endif
95a100
> #ifndef WINNT
96a102,104
> #else
> #include "ntif.h" /* hacked version for nt only */
> #endif
100a109
> #ifndef WINNT
101a111
> #endif
115a126,130
> #ifdef WINNT
> #include <process.h> 
> #include "../compat/lib/log.h"
> #endif
> 
127a143,191
> #ifdef WINNT
> 
> BOOLEAN GetNoLogFlag();
> extern BOOLEAN  nolog_flag_set;
> void ndc_thread (void *);
> 
> #ifndef WIN95
> void nsinit_thread(void *);
> #endif
> 
>     	/* handles for various threads, process, and objects */
> 	HANDLE hReadWriteEvent = NULL, hServDoneEvent = NULL, hNDCThread = NULL;
>         HANDLE hNSInitThread = NULL;
>      HANDLE hBootFileOkEvent = NULL;
>      HANDLE hWorkerThread = NULL;
>      BOOLEAN startedup = FALSE;
>  	/* variables used to inform the Service Control Manager of our current state */
>         volatile int doterminate = 0;
> 	SERVICE_STATUS ServiceStatus;
>         DWORD bootWaitTimeout = 10000; /* wait 10 seconds */
> 	SERVICE_STATUS_HANDLE   hServiceStatus;
> 	OVERLAPPED overlap; 
> 	int was_stopped = 0;
> 	char *pathboot, *pathxfer, *pathdebug,
> 	 	 *pathdumpfile, *pathpidfile, *pathstats,
> 	 	 *pathxfertrace, *pathxferddt, *pathtmpdir, *pathsysdir;
>     CRITICAL_SECTION protected_zp;
>     CRITICAL_SECTION maint_section;
>     /* lgk 10/96 new critical section to protect outgoing zone transfers */
>     CRITICAL_SECTION doxfr_section;
>     /* critical section used to synchronize the named xfers */
> #define exit(x) { if (hServDoneEvent != NULL) \
> 				  SetEvent(hServDoneEvent);\
> 				  ExitThread(x); \
> 				}
> char szMsgPath[255];
> #ifdef NOWAIT
> 	char loopbuf[] = "";
> 	struct sockaddr_in loopback;
> #endif
> 	
> #ifdef REGISTRY_PATHS
> 	/* software.com specific
> 	   PIW Software.com change to get path from registry */
> 	static int GetRegistryPath(int max_len, char *directory);
> #endif /* registry paths */
> #endif /* WINNT */
> 
> 
136a201
> #ifndef WINNT
150a216
> #endif /* WINNT */
166,167c232,237
< 	register int n, udpcnt;
< 	register char *arg;
---
>   	register int n;
> 	register char *arg;	
> 	const int on = 1;
> 
> #ifndef WINNT
>         register int udpcnt;
172d241
< 	const int on = 1;
180c249,252
< 	struct timeval t, *tp;
---
> 	struct timeval *tp;
> #endif /* WINNT */
> 
> 	struct timeval t;
195a268,296
> #ifdef WINNT
>  	WORD wVersionRequested;
> 	WSADATA wsaData;
> 	
> 	/* initialize the winsock dll version needed */
> 	wVersionRequested = MAKEWORD(1,1);
> 	if (WSAStartup(wVersionRequested, &wsaData)) {
> 		syslog(LOG_ERR, "No useable winsock.dll: %m");
> 		return;
> 	}
> 
>     /* initialize the critical section */
>    InitializeCriticalSection(&protected_zp);
>    InitializeCriticalSection(&maint_section);
>    InitializeCriticalSection(&doxfr_section);
>    /* initialize all pathnames */
>    expand_paths();
> 
>        /* lgk add startup code here */
>        /* Set the Event-ID message-file name. */
> 
>       /* lgk modified 10.96 to use getmodulefilename instead of getcurrent directory
>          so it works correctly when running as a service */
>            
>        GetModuleFileName(NULL,szMsgPath,sizeof(szMsgPath));
>        addSourceToRegistry("DNS", szMsgPath);
>        
> #endif /* WINNT */
> 
307a409
> #ifndef WINNT
310,312d411
< #else
< 	openlog("named", LOG_PID);
< #endif
320a420,426
> #else
>         /* note under windows Nt udp checksums are always turned on
>         so this is a no-op */
> 	openlog("named", LOG_PID);
> #endif
> 
> #endif /* WINNT */
342a449,454
> #ifdef WINNT
>        nolog_flag_set = GetNoLogFlag();
>        if (nolog_flag_set)
>          syslog(LOG_WARNING, "NoLog Flag is Enabled/On during startup (No Informational messages will be logged!)\n");
> #endif
> 	
354c466,470
< 		int fd;
---
> #ifdef F_DUPFD
>  		int fd;
> #endif
> 
> #ifndef WINNT
355a472,474
> #else
> 		if ((vs = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
> #endif
407a527
> #ifndef WINNT
420a541
> #endif /* NOT WINNT */
435c556,668
< 	ns_init(bootfile);
---
> 
> #ifdef WINNT           
>         /* lgk moved this earlier in the loop for nt otherwise the service startup was timinout out..
>            for a server with lots of zones (ie thousands)
>            the service startup (service_main) now does not start the main thread it is started later on where the
>            service used to be started up */
> 
>  /* create an event object that gets signaled when the bootfile is ok before we
>    start loading zones */
>  /* if it times out this means it was not ok */
>        
>          if (!(hBootFileOkEvent = CreateEvent(
>         				NULL,    /* no security attributes */
>         				FALSE,   /* auto-reset event */
>         				FALSE,   /* not-signalled */
>         				NULL)))
>              { /* no name */
>                syslog(LOG_CRIT, "CreateEvent() for hBootFileOkEvent failed: %m");
>                exit(1);
>              }
> 
> #ifndef WIN95
> #ifdef DEBUG
> 	if (!debug)
> #endif
> 	{
>          DWORD rvalue;
>          SERVICE_TABLE_ENTRY dispatchTable[] = {
>           { TEXT("DomainNameService"), (LPSERVICE_MAIN_FUNCTION)service_main },
>           { NULL, NULL }
>           };
> 
>       if (!(hNSInitThread = (HANDLE)_beginthread(
>                     nsinit_thread,
>                     0,       /* stack size			*/
>                     NULL)))
>            {    /* argument to thread	*/
>                 syslog(LOG_ERR, "Couldn't start up ns_init thread! %m");
>                 ExitProcess(2);
>            }
> 
> 
>     /* lgk new code here to wait on boot file ok event so that we don't get mislead thinking the
>       service started ok when the directory file line is not found or the boot file is bogus */
> 
>     /* now wait on the handle */
>      rvalue = WaitForSingleObject(hBootFileOkEvent,bootWaitTimeout);
> 
>     /* now check reason we woke up */
>     switch (rvalue)
>      {
> 
>       case WAIT_FAILED:
>         dprintf(1, (ddt, "Wait for BootFileOk event object failed!\n")); 
>         syslog(LOG_CRIT, "Wait for BootFileOk event object failed!");
>         CloseHandle(hBootFileOkEvent);
>         ExitProcess(1);
>         break;
>       
>       case WAIT_OBJECT_0:
>         dprintf(1, (ddt, "Wait for BootFileOk event object signaled \n"));
>         CloseHandle(hBootFileOkEvent); /* not needed anymore */
>         break;
> 
>       case WAIT_TIMEOUT:
>         dprintf(1, (ddt, "Wait for BootFileOk event timed out ... aborting startup!\n"));
>         syslog(LOG_CRIT,"Wait for BootFileOk event timed out ... aborting startup!");
>         CloseHandle(hBootFileOkEvent);
>         ExitProcess(1);
>         break;
>       
>       default:
>         dprintf(1, (ddt, "Unknown return type from WaitForSingleObject in wait for BootFileOk object (%d)!\n",rvalue));
>         syslog(LOG_ERR, "Unknown return type from WaitForSingleObject in wait for BootFileOk object (%d)!\n",rvalue);
>         CloseHandle(hBootFileOkEvent);
>         ExitProcess(1);
>         break;
>       
>      }
> 
>   /* ok proceed with startup */      
>   if (!StartServiceCtrlDispatcher(dispatchTable)) 
>           {
>   	     if (!was_stopped) 
>              {
> 				syslog(LOG_ERR, "StartServiceCtrlDispatcher: %m");
> 				ExitProcess(2);
> 		    } else {
> 				syslog(LOG_NOTICE, "StartServiceCtrlDispatcher: service stopped");
> 				ExitProcess(0);
> 		    }
> 	   }
> 	
> 	
> 	}
> 
> #ifdef DEBUG
>    else ns_init(bootfile);
> #endif
> 
> #else /* win95 */
>      ns_init(bootfile);
> #endif /* not win95 */
> #endif /* winnt - now init the bootfile in this way the service starts first */
> 
> #ifndef WINNT
>      ns_init(bootfile);
> 
> #else /* is WINNT */
>    if (hBootFileOkEvent != NULL)
>      CloseHandle(hBootFileOkEvent);
> #endif
>    
445a679
> #ifndef WINNT
462a697
> #endif /* WINNT */
471a707
> #ifndef WINNT
549a786,1025
> 
> #else /* WINNT */
> 
> #ifndef WIN95
> 
> #ifdef DEBUG
> 	if (debug)
> 	   service_main(argc, argv);
> #endif /* DEBUG */
> 
> #else /* is win95 version */
> 	   service_main(argc, argv);
> #endif /* win95 version */
> } /* end main */
> 
> 
> /*
>  * If this runs as a service under NT, the main thread will block at StartServiceCtrlDispatcher()
>  * and another thread will be started by the Service Control Dispatcher which will begin execution 
>  * at the routine specified in that call (viz. service_main) 
>  */
> 
> /* lgk change here bind was timing out on servers with thousands of domains to load
>    to handle this call service main earlier but have it wait up to 10 minutes to get the start
>    event signaled at which time it will start the main thread.. otherwise timeout and issue an
>    error.  */
> 
> /*
>  * If this runs as a service under NT, the main thread will block at StartServiceCtrlDispatcher()
>  * and another thread will be started by the Service Control Dispatcher which will begin execution 
>  * at the routine specified in that call (viz. service_main) 
>  */
> void
> service_main(argc, argv)
> 	DWORD argc;
> 	LPTSTR *argv;
> {
> 
> #ifndef WIN95
> DWORD dwWait;
> #endif
> 
> #ifdef NOWAIT
> 	loopback.sin_family = AF_INET;
> 	loopback.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
> 	loopback.sin_port = local_ns_port;
> #endif
> 
> 	/* lgk if win95 don't do this stuff */
> #ifndef WIN95
> 
> #ifdef DEBUG
> 	if(!debug) {
> #endif /* DEBUG */
> 
>       DWORD rvalue;
>     	/* register our service control handler */
> 		if (!(hServiceStatus = RegisterServiceCtrlHandler( TEXT("DomainNameService"),
>                         			(LPHANDLER_FUNCTION)service_ctrl))) {
> 			syslog(LOG_ERR, "RegisterServiceCtrlHandler() failed: %m");
> 			return;
> 		}
> 
> 		/* report pending status to Service Control Manager */
> 		ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
> 		ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
> 		ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
> 		ServiceStatus.dwWin32ExitCode = NO_ERROR;
>     	        ServiceStatus.dwServiceSpecificExitCode = 0;
> 		ServiceStatus.dwCheckPoint = 1;
> 		ServiceStatus.dwWaitHint = 5000;
> 		if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) {
> 			syslog(LOG_ERR, "SetServiceStatus(): %m");
>         	ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 			SetServiceStatus(hServiceStatus, &ServiceStatus);
> 			return;
>     	}
> 
> 		/* create an event object that the control handler function
> 	 	* will signal when it receives the "stop" control code */
> 		if (!(hServDoneEvent = CreateEvent(
>         				NULL,    /* no security attributes */
>         				FALSE,   /* auto-reset event */
>         				FALSE,   /* not-signalled */
>         				NULL)))
>              { /* no name */
> 			syslog(LOG_ERR, "CreateEvent() (servdoneeevnt) failed: %m");
>         		ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 			SetServiceStatus(hServiceStatus, &ServiceStatus);
> 			return;
>     	        }
> 
> 	/* 
> 	 * the service_main() thread will have to wait for start/stop/pause/continue requests
> 	 * from the services icon in the Control Panel or from any WIN32 application
>          * start a new thread to perform all the work of the NTP service 
>          */
>         /* now do not actually start this thread until the ns_init thread has terminated */
>         rvalue = WaitForSingleObject(hNSInitThread,INFINITE);
> 
>         if (!(hWorkerThread = (HANDLE)_beginthread(
>                     worker_thread,
>                     0,       /* stack size			*/
>                     NULL)))
>            {    /* argument to thread	*/
> 		   syslog(LOG_ERR, "_beginthread: %m");
> 		   if (hServDoneEvent != NULL)
> 			CloseHandle(hServDoneEvent);
>         	   ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 		   SetServiceStatus(hServiceStatus, &ServiceStatus);
> 		   return;
> 		 }
> 
> 
>                /* lgk 2/97 startup ndc thread on nt also for new version
>                /* still start up ndc thread even in win95 mode */
>                /* lgk new code now start up the ndc_named socket thread */
>                if (!(hNDCThread = (HANDLE)_beginthread(
>                       ndc_thread,
>                       0,       /* stack size			*/
>                       NULL)))
>                  {      /* argument to thread	*/
> 			syslog(LOG_ERR, "_beginthread: (ndc thread) %m");
>                         /* under nt since we have other ndc thread this is not an error */
> 		}
> 
> 
>     	        /* report to the service control manager that the service is running */
> 		ServiceStatus.dwCurrentState = SERVICE_RUNNING;
> 		ServiceStatus.dwWin32ExitCode = NO_ERROR;
> 		if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) 
>              {
> 			syslog(LOG_ERR, "SetServiceStatus(): %m");
> 			if (hServDoneEvent != NULL)
> 			  CloseHandle(hServDoneEvent);
>         	     ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 			SetServiceStatus(hServiceStatus, &ServiceStatus);
> 			return;
> 		}
> 
> 
>     	/* wait indefinitely until hServDoneEvent is signaled */
>     	dwWait = WaitForSingleObject(hServDoneEvent,INFINITE);
> 	if (hServDoneEvent != NULL)
> 	  CloseHandle(hServDoneEvent);
> 	if (hWorkerThread != NULL)
> 	  CloseHandle(hWorkerThread);
> 
>     	ServiceStatus.dwCurrentState = SERVICE_STOPPED;
> 	SetServiceStatus(hServiceStatus, &ServiceStatus);
> 	return;
> 	}
> 	
> #ifdef DEBUG  
> 	else 
>            /* start up ndc thread here also so we can control an nt server in debug mode */ 
> 
>                /* lgk 2/97 startup ndc thread on nt also for new version
>                /* still start up ndc thread even in win95 mode */
>                /* lgk new code now start up the ndc_named socket thread */
>                if (!(hNDCThread = (HANDLE)_beginthread(
>                       ndc_thread,
>                       0,       /* stack size			*/
>                       NULL)))
>                  {      /* argument to thread	*/
> 			syslog(LOG_ERR, "_beginthread: (ndc thread) %m");
>                         /* under nt since we have other ndc thread this is not an error */
>  		 }
> 
>  		 fprintf(stderr,"ndc thread starting up\n");
>  		 fflush(stderr);
> 
> 	    worker_thread(NULL);
> 
> #endif /* DEBUG */
> 
> 
> 
> #else /* it is win95 so... no services */
> 
> 
>             /* still start up ndc thread even in win95 mode */
>             /* lgk new code now start up the ndc_named socket thread */
>             if (!(hNDCThread = (HANDLE)_beginthread(
>                     ndc_thread,
>                     0,       /* stack size			*/
>                     NULL)))
>                {    /* argument to thread	*/
> 			syslog(LOG_ERR, "_beginthread: (ndc thread) %m");
> 			if (hServDoneEvent != NULL)
> 			  CloseHandle(hServDoneEvent);
> 			return;
> 		}
> 
> worker_thread(NULL);
> 
> #endif /* win95 */
> 
> } /* end service_main() */
> 
> 
> /* lgk new thread to dispatch service */
> void nsinit_thread(notUsed)
>   void *notUsed;
> {
>   ns_init(bootfile);
> }
> 
> 
> /*
>  * worker_thread - perform all remaining functions after initialization and and becoming a service
>  */
> void
> worker_thread(notUsed)
> 	void *notUsed;
> {
> #ifdef WANT_PIDFILE
> 	FILE *fp;
> #endif
> 	register int n, udpcnt;
> 	register struct qstream *sp;
> 	register struct qdatagram *dqp;
> 	struct qstream *nextsp;
> 	int nfds;
> 	const int on = 1;
> 	int size;
> 	SOCKET rfd;
> 	time_t lasttime, maxctime;
> 	u_char buf[BUFSIZ];
> 	struct timeval t, *tp;
> 	fd_set tmpmask;
> 	struct qstream *candidate = QSTREAM_NULL;
>      /* would like to wait on the terminate even here. .but cannot find a way to declare
>         it volatile and it does not work .. so use the stupid doterminate flag */
> 
> 	hReadWriteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
> 	overlap.Offset = overlap.OffsetHigh = (DWORD)0;
> 	overlap.hEvent = hReadWriteEvent;
> #endif /* WINNT */
> 
559a1036,1038
> #ifdef WINNT
>         startedup = TRUE;
> #endif
582a1062,1074
> 
> #ifdef WIN95 /* lgk need exit code for win95 since we don't stop the service to exit */
>     	/* test the terminate event and terminate if necessary */
> if (doterminate)
>    {
>      if (hServDoneEvent != NULL)
>  	   CloseHandle(hServDoneEvent);
> 
>  	syslog(LOG_NOTICE, "named95: service stopped");
> 	ExitProcess(0);
>     }
> #endif
> 			  
590a1083,1085
> /* this should never be called from nt as the needendxfer is only set
>  * vai a call to reapchild in ns_maint.c through a signal
>  */
591a1087
> #ifndef WINNT
594a1091,1094
> #else
>                 needendxfer = 0;
> 		syslog(LOG_ERR, "Needendxfer was Set under Windows NT... Shouldn't happen!");
> #endif
595a1096,1097
> 
> #ifndef WINNT 
596a1099
> #endif
637a1141
> #ifndef WINNT
638a1143,1145
> #else
> 		if (n < 0 && errno != WSAEINTR) {
> #endif
666a1174,1181
> #if defined(WINNT) && defined(NOWAIT)
> 				if ((n ==1) && !strcmp(buf, "")) {
> 				/* dummy packet intended to terminate select
> 				 * because a control code has been received or
> 				 * needmaint flag has been set by the timer thread */
> 					break;
> 				}
> #endif
699a1215
> #ifndef WINNT
700a1217,1219
> #else
> 			if (rfd == INVALID_SOCKET && WSAGetLastError() == WSAEINTR)
> #endif
701a1221
> #ifndef WINNT
702a1223,1225
> #else
> 			if (rfd == INVALID_SOCKET && WSAGetLastError() == WSAEMFILE && streamq) {
> #endif
704a1228,1232
> 
> #ifdef WINNT
> EnterCriticalSection(&doxfr_section);
> #endif
> 
715d1242
< 						maxctime = lasttime;
717a1245,1248
> #ifdef WINNT
> LeaveCriticalSection(&doxfr_section);
> #endif
> 
719c1250
< 					sqrm(candidate);
---
> 				   sqrm(candidate);
721a1253
> #ifndef WINNT
722a1255,1257
> #else
> 			if (rfd == INVALID_SOCKET) {
> #endif
725a1261
> #ifndef WINNT 
735a1272,1278
> #else
> 			if(ioctlsocket(rfd, FIONBIO, (u_long *)&on) == SOCKET_ERROR) {
> 				syslog(LOG_INFO, "ioctlsocket(rfd, NONBLOCK): %m");
> 				(void) my_close(rfd);
> 				continue;
> 			}
> #endif
780a1324
>  	                        dprintf(1, (ddt, "sqadd: failed closing socket %d \n",rfd));
800a1345,1349
> 
> #ifdef WINNT
> EnterCriticalSection(&doxfr_section);
> #endif
> 
810c1359
< 				    "\tbufsize %d buf x%lx bufp x%lx\n",
---
> 				    "\tbufsize %d buf x%lx bufp x%lx refcnt %d\n",
812c1361
< 				    (u_long)sp->s_buf, (u_long)sp->s_bufp));
---
> 				    (u_long)sp->s_buf, (u_long)sp->s_bufp, (u_long)sp->s_refcnt));
816a1366
> #ifndef WINNT
817a1368,1371
> #else
>  			           (n = recv(sp->s_rfd, sp->s_bufp, size, 0)) >0
> 
> #endif
823a1378
> 
860a1416
> #ifndef WINNT
864a1421,1426
> #else
> 				  (n = recv(sp->s_rfd,
> 					sp->s_bufp,
> 					sp->s_size, 0)
> 			       ) > 0
> #endif
892,893c1454,1465
< 				(void) writemsg(sp->s_rfd, sp->s_buf,
< 						HFIXEDSZ);
---
> 
> #ifndef WINNT
> 				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
> 
916,917c1488,1499
< 				(void) writemsg(sp->s_rfd, sp->s_buf,
< 						HFIXEDSZ);
---
> #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
945a1528,1533
> 
> #ifdef WINNT
> LeaveCriticalSection(&doxfr_section);
> #endif
> 
> 
964a1553
> #ifndef WINNT /* nt dos not have this functionality so call our new fx */
968a1558,1569
> #else
> #ifndef WIN95
>         if (get_winnt_interfaces(&ifc) < 0)
> #else
>         if (get_win95_interfaces(&ifc) < 0)
> #endif
>          {
> 	      syslog(LOG_ERR, "get interface configuration: %m - exiting");
> 	      exit(1);
> 	    }
> #endif
> 
980a1582
> #ifndef WINNT
981a1584,1587
> #else
>              
> 	     cp += sizeof (ifr->ifr_name) + my_size(ifr->ifr_addr) + sizeof(ifr->ifr_mask)) {
> #endif
983c1589
< 		ifr = (struct ifreq *)cp;
---
> 		 ifr = (struct ifreq *)cp;
994c1600
< #if !defined(BSD) || (BSD < 199103)
---
> #if (!defined(BSD) || (BSD < 199103)) && !defined(WINNT)
1001c1607
< 			    inet_ntoa(((struct sockaddr_in *)
---
> 			    inet_ntoa(((struct sockaddr_in *)   
1002a1609
> 
1058a1666
> #ifndef WINNT				
1069a1678,1683
> #else /* nt masks are supported */
>                    ntp->mask = inet_addr(ifreq.ifr_mask);
> #endif
> 
> #ifndef WINNT /* no interface flags on NT */
> 
1073a1688,1689
> #endif
> 
1088a1705,1706
> 		}
> #ifndef WINNT /* no interface flags on NT */
1099a1718,1721
> #else
> 			     ntp->addr = ntp->mask & ntp->my_addr.s_addr;
> 
> #endif
1160a1783,1789
> 	/* don't know how to get interface information on multihomed NT
> 	 * machines. I'm told that gethostbyname(gethostname()) should
> 	 * return all IP addresses of the local machine (except 127.0.0.1)
> 	 * but there still remains the question of netmasks and flags etc
> 	 * This whole issue needs to be addressed more thoroughly.
> 	 * Implications of this???
> 	 */
1202a1832
> #ifdef F_DUPFD
1203a1834
> #endif
1207a1839
> #ifndef WINNT
1208a1841,1844
> #else
> 	if ((dqp->dq_dfd = socket(AF_INET, SOCK_DGRAM, 0)) == INVALID_SOCKET) {
> #endif
> 	 
1238a1875
> #ifndef WINNT
1245a1883,1887
> #else
> 	if(ioctlsocket(dqp->dq_dfd, FIONBIO, (u_long *)&on) == SOCKET_ERROR) {
> 		syslog(LOG_NOTICE, "ioctlsocket(dqp->dq_dfd, nonblocking): %m");
> 	}
> #endif
1264a1907
> #ifndef WINNT
1327a1971
> #endif /* WINNT */
1330c1974
< ** Turn on or off debuging by open or closeing the debug file
---
> ** Turn on or off debuging by open or closing the debug file
1342a1987
> #ifndef WINNT
1343a1989
> #endif
1355a2002
> #ifndef WINNT
1361a2009
> #endif /* WINNT */
1368a2017
> #ifndef WINNT
1472a2122,2123
> #endif /* WINNT */
> 
1481a2133,2137
> #ifdef WINNT
> EnterCriticalSection(&doxfr_section);
> #endif
> 
> 	
1483a2140,2142
> #ifdef WINNT
>                 EnterCriticalSection(&doxfr_section);
> #endif
1489a2149,2153
> 
> #ifdef WINNT
> LeaveCriticalSection(&doxfr_section);
> #endif
> 
1507a2172,2175
> #ifdef WINNT
> EnterCriticalSection(&doxfr_section);
> #endif
> 
1523a2192,2196
> 
> #ifdef WINNT
> LeaveCriticalSection(&doxfr_section);
> #endif
> 
1539c2212
< 
---
> 	
1575c2248
< 		FD_CLR(this->dq_dfd, &mask);
---
>  		FD_CLR(this->dq_dfd, &mask);
1696a2370,3659
> 
> 
> #ifdef WINNT
> /* service_ctrl - control handler for NTP service
>  * signals the service_main routine of start/stop requests
>  * from the control panel or other applications making
>  * win32API calls
>  */
> void
> service_ctrl(dwCtrlCode)
> 	DWORD dwCtrlCode;
> {
>     DWORD  dwState = SERVICE_RUNNING;
> 	int len;
>                         /* make sure it is started up before allowing a reload, dump, stats  */
>                         /* only allow stop,querylog,trace,notrace,log,nolog  before completely started */
> 
>     /* Handle the requested control code */
>     switch(dwCtrlCode) {
> 
>         case SERVICE_CONTROL_PAUSE:
> 		/* see no reason to support this */
> 		break;
> 
>         case SERVICE_CONTROL_CONTINUE:
>  		/* see no reason to support this */
>   		break;
> 
>         case SERVICE_CONTROL_STOP:
>             syslog(LOG_NOTICE,"Bind Service_Control_Stop received ... Service Terminating!");
>             dwState = SERVICE_STOP_PENDING;
>             /* Report the status, specifying the checkpoint and waithint,
>              *  before setting the termination event.
>              */
> 			ServiceStatus.dwCurrentState = dwState;
> 			ServiceStatus.dwWin32ExitCode = NO_ERROR;
> 			ServiceStatus.dwWaitHint = 1000;
> 			if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) {
> 				syslog(LOG_ERR, "SetServiceStatus(): %m");
> 			}
> 			was_stopped = 1;
>             SetEvent(hServDoneEvent);
>             return;
> 
>         case SERVICE_CONTROL_INTERROGATE:
>             	/* Update the service status */
> 			break;
> 
>         case SERVICE_CONTROL_DUMPDB:
>             if (startedup)
>               needToDoadump = 1;
>  	      else syslog(LOG_WARNING,"Warning Attempt to dump nameserver database before startup/load is complete ... Ignored!");  
> 	      break;
> 
>         case SERVICE_CONTROL_RELOAD:
>                         if (startedup)
> 			  needreload = 1;
> 			else syslog(LOG_WARNING,"Warning Attempt to reload nameserver before startup/load is complete ... Ignored!");  
> 			break;
> 
>         case SERVICE_CONTROL_STATS:
>                      if (startedup)
> 			needStatsDump = 1;
>  			else syslog(LOG_WARNING,"Warning Attempt to dump nameserver statistics before startup/load is complete ... Ignored!");  
> 			break;
> 
>         case SERVICE_CONTROL_TRACE:
>                          debug++;
> 			  if (debug == 1)
> 				setdebug(1);
> 			 fprintf(ddt, "Debug turned ON, Level %d\n", debug);
> 			break;
> 
>         case SERVICE_CONTROL_NOTRACE:
> 			setdebug(0);
> 			break;
> 
>         case SERVICE_CONTROL_QRYLOG:
> 			qrylog = !qrylog;
> 			syslog(LOG_NOTICE, "querylog %s\n", qrylog ? "on":"off");
> 			break;
> 
>         case SERVICE_CONTROL_CHKPT:
> 			needToChkpt = 1;
> 			break;
> 
>         case SERVICE_CONTROL_LOG:
> 			nolog_flag_set = FALSE;
> 			syslog(LOG_NOTICE, "NoLog Flag off!\n");
> 			break;
> 
>         case SERVICE_CONTROL_NOLOG:
> 			nolog_flag_set = TRUE;
>                         syslog(LOG_WARNING, "NoLog Flag is Enabled/On (No Informational messages will be logged!)\n");
> 			break;
> 			
>         case SERVICE_CONTROL_EXIT:
>  #ifdef XSTATS
>             needToExit = 1;
>  #endif
>         syslog(LOG_NOTICE,"Bind Service_Control_EXIT received ... Service Terminating!");
> 	was_stopped = 1;
>             SetEvent(hServDoneEvent);
>             break;
> 
>         default:
>         	/* invalid control code */
> 			syslog(LOG_ERR, "invalid control code: %d", dwCtrlCode);
>             break;
> 
>     }
> 
> #ifdef NOWAIT
> 	if((len = sendto(datagramq->dq_dfd, (const char *)loopbuf, 1, 0,  (struct sockaddr *)&loopback,
> 	          sizeof(struct sockaddr_in))) == SOCKET_ERROR)
> 		syslog(LOG_ERR, "failed to send the control code immediately: %m");
>  
> #endif
> 
> 	ServiceStatus.dwCurrentState = dwState;
> 	ServiceStatus.dwWin32ExitCode = NO_ERROR;
> 	if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) {
> 		syslog(LOG_ERR, "SetServiceStatus(): %m");
> 	}
> }
> 
> 
> /* Expand environmental variables in file pathnames */
> void expand_paths(void)
> {
>   FILE *fp;
> 
>         /* change name back to named.boot but for backwards compat. this fails go back to the
>            alternate name named.ini... unfort. since bootfile is passed a few layers down it
>            would be a pain to changeall these calls in the stock bind so attempt to open the
>            file here and decide which name to use */
>            
> 	pathtmpdir = (char *)malloc(MAX_PATH);
> 	pathsysdir = (char *)malloc(MAX_PATH);
> 
> #ifdef REGISTRY_PATHS
>     /* software.com specific */
> 	if (GetRegistryPath(MAX_PATH, pathtmpdir))
> 	  {
> 	    syslog(LOG_ERR, "GetRegistryPath() failed: %m");
> 	  }
> #else
> 	if (!GetTempPath(MAX_PATH, pathtmpdir))
> 		syslog(LOG_ERR, "GetTempPath() failed: %m");
> 
> 	if (!GetSystemDirectory((LPSTR)pathsysdir,MAX_PATH))
> 		syslog(LOG_ERR, "GetSystemDirectory() failed: %m");
>     strcat(pathsysdir,"\\");
> 
> #endif
> 
> #ifdef REGISTRY_PATHS
> 	}
>       	else
> 		syslog(LOG_INFO,"Get registry info okay: %s",pathtmpdir);
> 	/* software.com specific
> 	    PIW:  use the directory we found from the registry for ALL files
> 	          relating to the DNS:  */
> 	pathboot = (char *)malloc(MAX_PATH);
> 	strcpy(pathboot,pathtmpdir);
> 	strcat(pathboot,"NAMED.BOOT");
>     bootfile = pathboot;
> 
> 	pathpidfile = (char *)malloc(MAX_PATH);
> 	strcpy(pathpidfile,pathtmpdir);
> 	strcat(pathpidfile,"NAMED.PID");
> 
> 	pathxfer = (char *)malloc(MAX_PATH);
> 	strcpy(pathxfer,pathtmpdir);
> 	strcat(pathxfer,"NAMED.XFER");
> 
> #else /* don't use registry paths */
> 
> 	pathboot = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_BOOT, pathboot, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_BOOT) failed: %m\n");
> 	} else
>            {
> 	     if ((fp = fopen(pathboot, "r")) == NULL)
> 	       {
>                  /* try alternate name */
> 
> 	         if (!ExpandEnvironmentStrings(_ALT_PATH_BOOT, pathboot, MAX_PATH))
>                    {
> 		   syslog(LOG_ERR, "ExpandEnvironmentStrings(_ALT_PATH_BOOT) failed: %m\n");
> 	           }
>                   else bootfile = pathboot;
> 	       } /* else it opened ok so close it */
> 	      else
>                {
>                  fclose(fp);
>                  bootfile = pathboot;
>                }
>            }
>                
> 	pathpidfile = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_PIDFILE, pathpidfile, MAX_PATH))
>           {
> 	       syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_PIDFILE) failed: %m\n");
> 	      } else PidFile = pathpidfile;
> 		 
> 	pathxfer = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_XFER, pathxfer, MAX_PATH))
>           {
> 	       syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_XFER) failed: %m\n");
> 	      }
> #endif 
> 
> 	pathdebug = (char *)malloc(MAX_PATH);
> 	strcpy(pathdebug, pathsysdir);
> 	debugfile = strcat(pathdebug, _PATH_DEBUG);
> 	
> 	pathdumpfile = (char *)malloc(MAX_PATH);
> 	strcpy(pathdumpfile, pathsysdir);
> 	dumpfile = strcat(pathdumpfile, _PATH_DUMPFILE);
> 	 
> 	pathstats = (char *)malloc(MAX_PATH);
> 	strcpy(pathstats, pathsysdir);
> 	statsfile = strcat(pathstats, _PATH_STATS);
> 	 
> 	pathxfertrace = (char *)malloc(MAX_PATH);
> 	strcpy(pathxfertrace, pathtmpdir);
>     strcat(pathxfertrace, _PATH_XFERTRACE);
> 	
> 	pathxferddt = (char *)malloc(MAX_PATH);
> 	strcpy(pathxferddt, pathtmpdir);
> 	strcat(pathxferddt, _PATH_XFERDDT);
> }
> 
> /* software.com specific */
> #ifdef REGISTRY_PATHS
> 
> /*----------------------------------------------------------------------------------------
> /
> /	Function:		GetRegistryPath
> /
> /	Description:	given a char buffer to fill (and a max length allowed) look in the
> /					NT registry for the directory entry under Software.Com/DNS.
> /
> /	Returns:		0 means it worked, -1 if it didn't
> /
> /	History:		Paul W.		11/24/95	Created
> /
> /---------------------------------------------------------------------------------------*/
> static int GetRegistryPath(int max_len, char *directory)
> {
> 	HKEY hk;
> 	int bSuccess;
> 	DWORD dw_maxlen = max_len;
> 
>     /* get key for our application */
>     bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\ISC\\DomainNameService",&hk);
>     if (bSuccess != ERROR_SUCCESS)
>       {
>     	syslog(LOG_ERR, "Cannot open the default directory registry key: %m");
>     	return -1;
>       }
> 
>     bSuccess = RegQueryValueEx(hk,
>          "Directory",
>           NULL,
>           NULL,
>           (LPBYTE) directory,
>           &dw_maxlen);
>     if (bSuccess != ERROR_SUCCESS)
>       {
> 	    syslog(LOG_ERR, "Error in RegQueryValueEx fetching service name parameter: %m");
> 	    RegCloseKey(hk);
> 	    return -1;
>       }
> 
> 	if (directory[dw_maxlen-1] != '\\')	/* if the directory does NOT have a trailing backslash */
>  	  {  
> 		directory[dw_maxlen] = '\\';	/* put one on, and terminate a little longer */
> 		directory[dw_maxlen+1] = '\0';	/* terminate at given length plus slash-space */
> 	  }
> 	else
> 		directory[dw_maxlen] = '\0';	/* terminate at given length, already has slash */
> 		
>     RegCloseKey(hk);
> 	return 0;
> }
> #endif
> 
> /*-----------------------------------------------------------------
> 	Function:	GetNoLogFlagSet
> ------------------------------------------------------------------*/
> BOOLEAN GetNoLogFlag()
> 
> {
> 
>   HKEY hk;                      /* registry key handle */
>   BOOL bSuccess;
>   DWORD  sizeofnologflag    = 4;
>   DWORD lflag = 0;
> 
> #ifndef WIN95  
>   /* Create/open a new key for our application */
>   bSuccess = RegCreateKey(HKEY_LOCAL_MACHINE,
>       "SYSTEM\\CurrentControlSet\\Services\\DomainNameService\\Parameters", &hk);
> #else
>   bSuccess = RegCreateKey(HKEY_LOCAL_MACHINE,
>       "SOFTWARE\\DomainNameService\\Parameters", &hk);
> #endif
> 
>   if(bSuccess != ERROR_SUCCESS)
>     {
>       return FALSE;
>     }
>   
>   sizeofnologflag = sizeof(lflag);
>   bSuccess = RegQueryValueEx(hk,  /* subkey handle                */
>       "NoLogFlagSet",             /* value name                   */
>       NULL,                       /* must be zero                 */
>       NULL,                       /* value type                   */
>       (LPBYTE) &lflag,            /* address of value data        */
>       &sizeofnologflag);          /* length of value data         */
>    if(bSuccess != ERROR_SUCCESS)
>     {
>       /* no error message here if not in registry assume never set */
>       return FALSE;
>     }
> 
>  RegCloseKey(hk);
> 
>  if (lflag == 1)
>   return TRUE;
>  else return FALSE;
> }
> 
> #ifndef WIN95
> 
> /* ------------------------------------------------------------------------------------------------------------------ */
> /* written by l. kahn */
> /* modified with suggestions from Kevin Dunlap so we only pick out netcards bound to tcpip */
>   int get_winnt_interfaces(ifc)
> 
>     struct ifconf *ifc;
>     
> 
>   {
>         char *ifc_buffer = ifc->ifc_buf;
> 
>     	   struct ifreq *ifr;
>         HKEY hk, hksub;                      /* registry key handle */
>         BOOL bSuccess;
>         char newkey[200];
> 
>         char servicename[50];
>         DWORD sizeofservicename = 50;
>         int Done = 0;
>         
>         /* these need to be big as they are multi_sz in type and hold all ip addresses and subnet mask for a
>            given interface */
>         char IpAddresses[10000];
>         char *ipptr = IpAddresses;
>         DWORD sizeofipaddresses = 10000;
>         char SubNetMasks[10000];
>         char *subptr = SubNetMasks;
>         DWORD sizeofsubnetmasks = 10000;
>         char bindservicenames[1000];
>         DWORD sizeofbindnames = 1000;
> 
>        char oneIpAddress[16];
>        char oneSubNetMask[16];
>        int count = 0;
>        char *onenetcard;
> 
>     /* now get all the netcard values which are bound to tcpip */ 
> 
>     strcpy(newkey,"SYSTEM\\Currentcontrolset\\Services\\");
>     strcat(newkey,"tcpip\\linkage");
>        
>     bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,newkey,&hk);
>     if(bSuccess != ERROR_SUCCESS)
>     {
>         syslog(LOG_ERR, "failed to Open TCP/IP Linkage Registry key: %m");
>         dprintf(1, (ddt, "Cannot get TCP/IP Linkage from registery.\n"));
>         return -1;
>     }
> 
>     /* now get the bind value */
>         sizeofbindnames = 1000;
>         bSuccess = RegQueryValueEx(hk,     /* subkey handle         */
>         "Bind",                            /* value name            */
>         NULL,                              /* must be zero          */
>         NULL,                              /* value type          not required  */
>         (LPBYTE) &bindservicenames,        /* address of value data */
>         &sizeofbindnames);                 /* length of value data  */
>         if(bSuccess != ERROR_SUCCESS)
>         {
>             syslog(LOG_ERR, "Error in RegQueryValueEx fetching Bind Service names parameter: %m");
>             RegCloseKey(hk);
>             return -1;
>         }
> 
> 
>     /* now loop through and get all the values which are bound to tcpip */ 
>     /* we can also close the key here as we have the values now */
>     RegCloseKey(hk);
>     onenetcard = bindservicenames;
>     while(1)
>     {
> 
>        onenetcard = onenetcard + 8;
>        if  ((onenetcard < (bindservicenames + sizeofbindnames)) &&
>            (sscanf(onenetcard,"%s",servicename) != EOF))
>          {
>             onenetcard+= strlen(servicename) + 1;
>          }
>         else { /* no more */
>                break;
>              }
> 
>         /* skip services that are NDISWAN... since these are temporary interfaces like ras and if we bind to these
>            we would have to check if the socket is still ok everytime before using it as when the link goes down
>            and comes back up the socket is no longer any good... and the server eventually crashes if we don't check
>            this.. and to check it entails a lot of overhead... shouldn't be a problem with machines with only a RAS
>            interface anyway as we can bind to the loopback or 0.0.0.0 */
> 
>         if ((strlen(servicename) >= 7) && (strncmp(strupr(servicename),"NDISWAN",7) == 0))
>           {
>             /* skip it */
> 	    dprintf(1, (ddt, "Skippping temporary interface [%s]\n",servicename));
>           }
>         else {
>   
>            /* if opening this key fails we can assume it is not a network card ie digiboard and go on.. */
>            /* ok now that we have the service name parameter close the key and go get the ipaddress and subnet mask */
> 
>            strcpy(newkey,"SYSTEM\\Currentcontrolset\\Services\\");
>            strcat(newkey,servicename);
>            strcat(newkey,"\\parameters\\tcpip");
> 
>            bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,newkey,&hksub);
>            if(bSuccess != ERROR_SUCCESS)
>             {
>               dprintf(1, (ddt, "Skipping interface [%s] ... It is not a network card.\n",servicename));
>             }
> 
>            else { /* ok it is a network card */            
>            /* ok now get the ipaddress and subnetmask */
>            sizeofipaddresses = 10000;
>            bSuccess = RegQueryValueEx(hksub,  /* subkey handle         */
>            "IpAddress",                       /* value name            */
>             NULL,                             /* must be zero          */
>             NULL,                             /* value type          not required  */
>             (LPBYTE) &IpAddresses,               /* address of value data */
>             &sizeofipaddresses);                /* length of value data  */
>             if(bSuccess != ERROR_SUCCESS)
>               {
>                syslog(LOG_ERR, "Error in RegQueryValueEx fetching IpAddress parameter: %m");
>                RegCloseKey(hksub);
>                return -1;
>               }
>            /* ok now get the ipaddress and subnetmask */
>            sizeofsubnetmasks = 10000;
>            bSuccess = RegQueryValueEx(hksub,  /* subkey handle         */
>            "SubNetMask",                      /* value name            */
>             NULL,                             /* must be zero          */
>             NULL,                             /* value type          not required  */
>             (LPBYTE) &SubNetMasks,              /* address of value data */
>             &sizeofsubnetmasks);               /* length of value data  */
>             if(bSuccess != ERROR_SUCCESS)
>               {
>                syslog(LOG_ERR, "Error in RegQueryValueEx fetching SubNetMask parameter: %m");
>                RegCloseKey(hksub);
>                return -1;
>               }
> 
>           RegCloseKey(hksub);
>           /* ok now that we have some addresses and subnet masks go through each one and add to our structure... */
>           /* multi_sz strings are terminated by two \0 in a row */
> 
> 
>         ipptr = IpAddresses;
>         subptr = SubNetMasks;
>         Done = 0;
>         while (!Done)
>         {
>          ifr = (struct ifreq *)ifc_buffer;
>          if (sscanf(ipptr,"%s",oneIpAddress) != EOF)
>            ipptr+= strlen(oneIpAddress) + 1; /* add one for terminator \0 */
>          else Done = 1;
>          
>          if (sscanf(subptr,"%s",oneSubNetMask) != EOF)
>            subptr += strlen(oneSubNetMask) + 1;
>          else Done = 1;
> 
>          /* now add to interface structure */
>          if (!Done)                  
>           {
>            ifr->ifr_addr.sa_family = AF_INET;
>            ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr.s_addr = inet_addr(oneIpAddress);
>            strcpy(ifr->ifr_mask,oneSubNetMask);
> 
>            if (strlen(servicename) > 15)
>              strncpy(ifr->ifr_name,servicename,15);
>            else strcpy(ifr->ifr_name,servicename);
> 
>            /* now increment pointer */
> 	       ifc_buffer += sizeof (ifr->ifr_name) + sizeof(ifr->ifr_addr) + sizeof(ifr->ifr_mask);
>            ++count;
>            if (((char *)ipptr == '\0') || ((char *)subptr == '\0')) 
>              Done = 1;
>           }
>           
>         }
>            } /* it is a network card */
>         } /* it is/not a temporary ndiswan name */ 
>     } /* end of loop  */
> 
>     /* now reset the length */
>     ifc->ifc_len = count * (sizeof(ifr->ifr_name) + sizeof(ifr->ifr_addr) + sizeof(ifr->ifr_mask));
>     return 0;
> }
> 
> 
> #else // win95 version
> 
> /* this routine first checks if the same mstcpnetkey matches under
>    enum\net ... likely as this is all the old routine checked.. if the bindings
>    match it returns it.. otherwise it enumerates through all keys looking for
>    one with matching mstcp\xxxx binding numbers where xxxx=the passed in mstcpnetkey */
>    
> BOOL  find_matching_netkey(mstcpnetkey,netkey)
>        char *mstcpnetkey;
>        char *netkey;
> {
> 
>  char checkkey[50];
>  DWORD sizeofcheckkey = 50;
>  char valuekey[50];
>  DWORD sizeofvaluekey = 50;
>  char adapkey[50];
>  DWORD sizeofadapkey = 50;
>  char localnetkey[50];
>  DWORD sizeoflocalnetkey = 50;
>  HKEY bk, lnk;                      /* registry key handle */
>  BOOL bSuccess;
>  int enumcount = 0;
>  DWORD vtype;
>  DWORD valueresultsize = 50;
>  char valueresult[50];
> 
> 
> 
>  strcpy(checkkey,"ENUM\\Root\\Net\\");
>  strcat(checkkey,mstcpnetkey);
>  strcat(checkkey,"\\BINDINGS");
> 
>  strcpy(valuekey,"MSTCP\\");
>  strcat(valuekey,mstcpnetkey);
> 
>  bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,checkkey,&bk);
>  if(bSuccess != ERROR_SUCCESS) 
>    {
>       /* comment out later */
>    }
>   else // opened ok now try the regqueryvalue
>   {
>     valueresultsize = 50;
>     bSuccess = RegQueryValueEx(bk, (LPSTR)valuekey, (LPDWORD)NULL, 
>                (LPDWORD)&vtype, (LPBYTE)valueresult, (LPDWORD)&valueresultsize);
> 
>     if(bSuccess == ERROR_SUCCESS)
>       {
>         RegCloseKey(bk);
>         strcpy(netkey,mstcpnetkey);
>         return TRUE;
>       }
>      else
>      {
>        RegCloseKey(bk); 
>      }
>   }
> 
>    /* ok if we get here we did not find an immediate match so now that
>       means we must go through all the enum\net entries and then binding
>       entries on each in turn */
>    /* the above immediate match check was a shortcut for efficiency reasons */
> 
>  enumcount = 0;
>  strcpy(localnetkey,"ENUM\\Root\\Net\\");
>  bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,localnetkey,&lnk);
>  if(bSuccess != ERROR_SUCCESS) 
>     {
>         strcpy(netkey,"dummy");
>         return FALSE;
>     }
>  else while (1) //  adapters loop
> 	{
> 	     sizeofadapkey = 50;
> 	     bSuccess = RegEnumKey(lnk, (DWORD)enumcount, (LPTSTR)adapkey, sizeofadapkey);
> 	     if(bSuccess == ERROR_NO_MORE_ITEMS)
> 		  {
>                    RegCloseKey(lnk);
>                    strcpy(netkey,"dummy");
>                    return FALSE;
>                   }
> 	  	  if (bSuccess != ERROR_SUCCESS)
> 		   {
> 	            RegCloseKey(lnk);
>                  strcpy(netkey,"dummy");
>                  return FALSE;
> 		   }
> 
> 	     /* now get the bindings subkey */
> 
> 	   strcpy(checkkey,"ENUM\\Root\\Net\\");
>         strcat(checkkey,adapkey);
>         strcat(checkkey,"\\BINDINGS");
> 
>         strcpy(valuekey,"MSTCP\\");
>         strcat(valuekey,mstcpnetkey);
> 
>         bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,checkkey,&bk);
>         if(bSuccess != ERROR_SUCCESS) 
>           {
>                // printf("Not bound to TCPIP! \n");
>           }
>         else // opened ok now try the regqueryvalue
>           {
> 
>                valueresultsize = 50;
>                bSuccess = RegQueryValueEx(bk, (LPSTR)valuekey, (LPDWORD)NULL, 
>                          (LPDWORD)&vtype, (LPBYTE)valueresult, (LPDWORD)&valueresultsize);
>                RegCloseKey(bk);
> 	       if(bSuccess == ERROR_SUCCESS)
>                  {     	
>     	              strcpy(netkey,adapkey);
> 	              RegCloseKey(lnk);
>                    return TRUE;
>                  }
>               else
>                {
>                 // printf("[%s] not found (in RegQueryValue)! \n",valuekey);
>                }
>           }
>     /* ok not found with this binding increment enum count and continue */
>     ++enumcount;
>     
>   } /* end of adapter/card enumeration loop */
> 
> 	/* dead code shouldn't get here */
>         return FALSE;
>  }
>       
> 
> // ------------------------------------------------------------------------
> 
>   /* By Leon McCalla to get tcpip bound to netcards on 95*/
>   /* modified by l. kahn */
>   /* changed 12/96 by l. kahn to support the multi-ip address scheme
>      on win95 which uses commas instead of spaces like NT */
>      
>   int get_win95_interfaces(ifc)
>   struct ifconf *ifc;
> 
>   {
> 	char *ifc_buffer = ifc->ifc_buf;
> 	struct ifreq *ifr;
>      HKEY hk, dk, rk, ck;                      /* registry key handle */
>      BOOL bSuccess;
>      char realkey[200];
>      DWORD sizeofrealkey = 200;
>      char netkey[50];
>      DWORD sizeofnetkey = 50;
>      char mstcpnetkey[50];
>      DWORD sizeofmstcpnetkey = 50;
>      char newkey[50];
>      DWORD sizeofnewkey = 50;
>      char driverkey[50];
>      DWORD sizeofdriverkey = 50;
>      char netid[50];		
>      DWORD sizeofnettype = 50;
>      char nettype[50];		
>      DWORD sizeofnetid = 50;
>      char subkey[50];
>      DWORD sizeofsubkey = 50;
> 
>      char checkkey[50];
>      DWORD sizeofcheckkey = 50;
> 
>      int Done = 0;
>      int Done2 = 0;
> 
>      /* these need to be big as they are multi_sz in type and hold all ip addresses and subnet mask for a
>         given interface */
>      char IpAddresses[10000];
>      char *ipptr = IpAddresses;
>      DWORD sizeofipaddresses = 10000;
>      char SubNetMasks[10000];
>      char *subptr = SubNetMasks;
>      DWORD sizeofsubnetmasks = 10000;
>      const int sep = (int)',';
>      char *token =  NULL;
>      char oneIpAddress[16];
>      char oneSubNetMask[16];
>      int count = 0;
>      BOOL netkey_found;
> 
>      int ipcount = 0;
> 
>     /* now get all the netcard (ie 0001) ..._  values which are bound to tcpip */ 
> 
>     strcpy(newkey,"ENUM\\Network\\MSTCP");
>     bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,newkey,&hk);
>     if(bSuccess != ERROR_SUCCESS)
>     {
>         syslog(LOG_ERR, "failed to Open MSTCP network Registry key: %m");
>         dprintf(1, (ddt, "Cannot get MSTCP network linkage from registery.\n"));
>         return -1;
>     }
> 
>      while (!Done)
>        {
>  	     sizeofnetkey = 50;
> 	     bSuccess = RegEnumKey(hk, (DWORD)count, (LPTSTR)mstcpnetkey, sizeofmstcpnetkey);
> 	     if(bSuccess == ERROR_NO_MORE_ITEMS)
> 		  {
> 			Done = TRUE;
>                break;
>             }
> 	
> 	     if ((bSuccess != ERROR_SUCCESS) && (bSuccess != ERROR_NO_MORE_ITEMS))
> 		   {
>                         syslog(LOG_ERR, "Error in RegEnumKey fetching network card keys from registry: %m");
> 			RegCloseKey(hk);
> 			return -1;
> 		   }
> 
>         ++count;
>      
> 	 /* now the devicedesc here does not specify the dial up so we must get the
>             last part off the key and try the key enum//root//net//netkey   */
>          /* call new routine here that first checks if the enm\root\net\\netkey
>            matches and if so returns otherwise enumerates through all enum\root\net
>            keys looking for one that matches based on the bindings subkey.. ie the
>            bindings = mstcp\netkey should match */
> 
>          sizeofnetkey = 50;
>          netkey_found = find_matching_netkey(&mstcpnetkey,&netkey);
> 
>          if (!netkey_found)
>            {
>             strcpy(nettype,"dummy");
>             strcpy(netid,"dummy");
>            }
> 
>          else
>           {
>            strcpy(checkkey,"ENUM\\Root\\Net\\");
>            strcat(checkkey,netkey);
> 
>        /* not sure if this works but on my eisa machine these were not there
>           so if they are not there assume they are not temporary .. ie enum\eisa
>           for eisa cards instead of enum\\root but I imagine all ras interfaces are like this
>           above.. so if not there it is not a ras temporary interface */
> 
> 	 // get the check value
> 	 /*check for Dial up adapter*/
> 
>  	bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,checkkey,&ck);
>      if(bSuccess != ERROR_SUCCESS)
> 	  {
>            strcpy(nettype,"dummy");
>            strcpy(netid,"dummy");
> 	  }
> 
>       else
>       {
>         // now get the value
> 	   sizeofnettype = 50;
> 	   bSuccess = RegQueryValueEx(ck,     /* subkey handle         */
> 	         "DeviceDesc",              /* value name            */
> 		    NULL,                   /* must be zero          */
> 		    NULL,                   /* value type          not required  */
>               (LPBYTE) &nettype,            /* address of value data */
>               &sizeofnettype);              /* length of value data  */
> 
>         if(bSuccess != ERROR_SUCCESS)
>           {
>            strcpy(nettype,"dummy");
>           }
> 
> 	   sizeofnetid = 50;
> 	   bSuccess = RegQueryValueEx(ck,  /* subkey handle         */
> 	         "CompatibleIDs",        /* value name            */
> 		    NULL,                   /* must be zero          */
> 		    NULL,                   /* value type          not required  */
>               (LPBYTE) &netid,        /* address of value data */
>               &sizeofnetid);          /* length of value data  */
>         if(bSuccess != ERROR_SUCCESS)
>           {
>            strcpy(nettype,"dummy");
>           }
> 
>         RegCloseKey(ck); // not needed anymore either way
> 
>       } // not there
>      } // no netkey found (it is not in enum\net\ so it cannot be a temporary one
> 
>       // go on
>      if (((strlen(nettype) >= 15) && 
>            (strncmp(strupr(nettype),"DIAL-UP ADAPTER",15) == 0)) ||
>           ((strlen(netid) >= 8) &&
> 	      (strncmp(strupr(netid),"*PNP8387",8) == 0)))
>           {
>            /* skip it */
>            dprintf(1, (ddt, "Skippping temporary interface [%s]\n",nettype));
>           }
> 
>      else { // is not temporary interface
>             // ok get drivername
> 
> 	// get the Driver value
> 	/*now we have the values so we need to get the driver value for the key */
> 	strcpy(driverkey,"ENUM\\Network\\MSTCP\\");
> 	strcat(driverkey,mstcpnetkey);
> 
> 	bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,driverkey,&dk);
> 	if(bSuccess != ERROR_SUCCESS)
> 	  {
>            char temp[300];
>            sprintf(temp,"Can not open key [%s] from the registry \n",driverkey);
>            syslog(LOG_ERR, temp);
>            RegCloseKey(hk);
>            return -1;
> 	   }
> 
>             // ok get drivername
> 		sizeofsubkey = 50;
> 		bSuccess = RegQueryValueEx(dk,     /* subkey handle         */
> 	  	      "Driver",                    /* value name            */
> 		      NULL,                        /* must be zero          */
> 		      NULL,                        /* value type          not required  */
> 		      (LPBYTE) &subkey,            /* address of value data */
> 		      &sizeofsubkey);              /* length of value data  */
> 
>           if(bSuccess != ERROR_SUCCESS)
> 		  {
> 		    syslog(LOG_ERR,"Error in RegQueryValueEx fetching Driver value: %m \n");
> 		    RegCloseKey(dk);
> 		    RegCloseKey(hk);
> 		    return -1;
> 		  }
> 
>           RegCloseKey(dk); //driver key not needed any longer
> 
>           // now open the real key
> 	     strcpy(realkey,"SYSTEM\\CurrentControlSet\\Services\\Class\\");
> 	     strcat(realkey,subkey);
> 	     
> 	     bSuccess = RegOpenKey(HKEY_LOCAL_MACHINE,realkey,&rk);
> 	     if(bSuccess != ERROR_SUCCESS)
> 		 {
> 		   char temp[300];
> 		   sprintf(temp,"Error opening real network key [%s].\n",realkey);
>                    syslog(LOG_ERR, temp);
> 		   RegCloseKey(hk);
>                    return -1;
> 		}
>         
>            sizeofipaddresses = 10000;
>            bSuccess = RegQueryValueEx(rk,     /* subkey handle         */
>                 "IPAddress",                  /* value name            */
>                  NULL,                        /* must be zero          */
>                  NULL,                        /* value type          not required  */
>                  (LPBYTE) &IpAddresses,       /* address of value data */
>                  &sizeofipaddresses);         /* length of value data  */
> 
>            if(bSuccess != ERROR_SUCCESS)
>               {
>                syslog(LOG_ERR,"Error in RegQueryValueEx fetching IPAddress parameter! %m \n");
>                RegCloseKey(rk);
>                RegCloseKey(hk);
>                return -1;
>               }
>               
>            /* ok now get the subnetmask */
>            sizeofsubnetmasks = 10000;
>            bSuccess = RegQueryValueEx(rk,     /* subkey handle         */
>               "IPMask",                       /* value name            */
>                NULL,                          /* must be zero          */
>                NULL,                          /* value type          not required  */
>                (LPBYTE) &SubNetMasks,         /* address of value data */
>                &sizeofsubnetmasks);           /* length of value data  */
>    
>            if(bSuccess != ERROR_SUCCESS)
>               {
>                syslog(LOG_ERR,"Error in RegQueryValueEx fetching IPMask parameter! %m\n");
>                RegCloseKey(rk);
>                RegCloseKey(hk);
>                return -1;
>               }
> 
>           RegCloseKey(rk);
>           /* ok now that we have some addresses and subnet masks go through each one and add to our structure... */
>           /* multi_sz strings are terminated by two \0 in a row */
> 
>         ipptr = IpAddresses;
>         subptr = SubNetMasks;
>         Done2 = 0;
>         token = NULL;
>         
>        /* lgk change here win95 mutli addresses are separated by commas not
>           spaces like NT, so replace the commas with spaces so the old
>           loop works  */
> 
>        token = strchr(ipptr,sep);
>        while (token != NULL)
>         {
>          *token = ' ';
>          token = strchr(ipptr,sep);
>         }
> 
>         /* now handle subnet block */
>        token = strchr(subptr,sep);
>        while (token != NULL)
>         {
>          *token = ' ';
>          token = strchr(subptr,sep);
>         }
>         
>         while (!Done2)
>         {
>          ifr = (struct ifreq *)ifc_buffer;
>          if (sscanf(ipptr,"%s",oneIpAddress) != EOF)
>            ipptr+= strlen(oneIpAddress) + 1; /* add one for terminator \0 */
>          else Done2 = 1;
>          
>          if (sscanf(subptr,"%s",oneSubNetMask) != EOF)
>            subptr += strlen(oneSubNetMask) + 1;
>          else Done2 = 1;
> 
>          /* now add to interface structure */
>          if (!Done2)                  
>           {
>            ifr->ifr_addr.sa_family = AF_INET;
>            ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr.s_addr = inet_addr(oneIpAddress);
>            strcpy(ifr->ifr_mask,oneSubNetMask);
> 
>            // subkey is the closest thing to a service name under win95
>            if (strlen(subkey) > 15)
>              strncpy(ifr->ifr_name,subkey,15);
>            else strcpy(ifr->ifr_name,subkey);
> 
>            /* now increment pointer */
> 	      ifc_buffer += sizeof (ifr->ifr_name) + sizeof(ifr->ifr_addr) + sizeof(ifr->ifr_mask);
>            ++ipcount;
>            if (((char *)ipptr == '\0') || ((char *)subptr == '\0')) 
>              Done2 = 1;
>              
>           } // if
> 	} // not done2 loop
>       } // not temporary interface
>        } // loop (while) through more things bound to MSTCP
> 
>     RegCloseKey(hk); // done with top while so close key
> 
>     /* now reset the length */
>     ifc->ifc_len = ipcount * (sizeof(ifr->ifr_name) + sizeof(ifr->ifr_addr) + sizeof(ifr->ifr_mask));
> 
>     return 0;
>   }
> 
> #endif // win95
> 
> 
> // ndc_thread ... wait for ndc commands.. works both under nt and win95
> // there will be a ndc95 command
> // l. kahn.. this is needed for win95 port because there are no services and
> // we cannot use sevice api's
> // becuase the damn mailslots sendning more than once due to  how many network
> // transports you have bound we must use and id.. to make sure we are not doing the
> // same command twice..
> // also named pipes do not work.. since win95 does not support them.. so switched
> // to mail slots... also security api's don't work on win95
> // cant use this under nt even though originally designed also to work under nt.. 
> // actually it works under nt but the security doesn't so anyone can shut down your server etc.
> // this is acceptable for win95 where there is no security but not for nt..
> //when 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..
> // back to using the getmailslotinfo  with sleep solution.. not the prettiest..
> // lgk 2/97 used under nt now also for alternative control method ie more flexible can return
> // version info etc.. but no shutdown, start, restart under nt
> 
> 
> VOID
> ndc_thread(VOID *notUsed)
> {
>     char                 inbuf[120];
>     char                 outbuf[300];
>     BOOL                 ret;
>     BOOL                 bad_code;
>     DWORD                bytesRead;
>     DWORD                bytesWritten;
>     char                 command[40];
>     char                 mbname[20];
>     char                 outname[120];
>     char                 machname[60];
>     int                  len;
>     SOCKET               s;
>     HANDLE               slotHandle;
>     HANDLE               outslot;
>     DWORD                id, lastid;
>     DWORD                wcount;
>     BOOL                 onefound;
>     BOOL                 fResult;
>     char temp[300];
> 
>     
> // only do the event here if win95 as done elsewhere in nt
> #ifdef WIN95
> 		/* create an event object that the control handler function
> 	 	* will signal when it receives the "stop" control code */
> 		if (!(hServDoneEvent = CreateEvent(
>         				NULL,    /* no security attributes */
>         				FALSE,   /* auto-reset event */
>         				FALSE,   /* not-signalled */
>         				NULL))){ /* no name */
> 				syslog(LOG_ERR, "CreateEvent() failed: %m");
> 				return;
>     	}
> #endif
> 
> #ifdef NOWAIT
> 	loopback.sin_family = AF_INET;
> 	loopback.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
> 	loopback.sin_port = local_ns_port;
> #endif
> 
> 
>     // open our mail slot
>     //    
>     slotHandle = CreateMailslot(
>                     "\\\\.\\mailslot\\sd_bind",0,MAILSLOT_WAIT_FOREVER,NULL);
> 
>     if (slotHandle == INVALID_HANDLE_VALUE)
>       {
>        syslog(LOG_ERR, "CreateMailSlot for ndc communications failed: %m");
> 	if (debug)
> 	  fprintf(ddt, "CreateMailslot for ndc communications failed error = %d\n",GetLastError());
>         exit(1);
>       }
> 
>     // okay, our pipe has been created, let's enter the simple
>     //  processing loop...
>     //
>     
>     id = 0;
>     lastid = 0;
>     while (1) {
> 
> 
>         // bug in readfile here.. under win95 even with timeout set to infinite this is a busy wait
>         // consuming 100% of cpu so try getmail slot info with sleep statement
>         // actually use waitforsingleobject which is the correct way even
>         // though the documentation on this api does not mention mailslots
>         // as a handle you can wait on.. apparently it does become signaled
>         // and can be used. ..
>         
> 
>         onefound = FALSE;
>         wcount = 0;
>         while (!onefound)
> 
>          {
> 
>            fResult = GetMailslotInfo(slotHandle, /* mailslot handle         */ 
>                          (LPDWORD) NULL,              /* no maximum message size */ 
>                          (LPDWORD) NULL,              /* size of next message    */ 
>                          &wcount,                     /* number of messages      */ 
>                          (LPDWORD) NULL);             /* no read time-out        */ 
>  
>            if (!fResult)
>              { 
>                syslog(LOG_ERR,"Error in GetMailSlotInfo: %m");
>  	       if (debug)
> 	         fprintf(ddt, "Error in GetMailSlotInfo error = %d\n",GetLastError());
>                Sleep(5000);
>                continue;
>              } 
> 
>            if (wcount > 0)
>                onefound = TRUE;
>            else Sleep(5000);
> 
>          } // end of one found loop
>          
>         // grab whatever's coming through the slot...
>         //
>         strcpy(inbuf,"                                           ");
>         strcpy(command,"                     ");
>         bad_code = FALSE;
>         bytesRead = 0;
>         ret = ReadFile(
>                     slotHandle,     // file to read from
>                     &inbuf,         // address of input buffer
>                     sizeof(inbuf),  // number of bytes to read
>                     &bytesRead,     // number of bytes read
>                     NULL);          // overlapped stuff, not needed
> 
>         if ((!ret) || (bytesRead == 0))
>            continue;
>             // .. go back and reconnect
>             //
> 
>         // ok now check which mailbox to send message back to either sd_ndc or sd_ndcpl
> 
>           sscanf(inbuf,"%s %s %s %d",machname,mbname,command,&id);
>           // now check if same as last time and if so skip it..
>           
> 	  if (debug > 0)
> 	     { // for debugging
>               sprintf(temp,"NDC remote command \"%s\" from machine %s with id %d reply to %s\n",command,machname,id,mbname);
>  	      dprintf(1, (ddt,temp));
> 	     } 
>           
> 	   if (id == lastid)
>              continue;
> 
>           lastid = id;
>           strcpy(outbuf,"Ok"); // need some return so other pipe stops waiting
> 
>        // start and restart are handled by ndc ...
> #ifdef WIN95
>        if (strncmp(command,"stop",4) == 0)
>          {
> #ifdef XSTATS
>             needToExit = 1;
> #endif
> 
>             was_stopped = 1;
>             doterminate = 1;
>             SetEvent(hServDoneEvent);
>          }
>        else if (strncmp(command,"status",6) == 0)
> #else
>        if (strncmp(command,"status",6) == 0)
> #endif /* win95 only */
> 
> 		  { // returning that we are running ok
> 			  
>                           sprintf(temp,"%s\n",Version);
> 			  strcpy(outbuf,temp);
>           
> 			  sprintf(temp,"Query log %s! ",qrylog ? "on":"off");
> 			  strcat(outbuf,temp);
> 			  sprintf(temp,"\nNoLog Flag %s! \n",nolog_flag_set ? "on":"off");
> 			  strcat(outbuf,temp);
> 			  
> 			  if (debug > 0) sprintf(temp,"Debug Level %d enabled.",debug);
> 			  else  sprintf(temp,"Debuging Off!");
> 			  strcat(outbuf,temp);
> 
>           }
> 
>        else if (strncmp(command,"dumpdb",6) == 0)
>          {
>           needToDoadump = 1;
>          }
> 
>        else if (strncmp(command,"reload",6) == 0)
>          {
> 	  needreload = 1;
>          }
> 
>        else if (strncmp(command,"stats",5) == 0)
>          {
> 	   needStatsDump = 1;
>          }
> 
>        else if (strncmp(command,"trace",5) == 0)
>          {
> 	   debug++;
> 	   if (debug == 1)
> 	     setdebug(1);
> 	   fprintf(ddt, "Debug turned ON, Level %d\n", debug);
>          }
> 
>        else if (strncmp(command,"notrace",7) == 0)
>          {
> 	   setdebug(0);
>          }
> 
>        else if (strncmp(command,"querylog",8) == 0)
>          {
> 	   qrylog = !qrylog;
> 	   syslog(LOG_NOTICE, "querylog %s\n", qrylog ? "on":"off");
>          }
> 
>        else if (strncmp(command,"qrylog",6) == 0)
>          {
> 	   qrylog = !qrylog;
> 	   syslog(LOG_NOTICE, "querylog %s\n", qrylog ? "on":"off");
>          }
>        else if (strncmp(command,"nolog",5) == 0)
>          {
> 	   nolog_flag_set = TRUE;
>            syslog(LOG_WARNING, "NoLog Flag is Enabled/On (No Informational messages will be logged!)\n");
>          }
>        else if (strncmp(command,"log",3) == 0)
>          {
> 	   nolog_flag_set = FALSE;
> 	   syslog(LOG_NOTICE, "NoLog Flag off!\n");
>          }
> 
>        else
>        {
>  	 syslog(LOG_WARNING, "Invalid control code (possible security violation): %s from machine=%s", command,machname);
>          bad_code = TRUE;
>        }
>        
> #ifdef NOWAIT
> 
>         // also don't do this for status as nothing is pending
>         if ((!bad_code) && (strncmp(command,"status",6) != 0))
>          {
>  	  
>              	if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0)
>                  {
> 			    syslog(LOG_ERR, "socket for nowait: %m");
> 		       }
> 
>                else
>                {
>                if (connect(s, (struct sockaddr *)&loopback, sizeof(loopback)) < 0) 
> 				syslog(LOG_ERR,
> 				       "connect for nowait (%s) for failed: %m",
> 				       inet_ntoa(loopback.sin_addr));
> 
>                else 
>                {  
>                  if((len = sendto(s, (const char *)loopbuf, 1, 0, (const struct sockaddr *)&loopback,
> 	             sizeof(struct sockaddr_in))) == SOCKET_ERROR)
> 		        syslog(LOG_ERR, "failed to send the control code immediately: %m");
>                }
>                (void) closesocket(s);
>                }
>          }
> #endif
> 
>           // now open the out mailbox and write response .. if it fails ignore
>           strcpy(outname,"\\\\");
>           strcat(outname,machname);
>           strcat(outname,"\\mailslot\\");
>           strcat(outname,mbname);
>        
>           outslot = CreateFile(outname,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,
>                                FILE_ATTRIBUTE_NORMAL,NULL);
> 
>           if (outslot == INVALID_HANDLE_VALUE)
>             {
>               sprintf(temp,"Cannot open outgoing mailslot: %s ... response was %s !\n",outname,outbuf);
>               syslog(LOG_WARNING,temp);                    
>             }
>           else { // write data
> 
>           ret = WriteFile(
>                     outslot,     // file to write to
>                     &outbuf,         // address of output buffer
>                     strlen(outbuf) + 1, // number of bytes to write
>                     &bytesWritten,  // number of bytes written
>                     NULL);          // overlapped stuff, not needed
> 
>           if (!ret)
>             // failed... go back and reconnect
>             //
>             continue;
>         // close handle...
>         //
>         CloseHandle(outslot);
> 
>        }
>     } // end of loop
> }
> 
> #endif /* WINNT */
Only in m:\bind/named: ns_main.sav
diff --recurs m:\bind496rel/named/ns_maint.c m:\bind/named/ns_maint.c
61,70c61,76
< #include <sys/param.h>
< #include <sys/types.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< #include <sys/wait.h>
< #include <stdio.h>
< #include <syslog.h>
< #include <signal.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> #ifndef WINNT
> #include <sys/wait.h>
> #endif
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <signal.h>
76a83
> #ifndef WINNT
77a85,86
> #else
> # include <sys/utime.h>
78a88
> #endif
94c104
< static time_t cache_time;
---
> static time_t cache_time = 0;
97c107
< static time_t stats_time;
---
> static time_t stats_time = 0;
98a109,182
> 
> #ifdef WINNT
> /* lgk since timer resolution on nt (at least my box) only goes to 1000 seconds
>  * our method using mmedia times is no good therefore use a thread that
>  * we create that sleeps the timeout period and then when done calls maint_alarm
>  * and exits...
>  * lgk dec. 95 change again to use a waitforsingleobject on an event for the specified
>  * timeout instead of sleep so it can be signaled with a reschedule request..
>  */
>     
> DWORD pending_delay = 0;
> volatile HANDLE rescheduleevent = 0x00;
> DWORD threadid;
> HANDLE threadhandle = 0x00;
> HANDLE threadhandle2 = 0x00;
> static void named_xfer __P((HANDLE *));
> static void CALLBACK maint_alarm __P((UINT,UINT,DWORD,DWORD,DWORD));
> extern CRITICAL_SECTION protected_zp;
> extern CRITICAL_SECTION maint_section;
> volatile BOOLEAN maint_thread_running = FALSE;
> 
> DWORD thread_timer_fx(DWORD timeout)
>   {
> 
>     DWORD rvalue;
> 
>     /* now wait on the handle */
>     rvalue = WaitForSingleObject(rescheduleevent,timeout);
> 
>     /* now check reason we woke up */
>     switch (rvalue)
>      {
> 
>       case WAIT_FAILED:
>         dprintf(1, (ddt, "Wait for thread timer event object failed!\n")); 
>         syslog(LOG_ERR, "Wait for thread timer event object failed!");
>         EnterCriticalSection(&maint_section);
>         maint_thread_running = FALSE;
>         LeaveCriticalSection(&maint_section);
>         ExitThread(0);
>         break;
>       
>       case WAIT_OBJECT_0:
>         dprintf(1, (ddt, "In Maintenance thread... current thread is exiting for reschedule request!\n"));
>         /* don't set thread running to false here as by the time this gets hit and the
>            thread terminates we may overwrite someone else setting it to true */
>         ExitThread(0);
>         break;
> 
>       case WAIT_TIMEOUT:
>         dprintf(1, (ddt, "In Maintenance thread... timer has expired!\n"));
>         break;
>       
>       default:
>         dprintf(1, (ddt, "Unknown return type from WaitForSingleObject in thread_timer_fx (%d)!\n",rvalue));
>         syslog(LOG_ERR, "Unknown return type from WaitForSingleObject in thread_timer_fx (%d)!\n",rvalue);
>         EnterCriticalSection(&maint_section);
>         maint_thread_running = FALSE;
>         LeaveCriticalSection(&maint_section);
>         ExitThread(0);
>         break;
>       
>      }
> 
>     EnterCriticalSection(&maint_section);
>     maint_thread_running = FALSE;
>     LeaveCriticalSection(&maint_section);
>     maint_alarm(0,0,0,0,0);
>     return 0;
> }
> 
> 
> #endif /* WINNT */
> 
110d193
< 
112d194
< 
118a201,203
>                 dprintf(1, (ddt, "debug tt.tv_sec = %d , zp->z_time = %d, zp->z_refresh = %d \n",
>                                  tt.tv_sec,zp->z_time, zp->z_refresh));
>                 dprintf(1, (ddt, "want tv_sec > = z_time and z_refresh > 0 \n"));
142a228
> 				        dprintf(1, (ddt, "calling abort\n"));
178a265
> #ifndef WINNT
179a267,269
> #else
> 	DWORD wDelay;
> #endif
195c285,287
< 	bzero((char *)&ival, sizeof ival);
---
> #ifndef WINNT
> 	bzero((char *)&ival, sizeof (ival));
> #endif
206a299
> #ifndef WINNT
209a303,307
> #else
> 		wDelay = (next_refresh - tt.tv_sec) * 1000;
> 		if ((long) wDelay < (maint_interval * 1000))
> 			wDelay = maint_interval * 1000;
> #endif
212a311
> #ifndef WINNT
215a315,368
> #else
>       /* lgk under my h/w for nt maximum timer values are 1000 seconds... the above values are not for resolution
>        * as the original author supposed but for the minimum and maximum timer values that mm timers supports..
>        * and since they don't supprt 1 hour... the create of the timer object was failing... therefore the only
>        * way I figured out to do this was create a thread that sleeps for the timeout and then waits up and calls
>        * maint alarm... seems to work ok now... 
>        * lgk dec. 95 change again to use a waitforsingleobject on an event for the specified
>        * timeout instead of sleep so it can be signaled with a reschedule request..
>        */
> 
>        /* lgk 12/95 there is a problem here were it tries to reschedule
>           when a timer thread is already running... under nt now see comment above */
> 
>       if (rescheduleevent == 0x00)
>         {
>           if ((rescheduleevent = CreateEvent(NULL,TRUE,FALSE,NULL)) == 0x00)
>             {
>              syslog(LOG_ERR,"Error: Couldn't create the maint. reschedule event object!");
>              dprintf(1, (ddt, "Error: Couldn't create the maint. reschedule event object!"));
>              return;
>             }
>         }
> 
>       /* first check if already one running */
>       EnterCriticalSection(&maint_section);
>       
>       if (maint_thread_running)
>         { /* ok now check if we have a smaller time */
>           dprintf(1,(ddt,"sched_maint: Rescheduling maint. from %d sec to %d sec.\n",pending_delay/1000,wDelay/1000));
>           /* signal other waiting thread to exit */
>           PulseEvent(rescheduleevent);
>         }
> 
>        maint_thread_running = TRUE;
> 
>        if (threadhandle != 0x00)
>          CloseHandle(threadhandle );
>        /* reset the event */
>        ResetEvent(rescheduleevent);   
> 
>        threadhandle = NULL;
>        threadhandle = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)thread_timer_fx,(LPVOID)wDelay,0,&threadid);
> 
>        if (threadhandle == NULL)
> 	     {
>            syslog(LOG_ERR, "CreateThread() for maintenance: %m");
> 	     }
> 
>        
>        pending_delay = wDelay;
>  	   dprintf(1, (ddt, "sched_maint: Next interrupt in %d sec\n",wDelay/1000));
>        LeaveCriticalSection(&maint_section);
> 
> #endif
279c432
< 		syslog(LOG_INFO, "qserial_query(%s): sysquery FAILED",
---
> 		syslog(LOG_WARNING, "qserial_query(%s): sysquery FAILED",
342a496
> #ifndef WINNT
368a523
> #endif
393c548,551
< 	int argc = 0, argc_ns = 0, pid, i;
---
> 	int argc = 0, argc_ns = 0, i;
> #ifdef WINNT
> 	extern char *pathxferddt, *pathxfertrace;
> #endif
400a559,569
> #ifdef WINNT
> 	char *pos;
> 	DWORD xfer_thread_id;
> 	STARTUPINFO sui;
> 	static char CommandLine[NSMAX*(MAXDNAME+1)+20*10];
> 	PROCESS_INFORMATION *proc_info_copy;
>     
> 
> #else
> 	int pid;
> #endif
404c573,581
< 	argv[argc++] = _PATH_XFER;
---
> #ifndef WINNT
> 	argv[argc++] = "_PATH_XFER";
> #else
> #ifndef WIN95
> 	argv[argc++] = "xfer";
> #else
> 	argv[argc++] = "xfer95";
> #endif
> #endif
431a609
> #ifndef WINNT
432a611,613
> #else
> 		argv[argc++] = pathxferddt;
> #endif
434a616
> #ifndef WINNT
435a618,620
> #else
> 			argv[argc++] = pathxfertrace;
> #endif
463c648
<         }
---
> 	}
466a652,662
> #ifdef WINNT
> 	/* need the arguments in the form of a string not in argv format */
> 	pos = CommandLine;
> 	for (i = 0; i < argc; i++) {
> 		sprintf(pos, argv[i]);
> 		pos += strlen(pos);
> 		*pos++ = ' ';
> 	}
> 	*pos = '\0';
> #endif 
> 
472c668
<         }
---
> 	}
476,482c672,688
< 	holdsigchld();
< 	for (i = 0; i < MAX_XFERS_RUNNING; i++) {
< 		if (xferstatus[i].xfer_pid == 0) {
< 			xferstatus[i].xfer_state = XFER_RUNNING;
< 			break;
< 		}
< 	}
---
> #ifndef WINNT
>    	holdsigchld();
> #else
>     /* make sure we don't have two accessing the same structures */
>     /* lgk use critical section here for this and in endxfer where this is read to make sure that not more
>        than one is trying to start a xfer process at a time */
>     EnterCriticalSection(&protected_zp);
>     proc_info_copy = (PROCESS_INFORMATION *)malloc(sizeof(PROCESS_INFORMATION));
>  
> #endif
>   	for (i = 0; i < MAX_XFERS_RUNNING; i++) {
>   		if (xferstatus[i].xfer_pid == 0) {
>   			xferstatus[i].xfer_state = XFER_RUNNING;
>   			break;
>   		}
>   	}
> #ifndef WINNT
485c691
< 		releasesigchld();
---
>   		releasesigchld();
494c700
< 		_exit(XFER_FAIL);	/* Avoid duplicate buffer flushes. */
---
> 		_exit(XFER_FAIL);       /* Avoid duplicate buffer flushes. */
496,498c702,739
< 	/* Parent. */
< 	xferstatus[i].xfer_pid = pid;  /* XXX - small race condition here if we
< 					* can't hold signals */
---
> #else /* WINNT */
> 	bzero((char *)&sui, sizeof(STARTUPINFO));
> 	sui.cb = sizeof(STARTUPINFO);
> 	if (!CreateProcess(NULL, CommandLine, NULL, NULL, FALSE, DETACHED_PROCESS, NULL,
> 					   NULL, &sui, (LPPROCESS_INFORMATION)proc_info_copy))
>       {
> 	     syslog(LOG_ERR, "CreateProcess() for xfer: %m");
>              LeaveCriticalSection(&protected_zp);
> 	     return;
> 	  }
> 
> 	threadhandle2 = NULL;
> 	threadhandle2 = CreateThread(
> 	         NULL,                                /* no security attributes  */
> 	         0,                                   /* use default stack size  */
> 	         (LPTHREAD_START_ROUTINE) named_xfer, /* thread function         */
> 	         (LPVOID) proc_info_copy,             /* argument to thread function   */
> 	         0,                                   /* use default creation flags    */
> 	         (LPDWORD) &xfer_thread_id);
> 
>     if (threadhandle2 == NULL)
> 	  {
>         syslog(LOG_ERR, "CreateThread() for xfer status: %m");
>         LeaveCriticalSection(&protected_zp);
> 	return;
> 	  }
> 	CloseHandle(threadhandle2); /* no handle to this needed */
> 	
> #endif /* WINNT */
> 	/* parent */
> #ifdef WINNT
> 	dprintf(1, (ddt, "started xfer child %d\n", proc_info_copy->hProcess));
>     zp->z_xferpid = proc_info_copy->hProcess;
>   	xferstatus[i].xfer_pid = (long)proc_info_copy->hProcess;
> #else
> 	zp->z_xferpid = pid;
>   	xferstatus[i].xfer_pid = pid;  /* XXX - small race condition here if we
>   					* can't hold signals */
499a741
> #endif
502c744
< 	zp->z_xferpid = pid;
---
> 
505c747,753
< 	releasesigchld();
---
> 
> #ifdef WINNT
>     LeaveCriticalSection(&protected_zp);
> #else
>   	releasesigchld();
> #endif
>     
648c896
< 				dp = rm_datum(dp, np, pdp);
---
> 					dp = rm_datum(dp, np, pdp);
797a1046
> 
801c1050,1066
< {
---
>    {
> 
> #ifdef WINNT
> 	    TerminateProcess(zp->z_xferpid, (UINT)XFER_KILLED);
> 
> 	    syslog(LOG_WARNING,
> 		"zone transfer timeout for \"%s\"; pid %lu killed",
> 		zp->z_origin, (u_long)zp->z_xferpid);
>              dprintf(1, (ddt, "zone transfer timeout for %s pid %lu killed\n",
> 		zp->z_origin, (u_long)zp->z_xferpid));
> 
> 		zp->z_flags |= Z_XFER_ABORTED;
> 	     ns_retrytime(zp, tt.tv_sec);
>  	     (void) nxfers(zp, -1);        
> 
> #else
> 
806,807c1071,1072
< 			if (xferstatus[i].xfer_pid == zp->z_xferpid) {
< 				xferstatus[i].xfer_pid = 0;
---
> 			if (xferstatus[i].xfer_pid == (long)zp->z_xferpid) {
> 			    xferstatus[i].xfer_pid = 0;
816a1082
> 
823,825c1089,1091
< "zone transfer timeout for \"%s\"; second kill\
< pid %lu - forgetting, processes may accumulate",
< 			       zp->z_origin, (u_long)zp->z_xferpid);
---
>                             "zone transfer timeout for \"%s\"; second kill\
>                              pid %lu - forgetting, processes may accumulate",
> 			     zp->z_origin, (u_long)zp->z_xferpid);
831c1097,1099
< 	} else if (kill(zp->z_xferpid, SIGKILL) == -1) {
---
> 	}
> 
>         else if (kill(zp->z_xferpid, SIGKILL) == -1) {
847c1115,1118
< }
---
> 	
> #endif
>    }
> 
848a1120
> #ifndef WINNT
885a1158,1160
> }
> #endif
> 
887c1162,1163
<  * Finish processing of of finished xfers
---
>  * SIGCHLD signal handler: process exit of xfer's.
>  * (Note: also called when outgoing transfer completes.)
888a1165,1170
> /* the semantics here have changed now we call reapchild when a transfer ends which sets the
>    variable needendxfer ... however under nt since there are no signals endxfer is called
>    directly when a transfer ends... therefore we need to clear out the entry here under 
>    nt, also under nt we determine the pid to clear because it is passed in ... lgk */
> 
> #ifndef WINNT
890a1173,1177
> #else
> void
> endxfer(pid)
> 	HANDLE pid;
> #endif
892,893c1179,1181
<     	register struct zoneinfo *zp;   
< 	int exitstatus, pid, i;
---
>     register struct zoneinfo *zp;
> #ifndef WINNT   
>  	int exitstatus, pid;
898a1187,1190
> #else
> 	DWORD exitstatus;
> #endif
>     int i;
900c1192
< 	gettime(&tt);
---
> gettime(&tt);
902,907c1194,1215
< 	for (i = 0; i < MAX_XFERS_RUNNING; i++) {
< 		if (xferstatus[i].xfer_state != XFER_DONE)
< 			continue;
< 		pid = xferstatus[i].xfer_pid;
< 		status = xferstatus[i].xfer_status;
< 		exitstatus = WIFEXITED(status) ?WEXITSTATUS(status) :0;
---
> /* under Win NT this should not get called unless a transfer has completed 
>  * or aborted
>  */
> #ifndef WINNT
>   	for (i = 0; i < MAX_XFERS_RUNNING; i++) {
>   		if (xferstatus[i].xfer_state != XFER_DONE)
>   			continue;
>   		pid = xferstatus[i].xfer_pid;
>   		status = xferstatus[i].xfer_status;
> 
>     		exitstatus = WIFEXITED(status) ?WEXITSTATUS(status) :0;
> #else
>  
> 	if (!GetExitCodeProcess(pid, &exitstatus))
>           {
> 	    syslog(LOG_ERR, "endxfer: cannot determine return code of the xfer (%d) process: %m",pid);
> 	    dprintf(1, (ddt, "endxfer: cannot determine return code of the xfer (%d) process: %d",pid,GetLastError()));
>             /* lgk new code here if we cannot figure this out dummy it up so it gets rescheduled anyway */
>             /* dont return as previously or the zone does not get rescheduled */
>             exitstatus = XFER_FAIL;
> 	  }
> #endif /* WINNT */
909c1217,1218
< 		for (zp = zones; zp < &zones[nzones]; zp++) {
---
> 		for (zp = zones; zp < &zones[nzones]; zp++)
>                    {
911a1221,1241
>             /* ok found our zone */
> #ifdef WINNT
>             /* regardless of how it terminated if under NT clear it out here
>              * first find the entry 
>              */
>              
>   	         for (i = 0; i < MAX_XFERS_RUNNING; i++) {
> 			    if (xferstatus[i].xfer_pid == (long)pid) {
> 				    xferstatus[i].xfer_status = exitstatus;
>                     xferstatus[i].xfer_state = XFER_IDLE;
> 			    	xferstatus[i].xfer_pid = 0;
> 			    	
> 			   } 
> 		      }
> 		     /* lgk problem is here we cannot close the handle here as it will reuse it and then close it again later
> 		        don't think we need to close this handle anyway as it is the same handle that is closed before the free
> 		        in named_xfer  the problem was that critical sections allow the same thread
> 		        to go into the same critical section more than once and since this handle was
> 		        already closed here it was re-allocated and closed again in named-xfer after the call to endxfer  
> 		     CloseHandle(zp->z_xferpid); */
> #endif
915,916c1245,1247
< 			zp->z_flags &=
< 				~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE);
---
>   			zp->z_flags &=
>   				~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE);
> #ifndef WINNT
918c1249
< 		 "\nendxfer: child %d zone %s returned status=%d termsig=%d\n",
---
> 		            "\nendxfer: child %d zone %s returned status=%d termsig=%d\n", 
931a1263,1267
> #else /* WINNT */
> 			dprintf(1, (ddt,
> 		            "\nendxfer: child %d zone %s returned status=%d \n", 
> 				    pid, zp->z_origin, exitstatus));
> #endif /* WINNT */
941a1278
>                     dprintf(1, (ddt, "named-xfer for %s ended successfully (child = %d)\n",zp->z_origin,pid));
947,948c1284,1285
< 						syslog(LOG_NOTICE,
< 		      "zoneref: Masters for secondary zone \"%s\" unreachable",
---
> 						syslog(LOG_WARNING,
> 	 	                                        "zoneref: Masters for secondary zone \"%s\" unreachable",
950a1288
>                     dprintf(1, (ddt, "Masters for secondary zone %s unreachable (xfer timed out) (child = %d)\n",zp->z_origin,pid));
953c1291,1295
< 
---
> #ifdef WINNT
> 				case XFER_KILLED:
> 					ns_retrytime(zp, tt.tv_sec);
> 					break;
> #endif
958,960c1300,1301
< 					     "named-xfer for \"%s\" exited %d",
< 						       zp->z_origin,
< 						       exitstatus);
---
> 					         "named-xfer for \"%s\" exited %d",
> 						    zp->z_origin, exitstatus);
964a1306,1307
>                     dprintf(1, (ddt, "(xfer for %s failed in endxfer) (child = %d)\n",zp->z_origin,pid));
>                     syslog(LOG_WARNING, "(xfer for %s failed) (child = %d) - rescheduling!\n",zp->z_origin,pid);
967c1310
< 				}
---
> 				} /*switch*/
969,973c1312,1321
< 			}
< 		}
< 		xferstatus[i].xfer_state = XFER_IDLE;
< 		xferstatus[i].xfer_pid = 0;
< 	}
---
> #ifndef WINNT
> 			} /*if/else*/
> #endif
> 		   } /* inner for */
> 
> #ifndef WINNT
>  	 xferstatus[i].xfer_state = XFER_IDLE;
> 	 xferstatus[i].xfer_pid = 0;
> 	} /* outter for */
> 
974a1323,1324
> #endif
> 
975a1326
> 
1049c1400
<     	register struct zoneinfo *zp;   
---
> 	register struct zoneinfo *zp;   
1087a1439,1519
> 
> 
> #ifdef WINNT
> void CALLBACK maint_alarm (UINT wTimerID, UINT msg,
>     DWORD dwUser, DWORD dw1, DWORD dw2)
> {
> 	int len;
> 	char loopbuf[] = "";
> 	    struct sockaddr_in loopback; 
> 	    needmaint = 1;
> 	dprintf(1, (ddt, "in maint_alarm ...\n"));
> 	printf("in maint_alarm ...\n");
> 
> #ifdef NOWAIT
> 	loopback.sin_family = AF_INET;
> 	loopback.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
> 	loopback.sin_port = htons(NAMESERVER_PORT);
> 	if(len = sendto(datagramq->dq_dfd, loopbuf, 1, 0, (struct sockaddr *)&loopback,
> 		  sizeof(struct sockaddr_in)) == SOCKET_ERROR)
> 		{
> 		syslog(LOG_ERR, "failed to break select for maintenance: %m, maintenance delayed");
> 		syslog(LOG_ERR, "WSA ERRORCODE WAS: %d", WSAGetLastError());
> 		}
> #endif
> 
> 
>     UNREFERENCED_PARAMETER(dw1);
>     UNREFERENCED_PARAMETER(dw2);
>     UNREFERENCED_PARAMETER(dwUser);
>     UNREFERENCED_PARAMETER(msg);
>     UNREFERENCED_PARAMETER(wTimerID);
> }
> 
> void
> named_xfer(PROCESS_INFORMATION *proc_info)
> {
> 	DWORD dwWait;
> 
> 	dwWait = WaitForSingleObject((*proc_info).hProcess, (DWORD) MAX_XFER_TIME * 1000);
> 
> 
>     /* now check reason we woke up */
>     /* remove the return now so let it go into endxfer even if the wait fails so we can resched. the xfer */
>     switch (dwWait)
>      {
> 
>       case WAIT_TIMEOUT:
>            syslog(LOG_ERR, "WaitForSingleObject() on named-xfer process (%d) status timed out!",(*proc_info).hProcess);
>            dprintf(1,(ddt, "WaitForSingleObject() on named-xfer process (%d) status timed out!\n",(*proc_info).hProcess));
> 	       break;
> 
>       case WAIT_FAILED:
>            syslog(LOG_ERR, "WaitForSingleObject() on named-xfer process (%d) status failed: %m",(*proc_info).hProcess);
>            dprintf(1,(ddt, "WaitForSingleObject() on named-xfer process (%d) status failed: %d\n",(*proc_info).hProcess,GetLastError()));
> 	       break;
> 
>       case WAIT_OBJECT_0:
>            /* normal case */
>            break;
>        
>       default:
>         dprintf(1, (ddt, "Unknown return type from WaitForSingleObject on named-xfer (%d) status! (%d)\n",(*proc_info).hProcess,dwWait));
>         syslog(LOG_ERR, "Unknown return type from WaitForSingleObject on named-xfer (%d) status %d:",(*proc_info).hProcess,dwWait);
>         break;
>       
>      }
>     
>     /* lgk new code using critical section to synchronize */
>     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);
> }
> #endif /* WINNT */
diff --recurs m:\bind496rel/named/ns_ncache.c m:\bind/named/ns_ncache.c
10,18c10,22
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <syslog.h>
< #include <errno.h>
< #include <stdio.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <errno.h>
> #include <stdio.h>
> #include <resolv.h>
35a40
> #ifdef VALIDATE
36a42
> #endif
diff --recurs m:\bind496rel/named/ns_req.c m:\bind/named/ns_req.c
84,93c84,97
< #include <sys/param.h>
< #include <sys/uio.h>
< #include <sys/file.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <fcntl.h>
< #include <syslog.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/uio.h>
> #include <sys/file.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <fcntl.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <errno.h>
105a110,123
> #ifdef WINNT
> extern CRITICAL_SECTION doxfr_section;
> 
> #define _exit(x) ExitThread(x)
> struct ntxfr {
> 	struct qstream *qsp;
> 	struct namebuf *np;
> 	u_char *soa;
> 	int soalen;
> 	int class;
>      u_char *dnptrs[40];
> };
> #endif
> 
122a141
> #ifndef WINNT
123a143,146
> #else
> static void		fwritemsg __P((SOCKET, u_char *, int)),
> #endif
> #ifndef WINNT
125a149,152
> #else
> 			doaxfr __P((struct namebuf *, SOCKET,
> 				    struct namebuf *, int)),
> #endif
127a155,157
> #ifdef WINNT
> static void startxfr_child __P((struct ntxfr *));
> #endif
186c216
< 	dnptrs[0] = NULL;
---
> 	dnptrs [0] = NULL;
252c282,283
< 		    ntohs(hp->id), cp - msg, sortmsgtxt));
---
> 		    ntohs((u_short)hp->id), cp - msg, sortmsgtxt));
> 
437,440c468,471
< 	if ((ntohs(hp->qdcount) != 1)
< 	    || ntohs(hp->ancount) != 0
< 	    || ntohs(hp->nscount) != 0
< 	    || ntohs(hp->arcount) != 0) {
---
> 	if ((ntohs((u_short)  hp->qdcount) != 1)
>  	    || ntohs((u_short) hp->ancount) != 0
>  	    || ntohs((u_short) hp->nscount) != 0
>  	    || ntohs((u_short) hp->arcount) != 0) {
525c556
< 				syslog(LOG_INFO,
---
> 				syslog(LOG_WARNING,
534c565
< 		syslog(LOG_INFO, "approved AXFR from %s for \"%s\"",
---
> 		syslog(LOG_NOTICE, "approved AXFR from %s for \"%s\"",
546c577
< 		syslog(LOG_INFO, "XX /%s/%s/%s",
---
> 		syslog(LOG_NOTICE, "XX /%s/%s/%s",
555c586
< 		    dname, ntohs(hp->id), type, class));
---
> 		    dname, ntohs((u_short)hp->id), type, class));
692c723
< 			hp->nscount = htons(count);
---
>                hp->nscount = htons((u_int16_t)count);
703c734
< 	hp->ancount = htons(ntohs(hp->ancount) + (u_int16_t)count);
---
> 	hp->ancount = htons((u_short)(ntohs((u_short)hp->ancount) + (u_int16_t)count));
787c818
< 			} else if (ntohs(hp->ancount) != 0) {
---
> 			} else if (ntohs((u_short)hp->ancount) != 0) {
865c896
< 			syslog(LOG_INFO, "ns_req: Out Of Memory");
---
> 			syslog(LOG_WARNING, "ns_req: Out Of Memory");
877c908
< 			syslog(LOG_INFO, "res_mkquery(%s) failed", dname);
---
> 			syslog(LOG_NOTICE, "res_mkquery(%s) failed", dname);
971,974c1002,1005
< 	if (ntohs(hp->ancount) != 1
< 	    || ntohs(hp->qdcount) != 0
< 	    || ntohs(hp->nscount) != 0
< 	    || ntohs(hp->arcount) != 0) {
---
> 	if (ntohs((u_short) hp->ancount) != 1
> 	    || ntohs((u_short) hp->qdcount) != 0
> 	    || ntohs((u_short) hp->nscount) != 0
> 	    || ntohs((u_short) hp->arcount) != 0) {
1032c1063
< 		syslog(LOG_INFO, "XX /%s/%s/-%s",
---
> 		syslog(LOG_NOTICE, "XX /%s/%s/-%s",
1113a1145
> #ifndef WINNT
1117a1150,1155
> #else
> fwritemsg(rfd, msg, msglen)
> 	SOCKET rfd;
> 	u_char *msg;
> 	int msglen;
> #endif
1121a1160
> #ifndef WINNT
1123a1163,1166
> #else
> 	if (send(rfd, len, INT16SZ, 0) != INT16SZ ||
> 		send(rfd, msg, msglen, 0) != msglen) {
> #endif
1216c1259
< 	u_char **edp = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
---
>         u_char **edp = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
1235c1278,1582
< 		    || dp->d_ttl < (u_int32_t)tt.tv_sec) {
---
> #ifndef WINNT
> 	        || dp->d_ttl < (u_int32_t)tt.tv_sec) {
> #else
>      		|| dp->d_ttl < (int32_t)tt.tv_sec) {
> #endif
> 			ttl = 0;
> 		} else
> 			ttl = dp->d_ttl - (u_int32_t) tt.tv_sec;
> 	} else {
> 		if (dp->d_ttl != USE_MINIMUM)
> 			ttl = dp->d_ttl;
> 		else
> 			ttl = zp->z_minimum;		/* really default */
> #ifdef notdef /* don't decrease ttl based on time since verification */
> 		if (zp->z_type == Z_SECONDARY) {
> 			/*
> 			 * Set ttl to value received from primary,
> 			 * less time since we verified it (but never
> 			 * less than a small positive value).
> 			 */
> 			ttl -= tt.tv_sec - zp->z_lastupdate;
> 			if (ttl <= 0)
> 				ttl = 120;
> 		}
> #endif
> 	}
> 
> 	buflen -= RRFIXEDSZ;
> #if defined(RETURNSOA) && defined(NCACHE)
> 	if (dp->d_rcode) {
> 		name = (char *)dp->d_data;
> 		name += strlen(name) +1;
> 		name += strlen(name) +1;
> 		name += 5 * INT32SZ;
> 		type = T_SOA;
> 	}
> #endif
> 	if ((n = dn_comp(name, buf, buflen, dnptrs, edp)) < 0)
> 		return (-1);
> 	cp = buf + n;
> 	buflen -= n;
> 	PUTSHORT((u_int16_t)type, cp);
> 	PUTSHORT((u_int16_t)dp->d_class, cp);
> 	PUTLONG(ttl, cp);
> 	sp = cp;
> 	cp += INT16SZ;
> 	switch (type) {
> 	case T_CNAME:
> 	case T_MG:
> 	case T_MR:
> 	case T_PTR:
> 		n = dn_comp((char *)dp->d_data, cp, buflen, dnptrs, edp);
> 		if (n < 0)
> 			return (-1);
> 		PUTSHORT((u_int16_t)n, sp);
> 		cp += n;
> 		break;
> 
> 	case T_MB:
> 	case T_NS:
> 		/* Store domain name in answer */
> 		n = dn_comp((char *)dp->d_data, cp, buflen, dnptrs, edp);
> 		if (n < 0)
> 			return (-1);
> 		PUTSHORT((u_int16_t)n, sp);
> 		cp += n;
> 		if (doadd)
> 			addname((char*)dp->d_data, name,
> 				type, dp->d_class);
> 		break;
> 
> 	case T_SOA:
> 	case T_MINFO:
> 	case T_RP:
> 		cp1 = dp->d_data;
> 		n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
> 		if (n < 0)
> 			return (-1);
> 		cp += n;
> 		buflen -= type == T_SOA ? n + 5 * INT32SZ : n;
> 		cp1 += strlen((char *)cp1) + 1;
> 		n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
> 		if (n < 0)
> 			return (-1);
> 		cp += n;
> 		if (type == T_SOA) {
> 			cp1 += strlen((char *)cp1) + 1;
> 			bcopy(cp1, cp, (n = 5 * INT32SZ));
> 			cp += n;
> 		}
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		PUTSHORT((u_int16_t)n, sp);
> 		break;
> 
> 	case T_NAPTR:
> 		/* cp1 == our data/ cp == data of RR */
> 		cp1 = dp->d_data;
> 
>  		if ((buflen -= INT16SZ) < 0)
> 			return (-1);
> 
>  		/* copy order */
>  		bcopy(cp1, cp, INT16SZ);
>  		cp += INT16SZ;
>  		cp1 += INT16SZ;
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		dprintf(1, (ddt, "current size n = %u\n", n));
> 
> 		/* copy preference */
> 		bcopy(cp1, cp, INT16SZ);
> 		cp += INT16SZ;
> 		cp1 += INT16SZ;
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		dprintf(1, (ddt, "current size n = %u\n", n));
> 
> 		/* Flags */
> 		n = *cp1++;
> 		dprintf(1, (ddt, "size of n at flags = %d\n", n));
> 		*cp++ = n;
> 		bcopy(cp1,cp,n);
> 		cp += n;
> 		cp1 += n;
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		dprintf(1, (ddt, "current size n = %u\n", n));
> 		
> 		/* Service */
> 		n = *cp1++;
> 		*cp++ = n;
> 		bcopy(cp1,cp,n);
> 		cp += n;
> 		cp1 += n;
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		dprintf(1, (ddt, "current size n = %u\n", n));
> 
> 		/* Regexp */
> 		n = *cp1++;
> 		*cp++ = n;
> 		bcopy(cp1,cp,n);
> 		cp += n;
> 		cp1 += n;
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		dprintf(1, (ddt, "current size n = %u\n", n));
> 
> 		/* Replacement */
> 		dprintf(1, (ddt, "Replacement = %s\n", cp1));
> 		n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
> 		dprintf(1, (ddt, "dn_comp's n = %u\n", n));
> 		if (n < 0)
> 			return (-1);
> 		cp += n;
> 
> 		/* save data length */
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		dprintf(1, (ddt, "saved size n = %u\n", n));
> 		PUTSHORT((u_int16_t)n, sp);
> 
> 		break;
> 
> 	case T_MX:
> 	case T_AFSDB:
> 	case T_RT:
> 	case T_SRV:
> 		/* cp1 == our data/ cp == data of RR */
> 		cp1 = dp->d_data;
> 
>  		if ((buflen -= INT16SZ) < 0)
> 			return (-1);
> 
>  		/* copy preference */
>  		bcopy(cp1, cp, INT16SZ);
>  		cp += INT16SZ;
>  		cp1 += INT16SZ;
> 
> 		if (type == T_SRV) {
> 			bcopy(cp1, cp, INT16SZ*2);
> 			cp += INT16SZ*2;
> 			cp1 += INT16SZ*2;
> 		}
> 
> 		n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
> 		if (n < 0)
> 			return (-1);
> 		cp += n;
> 
> 		/* save data length */
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		PUTSHORT((u_int16_t)n, sp);
> 		if (doadd)
> 			addname((char*)cp1, name, type, dp->d_class);
> 		break;
> 
> 	case T_PX:
> 		cp1 = dp->d_data;
> 
> 		if ((buflen -= INT16SZ) < 0)
> 			return (-1);
> 
> 		/* copy preference */
> 		bcopy(cp1, cp, INT16SZ);
> 		cp += INT16SZ;
> 		cp1 += INT16SZ;
> 
> 		n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
> 		if (n < 0)
> 			return (-1);
> 		cp += n;
> 		buflen -= n;
> 		cp1 += strlen((char *)cp1) + 1;
> 		n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
> 		if (n < 0)
> 			return (-1);
> 		cp += n;
> 
> 		/* save data length */
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
> 		PUTSHORT((u_int16_t)n, sp);
> 		break;
> 
> 	case T_SIG:
> 		/* cp1 == our data; cp == data of target RR */
> 		cp1 = dp->d_data;
> 
> 		/* first just copy over the type_covered, algorithm, */
> 		/* labels, orig ttl, two timestamps, and the footprint */
> 		if ((dp->d_size - 18) > buflen)
> 			return (-1);  /* out of room! */
> 		bcopy( cp1, cp, 18 );
> 		cp  += 18;
> 		cp1 += 18;
> 		buflen -= 18;
> 
> 		/* then the signer's name */
> 		n = dn_comp((char *)cp1, cp, buflen, NULL, NULL);
> 		if (n < 0)
> 			return (-1);
> 		cp += n;
> 		buflen -= n;
> 		cp1 += strlen((char*)cp1)+1;
> 
> 		/* finally, we copy over the variable-length signature */
> 		n = dp->d_size - (u_int16_t)((cp1 - dp->d_data));
> 		if (n > buflen)
> 			return (-1);  /* out of room! */
> 		bcopy(cp1, cp, n);
> 		cp += n;
> 		
>   		/* save data length & return */
> 		n = (u_int16_t)((cp - sp) - INT16SZ);
>   		PUTSHORT((u_int16_t)n, sp);
> 		break;
> 
> 	default:
> 		if (dp->d_size > buflen)
> 			return (-1);
> 		bcopy(dp->d_data, cp, dp->d_size);
> 		PUTSHORT((u_int16_t)dp->d_size, sp);
> 		cp += dp->d_size;
> 	}
> 
> 	return (cp - buf);
> }
> 
> 
> 
> /*
>  * Copy databuf into a resource record for replies.
>  * Return size of RR if OK, -1 if buffer is full.
>  */
> int
> make_rr2(name, dp, buf, buflen, doadd, dnptrs)
> 	const char *name;
> 	register struct databuf *dp;
> 	u_char *buf;
> 	int buflen, doadd;
> 	u_char **dnptrs;
> {
> 	register u_char *cp;
> 	u_char *cp1, *sp;
> 	struct zoneinfo *zp;
> 	register int32_t n;
> 	register int16_t type = dp->d_type;
> 	register u_int32_t ttl;
>         u_char **edp = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
> 	dprintf(5, (ddt, "make_rr2(%s, %lx, %lx, %d, %d) %d zone %d ttl %lu\n",
> 		    name, (u_long)dp, (u_long)buf,
> 		    buflen, doadd, dp->d_size, dp->d_zone, (u_long)dp->d_ttl));
> 
> #ifdef	NCACHE
> 	if (dp->d_rcode
> #ifdef RETURNSOA
> 	    && dp->d_size == 0
> #endif
> 	) {
> 		panic(-1, "make_rr2: impossible d_rcode value");
> 	}
> #endif
> 	zp = &zones[dp->d_zone];
> 	/* check for outdated RR before updating dnptrs by dn_comp() (?) */
> 	if (zp->z_type == Z_CACHE) {
> 		if ((dp->d_flags & DB_F_HINT) != 0
> #ifndef WINNT
> 	        || dp->d_ttl < (u_int32_t)tt.tv_sec) {
> #else
>      		|| dp->d_ttl < (int32_t)tt.tv_sec) {
> #endif
1491a1839,1842
> 
> 
> 
> 
1667c2018
< 	hp->nscount = htons(ntohs(hp->nscount) + 1);
---
> 	hp->nscount = htons((u_short)(ntohs((u_short)hp->nscount) + 1));
1681a2033
> #ifndef WINNT
1686a2039,2046
> #else
> doaxfr(np, rfd, top, class, dnptrs_copy)
> 	register struct namebuf *np;
> 	SOCKET rfd;
> 	struct namebuf *top;
> 	int class;		/* Class to transfer */
> 	u_char **dnptrs_copy;
> #endif
1726a2087
> #ifndef WINNT
1727a2089,2091
> #else
> 		n = make_rr2(dname, dp, cp, sizeof(msg)-HFIXEDSZ, 0, dnptrs_copy);
> #endif
1729a2094
> #ifndef WINNT
1730a2096,2098
> #else
> 		fwritemsg(rfd, msg, n + HFIXEDSZ);
> #endif
1784a2153
> #ifndef WINNT
1786c2155,2158
< 			if (n < 0)
---
> #else
>  			n = make_rr2(fname, gdp, cp, sizeof(msg)-HFIXEDSZ, 0, dnptrs_copy);
> #endif
>                if (n < 0)
1787a2160
> #ifndef WINNT
1788a2162,2164
> #else
>  			fwritemsg(rfd, msg, n + HFIXEDSZ);
> #endif
1828c2204,2205
< 		if ((n = make_rr(dname, dp, cp, sizeof(msg)-HFIXEDSZ, 0)) < 0)
---
> #ifndef WINNT
>            if ((n = make_rr(dname, dp, cp, sizeof(msg)-HFIXEDSZ, 0)) < 0)
1830c2207,2213
< 		fwritemsg(rfp, msg, n + HFIXEDSZ);
---
>             fwritemsg(rfp, msg, n + HFIXEDSZ);
> #else
> 		
>  		if ((n = make_rr2(dname, dp, cp, sizeof(msg)-HFIXEDSZ, 0, dnptrs_copy)) < 0)
>           	continue;
>           fwritemsg(rfd, msg, n + HFIXEDSZ);
> #endif
1874a2258
> #ifndef WINNT
1875a2260,2262
> #else
> 			doaxfr(np, rfd, top, class, dnptrs_copy);
> #endif
1880a2268
> 
1888,1889c2276,2277
< 	int		soalen;
< 	int		class;
---
> 	int		     soalen;
> 	int		     class;
1891a2280
> #ifndef WINNT
1905a2295,2300
> #else /* WINNT */
> 	HANDLE xfr_thread_handle;
> 	struct ntxfr *xfr_child;
> 	char *xfrbuf;
> 	DWORD id;
> #endif /* WINNT */
1908a2304
> #ifndef WINNT
1941a2338,2417
> #else
> 	if ((xfr_child = (struct ntxfr *)malloc(sizeof(struct ntxfr))) == NULL) {
> 		syslog(LOG_ERR, "startxfr: malloc xfr_child: %m");
> 		sqrm(qsp);
> 		return;
> 	}
> 	if ((xfrbuf = (u_char *)malloc(BUFSIZ)) == NULL) {
> 		syslog(LOG_ERR, "startxfr: malloc xfrbuf: %m");
> 		sqrm(qsp);
> 		return;
> 	}
> 
>      /* fill in the dnptrs also */
>    	{
>       u_char **edp = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
>       int len = (int)edp - (int)dnptrs;
>       memcpy(xfr_child->dnptrs,dnptrs,len);
>     }
> 
>         xfr_child->qsp = qsp;
> 	xfr_child->np = np;
> 	bcopy(soa, xfrbuf, soalen);
> 	soa[soalen+1] = '\0';
> 	xfr_child->soa = xfrbuf;
> 	xfr_child->soalen = soalen;
> 	xfr_child->class = class;
>  
>          
> 	xfr_thread_handle = CreateThread(NULL, 0,
> 					(LPTHREAD_START_ROUTINE)startxfr_child,
> 					(LPVOID)xfr_child, CREATE_SUSPENDED, &id);
> 	
>      if(xfr_thread_handle == NULL) {
> 		syslog(LOG_NOTICE, "startxfr(%s -> %s) failing; CreateThread(): %m",
> 		       dname, sin_ntoa(&qsp->s_from));
> 		sqrm(qsp);
> 	}
> 	else
> 		/* probably should store the thread handle and/or thread id
> 		 * and identify and kill a hung outgoing zone transfer thread
> 		 */
> 		syslog(LOG_DEBUG, "zone transfer of \"%s\" to %s (threadId %d)",
> 		       dname, sin_ntoa(&qsp->s_from), id);
>         /* lgk close errant handle here so we don't get too many */
>         /* lgk this handle is being closed ok but there are still two open after
>            an outgoing transfer that I need to track down  adding sqrm should fix this
>            but we need to make sure child waits until this is done before continueing
>            as above in unix the pipes synchronize the two.. the child waits until parent
>            pipe is closed and then goes on... we can do this by makeing the child thread
>            wait for its startup */
>         dprintf(1, (ddt, "ns_req: resuming thread/closing thread handle  = %d id = %d\n",xfr_thread_handle,id));
>         ResumeThread(xfr_thread_handle);
>         CloseHandle(xfr_thread_handle);
> 	return;
> }
> 
> static void
> startxfr_child(pxfr_child)
> 	struct ntxfr *pxfr_child;
> {
> 	DWORD pid;
> #if defined(HAVE_SETVBUF) && !defined(WINNT)
> 	char *buf;
> #endif
> #ifdef SO_SNDBUF
> 	static const int sndbuf = XFER_BUFSIZE * 2;
> #endif
> #ifdef SO_LINGER
> 	static const struct linger ll = { 1, 120 };
> #endif
> 	struct qstream	*qsp = pxfr_child->qsp;
> 	struct namebuf	*np = pxfr_child->np;
> 	u_char		*soa = pxfr_child->soa;
> 	int		soalen = pxfr_child->soalen;
> 	int		class = pxfr_child->class;
> 	int off = 0;
> 	u_char **dnptrs_copy = pxfr_child->dnptrs;
> 
> 	pid = GetCurrentThreadId();
> #endif /* WINNT */
1942a2419
> #ifndef WINNT
1965a2443,2444
> #endif
> 
1968a2448,2450
> #ifdef WINNT
> 	(void) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
> #endif
1970a2453
> #ifndef WINNT
1974a2458
> #endif
1975a2460
> #ifndef WINNT
1981c2466,2473
< #ifdef HAVE_SETVBUF
---
> #else
> 	/* set the socket to be blocking again */
> 	if(ioctlsocket(qsp->s_rfd, FIONBIO, (u_long *)&off) == SOCKET_ERROR) {
> 		syslog(LOG_INFO, "ioctlsocket(rfd, BLOCK): %m");
> 		exit(1);
> 	}
> #endif /* WINNT */
> #if defined(HAVE_SETVBUF) && !defined(WINNT)
2001c2493,2494
< 	fwritemsg(rfp, soa, soalen);
---
> #ifndef WINNT
>   	fwritemsg(rfp, soa, soalen);
2004a2498,2502
> #else
>  	fwritemsg(qsp->s_rfd, soa, soalen);
>  	doaxfr(np, qsp->s_rfd, np, class,dnptrs_copy);
>  	fwritemsg(qsp->s_rfd, soa, soalen);
> #endif
2012c2510,2521
< #endif
---
> #endif // so linger
> #ifdef WINNT
>          dprintf(1, (ddt, "closing xfer socket = %d threadid = %d\n",
>  			    qsp->s_rfd,(u_long)pid));
>  			    // lgk 10.96 nt not freeing the buf or the pxfr_child so do it
>  			    // lgk it looks like sqrm does this and by not doing it we
>  			    // are not unlinking which may be causing the crash/
>       close(qsp->s_rfd);
>       free(soa);
>       free(pxfr_child);
>       sqrm(qsp);
> #else
2015a2525
> #endif
diff --recurs m:\bind496rel/named/ns_resp.c m:\bind/named/ns_resp.c
84,93c84,97
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <syslog.h>
< #include <errno.h>
< #include <stdio.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <errno.h>
> #include <stdio.h>
> #include <resolv.h>
273c277
< 		dprintf(1, (ddt, "DUP? dropped (id %d)\n", ntohs(hp->id)));
---
> 		dprintf(1, (ddt, "DUP? dropped (id %d)\n", ntohs( (u_short) hp->id)));
287,290c291,294
< 	qdcount = ntohs(hp->qdcount);
< 	ancount = ntohs(hp->ancount);
< 	aucount = ntohs(hp->nscount);	/* !!! */
< 	arcount = ntohs(hp->arcount);
---
> 	qdcount = ntohs( (u_short) hp->qdcount);
> 	ancount = ntohs( (u_short) hp->ancount);
> 	aucount = ntohs( (u_short) hp->nscount);	/* !!! */
> 	arcount = ntohs( (u_short) hp->arcount);
489c493
< 				t = ns->d_nstime * ALPHA
---
> 				t = (u_long)(ns->d_nstime * ALPHA
491c495
< 				   (1 - ALPHA) * rtrip;
---
> 				   (1 - ALPHA) * rtrip);
531c535
< 				t = (rtrip * BETA);
---
> 				t = (u_long)(rtrip * BETA);
533c537
< 				t = ns2->d_nstime * BETA
---
> 				t = (u_long)(ns2->d_nstime * BETA
535c539
< 				   (1 - ALPHA) * rtrip;
---
> 				   (1 - ALPHA) * rtrip);
537c541
< 			    t = ns2->d_nstime * GAMMA;
---
> 			    t = (u_long)(ns2->d_nstime * GAMMA);
1123c1127
< 	hp->ancount = htons(ntohs(hp->ancount) + (u_int16_t)count);
---
>   	hp->ancount = htons((u_short)(ntohs((u_short)hp->ancount) + (u_int16_t)count));
1715c1719
< 		if (n > (sizeof data) - (cp1 - (u_char *)data))
---
> 		if ((unsigned)n > (sizeof data) - (cp1 - (u_char *)data))
2608c2612,2613
< 					+
---
> 					+ (int) (
> 				0.95 * (int) (dp->d_ttl - tt.tv_sec));
2664a2670,2681
> #ifdef MSN_LIMIT
>           if ((count >= 28) && (type == T_A) && (class = C_IN)) 
>             {
>               // normally we would put truncation bit here...
>               // don't put truncation bit in here as win95 cannot handle it
>               //hp->tc = 1;
>               dprintf(3, (ddt, "MSN_LIMIT is in effect ... limiting query response to 28 records\n"));
>               *countp = 28;
>               return (*lenp - buflen);
>           }
>    
> #endif
2894c2911
< 		} else if (ttl != dp->d_ttl) {
---
> 		} else if (ttl != (unsigned)dp->d_ttl) {
2914c2931
< 		} else if (ttl != dbp->db_dp->d_ttl) {
---
> 		} else if (ttl != (unsigned)dbp->db_dp->d_ttl) {
2925c2942
< 			if (dp->d_ttl > ttl)
---
> 			if ((unsigned)dp->d_ttl > ttl)
diff --recurs m:\bind496rel/named/ns_sort.c m:\bind/named/ns_sort.c
61,69c61,73
< #include <sys/param.h>
< #include <sys/types.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <stdio.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
diff --recurs m:\bind496rel/named/ns_stats.c m:\bind/named/ns_stats.c
67,73c67,77
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <stdio.h>
< #include <syslog.h>
< #include <errno.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <stdio.h>
> #ifndef WINNT
> #include <syslog.h>
> #endif
> #include <errno.h>
75,76c79,80
< #include "named.h"
< #include "tree.h"
---
> #include "named.h"
> #include "tree.h"
244a249
> #ifndef WINNT
245a251,253
> #else
> 			SetLastError(save);
> #endif
diff --recurs m:\bind496rel/named/ns_udp.c m:\bind/named/ns_udp.c
23,32c23,36
< #include <sys/param.h>
< #include <sys/stat.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< 
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< 
< #include <ctype.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #endif
> #include <sys/stat.h>
> #ifndef WINNT
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> 
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> 
> #include <ctype.h>
34a39,40
> 
> #ifndef WINNT
36d41
< #include <netdb.h>
37a43,45
> #endif
> 
> #include <netdb.h>
diff --recurs m:\bind496rel/named/ns_validate.c m:\bind/named/ns_validate.c
11,19c11,21
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/file.h>
< 
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< 
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/file.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #ifndef WINNT
> #include <arpa/inet.h>
> #include <syslog.h>
> #endif
Only in m:\bind/named: ntif.h
diff --recurs m:\bind496rel/named/pathnames.h m:\bind/named/pathnames.h
61,62c61,63
< #ifdef _PATH_XFER
< # define _PATH_XFER_PREDEFINED	/* probably from Makefile */
---
> 
> #ifdef _PATH_XFER
> # define _PATH_XFER_PREDEFINED	/* probably from Makefile */
65,66c66,81
< #if defined (__sgi) && !defined(_SYSTYPE_SVR4) && !defined(__SYSTYPE_SVR4)
< #define	_PATH_BOOT	"/usr/etc/named.d/named.boot"
---
> #ifdef WINNT
> #define	_PATH_BOOT	"%windir%\\NAMED.BOOT"
> #define	_ALT_PATH_BOOT	"%windir%\\NAMED.INI"
> #ifndef _PATH_XFER
> # define _PATH_XFER	"%windir%\\SYSTEM32\\XFER.EXE"
> #endif
> #ifndef _PATH_PIDFILE
> # define _PATH_PIDFILE	"%windir%\\NAMED.PID"
> #endif
> /* following paths prepended with GetTempPath() */
> #define	_PATH_DEBUG	"NAMED.RUN" 
> #define	_PATH_DUMPFILE	"NAMDUMP.DB"
> #define	_PATH_STATS	"NAMED.STS"
> #define	_PATH_XFERTRACE	"XFER.TRC"
> #define _PATH_XFERDDT	"XFER.DDT"
> #define	_PATH_TMPXFER	"XFER.DDT.XXXXXX"
68c83,87
< #define	_PATH_BOOT	"/etc/named.boot"
---
> 
> #if defined (__sgi) && !defined(_SYSTYPE_SVR4) && !defined(__SYSTYPE_SVR4)
> #define	_PATH_BOOT	"/usr/etc/named.d/named.boot"
> #else
> #define	_PATH_BOOT	"/etc/named.boot"
122a142,143
> 
> #endif /* WINNT */
Only in m:\bind/named: resource.h
diff --recurs m:\bind496rel/named/storage.c m:\bind/named/storage.c
57,58c57,60
< #include <sys/param.h>
< #include <syslog.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <syslog.h>
> #endif
Only in m:\bind/named: strip.bat
Only in m:\bind/named: t3ansrespchanges
Only in m:\bind/named: versav.c
Only in m:\bind/named: xfer.mak
Only in m:\bind/named: xfer.mdp
Only in m:\bind/named: xfer.ncb
Only in m:\bind/named: xfer.vcp
Only in m:\bind/named: xfer95.mak
Only in m:\bind/named: xfer95.mdp
Only in m:\bind/named: xfer95.ncb
Only in m:\bind: namedold.exe
Only in m:\bind: nslookup.exe
Only in m:\bind: ntbind49326_vc22.zip
Only in m:\bind: ntbind49327.zip
Only in m:\bind: ntbind49332.zip
Only in m:\bind: ntbind493rel.zip
Only in m:\bind: ntbind493relo3.zip
Only in m:\bind: ntbind493relo5.zip
Only in m:\bind: ntbind493relp2.zip
Only in m:\bind: ntbind494arel.zip
Only in m:\bind: ntbind494beta2.zip
Only in m:\bind: ntbind494p1.zip
Only in m:\bind: ntbind494rel.zip
Only in m:\bind: ntbind494t3b2.zip
Only in m:\bind: ntbind494t4a.zip
Only in m:\bind: ntbind494t4b.zip
Only in m:\bind: ntbind494t5b.zip
Only in m:\bind: ntbind495p1.zip
Only in m:\bind: ntbind495p1a.zip
Only in m:\bind: ntbind495p1b.zip
Only in m:\bind: ntbind495p1c2.zip
Only in m:\bind: ntbind495rel.zip
Only in m:\bind: ntbind495relmsn.zip
Only in m:\bind: ntbind495t1.zip
Only in m:\bind: ntbind495t1a.zip
Only in m:\bind: ntbind495t1b.zip
Only in m:\bind: ntbind495t3a.zip
Only in m:\bind: ntbind495t3b.zip
Only in m:\bind: ntbind495t4b.zip
Only in m:\bind: ntbind495t5b+.zip
Only in m:\bind: ntbind495t5b.zip
Only in m:\bind: ntbind495t6b.zip
Only in m:\bind: ntbind495t6bo.zip
Only in m:\bind: ntbind495t6bold.zip
Only in m:\bind: ntbind496t1a.zip
Only in m:\bind: ntdns49326bin_vc22.zip
Only in m:\bind: ntdns493relbin-nongui.zip
Only in m:\bind: ntdns493relbin.zip
Only in m:\bind: ntdns493relbino5.zip
Only in m:\bind: ntdns493relp2bin-nongui.zip
Only in m:\bind: ntdns493relp2bin.zip
Only in m:\bind: ntdns494arelbin-nongui.zip
Only in m:\bind: ntdns494arelbin.zip
Only in m:\bind: ntdns494beta2bin-nongui.zip
Only in m:\bind: ntdns494beta2bin.zip
Only in m:\bind: ntdns494p1bin-nongui.zip
Only in m:\bind: ntdns494p1bin.zip
Only in m:\bind: ntdns494relbin-nongui.zip
Only in m:\bind: ntdns494relbin.zip
Only in m:\bind: ntdns494t3b2bin.zip
Only in m:\bind: ntdns494t4abin-nongui.zip
Only in m:\bind: ntdns494t4abin.zip
Only in m:\bind: ntdns494t4bbin-nongui.zip
Only in m:\bind: ntdns494t4bbin.zip
Only in m:\bind: ntdns494t5bbin-nongui.zip
Only in m:\bind: ntdns494t5bbin.zip
Only in m:\bind: ntdns495p1-nongui.zip
Only in m:\bind: ntdns495p1a-nongui.zip
Only in m:\bind: ntdns495p1abin.zip
Only in m:\bind: ntdns495p1b-nongui.zip
Only in m:\bind: ntdns495p1bbin.zip
Only in m:\bind: ntdns495p1bin.zip
Only in m:\bind: ntdns495p1c2bin.zip
Only in m:\bind: ntdns495rel-nongui.zip
Only in m:\bind: ntdns495relbin.zip
Only in m:\bind: ntdns495relmsnbin.zip
Only in m:\bind: ntdns495t1abin-nongui.zip
Only in m:\bind: ntdns495t1abin.zip
Only in m:\bind: ntdns495t1bbin-nongui.zip
Only in m:\bind: ntdns495t1bbin.zip
Only in m:\bind: ntdns495t1bin-nongui.zip
Only in m:\bind: ntdns495t1bin.zip
Only in m:\bind: ntdns495t3abin-nongui.zip
Only in m:\bind: ntdns495t3abin.zip
Only in m:\bind: ntdns495t3bbin-nongui.zip
Only in m:\bind: ntdns495t3bbin.zip
Only in m:\bind: ntdns495t4bbin-nongui.zip
Only in m:\bind: ntdns495t4bbin.zip
Only in m:\bind: ntdns495t5bbin-nongui.zip
Only in m:\bind: ntdns495t5bbin.zip
Only in m:\bind: ntdns495t6bbin-nongui.zip
Only in m:\bind: ntdns495t6bbin-nonguio.zip
Only in m:\bind: ntdns495t6bbin.zip
Only in m:\bind: ntdns496rel-nongui.zip
Only in m:\bind: ntdns496t1a-nongui.zip
Only in m:\bind: ntdns496t1abin.zip
Only in m:\bind: out
Only in m:\bind: readme.nt
Only in m:\bind/res: WinRel
diff --recurs m:\bind496rel/res/base64.c m:\bind/res/base64.c
44,48c44,50
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
50,52c52,54
< #include <ctype.h>
< #include <resolv.h>
< #include <stdio.h>
---
> #include <ctype.h>
> #include <resolv.h>
> #include <stdio.h>
140c142
< 	int i;
---
> 	size_t i;
227c229
< 				if (tarindex >= targsize)
---
> 				if ((size_t)tarindex >= targsize)
235c237
< 				if (tarindex + 1 >= targsize)
---
> 				if ((size_t)(tarindex + 1) >= targsize)
246c248
< 				if (tarindex + 1 >= targsize)
---
> 				if ((size_t)(tarindex + 1) >= targsize)
257c259
< 				if (tarindex >= targsize)
---
> 				if ((size_t)tarindex >= targsize)
diff --recurs m:\bind496rel/res/gethnamaddr.c m:\bind/res/gethnamaddr.c
62,66c62,68
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
68,71c70,73
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #include <ctype.h>
---
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #include <ctype.h>	 
72a75
> #ifndef WINNT
73a77
> #endif
76c80
< # define LOG_AUTH 0
---
> #define LOG_AUTH 0
82,83c86,87
< # include <stdlib.h>
< # include <string.h>
---
> #include <stdlib.h>
> #include <string.h>
85c89
< # include "../conf/portability.h"
---
> #include "../conf/portability.h"
89c93
< # include <../conf/options.h>
---
> #include <../conf/options.h>
93c97
< # define SPRINTF(x) strlen(sprintf/**/x)
---
> #define SPRINTF(x) strlen(sprintf/**/x)
95c99,105
< # define SPRINTF(x) ((size_t)sprintf x)
---
> #define SPRINTF(x) ((size_t)sprintf x)
> #endif
> 
> #ifdef WINNT
> extern char *pathhosts;
> extern int res_paths_initialized;
> extern init_res_paths();
112a123
> int inet_pton();
135a147
> #ifndef WINNT
136a149
> #endif
147a161
> #ifndef WINNT
148a163,166
> #else
> 		WSASetLastError(save);
> 		SetLastError(save);
> #endif
152c170
< # define dprintf(msg, num) /*nada*/
---
> #define dprintf(msg, num) /*nada*/
192,193c210,211
< 	ancount = ntohs(hp->ancount);
< 	qdcount = ntohs(hp->qdcount);
---
> 	ancount = ntohs( (u_short) hp->ancount);
> 	qdcount = ntohs( (u_short) hp->qdcount);
197a216
> #ifndef WINNT
198a218,220
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
202a225
> #ifndef WINNT
203a227,229
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
214c240,244
< 			h_errno = NO_RECOVERY;
---
> #ifndef WINNT
> 		h_errno = NO_RECOVERY;
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
310c340
< 				       AskedForGot, qname, bp);
---
> 				       (char *) AskedForGot, qname, bp);
349c379,383
< 			h_errno = NETDB_SUCCESS;
---
> #ifndef WINNT
>    		       h_errno = NETDB_SUCCESS;
> #else
>  		       WSASetLastError(NETDB_SUCCESS);
> #endif
356c390
< 				       AskedForGot, host.h_name, bp);
---
> 				       (char *)AskedForGot, host.h_name, bp);
401c435
< # if defined(RESOLVSORT)
---
> #if defined(RESOLVSORT)
409c443
< # endif /*RESOLVSORT*/
---
> #endif /*RESOLVSORT*/
421c455,459
< 		h_errno = NETDB_SUCCESS;
---
> #ifndef WINNT
>     		       h_errno = NETDB_SUCCESS;
> #else
>  		       WSASetLastError(NETDB_SUCCESS);
> #endif
425c463,467
< 	h_errno = NO_RECOVERY;
---
> #ifndef WINNT
> 		h_errno = NO_RECOVERY;
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
429,445d470
< struct hostent *
< gethostbyname(name)
< 	const char *name;
< {
< 	struct hostent *hp;
< 
< 	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
< 		h_errno = NETDB_INTERNAL;
< 		return (NULL);
< 	}
< 	if (_res.options & RES_USE_INET6) {
< 		hp = gethostbyname2(name, AF_INET6);
< 		if (hp)
< 			return (hp);
< 	}
< 	return (gethostbyname2(name, AF_INET));
< }
458a484
> #ifndef WINNT
459a486,488
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
472a502
> #ifndef WINNT
474a505,508
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> 		SetLastError(WSAEAFNOSUPPORT);
> #endif
503a538
> #ifndef WINNT
504a540,542
> #else
>                                         WSASetLastError(HOST_NOT_FOUND);
> #endif
519c557,561
< 				h_errno = NETDB_SUCCESS;
---
> #ifndef WINNT
>    		                 h_errno = NETDB_SUCCESS;
> #else
>  	 	                 WSASetLastError(NETDB_SUCCESS);
> #endif
536a579
> #ifndef WINNT
537a581,583
> #else
>                                         WSASetLastError(HOST_NOT_FOUND);
> #endif
550c596,600
< 				h_errno = NETDB_SUCCESS;
---
> #ifndef WINNT
>    		                h_errno = NETDB_SUCCESS;
> #else
>  		                WSASetLastError(NETDB_SUCCESS);
> #endif
566a617,643
> #ifndef WINNT
> gethostbyname(name)
> #else
> gethostbyname_nt(name)
> #endif
> 	const char *name;
> {
> 	struct hostent *hp;
> 
> 	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
> #ifndef WINNT
> 		h_errno = NETDB_INTERNAL;
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
> 		return (NULL);
> 	}
> 	if (_res.options & RES_USE_INET6) {
> 		hp = gethostbyname2(name, AF_INET6);
> 		if (hp)
> 			return (hp);
> 	}
> 	return (gethostbyname2(name, AF_INET));
> }
> 
> struct hostent *
> #ifndef WINNT
567a645,647
> #else
> gethostbyaddr_nt(addr, len, af)
> #endif
584c664
< 	extern struct hostent *_gethtbyaddr();
---
> extern struct hostent *_gethtbyaddr();
586a667
> #ifndef WINNT
588c669,672
< 		return (NULL);
---
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
> 		return (0);
606a691
> #ifndef WINNT
609c694,698
< 		return (NULL);
---
> #else
>  		SetLastError(WSAEAFNOSUPPORT);
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
> 		return (0);
611a701
> #ifndef WINNT
614c704,708
< 		return (NULL);
---
> #else
>  		SetLastError(WSAEINVAL);
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
> 		return (0);
641c735
< 		return (NULL);
---
> 		return (0);
644c738
< 		return (NULL);	/* h_errno was set by getanswer() */
---
> 		return (0);	/* h_errno was set by getanswer() */
656c750
< 	    if (!(rhp = gethostbyname(hname2))) {
---
> 	    if (!(rhp = gethostbyname_nt(hname2))) {
661c755,759
< 		h_errno = HOST_NOT_FOUND;
---
> #ifndef WINNT
> 		    h_errno = HOST_NOT_FOUND;
> #else
>                     WSASetLastError(HOST_NOT_FOUND);
> #endif
672c770,774
< 		h_errno = HOST_NOT_FOUND;
---
> #ifndef WINNT
> 		    h_errno = HOST_NOT_FOUND;
> #else
>                     WSASetLastError(HOST_NOT_FOUND);
> #endif
687c789,793
< 	h_errno = NETDB_SUCCESS;
---
> #ifndef WINNT
>    		       h_errno = NETDB_SUCCESS;
> #else
>  		       WSASetLastError(NETDB_SUCCESS);
> #endif
694a801,802
>     
> #ifndef WINNT
696a805,812
> #else
>         if (!res_paths_initialized)
>           init_res_paths();
> 
> 	if (!hostf)
> 		hostf = fopen(pathhosts, "r" );
> #endif
> 
718c834,843
< 	if (!hostf && !(hostf = fopen(_PATH_HOSTS, "r" ))) {
---
> #ifndef WINNT
>  	if (!hostf && !(hostf = fopen(_PATH_HOSTS, "r" ))) {
> #else
>         if (!res_paths_initialized)
>            init_res_paths();
>  
>  	if (!hostf && !(hostf = fopen(pathhosts, "r" ))) {
> #endif
>  
> #ifndef WINNT
719a845,847
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
724c852,856
< 		h_errno = HOST_NOT_FOUND;
---
> #ifndef WINNT
> 		    h_errno = HOST_NOT_FOUND;
> #else
>                     WSASetLastError(HOST_NOT_FOUND);
> #endif
772c904,908
< 	h_errno = NETDB_SUCCESS;
---
> #ifndef WINNT
>    		       h_errno = NETDB_SUCCESS;
> #else
> 		       WSASetLastError(NETDB_SUCCESS);
> #endif
diff --recurs m:\bind496rel/res/getnetbyaddr.c m:\bind/res/getnetbyaddr.c
39a40,42
> #ifdef WINNT
> #include "../conf/portability.h"
> #endif
diff --recurs m:\bind496rel/res/getnetbyname.c m:\bind/res/getnetbyname.c
41a42,44
> #ifdef WINNT
> #include "../conf/portability.h"
> #endif
diff --recurs m:\bind496rel/res/getnetent.c m:\bind/res/getnetent.c
50,54c50,56
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
56,59c58,67
< #include <stdio.h>
< #include <resolv.h>
< #include <netdb.h>
< #include <string.h>
---
> #include <stdio.h>
> #include <resolv.h>
> #include <netdb.h>
> #include <string.h>
> #ifdef WINNT
> #include "../conf/portability.h"
> extern char *pathnetworks;
> extern int res_paths_initialized;
> extern init_res_paths();
> #endif
64a73,74
> 
> 
97a108
> #ifndef WINNT
99a111,117
> #else
>        if (!res_paths_initialized)
>          init_res_paths();
> 
> 	if (netf == NULL)
> 		netf = fopen(pathnetworks, "r" );
> #endif
121a140
> #ifndef WINNT
122a142,148
> #else
>        if (!res_paths_initialized)
>          init_res_paths();
> 
> 	if (netf == NULL && (netf = fopen(pathnetworks, "r" )) == NULL)
> #endif
> 
diff --recurs m:\bind496rel/res/getnetnamadr.c m:\bind/res/getnetnamadr.c
48,52c48,54
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
54,57c56,59
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #include <ctype.h>
---
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #include <ctype.h>
60a63
> #ifndef WINNT
61a65,67
> #else
> #include "../conf/portability.h"
> #endif
67c73
< struct netent *_getnetbyaddr __P((long net, int type));
---
> struct netent *_getnetbyaddr __P((u_long net, int type));
123,124c129,130
< 	ancount = ntohs(hp->ancount); /* #/records in the answer section */
< 	qdcount = ntohs(hp->qdcount); /* #/entries in the question section */
---
> 	ancount = ntohs( (u_short) hp->ancount); /* #/records in the answer section */
> 	qdcount = ntohs( (u_short) hp->qdcount); /* #/entries in the question section */
129a136
> #ifndef WINNT
130a138,140
> #else
> 			WSASetLastError(HOST_NOT_FOUND);
> #endif
131a142
> #ifndef WINNT
132a144,146
> #else
> 			WSASetLastError(HOST_NOT_FOUND);
> #endif
199a214
> #ifndef WINNT
200a216,218
> #else
> 	WSASetLastError(TRY_AGAIN);
> #endif
269a288
> #ifndef WINNT
270a290,292
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
diff --recurs m:\bind496rel/res/herror.c m:\bind/res/herror.c
62,70c62,72
< #include <sys/param.h>
< #include <sys/uio.h>
< #include <netdb.h>
< #if defined(BSD) && (BSD >= 199103)
< # include <unistd.h>
< # include <string.h>
< #else
< # include "../conf/portability.h"
< #endif
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/uio.h>
> #endif
> #include <netdb.h>
> #if defined(BSD) && (BSD >= 199103)
> # include <unistd.h>
> # include <string.h>
> #else
> # include "../conf/portability.h"
> #endif
80a83
> #ifndef WINNT
81a85
> #endif
92a97,99
> #ifdef WINNT
> 	char err[50];
> #endif
101a109
> #ifndef WINNT
102a111,115
> #else
> 	/* XXX - map the error number to the corresponding message here */
> 	sprintf(err, "%d", h_errno);
> 	v->iov_base = err;
> #endif
109a123
> #ifndef WINNT
119a134
> #endif
diff --recurs m:\bind496rel/res/hostnamelen.c m:\bind/res/hostnamelen.c
60,62c60,65
< #include <sys/param.h>
< #include <sys/types.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <netinet/in.h>
> #endif
> 
diff --recurs m:\bind496rel/res/inet_addr.c m:\bind/res/inet_addr.c
62,66c62,68
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <ctype.h>
< #include "../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <ctype.h>
> #include "../conf/portability.h"
68c70,73
< /* these are compatibility routines, not needed on recent BSD releases */
---
> #ifndef NEED_INETADDR
> int __inet_addr_unneeded__;
> #else
> /* these are compatibility routines, not needed on recent BSD releases */
70,71c75,76
< /*
<  * Ascii internet address interpretation routine.
---
> /*
>  * Ascii internet address interpretation routine.
83a89
> #endif  /* NEED_INETADDR */
diff --recurs m:\bind496rel/res/inet_net_ntop.c m:\bind/res/inet_net_ntop.c
23,25c23,27
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
---
> #ifndef WINNT
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
27,30c29,32
< #include <errno.h>
< #include <stdio.h>
< #include <string.h>
< #include <stdlib.h>
---
> #include <errno.h>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
32c34
< #ifdef SPRINTF_CHAR
---
> #ifdef SPRINTF_CHAR
63,64c65,75
< 		errno = EAFNOSUPPORT;
< 		return (NULL);
---
> 
> #ifndef WINNT
> 	errno = EAFNOSUPPORT;
>      return (NULL);
> #else
> 
> 	WSASetLastError(WSAEAFNOSUPPORT);
> 	SetLastError(WSAEAFNOSUPPORT);
>      return (NULL);
> #endif
> 
137,138c148,158
< 	errno = EMSGSIZE;
< 	return (NULL);
---
> 
>  #ifndef WINNT
>      errno = EMSGSIZE;
>      return (NULL);
> #else
>      WSASetLastError(WSAEMSGSIZE);
>      SetLastError(WSAEMSGSIZE);
>      return (NULL);
> #endif
> 
> 
diff --recurs m:\bind496rel/res/inet_net_pton.c m:\bind/res/inet_net_pton.c
23,25c23,27
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
---
> #ifndef WINNT
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
27,32c29,34
< #include <assert.h>
< #include <ctype.h>
< #include <errno.h>
< #include <stdio.h>
< #include <string.h>
< #include <stdlib.h>
---
> #include <assert.h>
> #include <ctype.h>
> #include <errno.h>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
67,68c69,78
< 		errno = EAFNOSUPPORT;
< 		return (-1);
---
> #ifndef WINNT
> 	errno = EAFNOSUPPORT;
>      return (-1);
> #else
> 
> 	WSASetLastError(WSAEAFNOSUPPORT);
> 	SetLastError(WSAEAFNOSUPPORT);
>      return (-1);
> #endif
> 		
201,202c211,218
< 	errno = ENOENT;
< 	return (-1);
---
> 
> #ifndef WINNT
> 	errno = ENOENT
>      return (-1);
> #else
>      SetLastError(ENOENT);
>      return (-1);
> #endif
204a221,222
> 
> #ifndef WINNT
206c224,230
< 	return (-1);
---
>      return (-1);
> #else
>      SetLastError(WSAEMSGSIZE);
>      WSASetLastError(WSAEMSGSIZE);
>      return (-1);
> #endif
> 
diff --recurs m:\bind496rel/res/inet_neta.c m:\bind/res/inet_neta.c
23,25c23,27
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
---
> #ifndef WINNT
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
27,28c29,30
< #include <errno.h>
< #include <stdio.h>
---
> #include <errno.h>
> #include <stdio.h>
30,32c32,34
< #ifdef SPRINTF_CHAR
< # define SPRINTF(x) strlen(sprintf/**/x)
< #else
---
> #ifdef SPRINTF_CHAR
> # define SPRINTF(x) strlen(sprintf/**/x)
> #else
57c59
< 		u_char b = (src & 0xff000000) >> 24;
---
> 		u_char b = (u_char)((src & 0xff000000) >> 24);
80,81c82,91
< 	errno = EMSGSIZE;
< 	return (NULL);
---
> 
>  #ifndef WINNT
>      errno = EMSGSIZE;
>      return (NULL);
> #else
>      WSASetLastError(WSAEMSGSIZE);
>      SetLastError(WSAEMSGSIZE);
>      return (NULL);
> #endif
> 
diff --recurs m:\bind496rel/res/inet_ntop.c m:\bind/res/inet_ntop.c
21,30c21,32
< #include <sys/param.h>
< #include <sys/types.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< #include <string.h>
< #include <errno.h>
< #include <stdio.h>
< #include "../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> #include <string.h>
> #include <errno.h>
> #include <stdio.h>
> #include "../conf/portability.h"
66a69
> #ifndef WINNT
67a71,74
> #else
> 		SetLastError(WSAEAFNOSUPPORT);
> 		WSASetLastError(WSAEAFNOSUPPORT);
> #endif
93c100,101
< 	if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
---
> 	if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > (int)size) {
> #ifndef WINNT
94a103,106
> #else
> 		SetLastError(ENOSPC);
> 		WSASetLastError(ENOSPC);
> #endif
189a202
> #ifndef WINNT
190a204,207
> #else
> 		SetLastError(ENOSPC);
> 		WSASetLastError(ENOSPC);
> #endif
diff --recurs m:\bind496rel/res/inet_pton.c m:\bind/res/inet_pton.c
21,29c21,31
< #include <sys/param.h>
< #include <sys/types.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< #include <string.h>
< #include <errno.h>
< #include "../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> #include <string.h>
> #include <errno.h>
> #include "../conf/portability.h"
61a64
> #ifndef WINNT
62a66,68
> #else
>         SetLastError(WSAEAFNOSUPPORT);
> #endif
diff --recurs m:\bind496rel/res/nsap_addr.c m:\bind/res/nsap_addr.c
22,28c22,30
< #include <sys/types.h>
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <ctype.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/types.h>
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <ctype.h>
> #include <resolv.h>
30c32
< #include "../conf/portability.h"
---
> #include "../conf/portability.h"
52c54
< 	int maxlen;
---
> 	u_int maxlen;
diff --recurs m:\bind496rel/res/res_comp.c m:\bind/res/res_comp.c
62,63c62,65
< #include <sys/param.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
diff --recurs m:\bind496rel/res/res_data.c m:\bind/res/res_data.c
61,64c61,66
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/time.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/time.h>
> #include <netinet/in.h>
> #endif /* WINNT */
diff --recurs m:\bind496rel/res/res_debug.c m:\bind/res/res_debug.c
83,88c83,90
< #include <sys/param.h>
< #include <sys/types.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
90,92c92,94
< #include <ctype.h>
< #include <netdb.h>
< #include <resolv.h>
---
> #include <ctype.h>
> #include <netdb.h>
> #include <resolv.h>
108a111,112
> char * inet_nsap_ntoa();
> const char * inet_ntop();
206c210
< 	if (n = ntohs(cnt)) {
---
> 	if (n = ntohs( (u_short) cnt)) {
303c307
< 			ntohs(hp->id));
---
> 			ntohs( (u_short) hp->id));
328,331c332,335
< 		fprintf(file, "; Ques: %d", ntohs(hp->qdcount));
< 		fprintf(file, ", Ans: %d", ntohs(hp->ancount));
< 		fprintf(file, ", Auth: %d", ntohs(hp->nscount));
< 		fprintf(file, ", Addit: %d", ntohs(hp->arcount));
---
> 		fprintf(file, "; Ques: %d", ntohs( (u_short) hp->qdcount));
> 		fprintf(file, ", Ans: %d", ntohs( (u_short) hp->ancount));
> 		fprintf(file, ", Auth: %d", ntohs( (u_short) hp->nscount));
> 		fprintf(file, ", Addit: %d", ntohs( (u_short) hp->arcount));
340c344
< 	if (n = ntohs(hp->qdcount)) {
---
> 	if (n = ntohs( (u_short) hp->qdcount)) {
498a503
> #ifndef WINNT
499a505,507
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
808c816
< 		if (n != tmpttl)
---
> 		if ((u_int32_t)n != tmpttl)
1428c1436
< 	if (templ < referencealt) { /* below WGS 84 spheroid */
---
> 	if (templ < (u_int32_t)referencealt) { /* below WGS 84 spheroid */
diff --recurs m:\bind496rel/res/res_init.c m:\bind/res/res_init.c
62,71c62,73
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <sys/time.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
< 
< #include <stdio.h>
< #include <ctype.h>
< #include <resolv.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <sys/time.h>
> #include <netinet/in.h>
> #endif /* WINNT */
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
> 
> #include <stdio.h>
> #include <ctype.h>
> #include <resolv.h>
77c79
< # include "../conf/portability.h"
---
> #include "../conf/portability.h"
79a82,89
> #ifdef WINNT
> #include <netdb.h>
> #include "../conf/portability.h"
> extern char *pathresconf;
> extern int res_paths_initialized;
> extern init_res_paths();
> #endif
> 
173a184,195
> 
> #ifdef WINNT
>  	WORD wVersionRequested;
> 	WSADATA wsaData;
> 
> 	wVersionRequested = MAKEWORD(1,1);
> 	if (WSAStartup(wVersionRequested, &wsaData)) {
> 		syslog(LOG_ERR, "No useable winsock.dll: %m");
> 		return (-1);
> 	}
> #endif /* WINNT */
> 
259a282
> #ifndef WINNT
260a284,290
> #else
>        if (!res_paths_initialized)
>          init_res_paths();
> 
> 	if ((fp = fopen(pathresconf, "r")) != NULL) {
> 
> #endif
diff --recurs m:\bind496rel/res/res_mkquery.c m:\bind/res/res_mkquery.c
62,64c62,66
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
66,71c68,73
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #if defined(BSD) && (BSD >= 199103)
< # include <string.h>
< #else
---
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #if defined(BSD) && (BSD >= 199103)
> # include <string.h>
> #else
99a102
> #ifndef WINNT
100a104,106
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
Only in m:\bind/res: res_nt_misc.c
diff --recurs m:\bind496rel/res/res_query.c m:\bind/res/res_query.c
62,65c62,67
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/inet.h>
< #include <arpa/nameser.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/inet.h>
> #include <arpa/nameser.h>
67,71c69,73
< #include <stdio.h>
< #include <netdb.h>
< #include <resolv.h>
< #include <ctype.h>
< #include <errno.h>
---
> #include <stdio.h>
> #include <netdb.h>
> #include <resolv.h>
> #include <ctype.h>
> #include <errno.h>
89a92
> #ifndef WINNT
90a94
> #endif
115a120
> #ifndef WINNT
116a122,124
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
130a139
> #ifndef WINNT
131a141,143
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
139a152
> #ifndef WINNT
140a154,156
> #else
> 		WSASetLastError(TRY_AGAIN);
> #endif
144c160
< 	if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
---
> 	if (hp->rcode != NOERROR || ntohs( (u_short) hp->ancount) == 0) {
148c164
< 			    ntohs(hp->ancount));
---
> 			    ntohs( (u_short) hp->ancount));
151a168
> #ifndef WINNT
152a170,172
> #else
> 			WSASetLastError(HOST_NOT_FOUND);
> #endif
154a175
> #ifndef WINNT
155a177,179
> #else
> 			WSASetLastError(TRY_AGAIN);
> #endif
157a182
> #ifndef WINNT
158a184,186
> #else
> 			WSASetLastError(NO_DATA);
> #endif
163a192
> #ifndef WINNT
164a194,196
> #else
> 			WSASetLastError(NO_RECOVERY);
> #endif
191a224
> #ifndef WINNT
192a226,228
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
194a231
> #ifndef WINNT
196a234,237
> #else
> 	WSASetLastError(HOST_NOT_FOUND);
> 	SetLastError(0);
> #endif
218a260
> #ifndef WINNT
219a262,264
> #else
>                 saved_herrno = WSAGetLastError();
> #endif
255a301
> #ifndef WINNT
256a303,305
> #else
> 				WSASetLastError(TRY_AGAIN);
> #endif
303a353
> #ifndef WINNT
309a360,367
> #else
> 	if (saved_herrno != -1)
> 		WSASetLastError(saved_herrno);
> 	else if (got_nodata)
> 		WSASetLastError(NO_DATA);
> 	else if (got_servfail)
> 		WSASetLastError(TRY_AGAIN);
> #endif
328a387
> #ifndef WINNT
329a389,391
> #else
> 		WSASetLastError(NETDB_INTERNAL);
> #endif
344c406,410
< 			h_errno = NO_RECOVERY;
---
> #ifndef WINNT
> 		h_errno = NO_RECOVERY;
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
357c423,427
< 			h_errno = NO_RECOVERY;
---
> #ifndef WINNT
> 		h_errno = NO_RECOVERY;
> #else
> 		WSASetLastError(NO_RECOVERY);
> #endif
diff --recurs m:\bind496rel/res/res_send.c m:\bind/res/res_send.c
73,79c73,81
< #include <sys/param.h>
< #include <sys/time.h>
< #include <sys/socket.h>
< #include <sys/uio.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/time.h>
> #include <sys/socket.h>
> #include <sys/uio.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
81,82c83,84
< #include <stdio.h>
< #include <netdb.h>
---
> #include <stdio.h>
> #include <netdb.h>
96a99
> #ifndef WINNT
97a101,104
> #else
> static SOCKET s = INVALID_SOCKET;
> typedef char * caddr_t;
> #endif
144a152
> #ifndef WINNT
145a154,157
> #else
> 	WSASetLastError(save);
> 	SetLastError(save);
> #endif
158a171
> #ifndef WINNT
159a173,175
> #else
>  	SetLastError(save);
> #endif
231c247
< 	int qdcount = ntohs(((HEADER*)buf)->qdcount);
---
> 	int qdcount = ntohs( (u_short) ((HEADER*)buf)->qdcount);
268c284
< 	int qdcount = ntohs(((HEADER*)buf1)->qdcount);
---
> 	int qdcount = ntohs( (u_short) ((HEADER*)buf1)->qdcount);
270c286
< 	if (qdcount != ntohs(((HEADER*)buf2)->qdcount))
---
> 	if (qdcount != ntohs( (u_short) ((HEADER*)buf2)->qdcount))
299a316,319
> #ifdef WINNT
> 	int optionValue = SO_SYNCHRONOUS_NONALERT;
> 	DWORD BytesRead;
> #endif
364c384,393
< 
---
> #ifdef WINNT
> 			/* set up things so that subsequent socket()
> 			   calls will open blocking sockets */
> 			if (setsockopt(INVALID_SOCKET, SOL_SOCKET,
> 				  	SO_OPENTYPE, (char *)&optionValue,
> 					sizeof(optionValue)) != NO_ERROR) {
> 						Perror(stderr, "cannot open nonoverlapped socket", errno);
> 						return (-1);
> 			}
> #endif
375a405
> #ifndef WINNT
376a407,409
> #else
> 				if (s == INVALID_SOCKET) {
> #endif
380a414
> #ifndef WINNT
381a416,418
> #else
> 				SetLastError(0);
> #endif
413a451
> #ifndef WINNT
414a453,457
> #else
> 			while (ReadFile((HANDLE)s, (char *)cp, (DWORD)len,
> 				             &BytesRead, NULL) &&
> 				   (n = (int)BytesRead) > 0) {
> #endif
450a494
> #ifndef WINNT
451a496,500
> #else
> 					ReadFile((HANDLE)s, (char *)cp, (DWORD)len,
> 				             &BytesRead, NULL) &&
> 				    (n = (int)BytesRead) > 0) {
> #endif
473a523
> #ifndef WINNT
474a525,529
> #else
> 					if (ReadFile((HANDLE)s, (char *)junk, (DWORD)n,
> 				             &BytesRead, NULL) &&
> 				        (n = (int)BytesRead) > 0)
> #endif
503c558,562
< 			if ((s < 0) || vc) {
---
> #ifndef WINNT
>   			if ((s < 0) || vc) {
> #else
>  			if ((s == INVALID_SOCKET) || vc) {
> #endif
506a566
> #ifndef WINNT
507a568,570
> #else
>  				if (s == INVALID_SOCKET) {
> #endif
531a595
> #ifndef WINNT
556a621
> #endif /* WINNT */
573a639
> #ifndef WINNT
574a641,643
> #else
> 					if (s1 == INVALID_SOCKET)
> #endif
581a651
> #ifndef WINNT
582a653,655
> #else
> 					SetLastError(0);
> #endif
592a666
> #ifndef WINNT
593a668
> #endif
614a690
> #ifndef WINNT
615a692,694
> #else
> 				if (errno == WSAEINTR)
> #endif
630a710
> #ifndef WINNT
631a712,715
> #else
>  			WSASetLastError(0);
>  			SetLastError(0);
> #endif
635a720
> #ifndef WINNT
636a722,724
> #else
>  				Perror(stderr, "recvfrom", WSAGetLastError());
> #endif
761c849,850
< 		if (!gotsomewhere)
---
> 		if (!gotsomewhere) {
> #ifndef WINNT
763c852,857
< 		else
---
> #else
>  			WSASetLastError(ECONNREFUSED);
>   			SetLastError(ECONNREFUSED);
> #endif
> 		} else {
> #ifndef WINNT
765c859,864
< 	else
---
> #else
>  			WSASetLastError(ETIMEDOUT);
>  			SetLastError(ETIMEDOUT);
> #endif
> 		} else {
> #ifndef WINNT
766a866,869
> #else
>  		WSASetLastError(terrno);
>  		SetLastError(terrno);
> #endif
767a871
>  }
781a886
> #ifndef WINNT
782a888,890
> #else
> 		s = INVALID_SOCKET;
> #endif
Only in m:\bind/res: resolv.mak
Only in m:\bind/res: resolv.mdp
Only in m:\bind/res: resolv.ncb
Only in m:\bind/res: resolv.vcp
Only in m:\bind/res: resolv_vc22.mak
Only in m:\bind/res: resolv_vc22.vcp
diff --recurs m:\bind496rel/res/sethostent.c m:\bind/res/sethostent.c
40,41c40,43
< #include <sys/param.h>
< #include <netinet/in.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
Only in m:\bind/res: strip.bat
Only in m:\bind: resolv.mak
diff --recurs m:\bind496rel/shres/irix/Makefile m:\bind/shres/irix/Makefile
1c1
< # $Id: Makefile,v 8.2 1996/09/22 00:13:32 vixie Exp $
---
> # $Id: Makefile,v 1.4 1996/05/22 04:56:31 vixie Exp $
3c3
< CFLAGS=	-O -I../${INCL} -I../${COMPINCL} ${DEFS} ${LOCDEFS} 
---
> CFLAGS=	-O -I../${INCL} -I../${COMPINCL} ${DEFS} ${LOCDEFS} 
5c5
< LOCDEFS= -DUSE_OPTIONS_H
---
> LOCDEFS= -DUSE_OPTIONS_H
7,10c7,10
< OBJS=	base64.o herror.o res_debug.o res_data.o \
< 	res_comp.o res_init.o res_mkquery.o res_query.o res_send.o \
< 	getnetbyaddr.o getnetbyname.o getnetent.o getnetnamadr.o \
< 	gethnamaddr.o sethostent.o nsap_addr.o inet_pton.o inet_ntop.o \
---
> OBJS=	herror.o res_debug.o res_data.o \
> 	res_comp.o res_init.o res_mkquery.o res_query.o res_send.o \
> 	getnetbyaddr.o getnetbyname.o getnetent.o getnetnamadr.o \
> 	gethnamaddr.o sethostent.o nsap_addr.o inet_pton.o inet_ntop.o \
38d37
< base64.o: ../../res/base64.c
Only in m:\bind/shres/netbsd: .cvsignore
Only in m:\bind/shres/netbsd: Letter
Only in m:\bind496rel/shres/sunos: INSTALL.orig
Only in m:\bind496rel/shres/sunos: ISSUES.orig
Only in m:\bind496rel/shres/sunos: PROBLEMS.orig
Only in m:\bind496rel/shres/sunos: makeshlib.orig
Only in m:\bind: t6b-rel
Only in m:\bind/tools: MYDLL.DEF
Only in m:\bind/tools: bdlltest.c
Only in m:\bind/tools: bdltest.mak
Only in m:\bind/tools: bdltest.vcp
Only in m:\bind/tools: binddll.def
Only in m:\bind/tools: binddll.mak
Only in m:\bind/tools: binddll.mdp
Only in m:\bind/tools: binddll.ncb
Only in m:\bind/tools: binddll.vcp
Only in m:\bind/tools: bindll.c
Only in m:\bind/tools: dig.c.sav
Only in m:\bind/tools: dig_nt.c
Only in m:\bind/tools: instsrv.c
Only in m:\bind/tools: instsrv.mak
Only in m:\bind/tools: instsrv.mdp
Only in m:\bind/tools: instsrv.ncb
Only in m:\bind/tools: instsrv.vcp
Only in m:\bind/tools/nslookup: BOG.WRI
Only in m:\bind/tools/nslookup: GUI.c
Only in m:\bind/tools/nslookup: WinRel
diff --recurs m:\bind496rel/tools/nslookup/commands.l m:\bind/tools/nslookup/commands.l
210,219c210,219
< ^{WS}*\n				{
< 					    return(1);
< 					}
< ^.*\n					{
< 					    printf("Unrecognized command: %s",
< 							yytext);
< 					    return(1);
< 					}
< \n					{ ; }
< %%
---
> ^{WS}*\n   				{
> 					    return(1);
> 					}
> ^.*\n					{
> 					    printf("Unrecognized command: %s",
> 							yytext);
> 					    return(1);
> 					}
> \n					{ ; }
> %%                                      
diff --recurs m:\bind496rel/tools/nslookup/debug.c m:\bind/tools/nslookup/debug.c
73,82c73,84
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <resolv.h>
< #include <netdb.h>
< #include <stdio.h>
< #include "res.h"
< #include "../../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <resolv.h>
> #include <netdb.h>
> #include <stdio.h>
> #include "res.h"
> #include "../../conf/portability.h"
88a91,102
> char * inet_nsap_ntoa();
> const char * inet_ntop();
> #ifdef GUI
> BOOLEAN doing_nameserver = FALSE;
> extern void process_nameserver_addition();
> #endif
> 
> /*
>  *  Forward references
>  */
> 
> void Fprint_query(u_char *msg, u_char *eom, int printHeader, FILE *file);
89a104
> 
101a117
> void
106c122,126
< 	Fprint_query(msg, eom, printHeader,stdout);
---
> #ifndef GUI    
> 	Fprint_query(msg, eom, printHeader, stdout);
> #else
> 	Fprint_query(msg, eom, printHeader, outputfile);
> #endif
108a129
> void
128c149
< 	    fprintf(file,", id = %d", ntohs(hp->id));
---
> 	    fprintf(file,", id = %d", ntohs( (u_short) hp->id));
150,154c171,175
< 	    fprintf(file,"\n\tquestions = %d", ntohs(hp->qdcount));
< 	    fprintf(file,",  answers = %d", ntohs(hp->ancount));
< 	    fprintf(file,",  authority records = %d", ntohs(hp->nscount));
< 	    fprintf(file,",  additional = %d\n\n", ntohs(hp->arcount));
< 	}
---
>   	    fprintf(file,"\n\tquestions = %d", ntohs( (u_short) hp->qdcount));
>   	    fprintf(file,",  answers = %d", ntohs( (u_short) hp->ancount));
>   	    fprintf(file,",  authority records = %d", ntohs( (u_short) hp->nscount));
>   	    fprintf(file,",  additional = %d\n\n", ntohs( (u_short) hp->arcount));
>   	}
159c180
< 	if (n = ntohs(hp->qdcount)) {
---
>  	if (n = ntohs( (u_short) hp->qdcount)) {
177c198
< 	if (n = ntohs(hp->ancount)) {
---
> 	if (n = ntohs( (u_short) hp->ancount)) {
180c201
< 			printf("Limiting response to MAX Addrs = %d \n",
---
> 			fprintf(file,"Limiting response to MAX Addrs = %d \n",
194c215
< 	if (n = ntohs(hp->nscount)) {
---
> 	if (n = ntohs( (u_short) hp->nscount)) {
206c227
< 	if (n = ntohs(hp->arcount)) {
---
> 	if (n = ntohs( (u_short) hp->arcount)) {
218d238
< 
238a259,263
> #ifdef GUI
>        /* lgk new code for gui to add to list */
>        if (doing_nameserver)
>          process_nameserver_addition(name);
> #endif	
271a297,300
> #ifdef GUI
>         doing_nameserver = FALSE;
> #endif
> 
414a444,446
> #ifdef GUI
>                 doing_nameserver = TRUE;
> #endif
419a452,454
> #ifdef GUI
>                 doing_nameserver = FALSE;
> #endif
610c645
< 					s = getservbyport((int)htons(n),
---
> 					s = getservbyport((int)htons( (u_short) n),
Only in m:\bind/tools/nslookup: dig.c
Only in m:\bind/tools/nslookup: dig.mak
Only in m:\bind/tools/nslookup: dig.mdp
Only in m:\bind/tools/nslookup: dig.ncb
Only in m:\bind/tools/nslookup: dig.vcp
diff --recurs m:\bind496rel/tools/nslookup/getinfo.c m:\bind/tools/nslookup/getinfo.c
74,83c74,85
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <resolv.h>
< #include <stdio.h>
< #include <ctype.h>
< #include "res.h"
< #include "../../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif 
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <resolv.h>
> #include <stdio.h>
> #include <ctype.h>
> #include "res.h"
> #include "../../conf/portability.h"
115a118,126
> /*
>  * Forward references
>  */
> 
> int GetHostDomain(struct in_addr *nsAddrPtr, int queryClass, int queryType, char *name, 
>               char *domain, HostInfo *hostPtr, Boolean isServer);
> static int GetAnswer(struct in_addr	*nsAddrPtr, int queryType, char *msg, int msglen, Boolean iquery, 
>                      register HostInfo	*hostPtr, Boolean isServer);
> 
166c177,181
< 
---
> #ifndef GUI
>  filePtr = stdout;
> #else
>  filePtr = outputfile;
> #endif
188,191c203,206
<     qdcount = ntohs(headerPtr->qdcount);
<     ancount = ntohs(headerPtr->ancount);
<     arcount = ntohs(headerPtr->arcount);
<     nscount = ntohs(headerPtr->nscount);
---
>     qdcount = ntohs( (u_short) headerPtr->qdcount);
>     ancount = ntohs( (u_short) headerPtr->ancount);
>     arcount = ntohs( (u_short) headerPtr->arcount);
>     nscount = ntohs( (u_short) headerPtr->nscount);
221a237
> #ifndef GUI
222a239,241
> #else
> 	    fprintf(outputfile,"Non-authoritative answer:\n");
> #endif
228c247
< 		    (char *)&answer, eom, stdout)) == NULL) {
---
> 		    (char *)&answer, eom, filePtr)) == NULL) {
312c331,335
< 			printf("MAXADDRS exceeded: skipping address\n");
---
> #ifndef GUI
> 			fprintf(stderr,"MAXADDRS exceeded: skipping address\n");
> #else
> 			fprintf(outputfile,"MAXADDRS exceeded: skipping address\n");
> #endif
372a396
> #ifndef GUI
373a398,400
> #else
> 	fprintf(outputfile,"Authoritative answers can be found from:\n");
> #endif
385c412
< 		(char *) &answer, eom, stdout)) == NULL) {
---
> 		(char *) &answer, eom, filePtr)) == NULL) {
465c492
< 		(char *) &answer, eom, stdout)) == NULL) {
---
> 		(char *) &answer, eom, filePtr)) == NULL) {
598a626
> #ifndef GUI
599a628,630
> #else
> 	    fprintf(outputfile,"Aliased to \"%s\"\n\n", cp);
> #endif
601c632
< 		    cp, (char *)NULL, hostPtr, isServer));
---
> 		    (char *)cp, (char *)NULL, hostPtr, isServer));
648c679
< 	}
---
>     }
666a698
> int
Only in m:\bind/tools/nslookup: gnslookup.aps
Only in m:\bind/tools/nslookup: gnslookup.mak
Only in m:\bind/tools/nslookup: gnslookup.mdp
Only in m:\bind/tools/nslookup: gnslookup.ncb
Only in m:\bind/tools/nslookup: gnslookup.rc
Only in m:\bind/tools/nslookup: gnslookup.zip
Only in m:\bind/tools/nslookup: icon1.ico
diff --recurs m:\bind496rel/tools/nslookup/list.c m:\bind/tools/nslookup/list.c
73,82c73,84
< #include <sys/param.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <resolv.h>
< #include <netdb.h>
< #include <stdio.h>
< #include <limits.h>
< #include <ctype.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <resolv.h>
> #include <netdb.h>
> #include <stdio.h>
> #include <limits.h>
> #include <ctype.h>
100a103,113
> char * inet_nsap_ntoa();
> const char * inet_ntop();
> 
> /*
>  * Forward references
>  */
> 
> int
> PrintListInfo(FILE *file, u_char *msg, u_char *eom, int qtype, char *domain);
> 
> 
171a185
> #ifndef GUI	    
172a187,189
> #else
> 	    fprintf(outputfile, "*** ls: invalid request %s\n",string);
> #endif
176a194
> #ifndef GUI
178a197,200
> #else
> 	    fprintf(outputfile, "*** Can't list domain %s: %s\n", 
> 			namePtr, DecodeError(result));
> #endif
221a244
> #ifndef GUI
222a246,248
> #else
> 	    fprintf(outputfile, "*** ls: invalid request %s\n",string);
> #endif
226a253
> #ifndef GUI
228a256,259
> #else
> 	    fprintf(outputfile, "*** Can't list domain %s: %s\n", 
> 			namePtr, DecodeError(result));
> #endif
267a299
> #ifndef GUI
268a301,303
> #else
> 		fprintf(outputfile, "*** ls: res_mkquery failed\n");
> #endif
315c350,351
< 
---
>     
>   #ifndef WINNT
317a354,359
>   #else
> 
>         if (send(sockFD,(const char *)&len,INT16SZ,0) != INT16SZ  ||
>             send(sockFD,(const char *)&buf,msglen,0) != msglen) {
>   #endif
> 
323c365
< 
---
> #ifndef GUI
326a369,372
> #else
> 	fprintf(outputfile,"[%s]\n",
> 		(defaultPtr->addrList != NULL) ? defaultPtr->name :
> 		 defaultPtr->servers[0]->name);
327a374,375
> #endif
> 		 
328a377
> #ifndef GUI
329a379,381
> #else
>          filePtr = outputfile;
> #endif
331c383
< 	    filePtr = OpenFile(cmd, file);
---
> 	    filePtr = AppOpenFile(cmd, file);
353a406
> #ifndef WINNT
354a408,410
> #else
> 	    while ((numRead = recv(sockFD, cp, amtToRead,0)) > 0) {
> #endif
385a442
>         #ifndef WINNT
386a444,447
> #else
> 	    while (amtToRead > 0 && (numRead=recv(sockFD, cp, amtToRead,0)) > 0) {
> 
> #endif
400c461
< 	    numRecords += htons(((HEADER *)answer)->ancount);
---
> 	    numRecords += htons((u_short)((HEADER *)answer)->ancount);
406,445c467,506
< 	    /* Header. */
< 	    cp = answer + HFIXEDSZ;
< 	    /* Question. */
< 	    for (count = ntohs(((HEADER* )answer)->qdcount);
< 		 count > 0;
< 		 count--)
< 		    cp += dn_skipname(cp, answer + len) + QFIXEDSZ;
< 	    /* Answer. */
< 	    for (count = ntohs(((HEADER* )answer)->ancount);
< 		 count > 0;
< 		 count--) {
< 		int type, class, rlen;
< 
< 		n = dn_expand(answer, answer + len, cp,
< 			      dname[soacnt], sizeof dname[0]);
< 		if (n < 0) {
< 		    error = ERR_PRINTING;
< 		    done++;
< 		    break;
< 		}
< 		cp += n;
< 		GETSHORT(type, cp);
< 		GETSHORT(class, cp);
< 		cp += INT32SZ;	/* ttl */
< 		GETSHORT(rlen, cp);
< 		cp += rlen;
< 		if (type == T_SOA && soacnt++ &&
< 		    !strcasecmp(dname[0], dname[1])) {
< 		    done++;
< 		    break;
< 		}
< 	    }
< 	}
< 
< 	if (cmd != NULL) {
< 	    fprintf(stdout, "%sReceived %d answer%s (%d record%s).\n",
< 		(numAnswers >= HASH_SIZE) ? "\n" : "",
< 		numAnswers, (numAnswers != 1) ? "s" : "",
< 		numRecords, (numRecords != 1) ? "s" : "");
< 	}
---
>  	    /* Header. */
>   	    cp = answer + HFIXEDSZ;
>  	    /* Question. */
>  	    for (count = ntohs((u_short)((HEADER* )answer)->qdcount);
>  		 count > 0;
>  		 count--)
>  		    cp += dn_skipname((u_char *)cp, (u_char *)answer + len) + QFIXEDSZ;
>  	    /* Answer. */
>  	    for (count = ntohs((u_short)((HEADER* )answer)->ancount);
>  		 count > 0;
>  		 count--) {
>  		int type, class, rlen;
>  
>  		n = dn_expand(answer, answer + len, cp,
>  			      dname[soacnt], sizeof dname[0]);
>  		if (n < 0) {
>  		    error = ERR_PRINTING;
>  		    done++;
>  		    break;
>  		}
>  		cp += n;
>  		GETSHORT(type, cp);
>  		GETSHORT(class, cp);
>  		cp += INT32SZ;	/* ttl */
>  		GETSHORT(rlen, cp);
>  		cp += rlen;
>  		if (type == T_SOA && soacnt++ &&
>  		    !strcasecmp(dname[0], dname[1])) {
>  		    done++;
>  		    break;
>  		}
>   	    }
>   	}
>   
>   	if (cmd != NULL) {
>  	    fprintf(stdout, "%sReceived %d answer%s (%d record%s).\n",
>   		(numAnswers >= HASH_SIZE) ? "\n" : "",
>  		numAnswers, (numAnswers != 1) ? "s" : "",
>  		numRecords, (numRecords != 1) ? "s" : "");
>   	}
465a527
> #ifndef GUI
470,471c532,541
< 			ntohs(headerPtr->ancount), ntohs(headerPtr->nscount),
< 			ntohs(headerPtr->arcount));
---
> 			ntohs( (u_short) headerPtr->ancount), ntohs( (u_short) headerPtr->nscount),
> 			ntohs( (u_short) headerPtr->arcount));
> #else
> 		fprintf(outputfile,"*** ls: error receiving zone transfer:\n");
> 		fprintf(outputfile,
> 	       "  result: %s, answers = %d, authority = %d, additional = %d\n",
> 			_res_resultcodes[headerPtr->rcode],
> 			ntohs( (u_short) headerPtr->ancount), ntohs( (u_short) headerPtr->nscount),
> 			ntohs( (u_short) headerPtr->arcount));
> #endif
477d546
< 
517a587
> int
549c619
<     if (ntohs(headerPtr->ancount) == 0) {
---
>     if (ntohs( (u_short) headerPtr->ancount) == 0) {
551,560c621,630
<     }
<     for (n = ntohs(headerPtr->qdcount); n > 0; n--) {
< 	nameLen = dn_skipname(cp, eom);
< 	if (nameLen < 0)
< 	    return (ERROR);
< 	cp += nameLen + QFIXEDSZ;
<     }
<     for (count = ntohs(headerPtr->ancount); count > 0; count--) {
< 	nameLen = dn_expand(msg, eom, cp, name, sizeof name);
< 	if (nameLen < 0)
---
>       }
>       for (n = ntohs((u_short) headerPtr->qdcount); n > 0; n--) {
>  	nameLen = dn_skipname(cp, eom);
>  	if (nameLen < 0)
>  	    return (ERROR);
>  	cp += nameLen + QFIXEDSZ;
>       }
>       for (count = ntohs((u_short)headerPtr->ancount); count > 0; count--) {
>   	nameLen = dn_expand(msg, eom, cp, name, sizeof name);
>   	if (nameLen < 0)
892a963
> void
927a999
>     #ifndef WINNT
928a1001,1005
>     #else
>     char f[5000];
>     int numread = 0;
>     int i;
>     #endif
937a1015
> #ifndef GUI	    
938a1017,1019
> #else
> 	    fprintf(outputfile, "Finger: no current host defined.\n");
> #endif
951a1033
> #ifndef GUI
952a1035,1037
> #else
> 	    fprintf(outputfile, "Finger: unknown service\n");
> #endif
981a1067
> #ifndef GUI
982a1069,1071
> #else
>             filePtr = outputfile;
> #endif
984c1073
< 	    filePtr = OpenFile(string, file);
---
> 	    filePtr = AppOpenFile(string, file);
995a1085
> #ifndef WINNT
997c1087
< 	}
---
>         	}
1000c1090,1097
< 	f = fdopen(sockFD, "r");
---
> #else
>    /* send(sockFD,"/W",3,0); */
>          }
> 	send(sockFD, name, strlen(name),0);
> 	send(sockFD, "\r\n", 2,0);
> 	#endif
> #ifndef WINNT	
> 	f = fdopen(sockFD, "r"); 
1016c1113,1137
< 	if (lastc != '\n') {
---
> #else
>     while ((numread = recv(sockFD,(char *)f,4999,0)) != 0)
>       {
> 
> 	   for (i=0; i<=numread; i++)
>         {
>           c = f[i];
>           switch (c) 
>           {
> 		    case 0210:
> 		    case 0211:
> 		    case 0212:
> 		    case 0214:
> 	  		      c -= 0200;
> 			      break;
> 		    case 0215:
> 			     c = '\n';
> 			     break;
> 	       }
> 	        putc(lastc = c, filePtr);
>       }       
>       }
>  #endif
> 	if (lastc != '\n') 
> 	  {
1018,1019c1139,1140
< 	}
< 	putc('\n', filePtr);
---
> 	  }
> 	  putc('\n', filePtr);
1030a1152
> void
diff --recurs m:\bind496rel/tools/nslookup/main.c m:\bind/tools/nslookup/main.c
1,2c1,2
< /*
<  * ++Copyright++ 1985, 1989
---
>  /*
>  * ++Copyright++ 1985, 1989
4,5c4,5
<  * Copyright (c) 1985, 1989
<  *    The Regents of the University of California.  All rights reserved.
---
>  * Copyright (c) 1985, 1989
>  *    The Regents of the University of California.  All rights reserved.
7,10c7,10
<  * Redistribution and use in source and binary forms, with or without
<  * modification, are permitted provided that the following conditions
<  * are met:
<  * 1. Redistributions of source code must retain the above copyright
---
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions
>  * are met:
>  * 1. Redistributions of source code must retain the above copyright
81a82
> #ifndef WINNT
82a84,86
> #include <netinet/in.h>
> #include <setjmp.h>
> #endif
83a88
> #ifndef WINNT
85c90
< #include <netinet/in.h>
---
> #endif
90d94
< #include <setjmp.h>
98a103,121
>   /* 
>    * Forward references
>    */
>   void Usage();
>   void LocalServer(HostInfo *defaultPtr);
>   int  LookupHost(char *string, Boolean putToFile);
>   void res_re_init();
>   void res_dnsrch(register char *cp);
>   int  SetOption(register char *option);
> #ifdef WINNT
> #ifdef GUI
> 
>   int PrintToBox(char *, int);
>   void gui();
>   extern	char output[10000];
>   extern	char final_output[10000];
> 
> #endif
> #endif
104a128
> 
109a134,136
>   #ifdef WINNT
>   HANDLE hReadWriteEvent = NULL;
>   #endif
143c170
<  * Stuff for Interrupt (control-C) signal handler.
---
>  * Stuff for Interrupt (control-C) signal handler.                    
145a173
> #ifndef WINNT
147d174
< FILE		*filePtr;
149a177,180
> #else
> 	char *pathnslookuprc, *pathpagercmd, *pathhelpfile;
> #endif
> FILE		*filePtr;
158a190,223
> 
> #ifdef WINNT
> /* Expand environmental variables in file pathnames */
> /* XXX - Would it be better to store/retrieve pathnames from the registry? */
> void
> expand_paths(void)
> {
>    	pathnslookuprc = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_NSLOOKUPRC, pathnslookuprc, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_NSLOOKUPRC) failed: %m\n");
> 	} else
> 
> 	pathpagercmd = (char *)malloc(MAX_PATH);
> 	if (!ExpandEnvironmentStrings(_PATH_PAGERCMD, pathpagercmd, MAX_PATH)) {
> 		syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_PAGERCMD) failed: %m\n");
> 	} else
> 
> 	pathhelpfile = (char *)malloc(MAX_PATH);
>         if (OnWinnt() == TRUE)
>           {
> 	    if (!ExpandEnvironmentStrings(_PATH_HELPFILE, pathhelpfile, MAX_PATH)) {
> 	 	  syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_HELPFILE) failed: %m\n");
> 	    }
> 	  }
>           else
>            { 
>  	    if (!ExpandEnvironmentStrings(_PATH_95HELPFILE, pathhelpfile, MAX_PATH)) {
> 	 	  syslog(LOG_ERR, "ExpandEnvironmentStrings(_PATH_95HELPFILE) failed: %m\n");
> 	    }
> 	   }
> }
> #endif /* WINNT */
> 
> 
184a250,260
>      
> #ifdef WINNT
> /* lgk moved startup to beginning.. */
> 
> 
> 
> 
> 	hReadWriteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
>    {
>  	WORD wVersionRequested;
> 	WSADATA wsaData;
185a262,273
>         expand_paths();
> 	wVersionRequested = MAKEWORD(1,1);
> 	if (WSAStartup(wVersionRequested, &wsaData)) {
> 		syslog(LOG_ERR, "No useable winsock.dll: %m");
> 		return (-1);
> 	}
> 
> 
> 
>    }
> #endif /* WINNT */
> 
246a335
> #ifndef WINNT
247a337,339
> #else
> 	    hp = gethostbyname_nt(*argv);
> #endif
318a411
> #ifndef GUI        
319a413,415
> #else
> 	PrintHostInfo(outputfile, "Default Server:", defaultPtr);
> #endif
322a419
> #ifndef WINNT 
323a421,423
> #else
>             pager = pathpagercmd;
> #endif
325d424
< 
329c428
< 
---
> #ifndef WINNT
338c437
< 
---
> #endif
345a445,447
> #ifdef GUI 
>   	gui();
> #else
347c449
< 	    printf("> ");
---
> 		printf("> ");
349a452,455
>  
> #endif
> 
> 
354a461
> void
362,363c469,471
<     defaultAddr.s_addr = htonl(INADDR_ANY);
<     (void) GetHostInfoByName(&defaultAddr, C_IN, T_A,
---
> #ifndef WINNT
>     defaultAddr.s_addr = htonl(INADDR_ANY); 
>       (void) GetHostInfoByName(&defaultAddr, C_IN, T_A,
364a473,479
> #else /* lgk the 0.0.0.0 doesn't work for nt so set to loopback */
>     defaultAddr.s_addr = htonl(INADDR_LOOPBACK);
>           (void) GetHostInfoByName(&defaultAddr, C_IN, T_A,
> 			     "127.0.0.1", defaultPtr, 1);
> 
> #endif
>   
380a496
> void 
535a652
> #ifndef GUI
536a654,656
> #else
> 	    PrintHostInfo(outputfile, "Default Server:", defaultPtr);
> #endif
538a659
> #ifndef GUI
540a662,666
> #else
> 	    fprintf(filePtr, "*** Can't find address for server %s: %s\n",
> 		    newServer, DecodeError(result));
> #endif
> 		    
627a754
> #ifndef GUI
629a757,760
> #else
> 	    fprintf(filePtr, "*** No %s (%s) records available for %s\n", 
> 			DecodeType(queryType), p_type(queryType), host);
> #endif
636a768
> #ifndef GUI
638a771,774
> #else
> 	    fprintf(filePtr, "*** %s can't find %s: %s\n", serverName, host,
> 		    DecodeError(result));
> #endif
666a803
>     FILE *fileptr = NULL;
682a820,821
> 
> #ifndef GUI	
683a823,826
> #else
>      fileptr = outputfile;
> #endif
> 
685c828
< 	filePtr = OpenFile(string, file);
---
> 	filePtr = AppOpenFile(string, file);
743a887
> #ifndef GUI
744a889,891
> #else
> 	filePtr = outputfile;
> #endif
746c893
< 	filePtr = OpenFile(string, file);
---
> 	filePtr = AppOpenFile(string, file);
760a908
> #ifndef GUI
763,764c911,914
<     } else {
< 	PrintHostInfo(filePtr, "Server:", &serverInfo);
---
> #else
> 	fprintf(filePtr,"*** Can't find address for server %s: %s\n", server,
> 		 DecodeError(result));
> #endif
765a916,918
>     } else { /*
> 	PrintHostInfo(filePtr, "Server:", &serverInfo);
> 		 */
842a996
> #ifndef GUI
843a998,1000
> #else
> 	    fprintf(outputfile,"d2 mode disabled; still in debug mode\n");
> #endif 
934a1092
> void
956a1115
> void
1004a1164
> #ifndef GUI    
1008a1169,1174
> #else
>     PrintHostInfo(outputfile, "Default Server:", defaultPtr);
>     if (curHostValid) {
> 	PrintHostInfo(outputfile, "Host:", &curHostInfo);
>     }
> #endif
1009a1176
> #ifndef GUI
1036a1204,1253
> #else
>     sprintf(final_output,"Set options:\n");
>     sprintf(output,"  %sdebug  \t", (_res.options & RES_DEBUG) ? "" : "no");
>     strcat(final_output,output);
>     sprintf(output,"  %sdefname\t", (_res.options & RES_DEFNAMES) ? "" : "no");
>     strcat(final_output,output);
>     sprintf(output,"  %ssearch\t", (_res.options & RES_DNSRCH) ? "" : "no");
>     strcat(final_output,output);
>     sprintf(output,"  %srecurse\n", (_res.options & RES_RECURSE) ? "" : "no");
>     strcat(final_output,output);
> 
>     sprintf(output,"  %sd2\t\t", (_res.options & RES_DEBUG2) ? "" : "no");
>     strcat(final_output,output);
>     sprintf(output,"  %svc\t\t", (_res.options & RES_USEVC) ? "" : "no");
>     strcat(final_output,output);
>     sprintf(output,"  %signoretc\t", (_res.options & RES_IGNTC) ? "" : "no");
>     strcat(final_output,output);
>     sprintf(output,"  port=%u\n", nsport);
>     strcat(final_output,output);
> 
>     sprintf(output,"  querytype=%s\t", p_type(queryType));
>     strcat(final_output,output);
>     sprintf(output,"  class=%s\t", p_class(queryClass));
>     strcat(final_output,output);
>     sprintf(output,"  timeout=%d\t", _res.retrans);
>     strcat(final_output,output);
>     sprintf(output,"  retry=%d\n", _res.retry);
>     strcat(final_output,output);
>     sprintf(output,"  root=%s\n", rootServerName);
>     strcat(final_output,output);
>     sprintf(output,"  domain=%s\n", _res.defdname);
>     strcat(final_output,output);
>     
>     if (cp = _res.dnsrch) {
> 	sprintf(output,"  srchlist=%s", *cp);
>         strcat(final_output,output);
> 	for (cp++; *cp; cp++) {
> 	    sprintf(output,"%c%s", SRCHLIST_SEP, *cp);
>         strcat(final_output,output);
> 	}
> 	strcat(final_output,"\n");
>     }
>  strcat(final_output,"\n\0");
>  PrintToBox(final_output,0);
> }
> #endif
> 
> 
> 
> 
1053c1270
< 
---
> #ifndef WINNT
1054a1272,1288
> #else
> #ifdef GUI
>  {
>           extern char filestring[100000];
>           int count;
>           FILE *hfile;
>           hfile = fopen(pathhelpfile,"r+");
>           count = fread(filestring,sizeof(char),100000,hfile);
>           filestring[count] = '\0'; 
>           PrintToBox(filestring,count);
>           fclose(hfile); 	
>           sprintf(cmd, "%s < %s", pager, pathhelpfile);
> 
>  }
> #else
> 	sprintf(cmd, "%s < %s", pager, pathhelpfile);
>         /* printf("path helpfile = %s ",pathhelpfile); */
1055a1290,1291
> #endif
> #endif
1108a1345
> #ifndef WINNT
1109a1347,1349
> #else
> 	(void) strcat(buf, pathnslookuprc);
> #endif
1121a1362
> 
Only in m:\bind/tools/nslookup: nslookup.aps
Only in m:\bind/tools/nslookup: nslookup.mak
Only in m:\bind/tools/nslookup: nslookup.mdp
Only in m:\bind/tools/nslookup: nslookup.ncb
Only in m:\bind/tools/nslookup: nslookup.vcp
Only in m:\bind/tools/nslookup: nslookup_vc22.mak
Only in m:\bind/tools/nslookup: nslookup_vc22.vcp
diff --recurs m:\bind496rel/tools/nslookup/pathnames.h m:\bind/tools/nslookup/pathnames.h
62,68c62,78
< #define _PATH_PAGERCMD		"more"
< 
< #ifndef _PATH_HELPFILE
< #if defined(BSD) && BSD >= 198810
< #define	_PATH_HELPFILE		"/usr/share/misc/nslookup.help"
< #else
< #define _PATH_HELPFILE		"/usr/lib/nslookup.help"
---
> 
> #ifndef WINNT
> #define _PATH_PAGERCMD		"more"
> #else
> #define _PATH_PAGERCMD		"more"
> #endif
> 
> #ifndef _PATH_HELPFILE
> #if defined(BSD) && BSD >= 198810
> #define	_PATH_HELPFILE		"/usr/share/misc/nslookup.help"
> #else
> #ifdef WINNT
> #define _PATH_HELPFILE		"%windir%\\system32\\nslookup.help"
> #define _PATH_95HELPFILE        "%windir%\\nslookup.help"
> #else
> #define _PATH_HELPFILE		"/usr/lib/nslookup.help"
> #endif
Only in m:\bind/tools/nslookup: readme.nt
diff --recurs m:\bind496rel/tools/nslookup/res.h m:\bind/tools/nslookup/res.h
76,78c76,77
< #define TRUE	1
< #define FALSE	0
< typedef int Boolean;
---
> #ifndef _RES_H_
> #define _RES_H_
80,83c79,92
< #define MAXALIASES	35
< #define MAXADDRS	35
< #define MAXDOMAINS	35
< #define MAXSERVERS	10
---
> #ifdef WINNT
> #include <winsock.h>
> #include "../../conf/portability.h"
> #include <stdio.h>
> #endif
> 
> #define TRUE	1
> #define FALSE	0
> typedef int Boolean;
> 
> #define MAXALIASES	35
> #define MAXADDRS	35
> #define MAXDOMAINS	35
> #define MAXSERVERS	10
102a112,116
> #ifdef WINNT
> #ifdef ERROR
> #undef ERROR
> #endif
> #endif
151a166,168
> #ifdef GUI
> extern FILE *outputfile;
> #endif
163c180
< extern int  Print_query();
---
> extern void  Print_query();
168a186
> 
175a194,195
> 
> #ifndef WINNT
176a197,198
> #endif
> 
177a200,243
> 
> #ifdef WINNT
>   
> /*
>    * subr.c definitions
> */
>   
>   FILE * AppOpenFile(char *string, char *file);
>   int StringToType(char *type, int dflt, FILE *errorfile);
>   int StringToClass(char *class, int dflt, FILE *errorfile);
>   
> /*
> * getinfo.c definitions
>    */
>   
>   static int GetAnswer(struct in_addr *nsAddrPtr, int queryType, char *msg, int msglen,
>                        Boolean iquery, register HostInfo *hostPtr, Boolean isServer);
>   int GetHostInfoByName(struct in_addr	*nsAddrPtr, int queryClass, int queryType,
>                         char *name, HostInfo *hostPtr, Boolean isServer);
>   int GetHostInfoByAddr(struct in_addr *nsAddrPtr, struct in_addr	*address, HostInfo *hostPtr);
>   
>   /*
>    * send.c definitions
>    */
>   
>   int SendRequest(struct in_addr	*nsAddrPtr, char *buf, int buflen,
>   	            char *answer, u_int anslen, int *trueLenPtr);
>   
>   
>   /* lgk new definitions */
>   extern int SetDefaultServer();
>   extern int Finger();
>   extern void ViewList();
>   extern void ListHosts();
>   extern void ListHostsByType();
>   extern int SetOption();
>   extern int LookupHost();
>   extern int LookupHostWithServer();
>   extern int yylex();
> 
> #endif WINNT
> 
> #endif /* _RES_H_ */
> 
Only in m:\bind/tools/nslookup: resource.h
diff --recurs m:\bind496rel/tools/nslookup/send.c m:\bind/tools/nslookup/send.c
77,86c77,87
< 
< #include <sys/param.h>
< #include <sys/time.h>
< #include <sys/socket.h>
< #include <sys/uio.h>
< #include <netinet/in.h>
< #include <stdio.h>
< #include <errno.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <sys/time.h>
> #include <sys/socket.h>
> #include <sys/uio.h>
> #include <netinet/in.h>
> #endif 
> #include <stdio.h>
> #include <errno.h>
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
88d88
< #include "res.h"
89a90
> #include "res.h"
212a214
> #ifndef WINNT
213a216,218
> #else
> 			while ((n = recv(s, (char *)cp, (int)len,0)) > 0) {
> #endif
239c244
< 			if ((resplen = _getshort((u_char*)cp)) > anslen) {
---
> 			if ( (u_int)(resplen = _getshort((u_char*)cp)) > anslen) {
240a246
> #ifndef GUI
241a248,250
> #else
> 					fprintf(outputfile, "response truncated\n");
> #endif               
246a256
> #ifndef WINNT
247a258,260
> #else
> 			   (n = recv(s, (char *)cp, (int)len,0)) > 0) {
> #endif
268a282
> #ifndef WINNT
269a284,286
> #else
> 					if ((n = recv(s, junk, n,0)) > 0)
> #endif
335c352,353
< 					printf("timeout\n");
---
> 					printf("timeout (%d secs)\n", 
> 						timeout.tv_sec);
362a381
> #ifndef GUI
363a383,385
> #else
> 					fprintf(outputfile,"truncated answer\n");
> #endif
371a394
> #ifndef GUI
373a397,400
> #else
> 			fprintf(outputfile,"------------\nGot answer (%d bytes):\n",
> 			    resplen);
> #endif
374a402
> #ifndef GUI
375a404,406
> #else
> 			fprintf(outputfile,"------------\nGot answer:\n");
> #endif
404a436
> void
Only in m:\bind496rel/tools/nslookup: send.c.orig
diff --recurs m:\bind496rel/tools/nslookup/skip.c m:\bind/tools/nslookup/skip.c
78,83c78,85
< #include <sys/param.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <resolv.h>
< #include <stdio.h>
< #include "../../conf/portability.h"
---
> #ifndef WINNT
> #include <sys/param.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <resolv.h>
> #include <stdio.h>
> #include "../../conf/portability.h"
85c87
< char *res_skip_rr();
---
> char *res_skip_rr();
87c89
< 
---
> 
129c131
< 	if (n = ntohs(hp->qdcount) ) {
---
> 	if (n = ntohs( (u_short) hp->qdcount) ) {
143c145
< 	if (n = ntohs(hp->ancount)) {
---
> 	if (n = ntohs( (u_short) hp->ancount)) {
154c156
< 	if (n = ntohs(hp->nscount)) {
---
> 	if (n = ntohs( (u_short) hp->nscount)) {
165c167
< 	if (n = ntohs(hp->arcount)) {
---
> 	if (n = ntohs( (u_short) hp->arcount)) {
Only in m:\bind/tools/nslookup: strip.bat
diff --recurs m:\bind496rel/tools/nslookup/subr.c m:\bind/tools/nslookup/subr.c
77,86c77,93
< #include <sys/types.h>
< #include <sys/param.h>
< #include <netdb.h>
< #include <sys/socket.h>
< #include <netinet/in.h>
< #include <arpa/nameser.h>
< #include <arpa/inet.h>
< #include <signal.h>
< #include <setjmp.h>
< #include <stdio.h>
---
> 
> #ifndef WINNT
> #include <sys/types.h>
> #include <sys/param.h>
> #endif
> #include <netdb.h>
> #ifndef WINNT
> #include <sys/socket.h>
> #include <netinet/in.h>
> #endif
> #include <arpa/nameser.h>
> #include <arpa/inet.h>
> #include <signal.h>
> #ifndef WINNT
> #include <setjmp.h>
> #endif
> #include <stdio.h>
90a98,103
> #ifdef WINNT
> #ifdef GUI
> 	char output[10000];
> 	char final_output[10000];
> #endif
> #endif
115a129
>  #ifndef WINNT
139c153
< 
---
>  #endif
190c204,206
<     { int saveMask;
---
>     { 
>       #ifndef WINNT
> 	  int saveMask;
191a208
>       #endif
192a210
>      #ifndef WINNT
193a212
>      #endif
227a247
> 
238a259,261
>      if (file == NULL)
>        file = stdout;
> 
316a340,463
> 
>  
> /*void
> PrintHostInfo(file, title, hp)
> 	FILE	*file;
> 	char	*title;
> 	register HostInfo *hp;
> {
> 	register char		**cp;
> 	register ServerInfo	**sp;
> 	char			comma;
> 	int			i;
> 	void PrintToBox(char *output);
> 	
> 	sprintf(final_output, "%-7s  %s", title, hp->name);
> 
> 	if (hp->addrList != NULL) {
> 	    if (hp->addrList[1] != NULL) {
> 		sprintf(output, "\nAddresses:");
>           strcat(final_output,output);
> 
> 	    } else {
> 		sprintf(output, "\nAddress:");
>           strcat(final_output,output);
> 
> 	    }
> 	    comma = ' ';
> 	    i = 0;
> 	    for (cp = hp->addrList; cp && *cp; cp++) {
> 		i++;
> 		if (i > 4) {
> 		    sprintf(output, "\n\t");
>               strcat(final_output,output);
> 
> 		    comma = ' ';
> 		    i = 0;
> 		}
> 		sprintf(output,"%c %s", comma, inet_ntoa(*(struct in_addr *)*cp));
>           strcat(final_output,output);
> 
>           comma = ',';
> 	    }
> 	}
> 
> 	if (hp->aliases != NULL) {
> 	    sprintf(output, "\nAliases:");
>          strcat(final_output,output);
> 
> 	    comma = ' ';
> 	    i = 10;
> 	    for (cp = hp->aliases; cp && *cp && **cp; cp++) {
> 		i += strlen(*cp) + 2;
> 		if (i > 75) {
> 		    sprintf(output, "\n\t");
>               strcat(final_output,output);
> 
> 		    comma = ' ';
> 		    i = 10;
> 		}
> 		sprintf(output, "%c %s", comma, *cp);
>           strcat(final_output,output);
> 
> 		comma = ',';
> 	    }
> 	}
> 
> 	if (hp->servers != NULL) {
> 	    sprintf(output, "\nServed by:\n");
>          strcat(final_output,output);
> 
> 	    for (sp = hp->servers; *sp != NULL ; sp++) {
> 
> 		sprintf(output, "- %s\n\t",  (*sp)->name);
>           strcat(final_output,output);
> 
> 
> 		comma = ' ';
> 		i = 0;
> 		for (cp = (*sp)->addrList; cp && *cp && **cp; cp++) {
> 		    i++;
> 		    if (i > 4) {
> 			sprintf(output, "\n\t");
>                strcat(final_output,output);
> 
>                comma = ' ';
> 			i = 0;
> 		    }
> 		    sprintf(output,
> 			"%c %s", comma, inet_ntoa(*(struct in_addr *)*cp));
>               strcat(final_output,output);
> 
>               comma = ',';
> 		}
> 		sprintf(output, "\n\t");
>           strcat(final_output,output);
> 
> 		comma = ' ';
> 		i = 10;
> 		for (cp = (*sp)->domains; cp && *cp && **cp; cp++) {
> 		    i += strlen(*cp) + 2;
> 		    if (i > 75) {
> 			sprintf(output, "\n\t");
>                     strcat(final_output,output);
> 
>                comma = ' ';
> 			i = 10;
> 		    }
> 		    sprintf(output, "%c %s", comma, *cp);
>                    strcat(final_output,output);
> 
>               comma = ',';
> 		}
> 		sprintf(output, "\n");
>               strcat(final_output,output);
> 
>          }
> 	}
> 
> 	sprintf(output, "\n\n");
>      strcat(final_output,output);
>      PrintToBox(final_output,0);
> }
> 
> */
320c467
<  *  OpenFile --
---
>  *  AppOpenFile --
334c481
< OpenFile(string, file)
---
> AppOpenFile(string, file)
Only in m:\bind/tools/nslookup: winntport.txt
Only in m:\bind/tools/nslookup: yylex.c
Only in m:\bind/tools: save.zip
