summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorInternet Software Consortium, Inc <@isc.org>2007-09-07 14:14:31 -0600
committerLaMont Jones <lamont@debian.org>2007-09-07 14:14:31 -0600
commit827006a436e7babc39b4b5b52797aa54313f5be6 (patch)
tree897f21a87e0eb0131628e6c39691789563ee78d7 /lib
parentad2d173ed9521052e7fd8ba2cd10117cdea6f058 (diff)
downloadbind9-827006a436e7babc39b4b5b52797aa54313f5be6.tar.gz
9.2.3rc1
Diffstat (limited to 'lib')
-rw-r--r--lib/bind/Makefile.in7
-rw-r--r--lib/bind/api4
-rw-r--r--lib/bind/bsd/strtoul.c6
-rw-r--r--lib/bind/bsd/writev.c3
-rw-r--r--lib/bind/config.h.in1
-rwxr-xr-xlib/bind/configure304
-rw-r--r--lib/bind/configure.in74
-rw-r--r--lib/bind/dst/hmac_link.c11
-rw-r--r--lib/bind/include/arpa/nameser.h8
-rw-r--r--lib/bind/include/arpa/nameser_compat.h3
-rw-r--r--lib/bind/include/hesiod.h18
-rw-r--r--lib/bind/include/irp.h28
-rw-r--r--lib/bind/include/irs.h194
-rw-r--r--lib/bind/include/isc/ctl.h8
-rw-r--r--lib/bind/include/isc/dst.h130
-rw-r--r--lib/bind/include/isc/eventlib.h83
-rw-r--r--lib/bind/include/isc/irpmarshall.h37
-rw-r--r--lib/bind/include/isc/logging.h7
-rw-r--r--lib/bind/include/isc/misc.h4
-rw-r--r--lib/bind/include/isc/tree.h12
-rw-r--r--lib/bind/include/netdb.h3
-rw-r--r--lib/bind/include/resolv.h97
-rw-r--r--lib/bind/irs/dns_gr.c4
-rw-r--r--lib/bind/irs/dns_ho.c598
-rw-r--r--lib/bind/irs/dns_nw.c21
-rw-r--r--lib/bind/irs/gen_gr.c17
-rw-r--r--lib/bind/irs/getaddrinfo.c63
-rw-r--r--lib/bind/irs/gethostent.c59
-rw-r--r--lib/bind/irs/getnameinfo.c1
-rw-r--r--lib/bind/irs/getnetgrent.c27
-rw-r--r--lib/bind/irs/getnetgrent_r.c14
-rw-r--r--lib/bind/irs/hesiod.c26
-rw-r--r--lib/bind/irs/irp_p.h4
-rw-r--r--lib/bind/irs/irs_data.c25
-rw-r--r--lib/bind/irs/nis_gr.c4
-rw-r--r--lib/bind/irs/nis_ho.c107
-rw-r--r--lib/bind/isc/ctl_clnt.c4
-rw-r--r--lib/bind/isc/ctl_srvr.c4
-rw-r--r--lib/bind/isc/ev_files.c4
-rw-r--r--lib/bind/isc/ev_timers.c14
-rw-r--r--lib/bind/isc/ev_waits.c8
-rw-r--r--lib/bind/isc/eventlib.c16
-rw-r--r--lib/bind/isc/eventlib_p.h5
-rw-r--r--lib/bind/isc/logging.c11
-rw-r--r--lib/bind/libtool.m42
-rw-r--r--lib/bind/make/rules.in4
-rw-r--r--lib/bind/nameser/ns_name.c36
-rw-r--r--lib/bind/nameser/ns_parse.c5
-rw-r--r--lib/bind/nameser/ns_print.c14
-rw-r--r--lib/bind/nameser/ns_samedomain.c10
-rw-r--r--lib/bind/nameser/ns_sign.c27
-rw-r--r--lib/bind/port_after.h.in13
-rw-r--r--lib/bind/resolv/res_comp.c8
-rw-r--r--lib/bind/resolv/res_debug.c38
-rw-r--r--lib/bind/resolv/res_findzonecut.c113
-rw-r--r--lib/bind/resolv/res_init.c55
-rw-r--r--lib/bind/resolv/res_mkquery.c72
-rw-r--r--lib/bind/resolv/res_mkupdate.c68
-rw-r--r--lib/bind/resolv/res_private.h1
-rw-r--r--lib/bind/resolv/res_query.c9
-rw-r--r--lib/bind/resolv/res_send.c9
-rw-r--r--lib/bind/resolv/res_update.c15
-rw-r--r--lib/dns/Makefile.in40
-rw-r--r--lib/dns/adb.c112
-rw-r--r--lib/dns/api4
-rw-r--r--lib/dns/byaddr.c26
-rw-r--r--lib/dns/dispatch.c63
-rw-r--r--lib/dns/dnssec.c22
-rw-r--r--lib/dns/gen.c96
-rw-r--r--lib/dns/include/dns/adb.h12
-rw-r--r--lib/dns/include/dns/byaddr.h20
-rw-r--r--lib/dns/include/dns/dispatch.h2
-rw-r--r--lib/dns/include/dns/events.h3
-rw-r--r--lib/dns/include/dns/master.h5
-rw-r--r--lib/dns/include/dns/name.h18
-rw-r--r--lib/dns/include/dns/rdata.h10
-rw-r--r--lib/dns/include/dns/rdataset.h7
-rw-r--r--lib/dns/include/dns/rdataslab.h21
-rw-r--r--lib/dns/include/dns/result.h10
-rw-r--r--lib/dns/include/dns/view.h13
-rw-r--r--lib/dns/include/dns/zone.h2
-rw-r--r--lib/dns/master.c17
-rw-r--r--lib/dns/masterdump.c30
-rw-r--r--lib/dns/message.c7
-rw-r--r--lib/dns/name.c21
-rw-r--r--lib/dns/ncache.c6
-rw-r--r--lib/dns/rbt.c7
-rw-r--r--lib/dns/rbtdb.c378
-rw-r--r--lib/dns/rdata.c32
-rw-r--r--lib/dns/rdata/any_255/tsig_250.c10
-rw-r--r--lib/dns/rdata/generic/afsdb_18.c4
-rw-r--r--lib/dns/rdata/generic/cert_37.c4
-rw-r--r--lib/dns/rdata/generic/loc_29.c8
-rw-r--r--lib/dns/rdata/generic/mx_15.c4
-rw-r--r--lib/dns/rdata/generic/nxt_30.c14
-rw-r--r--lib/dns/rdata/generic/rt_21.c4
-rw-r--r--lib/dns/rdata/generic/sig_24.c4
-rw-r--r--lib/dns/rdata/generic/tkey_249.c10
-rw-r--r--lib/dns/rdata/in_1/a6_38.c4
-rw-r--r--lib/dns/rdata/in_1/kx_36.c4
-rw-r--r--lib/dns/rdata/in_1/naptr_35.c6
-rw-r--r--lib/dns/rdata/in_1/px_26.c4
-rw-r--r--lib/dns/rdata/in_1/srv_33.c8
-rw-r--r--lib/dns/rdatalist.c6
-rw-r--r--lib/dns/rdataset.c17
-rw-r--r--lib/dns/rdataslab.c36
-rw-r--r--lib/dns/resolver.c43
-rw-r--r--lib/dns/result.c19
-rw-r--r--lib/dns/rootns.c6
-rw-r--r--lib/dns/sec/dst/dst_api.c6
-rw-r--r--lib/dns/sec/dst/openssl_link.c4
-rw-r--r--lib/dns/sec/dst/opensslrsa_link.c5
-rw-r--r--lib/dns/time.c12
-rw-r--r--lib/dns/view.c22
-rw-r--r--lib/dns/win32/gen.dsp214
-rw-r--r--lib/dns/win32/gen.dsw58
-rw-r--r--lib/dns/win32/libdns.def1435
-rw-r--r--lib/dns/win32/libdns.dsp796
-rw-r--r--lib/dns/win32/libdns.dsw58
-rw-r--r--lib/dns/win32/libdns.mak12
-rw-r--r--lib/dns/xfrin.c9
-rw-r--r--lib/dns/zone.c131
-rw-r--r--lib/isc/Makefile.in4
-rw-r--r--lib/isc/api4
-rw-r--r--lib/isc/base64.c15
-rw-r--r--lib/isc/entropy.c4
-rw-r--r--lib/isc/hash.c387
-rw-r--r--lib/isc/include/isc/hash.h175
-rw-r--r--lib/isc/include/isc/log.h5
-rw-r--r--lib/isc/include/isc/refcount.h12
-rw-r--r--lib/isc/include/isc/rwlock.h11
-rw-r--r--lib/isc/include/isc/types.h3
-rw-r--r--lib/isc/inet_pton.c6
-rw-r--r--lib/isc/lex.c16
-rw-r--r--lib/isc/lfsr.c6
-rw-r--r--lib/isc/log.c113
-rw-r--r--lib/isc/mem.c22
-rw-r--r--lib/isc/print.c7
-rw-r--r--lib/isc/pthreads/thread.c7
-rw-r--r--lib/isc/random.c33
-rw-r--r--lib/isc/rwlock.c80
-rw-r--r--lib/isc/sha1.c76
-rw-r--r--lib/isc/sockaddr.c68
-rw-r--r--lib/isc/unix/dir.c4
-rw-r--r--lib/isc/unix/ifiter_ioctl.c6
-rw-r--r--lib/isc/unix/include/isc/stat.h53
-rw-r--r--lib/isc/unix/socket.c39
-rw-r--r--lib/isc/unix/time.c6
-rw-r--r--lib/isc/win32/errno2result.c373
-rw-r--r--lib/isc/win32/include/isc/ipv6.h7
-rw-r--r--lib/isc/win32/include/isc/stat.h9
-rw-r--r--lib/isc/win32/include/isc/win32os.h71
-rw-r--r--lib/isc/win32/ipv6.c6
-rw-r--r--lib/isc/win32/libisc.def894
-rw-r--r--lib/isc/win32/libisc.dsp1376
-rw-r--r--lib/isc/win32/libisc.dsw58
-rw-r--r--lib/isc/win32/libisc.mak76
-rw-r--r--lib/isc/win32/net.c2
-rw-r--r--lib/isc/win32/netdb.h8
-rw-r--r--lib/isc/win32/socket.c2635
-rw-r--r--lib/isc/win32/strerror.c459
-rw-r--r--lib/isc/win32/win32os.c101
-rw-r--r--lib/isccc/api6
-rw-r--r--lib/isccc/cc.c8
-rw-r--r--lib/isccc/include/isccc/result.h11
-rw-r--r--lib/isccc/result.c9
-rw-r--r--lib/isccc/win32/libisccc.def132
-rw-r--r--lib/isccc/win32/libisccc.dsp394
-rw-r--r--lib/isccc/win32/libisccc.dsw58
-rw-r--r--lib/isccfg/api2
-rw-r--r--lib/isccfg/check.c21
-rw-r--r--lib/isccfg/parser.c27
-rw-r--r--lib/isccfg/win32/libisccfg.def88
-rw-r--r--lib/isccfg/win32/libisccfg.dsp282
-rw-r--r--lib/isccfg/win32/libisccfg.dsw58
-rw-r--r--lib/lwres/context.c8
-rw-r--r--lib/lwres/getipnode.c6
-rw-r--r--lib/lwres/getnameinfo.c14
-rw-r--r--lib/lwres/getrrset.c4
-rw-r--r--lib/lwres/lwconfig.c28
-rw-r--r--lib/lwres/lwinetaton.c10
-rw-r--r--lib/lwres/man/lwres_context.32
-rw-r--r--lib/lwres/man/lwres_context.docbook6
-rw-r--r--lib/lwres/man/lwres_context.html2
-rw-r--r--lib/lwres/man/lwres_getipnode.docbook2
-rw-r--r--lib/lwres/win32/liblwres.def156
-rw-r--r--lib/lwres/win32/liblwres.dsp482
-rw-r--r--lib/lwres/win32/liblwres.dsw58
-rw-r--r--lib/tests/t_api.c6
-rw-r--r--lib/win32/bindevt/bindevt.dsp264
-rw-r--r--lib/win32/bindevt/bindevt.dsw58
191 files changed, 9136 insertions, 6841 deletions
diff --git a/lib/bind/Makefile.in b/lib/bind/Makefile.in
index 36289107..2e1278b0 100644
--- a/lib/bind/Makefile.in
+++ b/lib/bind/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2001, 2002 Internet Software Consortium.
+# Copyright (C) 2001-2003 Internet Software Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.12.2.3 2002/08/05 06:57:11 marka Exp $
+# $Id: Makefile.in,v 1.12.2.5 2003/07/22 04:03:40 marka Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -120,6 +120,7 @@ distclean::
distclean::
rm -f config.cache config.h config.log config.status libtool
- rm -f port_before.h port_after.h
+ rm -f port_before.h port_after.h configure.lineno
+ rm -f port/Makefile @PORT_DIR@/Makefile
man:
diff --git a/lib/bind/api b/lib/bind/api
index 13178156..438d8f3f 100644
--- a/lib/bind/api
+++ b/lib/bind/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 1
+LIBINTERFACE = 2
LIBREVISION = 0
-LIBAGE = 1
+LIBAGE = 0
diff --git a/lib/bind/bsd/strtoul.c b/lib/bind/bsd/strtoul.c
index ab3d5a47..d110f309 100644
--- a/lib/bind/bsd/strtoul.c
+++ b/lib/bind/bsd/strtoul.c
@@ -1,6 +1,6 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: strtoul.c,v 1.1 2001/03/29 06:30:36 marka Exp $";
+static const char rcsid[] = "$Id: strtoul.c,v 1.1.2.1 2003/06/27 03:51:35 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -70,7 +70,7 @@ strtoul(const char *nptr, char **endptr, int base) {
* See strtol for comments as to the logic used.
*/
do {
- c = *s++;
+ c = *(unsigned char *)s++;
} while (isspace(c));
if (c == '-') {
neg = 1;
@@ -87,7 +87,7 @@ strtoul(const char *nptr, char **endptr, int base) {
base = c == '0' ? 8 : 10;
cutoff = (u_long)ULONG_MAX / (u_long)base;
cutlim = (u_long)ULONG_MAX % (u_long)base;
- for (acc = 0, any = 0;; c = *s++) {
+ for (acc = 0, any = 0;; c = *(unsigned char*)s++) {
if (isdigit(c))
c -= '0';
else if (isalpha(c))
diff --git a/lib/bind/bsd/writev.c b/lib/bind/bsd/writev.c
index 37392880..fe204a97 100644
--- a/lib/bind/bsd/writev.c
+++ b/lib/bind/bsd/writev.c
@@ -1,5 +1,5 @@
#ifndef LINT
-static const char rcsid[] = "$Id: writev.c,v 1.1 2001/03/29 06:30:37 marka Exp $";
+static const char rcsid[] = "$Id: writev.c,v 1.1.2.1 2003/06/27 03:51:35 marka Exp $";
#endif
#include "port_before.h"
@@ -31,6 +31,7 @@ __writev(int fd, struct iovec *iov, int iovlen)
if (statbuf.st_mode & S_IFSOCK) {
struct msghdr mesg;
+ memset(&mesg, 0, sizeof(mesg));
mesg.msg_name = 0;
mesg.msg_namelen = 0;
mesg.msg_iov = iov;
diff --git a/lib/bind/config.h.in b/lib/bind/config.h.in
index c1c9399b..46de822b 100644
--- a/lib/bind/config.h.in
+++ b/lib/bind/config.h.in
@@ -42,3 +42,4 @@ struct __sFILE;
extern __inline int __sputaux(int _c, struct __sFILE *_p);
#endif
#undef BROKEN_IN6ADDR_INIT_MACROS
+#undef HAVE_STRLCAT
diff --git a/lib/bind/configure b/lib/bind/configure
index 3718b482..9d9515e4 100755
--- a/lib/bind/configure
+++ b/lib/bind/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 1.83.2.2.4.1 .
+# From configure.in Revision: 1.83.2.5 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53.
#
@@ -5086,6 +5086,96 @@ else
thread_dir=nothreads
fi
+echo "$as_me:$LINENO: checking for strlcat" >&5
+echo $ECHO_N "checking for strlcat... $ECHO_C" >&6
+if test "${ac_cv_func_strlcat+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+/* From autoconf 2.57 */
+/* Define strlcat to an innocuous variant, in case <limits.h> declares strlcat.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define strlcat innocuous_strlcat
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char strlcat (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef strlcat
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strlcat ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_strlcat) || defined (__stub___strlcat)
+choke me
+#else
+char (*f) () = strlcat;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+return f != strlcat;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_strlcat=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_strlcat=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_strlcat" >&5
+echo "${ECHO_T}$ac_cv_func_strlcat" >&6
+if test $ac_cv_func_strlcat = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRLCAT 1
+_ACEOF
+
+fi
+
+
@@ -6996,7 +7086,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6999 "configure"' > conftest.$ac_ext
+ echo '#line 7089 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7539,7 +7629,7 @@ chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
-if { (eval echo configure:7542: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:7632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
@@ -8482,7 +8572,7 @@ beos*)
shlibpath_var=LIBRARY_PATH
;;
-bsdi4*)
+bsdi45*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
@@ -9224,7 +9314,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9227 "configure"
+#line 9317 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9322,7 +9412,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9325 "configure"
+#line 9415 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10747,9 +10837,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext
# HAVE_MINIMUM_IFREQ
case "$host" in
- *-bsdi4*) have_minimum_ifreq=yes;;
- *-bsdi3*) have_minimum_ifreq=yes;;
- *-bsdi2*) have_minimum_ifreq=yes;;
+ *-bsdi2345*) have_minimum_ifreq=yes;;
*-darwin*) have_minimum_ifreq=yes;;
*-freebsd*) have_minimum_ifreq=yes;;
*-lynxos*) have_minimum_ifreq=yes;;
@@ -17255,6 +17343,202 @@ fi
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#undef _REENTRANT
+#define _REENTRANT
+#undef __USE_MISC
+#define __USE_MISC
+#include <unistd.h>
+#include <netdb.h>
+int innetgr(const char *netgroup, const char *host, const char *user, const char *domain);
+
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+INNETGR_ARGS="#undef INNETGR_ARGS"
+
+
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#undef _REENTRANT
+#define _REENTRANT
+#undef __USE_MISC
+#define __USE_MISC
+#include <unistd.h>
+#include <netdb.h>
+int innetgr(char *netgroup, char *host, char *user, char *domain);
+
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+INNETGR_ARGS="#define INNETGR_ARGS char *netgroup, char *host, char *user, char *domain"
+
+
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#undef _REENTRANT
+#define _REENTRANT
+#undef __USE_MISC
+#define __USE_MISC
+#include <unistd.h>
+#include <netdb.h>
+void setnetgrent(const char *);
+
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+SETNETGRENT_ARGS="#undef SETNETGRENT_ARGS"
+
+
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#undef _REENTRANT
+#define _REENTRANT
+#undef __USE_MISC
+#define __USE_MISC
+#include <unistd.h>
+#include <netdb.h>
+void setnetgrent(char *);
+
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+SETNETGRENT_ARGS="#define SETNETGRENT_ARGS char *netgroup"
+
+
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+
+
#
# Random remaining OS-specific issues involving compiler warnings.
# XXXDCL print messages to indicate some compensation is being done?
@@ -18122,6 +18406,8 @@ s,@SERV_R_END_RETURN@,$SERV_R_END_RETURN,;t t
s,@SERV_R_ENT_ARGS@,$SERV_R_ENT_ARGS,;t t
s,@SERV_R_SET_RESULT@,$SERV_R_SET_RESULT,;t t
s,@SERV_R_SET_RETURN@,$SERV_R_SET_RETURN,;t t
+s,@SETNETGRENT_ARGS@,$SETNETGRENT_ARGS,;t t
+s,@INNETGR_ARGS@,$INNETGR_ARGS,;t t
s,@ISC_PLATFORM_BRACEPTHREADONCEINIT@,$ISC_PLATFORM_BRACEPTHREADONCEINIT,;t t
s,@BIND9_TOP_BUILDDIR@,$BIND9_TOP_BUILDDIR,;t t
/@BIND9_INCLUDES@/r $BIND9_INCLUDES
diff --git a/lib/bind/configure.in b/lib/bind/configure.in
index 76e43f8e..32f714d3 100644
--- a/lib/bind/configure.in
+++ b/lib/bind/configure.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-AC_REVISION($Revision: 1.83.2.2.4.1 $)
+AC_REVISION($Revision: 1.83.2.5 $)
AC_INIT(resolv/herror.c)
AC_PREREQ(2.13)
@@ -518,6 +518,8 @@ else
thread_dir=nothreads
fi
+AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT))
+
AC_SUBST(ALWAYS_DEFINES)
AC_SUBST(DO_PTHREADS)
AC_SUBST(WANT_IRS_THREADSGR_OBJS)
@@ -1031,9 +1033,7 @@ AC_SUBST(HAVE_SA_LEN)
# HAVE_MINIMUM_IFREQ
case "$host" in
- *-bsdi4*) have_minimum_ifreq=yes;;
- *-bsdi3*) have_minimum_ifreq=yes;;
- *-bsdi2*) have_minimum_ifreq=yes;;
+ *-bsdi[2345]*) have_minimum_ifreq=yes;;
*-darwin*) have_minimum_ifreq=yes;;
*-freebsd*) have_minimum_ifreq=yes;;
*-lynxos*) have_minimum_ifreq=yes;;
@@ -2214,6 +2214,72 @@ SERV_R_SET_RETURN="#define SERV_R_SET_RETURN void"
AC_SUBST(SERV_R_SET_RESULT)
AC_SUBST(SERV_R_SET_RETURN)
+AC_TRY_COMPILE(
+[
+#undef _REENTRANT
+#define _REENTRANT
+#undef __USE_MISC
+#define __USE_MISC
+#include <unistd.h>
+#include <netdb.h>
+int innetgr(const char *netgroup, const char *host, const char *user, const char *domain);
+]
+,,
+[
+INNETGR_ARGS="#undef INNETGR_ARGS"
+]
+,
+AC_TRY_COMPILE(
+[
+#undef _REENTRANT
+#define _REENTRANT
+#undef __USE_MISC
+#define __USE_MISC
+#include <unistd.h>
+#include <netdb.h>
+int innetgr(char *netgroup, char *host, char *user, char *domain);
+]
+,,
+[
+INNETGR_ARGS="#define INNETGR_ARGS char *netgroup, char *host, char *user, char *domain"
+]
+,
+))
+
+AC_TRY_COMPILE(
+[
+#undef _REENTRANT
+#define _REENTRANT
+#undef __USE_MISC
+#define __USE_MISC
+#include <unistd.h>
+#include <netdb.h>
+void setnetgrent(const char *);
+]
+,,
+[
+SETNETGRENT_ARGS="#undef SETNETGRENT_ARGS"
+]
+,
+AC_TRY_COMPILE(
+[
+#undef _REENTRANT
+#define _REENTRANT
+#undef __USE_MISC
+#define __USE_MISC
+#include <unistd.h>
+#include <netdb.h>
+void setnetgrent(char *);
+]
+,,
+[
+SETNETGRENT_ARGS="#define SETNETGRENT_ARGS char *netgroup"
+]
+,
+))
+AC_SUBST(SETNETGRENT_ARGS)
+AC_SUBST(INNETGR_ARGS)
+
#
# Random remaining OS-specific issues involving compiler warnings.
# XXXDCL print messages to indicate some compensation is being done?
diff --git a/lib/bind/dst/hmac_link.c b/lib/bind/dst/hmac_link.c
index 039d5ff9..81f1748f 100644
--- a/lib/bind/dst/hmac_link.c
+++ b/lib/bind/dst/hmac_link.c
@@ -1,6 +1,6 @@
#ifdef HMAC_MD5
#ifndef LINT
-static const char rcsid[] = "$Header: /proj/cvs/isc/bind9/lib/bind/dst/hmac_link.c,v 1.2 2001/04/03 00:28:14 bwelling Exp $";
+static const char rcsid[] = "$Header: /proj/cvs/isc/bind9/lib/bind/dst/hmac_link.c,v 1.2.2.1 2003/06/27 03:51:36 marka Exp $";
#endif
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -459,15 +459,10 @@ dst_hmac_md5_init()
}
#else
+#define dst_hmac_md5_init __dst_hmac_md5_init
+
int
dst_hmac_md5_init(){
return (0);
}
#endif
-
-
-
-
-
-
-
diff --git a/lib/bind/include/arpa/nameser.h b/lib/bind/include/arpa/nameser.h
index 3608f0e3..35fa21a1 100644
--- a/lib/bind/include/arpa/nameser.h
+++ b/lib/bind/include/arpa/nameser.h
@@ -49,7 +49,7 @@
*/
/*
- * $Id: nameser.h,v 1.2.2.3 2002/07/14 04:26:55 marka Exp $
+ * $Id: nameser.h,v 1.2.2.4 2003/06/27 03:51:37 marka Exp $
*/
#ifndef _ARPA_NAMESER_H_
@@ -78,8 +78,9 @@
/*
* Define constants based on RFC 883, RFC 1034, RFC 1035
*/
-#define NS_PACKETSZ 512 /* maximum packet size */
+#define NS_PACKETSZ 512 /* default UDP packet size */
#define NS_MAXDNAME 1025 /* maximum domain name */
+#define NS_MAXMSG 65535 /* maximum message size */
#define NS_MAXCDNAME 255 /* maximum compressed domain name */
#define NS_MAXLABEL 63 /* maximum length of domain label */
#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
@@ -294,6 +295,7 @@ typedef enum __ns_type {
ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
ns_t_sink = 40, /* Kitchen sink (experimentatl) */
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
+ ns_t_apl = 42, /* Address prefix list (RFC 3123) */
ns_t_tkey = 249, /* Transaction key */
ns_t_tsig = 250, /* Transaction signature. */
ns_t_ixfr = 251, /* Incremental zone transfer. */
@@ -398,7 +400,7 @@ typedef enum __ns_cert_types {
/* Signatures */
#define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */
-#define NS_MD5RSA_MAX_BITS 2552
+#define NS_MD5RSA_MAX_BITS 4096
/* Total of binary mod and exp */
#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
/* Max length of text sig block */
diff --git a/lib/bind/include/arpa/nameser_compat.h b/lib/bind/include/arpa/nameser_compat.h
index fb7b946a..91fe52c1 100644
--- a/lib/bind/include/arpa/nameser_compat.h
+++ b/lib/bind/include/arpa/nameser_compat.h
@@ -32,7 +32,7 @@
/*
* from nameser.h 8.1 (Berkeley) 6/2/93
- * $Id: nameser_compat.h,v 1.1.2.2 2002/07/02 05:00:17 marka Exp $
+ * $Id: nameser_compat.h,v 1.1.2.3 2003/06/27 03:51:37 marka Exp $
*/
#ifndef _ARPA_NAMESER_COMPAT_
@@ -138,6 +138,7 @@ typedef struct {
#define RRFIXEDSZ NS_RRFIXEDSZ
#define INT32SZ NS_INT32SZ
#define INT16SZ NS_INT16SZ
+#define INT8SZ NS_INT8SZ
#define INADDRSZ NS_INADDRSZ
#define IN6ADDRSZ NS_IN6ADDRSZ
#define INDIR_MASK NS_CMPRSFLGS
diff --git a/lib/bind/include/hesiod.h b/lib/bind/include/hesiod.h
index b49f5e3d..909eda65 100644
--- a/lib/bind/include/hesiod.h
+++ b/lib/bind/include/hesiod.h
@@ -20,21 +20,19 @@
*/
/*
- * $Id: hesiod.h,v 1.1 2001/03/29 06:31:33 marka Exp $
+ * $Id: hesiod.h,v 1.1.2.1 2003/06/27 03:51:36 marka Exp $
*/
#ifndef _HESIOD_H_INCLUDED
#define _HESIOD_H_INCLUDED
-int hesiod_init __P((void **context));
-void hesiod_end __P((void *context));
-char * hesiod_to_bind __P((void *context, const char *name,
- const char *type));
-char ** hesiod_resolve __P((void *context, const char *name,
- const char *type));
-void hesiod_free_list __P((void *context, char **list));
-struct __res_state * __hesiod_res_get __P((void *context));
-void __hesiod_res_set __P((void *context, struct __res_state *,
+int hesiod_init __P((void **));
+void hesiod_end __P((void *));
+char * hesiod_to_bind __P((void *, const char *, const char *));
+char ** hesiod_resolve __P((void *, const char *, const char *));
+void hesiod_free_list __P((void *, char **));
+struct __res_state * __hesiod_res_get __P((void *));
+void __hesiod_res_set __P((void *, struct __res_state *,
void (*)(void *)));
#endif /*_HESIOD_H_INCLUDED*/
diff --git a/lib/bind/include/irp.h b/lib/bind/include/irp.h
index e56cfbc6..97a2c5be 100644
--- a/lib/bind/include/irp.h
+++ b/lib/bind/include/irp.h
@@ -16,7 +16,7 @@
*/
/*
- * $Id: irp.h,v 1.1 2001/03/29 06:31:34 marka Exp $
+ * $Id: irp.h,v 1.1.2.1 2003/06/27 03:51:37 marka Exp $
*/
#ifndef _IRP_H_INCLUDED
@@ -84,16 +84,20 @@
struct irp_p;
-char *irs_irp_read_body(struct irp_p *pvt, size_t *size);
-int irs_irp_read_response(struct irp_p *pvt, char *text, size_t len);
-void irs_irp_disconnect(struct irp_p *pvt);
-int irs_irp_connect(struct irp_p *pvt);
-int irs_irp_is_connected(struct irp_p *pvt);
-int irs_irp_connection_setup(struct irp_p *cxndata, int *warned);
-int irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...);
-int irs_irp_get_full_response(struct irp_p *pvt, int *code, char *text,
- size_t textlen, char **body,
- size_t *bodylen);
-int irs_irp_read_line(struct irp_p *pvt, char *buffer, int len);
+char *irs_irp_read_body(struct irp_p *, size_t *);
+int irs_irp_read_response(struct irp_p *, char *, size_t);
+void irs_irp_disconnect(struct irp_p *);
+int irs_irp_connect(struct irp_p *);
+int irs_irp_is_connected(struct irp_p *);
+int irs_irp_connection_setup(struct irp_p *, int *);
+#ifdef __GNUC__
+int irs_irp_send_command(struct irp_p *, const char *, ...)
+ __attribute__((__format__(__printf__, 2, 3)));
+#else
+int irs_irp_send_command(struct irp_p *, const char *, ...);
+#endif
+int irs_irp_get_full_response(struct irp_p *, int *, char *, size_t,
+ char **, size_t *);
+int irs_irp_read_line(struct irp_p *, char *, int);
#endif
diff --git a/lib/bind/include/irs.h b/lib/bind/include/irs.h
index d7fc7b4d..34fb23dc 100644
--- a/lib/bind/include/irs.h
+++ b/lib/bind/include/irs.h
@@ -16,7 +16,7 @@
*/
/*
- * $Id: irs.h,v 1.2 2001/06/22 05:10:58 marka Exp $
+ * $Id: irs.h,v 1.2.2.1 2003/06/27 03:51:37 marka Exp $
*/
#ifndef _IRS_H_INCLUDED
@@ -198,18 +198,58 @@ struct nwent {
#define irs_dns_acc __irs_dns_acc
#define irs_nis_acc __irs_nis_acc
#define irs_irp_acc __irs_irp_acc
+#define irs_destroy __irs_destroy
+#define irs_dns_gr __irs_dns_gr
+#define irs_dns_ho __irs_dns_ho
+#define irs_dns_nw __irs_dns_nw
+#define irs_dns_pr __irs_dns_pr
+#define irs_dns_pw __irs_dns_pw
+#define irs_dns_sv __irs_dns_sv
+#define irs_gen_gr __irs_gen_gr
+#define irs_gen_ho __irs_gen_ho
+#define irs_gen_ng __irs_gen_ng
+#define irs_gen_nw __irs_gen_nw
+#define irs_gen_pr __irs_gen_pr
+#define irs_gen_pw __irs_gen_pw
+#define irs_gen_sv __irs_gen_sv
+#define irs_irp_get_full_response __irs_irp_get_full_response
+#define irs_irp_gr __irs_irp_gr
+#define irs_irp_ho __irs_irp_ho
+#define irs_irp_is_connected __irs_irp_is_connected
+#define irs_irp_ng __irs_irp_ng
+#define irs_irp_nw __irs_irp_nw
+#define irs_irp_pr __irs_irp_pr
+#define irs_irp_pw __irs_irp_pw
+#define irs_irp_read_line __irs_irp_read_line
+#define irs_irp_sv __irs_irp_sv
+#define irs_lcl_gr __irs_lcl_gr
+#define irs_lcl_ho __irs_lcl_ho
+#define irs_lcl_ng __irs_lcl_ng
+#define irs_lcl_nw __irs_lcl_nw
+#define irs_lcl_pr __irs_lcl_pr
+#define irs_lcl_pw __irs_lcl_pw
+#define irs_lcl_sv __irs_lcl_sv
+#define irs_nis_gr __irs_nis_gr
+#define irs_nis_ho __irs_nis_ho
+#define irs_nis_ng __irs_nis_ng
+#define irs_nis_nw __irs_nis_nw
+#define irs_nis_pr __irs_nis_pr
+#define irs_nis_pw __irs_nis_pw
+#define irs_nis_sv __irs_nis_sv
+#define net_data_create __net_data_create
+#define net_data_destroy __net_data_destroy
+#define net_data_minimize __net_data_minimize
/*
* Externs.
*/
-extern struct irs_acc * irs_gen_acc __P((const char *options,
- const char *conf_file));
-extern struct irs_acc * irs_lcl_acc __P((const char *options));
-extern struct irs_acc * irs_dns_acc __P((const char *options));
-extern struct irs_acc * irs_nis_acc __P((const char *options));
-extern struct irs_acc * irs_irp_acc __P((const char *options));
+extern struct irs_acc * irs_gen_acc __P((const char *, const char *));
+extern struct irs_acc * irs_lcl_acc __P((const char *));
+extern struct irs_acc * irs_dns_acc __P((const char *));
+extern struct irs_acc * irs_nis_acc __P((const char *));
+extern struct irs_acc * irs_irp_acc __P((const char *));
-extern void irs_destroy(void);
+extern void irs_destroy __P((void));
/*
* These forward declarations are for the semi-private functions in
@@ -228,102 +268,78 @@ struct net_data; /* forward */
* the default interface will use net_data_create by default. Servers will
* probably want net_data_init (one call per client)
*/
-struct net_data *net_data_create(const char *conf_file);
-struct net_data *net_data_init(const char *conf_file);
-void net_data_destroy(void *p);
+struct net_data *net_data_create __P((const char *));
+struct net_data *net_data_init __P((const char *));
+void net_data_destroy __P((void *));
-extern struct group *getgrent_p __P((struct net_data *net_data));
-extern struct group *getgrnam_p __P((const char *name,
- struct net_data *net_data));
-extern struct group *getgrgid_p __P((gid_t gid,
- struct net_data *net_data));
-extern int setgroupent_p __P((int stayopen,
- struct net_data *net_data));
-extern void endgrent_p __P((struct net_data *net_data));
-extern int getgrouplist_p __P((const char *name,
- gid_t basegid,
- gid_t *groups,
- int *ngroups,
- struct net_data *net_data));
+extern struct group *getgrent_p __P((struct net_data *));
+extern struct group *getgrnam_p __P((const char *, struct net_data *));
+extern struct group *getgrgid_p __P((gid_t, struct net_data *));
+extern int setgroupent_p __P((int, struct net_data *));
+extern void endgrent_p __P((struct net_data *));
+extern int getgrouplist_p __P((const char *, gid_t, gid_t *, int *,
+ struct net_data *));
#ifdef SETGRENT_VOID
-extern void setgrent_p __P((struct net_data *net_data));
+extern void setgrent_p __P((struct net_data *));
#else
-extern int setgrent_p __P((struct net_data *net_data));
+extern int setgrent_p __P((struct net_data *));
#endif
-extern struct hostent *gethostbyname_p __P((const char *name,
- struct net_data *net_data));
-extern struct hostent *gethostbyname2_p __P((const char *name, int af,
- struct net_data *net_data));
-extern struct hostent *gethostbyaddr_p __P((const char *addr, int len,
- int af,
- struct net_data *net_data));
-extern struct hostent *gethostent_p __P((struct net_data *net_data));
-extern void sethostent_p __P((int stayopen,
- struct net_data *net_data));
-extern void endhostent_p __P((struct net_data *net_data));
-extern struct hostent *getipnodebyname_p __P((const char *name, int af,
- int flags, int *errp,
- struct net_data *net_data));
-extern struct hostent *getipnodebyaddr_p __P((const void *addr, size_t len,
- int af, int *errp,
- struct net_data *net_data));
+extern struct hostent *gethostbyname_p __P((const char *,
+ struct net_data *));
+extern struct hostent *gethostbyname2_p __P((const char *, int,
+ struct net_data *));
+extern struct hostent *gethostbyaddr_p __P((const char *, int, int,
+ struct net_data *));
+extern struct hostent *gethostent_p __P((struct net_data *));
+extern void sethostent_p __P((int, struct net_data *));
+extern void endhostent_p __P((struct net_data *));
+extern struct hostent *getipnodebyname_p __P((const char *, int, int, int *,
+ struct net_data *));
+extern struct hostent *getipnodebyaddr_p __P((const void *, size_t,
+ int, int *, struct net_data *));
-extern struct netent *getnetent_p __P((struct net_data *net_data));
-extern struct netent *getnetbyname_p __P((const char *name,
- struct net_data *net_data));
-extern struct netent *getnetbyaddr_p __P((unsigned long net, int type,
- struct net_data *net_data));
-extern void setnetent_p __P((int stayopen,
- struct net_data *net_data));
-extern void endnetent_p __P((struct net_data *net_data));
+extern struct netent *getnetent_p __P((struct net_data *));
+extern struct netent *getnetbyname_p __P((const char *, struct net_data *));
+extern struct netent *getnetbyaddr_p __P((unsigned long, int,
+ struct net_data *));
+extern void setnetent_p __P((int, struct net_data *));
+extern void endnetent_p __P((struct net_data *));
-extern void setnetgrent_p __P((const char *netgroup,
- struct net_data *net_data));
-extern void endnetgrent_p __P((struct net_data *net_data));
-extern int innetgr_p __P((const char *netgroup,
- const char *host,
- const char *user,
- const char *domain,
- struct net_data *net_data));
-extern int getnetgrent_p __P((const char **host, const char **user,
- const char **domain,
- struct net_data *net_data));
+extern void setnetgrent_p __P((const char *, struct net_data *));
+extern void endnetgrent_p __P((struct net_data *));
+extern int innetgr_p __P((const char *, const char *, const char *,
+ const char *, struct net_data *));
+extern int getnetgrent_p __P((const char **, const char **,
+ const char **, struct net_data *));
-extern struct protoent *getprotoent_p __P((struct net_data *net_data));
-extern struct protoent *getprotobyname_p __P((const char *name,
- struct net_data *net_data));
-extern struct protoent *getprotobynumber_p __P((int proto,
- struct net_data *net_data));
-extern void setprotoent_p __P((int stayopen,
- struct net_data *net_data));
-extern void endprotoent_p __P((struct net_data *net_data));
+extern struct protoent *getprotoent_p __P((struct net_data *));
+extern struct protoent *getprotobyname_p __P((const char *,
+ struct net_data *));
+extern struct protoent *getprotobynumber_p __P((int, struct net_data *));
+extern void setprotoent_p __P((int, struct net_data *));
+extern void endprotoent_p __P((struct net_data *));
-extern struct passwd *getpwent_p __P((struct net_data *net_data));
-extern struct passwd *getpwnam_p __P((const char *name,
- struct net_data *net_data));
-extern struct passwd *getpwuid_p __P((uid_t uid,
- struct net_data *net_data));
-extern int setpassent_p __P((int stayopen,
- struct net_data *net_data));
-extern void endpwent_p __P((struct net_data *net_data));
+extern struct passwd *getpwent_p __P((struct net_data *));
+extern struct passwd *getpwnam_p __P((const char *, struct net_data *));
+extern struct passwd *getpwuid_p __P((uid_t, struct net_data *));
+extern int setpassent_p __P((int, struct net_data *));
+extern void endpwent_p __P((struct net_data *));
#ifdef SETPWENT_VOID
-extern void setpwent_p __P((struct net_data *net_data));
+extern void setpwent_p __P((struct net_data *));
#else
-extern int setpwent_p __P((struct net_data *net_data));
+extern int setpwent_p __P((struct net_data *));
#endif
-extern struct servent *getservent_p __P((struct net_data *net_data));
-extern struct servent *getservbyname_p __P((const char *name,
- const char *proto,
- struct net_data *net_data));
-extern struct servent *getservbyport_p __P((int port, const char *proto,
- struct net_data *net_data));
-extern void setservent_p __P((int stayopen,
- struct net_data *net_data));
-extern void endservent_p __P((struct net_data *net_data));
+extern struct servent *getservent_p __P((struct net_data *));
+extern struct servent *getservbyname_p __P((const char *, const char *,
+ struct net_data *));
+extern struct servent *getservbyport_p __P((int, const char *,
+ struct net_data *));
+extern void setservent_p __P((int, struct net_data *));
+extern void endservent_p __P((struct net_data *));
#endif /*_IRS_H_INCLUDED*/
diff --git a/lib/bind/include/isc/ctl.h b/lib/bind/include/isc/ctl.h
index 663a084b..dab5a0e4 100644
--- a/lib/bind/include/isc/ctl.h
+++ b/lib/bind/include/isc/ctl.h
@@ -19,7 +19,7 @@
*/
/*
- * $Id: ctl.h,v 1.1.2.1 2002/07/11 23:32:30 marka Exp $
+ * $Id: ctl.h,v 1.1.2.2 2003/06/27 03:51:38 marka Exp $
*/
#include <sys/types.h>
@@ -42,11 +42,11 @@ struct ctl_verb;
enum ctl_severity { ctl_debug, ctl_warning, ctl_error };
-typedef void (*ctl_logfunc)(enum ctl_severity, const char *fmt, ...);
+typedef void (*ctl_logfunc)(enum ctl_severity, const char *, ...);
typedef void (*ctl_verbfunc)(struct ctl_sctx *, struct ctl_sess *,
- const struct ctl_verb *, const char *rest,
- u_int respflags, const void *respctx, void *uctx);
+ const struct ctl_verb *, const char *,
+ u_int, const void *, void *);
typedef void (*ctl_srvrdone)(struct ctl_sctx *, struct ctl_sess *, void *);
diff --git a/lib/bind/include/isc/dst.h b/lib/bind/include/isc/dst.h
index 4509f272..fe922972 100644
--- a/lib/bind/include/isc/dst.h
+++ b/lib/bind/include/isc/dst.h
@@ -12,72 +12,114 @@ typedef struct dst_key {
} DST_KEY;
#endif /* HAS_DST_KEY */
+/*
+ * do not taint namespace
+ */
+#define dst_bsafe_init __dst_bsafe_init
+#define dst_buffer_to_key __dst_buffer_to_key
+#define dst_check_algorithm __dst_check_algorithm
+#define dst_compare_keys __dst_compare_keys
+#define dst_cylink_init __dst_cylink_init
+#define dst_dnskey_to_key __dst_dnskey_to_key
+#define dst_eay_dss_init __dst_eay_dss_init
+#define dst_free_key __dst_free_key
+#define dst_generate_key __dst_generate_key
+#define dst_hmac_md5_init __dst_hmac_md5_init
+#define dst_init __dst_init
+#define dst_key_to_buffer __dst_key_to_buffer
+#define dst_key_to_dnskey __dst_key_to_dnskey
+#define dst_read_key __dst_read_key
+#define dst_rsaref_init __dst_rsaref_init
+#define dst_s_build_filename __dst_s_build_filename
+#define dst_s_calculate_bits __dst_s_calculate_bits
+#define dst_s_conv_bignum_b64_to_u8 __dst_s_conv_bignum_b64_to_u8
+#define dst_s_conv_bignum_u8_to_b64 __dst_s_conv_bignum_u8_to_b64
+#define dst_s_dns_key_id __dst_s_dns_key_id
+#define dst_s_dump __dst_s_dump
+#define dst_s_filename_length __dst_s_filename_length
+#define dst_s_fopen __dst_s_fopen
+#define dst_s_get_int16 __dst_s_get_int16
+#define dst_s_get_int32 __dst_s_get_int32
+#define dst_s_id_calc __dst_s_id_calc
+#define dst_s_put_int16 __dst_s_put_int16
+#define dst_s_put_int32 __dst_s_put_int32
+#define dst_s_quick_random __dst_s_quick_random
+#define dst_s_quick_random_set __dst_s_quick_random_set
+#define dst_s_random __dst_s_random
+#define dst_s_semi_random __dst_s_semi_random
+#define dst_s_verify_str __dst_s_verify_str
+#define dst_sig_size __dst_sig_size
+#define dst_sign_data __dst_sign_data
+#define dst_verify_data __dst_verify_data
+#define dst_write_key __dst_write_key
+
/*
* DST Crypto API defintions
*/
void dst_init(void);
int dst_check_algorithm(const int);
-int dst_sign_data(const int mode, /* specifies INIT/UPDATE/FINAL/ALL */
- DST_KEY *in_key, /* the key to use */
- void **context, /* pointer to state structure */
- const u_char *data, /* data to be signed */
- const int len, /* length of input data */
- u_char *signature, /* buffer to write signature to */
- const int sig_len); /* size of output buffer */
+int dst_sign_data(const int, /* specifies INIT/UPDATE/FINAL/ALL */
+ DST_KEY *, /* the key to use */
+ void **, /* pointer to state structure */
+ const u_char *, /* data to be signed */
+ const int, /* length of input data */
+ u_char *, /* buffer to write signature to */
+ const int); /* size of output buffer */
+
+int dst_verify_data(const int, /* specifies INIT/UPDATE/FINAL/ALL */
+ DST_KEY *, /* the key to use */
+ void **, /* pointer to state structure */
+ const u_char *, /* data to be verified */
+ const int, /* length of input data */
+ const u_char *, /* buffer containing signature */
+ const int); /* length of signature */
-int dst_verify_data(const int mode, /* specifies INIT/UPDATE/FINAL/ALL */
- DST_KEY *in_key, /* the key to use */
- void **context, /* pointer to state structure */
- const u_char *data, /* data to be verified */
- const int len, /* length of input data */
- const u_char *signature,/* buffer containing signature */
- const int sig_len); /* length of signature */
+DST_KEY *dst_read_key(const char *, /* name of key */
+ const u_int16_t, /* key tag identifier */
+ const int, /* key algorithm */
+ const int); /* Private/PublicKey wanted*/
-DST_KEY *dst_read_key(const char *in_name, /* name of key */
- const u_int16_t in_id, /* key tag identifier */
- const int in_alg, /* key algorithm */
- const int key_type); /* Private/PublicKey wanted*/
+int dst_write_key(const DST_KEY *, /* key to write out */
+ const int); /* Public/Private */
-int dst_write_key(const DST_KEY *key, /* key to write out */
- const int key_type); /* Public/Private */
+DST_KEY *dst_dnskey_to_key(const char *, /* KEY record name */
+ const u_char *, /* KEY RDATA */
+ const int); /* size of input buffer*/
-DST_KEY *dst_dnskey_to_key(const char *in_name, /* KEY record name */
- const u_char *key, /* KEY RDATA */
- const int len); /* size of input buffer*/
+int dst_key_to_dnskey(const DST_KEY *, /* key to translate */
+ u_char *, /* output buffer */
+ const int); /* size of out_storage*/
-int dst_key_to_dnskey(const DST_KEY *key, /* key to translate */
- u_char *out_storage, /* output buffer */
- const int out_len); /* size of out_storage*/
+DST_KEY *dst_buffer_to_key(const char *, /* name of the key */
+ const int, /* algorithm */
+ const int, /* dns flags */
+ const int, /* dns protocol */
+ const u_char *, /* key in dns wire fmt */
+ const int); /* size of key */
-DST_KEY *dst_buffer_to_key(const char *key_name, /* name of the key */
- const int alg, /* algorithm */
- const int flags, /* dns flags */
- const int protocol, /* dns protocol */
- const u_char *key_buf, /* key in dns wire fmt */
- const int key_len); /* size of key */
+int dst_key_to_buffer(DST_KEY *, u_char *, int);
-int dst_key_to_buffer(DST_KEY *key, u_char *out_buff, int buf_len);
+DST_KEY *dst_generate_key(const char *, /* name of new key */
+ const int, /* key algorithm to generate */
+ const int, /* size of new key */
+ const int, /* alg dependent parameter*/
+ const int, /* key DNS flags */
+ const int); /* key DNS protocol */
-DST_KEY *dst_generate_key(const char *name, /* name of new key */
- const int alg, /* key algorithm to generate */
- const int bits, /* size of new key */
- const int exp, /* alg dependent parameter*/
- const int flags, /* key DNS flags */
- const int protocol); /* key DNS protocol */
+DST_KEY *dst_free_key(DST_KEY *);
+int dst_compare_keys(const DST_KEY *, const DST_KEY *);
-DST_KEY *dst_free_key(DST_KEY *f_key);
-int dst_compare_keys(const DST_KEY *key1, const DST_KEY *key2);
+int dst_sig_size(DST_KEY *);
-int dst_sig_size(DST_KEY *key);
/* support for dns key tags/ids */
-u_int16_t dst_s_dns_key_id(const u_char *dns_key_rdata, const int rdata_len);
-u_int16_t dst_s_id_calc(const u_char *key_data, const int key_len);
+u_int16_t dst_s_dns_key_id(const u_char *, const int);
+u_int16_t dst_s_id_calc(const u_char *, const int);
/* Used by callers as well as by the library. */
#define RAW_KEY_SIZE 8192 /* large enough to store any key */
diff --git a/lib/bind/include/isc/eventlib.h b/lib/bind/include/isc/eventlib.h
index 4a3dc4b9..a182a1eb 100644
--- a/lib/bind/include/isc/eventlib.h
+++ b/lib/bind/include/isc/eventlib.h
@@ -18,7 +18,7 @@
/* eventlib.h - exported interfaces for eventlib
* vix 09sep95 [initial]
*
- * $Id: eventlib.h,v 1.1 2001/03/29 06:31:36 marka Exp $
+ * $Id: eventlib.h,v 1.1.2.1 2003/06/27 03:51:38 marka Exp $
*/
#ifndef _EVENTLIB_H
@@ -50,14 +50,13 @@ typedef struct { void *opaque; } evEvent;
#define evInitID(id) ((id)->opaque = NULL)
#define evTestID(id) ((id).opaque != NULL)
-typedef void (*evConnFunc)__P((evContext ctx, void *uap, int fd,
- const void *la, int lalen,
- const void *ra, int ralen));
-typedef void (*evFileFunc)__P((evContext ctx, void *uap, int fd, int evmask));
-typedef void (*evStreamFunc)__P((evContext ctx, void *uap, int fd, int bytes));
-typedef void (*evTimerFunc)__P((evContext ctx, void *uap,
- struct timespec due, struct timespec inter));
-typedef void (*evWaitFunc)__P((evContext ctx, void *uap, const void *tag));
+typedef void (*evConnFunc)__P((evContext, void *, int, const void *, int,
+ const void *, int));
+typedef void (*evFileFunc)__P((evContext, void *, int, int));
+typedef void (*evStreamFunc)__P((evContext, void *, int, int));
+typedef void (*evTimerFunc)__P((evContext, void *,
+ struct timespec, struct timespec));
+typedef void (*evWaitFunc)__P((evContext, void *, const void *));
typedef struct { unsigned char mask[256/8]; } evByteMask;
#define EV_BYTEMASK_BYTE(b) ((b) / 8)
@@ -87,14 +86,14 @@ typedef struct { unsigned char mask[256/8]; } evByteMask;
#define evMainLoop __evMainLoop
#define evHighestFD __evHighestFD
-int evCreate __P((evContext *ctx));
-void evSetDebug __P((evContext ctx, int lev, FILE *out));
-int evDestroy __P((evContext ctx));
-int evGetNext __P((evContext ctx, evEvent *ev, int options));
-int evDispatch __P((evContext ctx, evEvent ev));
-void evDrop __P((evContext ctx, evEvent ev));
-int evMainLoop __P((evContext ctx));
-int evHighestFD __P((evContext ctx));
+int evCreate __P((evContext *));
+void evSetDebug __P((evContext, int, FILE *));
+int evDestroy __P((evContext));
+int evGetNext __P((evContext, evEvent *, int));
+int evDispatch __P((evContext, evEvent));
+void evDrop __P((evContext, evEvent));
+int evMainLoop __P((evContext));
+int evHighestFD __P((evContext));
/* ev_connects.c */
#define evListen __evListen
@@ -104,11 +103,10 @@ int evHighestFD __P((evContext ctx));
#define evUnhold __evUnhold
#define evTryAccept __evTryAccept
-int evListen __P((evContext ctx, int fd, int maxconn,
- evConnFunc func, void *uap, evConnID *id));
-int evConnect __P((evContext ctx, int fd, const void *ra, int ralen,
- evConnFunc func, void *uap, evConnID *id));
-int evCancelConn __P((evContext ctx, evConnID id));
+int evListen __P((evContext, int, int, evConnFunc, void *, evConnID *));
+int evConnect __P((evContext, int, const void *, int,
+ evConnFunc, void *, evConnID *));
+int evCancelConn __P((evContext, evConnID));
int evHold __P((evContext, evConnID));
int evUnhold __P((evContext, evConnID));
int evTryAccept __P((evContext, evConnID, int *));
@@ -117,9 +115,8 @@ int evTryAccept __P((evContext, evConnID, int *));
#define evSelectFD __evSelectFD
#define evDeselectFD __evDeselectFD
-int evSelectFD __P((evContext ctx, int fd, int eventmask,
- evFileFunc func, void *uap, evFileID *id));
-int evDeselectFD __P((evContext ctx, evFileID id));
+int evSelectFD __P((evContext, int, int, evFileFunc, void *, evFileID *));
+int evDeselectFD __P((evContext, evFileID));
/* ev_streams.c */
#define evConsIovec __evConsIovec
@@ -129,14 +126,14 @@ int evDeselectFD __P((evContext ctx, evFileID id));
#define evUntimeRW __evUntimeRW
#define evCancelRW __evCancelRW
-struct iovec evConsIovec __P((void *buf, size_t cnt));
-int evWrite __P((evContext ctx, int fd, const struct iovec *iov, int cnt,
- evStreamFunc func, void *uap, evStreamID *id));
-int evRead __P((evContext ctx, int fd, const struct iovec *iov, int cnt,
- evStreamFunc func, void *uap, evStreamID *id));
-int evTimeRW __P((evContext ctx, evStreamID id, evTimerID timer));
-int evUntimeRW __P((evContext ctx, evStreamID id));
-int evCancelRW __P((evContext ctx, evStreamID id));
+struct iovec evConsIovec __P((void *, size_t));
+int evWrite __P((evContext, int, const struct iovec *, int,
+ evStreamFunc func, void *, evStreamID *));
+int evRead __P((evContext, int, const struct iovec *, int,
+ evStreamFunc func, void *, evStreamID *));
+int evTimeRW __P((evContext, evStreamID, evTimerID timer));
+int evUntimeRW __P((evContext, evStreamID));
+int evCancelRW __P((evContext, evStreamID));
/* ev_timers.c */
#define evConsTime __evConsTime
@@ -157,17 +154,16 @@ int evCancelRW __P((evContext ctx, evStreamID id));
#define evTouchIdleTimer __evTouchIdleTimer
struct timespec evConsTime __P((time_t sec, long nsec));
-struct timespec evAddTime __P((struct timespec add1, struct timespec add2));
-struct timespec evSubTime __P((struct timespec minu, struct timespec subtra));
+struct timespec evAddTime __P((struct timespec, struct timespec));
+struct timespec evSubTime __P((struct timespec, struct timespec));
struct timespec evNowTime __P((void));
struct timespec evLastEventTime __P((evContext));
struct timespec evTimeSpec __P((struct timeval));
struct timeval evTimeVal __P((struct timespec));
-int evCmpTime __P((struct timespec a, struct timespec b));
-int evSetTimer __P((evContext ctx, evTimerFunc func, void *uap,
- struct timespec due, struct timespec inter,
- evTimerID *id));
-int evClearTimer __P((evContext ctx, evTimerID id));
+int evCmpTime __P((struct timespec, struct timespec));
+int evSetTimer __P((evContext, evTimerFunc, void *, struct timespec,
+ struct timespec, evTimerID *));
+int evClearTimer __P((evContext, evTimerID));
int evResetTimer __P((evContext, evTimerID, evTimerFunc, void *,
struct timespec, struct timespec));
int evSetIdleTimer __P((evContext, evTimerFunc, void *, struct timespec,
@@ -183,10 +179,9 @@ int evTouchIdleTimer __P((evContext, evTimerID));
#define evUnwait __evUnwait
#define evDefer __evDefer
-int evWaitFor __P((evContext ctx, const void *tag, evWaitFunc func, void *uap,
- evWaitID *id));
-int evDo __P((evContext ctx, const void *tag));
-int evUnwait __P((evContext ctx, evWaitID id));
+int evWaitFor __P((evContext, const void *, evWaitFunc, void *, evWaitID *));
+int evDo __P((evContext, const void *));
+int evUnwait __P((evContext, evWaitID));
int evDefer __P((evContext, evWaitFunc, void *));
#ifdef __EVENTLIB_P_DEFINED
diff --git a/lib/bind/include/isc/irpmarshall.h b/lib/bind/include/isc/irpmarshall.h
index d851ecac..2b176bac 100644
--- a/lib/bind/include/isc/irpmarshall.h
+++ b/lib/bind/include/isc/irpmarshall.h
@@ -16,7 +16,7 @@
*/
/*
- * $Id: irpmarshall.h,v 1.1 2001/03/29 06:31:36 marka Exp $
+ * $Id: irpmarshall.h,v 1.1.2.1 2003/06/27 03:51:38 marka Exp $
*/
#ifndef _IRPMARSHALL_H_INCLUDED
@@ -45,24 +45,23 @@
(x == AF_INET6 ? "AF_INET6" : "UNKNOWN"))
/* See comment below on usage */
-int irp_marshall_pw(const struct passwd *pw, char **buffer, size_t *len);
-int irp_unmarshall_pw(struct passwd *pw, char *buffer);
-int irp_marshall_gr(const struct group *gr, char **buffer, size_t *len);
-int irp_unmarshall_gr(struct group *gr, char *buffer);
-int irp_marshall_sv(const struct servent *sv, char **buffer, size_t *len);
-int irp_unmarshall_sv(struct servent *sv, char *buffer);
-int irp_marshall_pr(struct protoent *pr, char **buffer, size_t *len);
-int irp_unmarshall_pr(struct protoent *pr, char *buffer);
-int irp_marshall_ho(struct hostent *ho, char **buffer, size_t *len);
-int irp_unmarshall_ho(struct hostent *ho, char *buffer);
-int irp_marshall_ng(const char *host, const char *user, const char *domain,
- char **buffer, size_t *len);
-int irp_unmarshall_ng(const char **host, const char **user,
- const char **domain, char *buffer);
-int irp_marshall_nw(struct nwent *ne, char **buffer, size_t *len);
-int irp_unmarshall_nw(struct nwent *ne, char *buffer);
-int irp_marshall_ne(struct netent *ne, char **buffer, size_t *len);
-int irp_unmarshall_ne(struct netent *ne, char *buffer);
+int irp_marshall_pw(const struct passwd *, char **, size_t *);
+int irp_unmarshall_pw(struct passwd *, char *);
+int irp_marshall_gr(const struct group *, char **, size_t *);
+int irp_unmarshall_gr(struct group *, char *);
+int irp_marshall_sv(const struct servent *, char **, size_t *);
+int irp_unmarshall_sv(struct servent *, char *);
+int irp_marshall_pr(struct protoent *, char **, size_t *);
+int irp_unmarshall_pr(struct protoent *, char *);
+int irp_marshall_ho(struct hostent *, char **, size_t *);
+int irp_unmarshall_ho(struct hostent *, char *);
+int irp_marshall_ng(const char *, const char *, const char *,
+ char **, size_t *);
+int irp_unmarshall_ng(const char **, const char **, const char **, char *);
+int irp_marshall_nw(struct nwent *, char **, size_t *);
+int irp_unmarshall_nw(struct nwent *, char *);
+int irp_marshall_ne(struct netent *, char **, size_t *);
+int irp_unmarshall_ne(struct netent *, char *);
/*
* Functions to marshall and unmarshall various system data structures. We
diff --git a/lib/bind/include/isc/logging.h b/lib/bind/include/isc/logging.h
index 6d6976f1..dc491dc0 100644
--- a/lib/bind/include/isc/logging.h
+++ b/lib/bind/include/isc/logging.h
@@ -80,12 +80,15 @@ FILE * log_get_stream(log_channel);
char * log_get_filename(log_channel);
int log_check_channel(log_context, int, log_channel);
int log_check(log_context, int, int);
-void log_vwrite(log_context, int, int, const char *,
- va_list args);
#ifdef __GNUC__
+void log_vwrite(log_context, int, int, const char *,
+ va_list args)
+ __attribute__((__format__(__printf__, 4, 0)));
void log_write(log_context, int, int, const char *, ...)
__attribute__((__format__(__printf__, 4, 5)));
#else
+void log_vwrite(log_context, int, int, const char *,
+ va_list args);
void log_write(log_context, int, int, const char *, ...);
#endif
int log_new_context(int, char **, log_context *);
diff --git a/lib/bind/include/isc/misc.h b/lib/bind/include/isc/misc.h
index b75121d4..3d35a04d 100644
--- a/lib/bind/include/isc/misc.h
+++ b/lib/bind/include/isc/misc.h
@@ -16,7 +16,7 @@
*/
/*
- * $Id: misc.h,v 1.2 2001/06/21 08:26:05 marka Exp $
+ * $Id: misc.h,v 1.2.2.1 2003/06/27 03:51:38 marka Exp $
*/
#ifndef _ISC_MISC_H
@@ -27,7 +27,7 @@
#define bitncmp __bitncmp
/*#define isc_movefile __isc_movefile */
-extern int bitncmp(const void *l, const void *r, int n);
+extern int bitncmp(const void *, const void *, int);
extern int isc_movefile(const char *, const char *);
extern int isc_gethexstring(unsigned char *, size_t, int, FILE *,
diff --git a/lib/bind/include/isc/tree.h b/lib/bind/include/isc/tree.h
index f383489e..0572c407 100644
--- a/lib/bind/include/isc/tree.h
+++ b/lib/bind/include/isc/tree.h
@@ -3,7 +3,7 @@
* vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes]
* vix 27jun86 [broken out of tree.c]
*
- * $Id: tree.h,v 1.1 2001/03/29 06:31:37 marka Exp $
+ * $Id: tree.h,v 1.1.2.1 2003/06/27 03:51:39 marka Exp $
*/
@@ -28,6 +28,16 @@ typedef void *tree_t;
typedef char *tree_t;
#endif
+/*
+ * Do not taint namespace
+ */
+#define tree_add __tree_add
+#define tree_delete __tree_delete
+#define tree_init __tree_init
+#define tree_mung __tree_mung
+#define tree_srch __tree_srch
+#define tree_trav __tree_trav
+
typedef struct tree_s {
tree_t data;
diff --git a/lib/bind/include/netdb.h b/lib/bind/include/netdb.h
index d992ad7b..34d58c6e 100644
--- a/lib/bind/include/netdb.h
+++ b/lib/bind/include/netdb.h
@@ -86,7 +86,7 @@
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
- * $Id: netdb.h,v 1.12 2001/07/23 00:48:51 marka Exp $
+ * $Id: netdb.h,v 1.12.2.1 2003/06/27 03:51:37 marka Exp $
*/
#ifndef _NETDB_H_
@@ -192,7 +192,6 @@ struct addrinfo {
/*
* Error return codes from getaddrinfo()
*/
-
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
diff --git a/lib/bind/include/resolv.h b/lib/bind/include/resolv.h
index a16e7a2e..964cd6f2 100644
--- a/lib/bind/include/resolv.h
+++ b/lib/bind/include/resolv.h
@@ -50,7 +50,7 @@
/*
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
- * $Id: resolv.h,v 1.7.2.10 2002/08/02 03:19:36 marka Exp $
+ * $Id: resolv.h,v 1.7.2.11 2003/06/27 03:51:37 marka Exp $
*/
#ifndef _RESOLV_H_
@@ -75,7 +75,7 @@
* is new enough to contain a certain feature.
*/
-#define __RES 19991006
+#define __RES 20030124
/*
* This used to be defined in res_query.c, now it's in herror.c.
@@ -105,7 +105,7 @@ __END_DECLS
/*
* Resolver configuration file.
* Normally not present, but may contain the address of the
- * inital name server(s) to query and the domain search list.
+ * initial name server(s) to query and the domain search list.
*/
#ifndef _PATH_RESCONF
@@ -115,19 +115,13 @@ __END_DECLS
typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
res_sendhookact;
-typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr * const *ns,
- const u_char **query,
- int *querylen,
- u_char *ans,
- int anssiz,
- int *resplen));
+typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr * const *,
+ const u_char **, int *,
+ u_char *, int, int *));
-typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr *ns,
- const u_char *query,
- int querylen,
- u_char *ans,
- int anssiz,
- int *resplen));
+typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr *,
+ const u_char *, int, u_char *,
+ int, int *));
struct res_sym {
int number; /* Identifying number, like T_MX */
@@ -154,7 +148,7 @@ struct res_sym {
struct __res_state_ext;
struct __res_state {
- int retrans; /* retransmition time interval */
+ int retrans; /* retransmission time interval */
int retry; /* number of times to retransmit */
#ifdef sun
u_int options; /* option flags - see below. */
@@ -219,6 +213,10 @@ union res_sockaddr_union {
#define RES_F_VC 0x00000001 /* socket is TCP */
#define RES_F_CONN 0x00000002 /* socket is connected */
#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */
+#define RES_F__UNUSED 0x00000008 /* (unused) */
+#define RES_F_LASTMASK 0x000000F0 /* ordinal server of last res_nsend */
+#define RES_F_LASTSHIFT 4 /* bit position of LASTMASK "flag" */
+#define RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)
/* res_findzonecut2() options */
#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */
@@ -246,13 +244,10 @@ union res_sockaddr_union {
#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */
#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */
#define RES_BLAST 0x00020000 /* blast all recursive servers */
-#define RES_NO_NIBBLE 0x00040000 /* disable IPv6 nibble mode reverse */
-#define RES_NO_BITSTRING 0x00080000 /* disable IPv6 bitstring mode reverse */
#define RES_NOTLDQUERY 0x00100000 /* don't unqualified name as a tld */
#define RES_USE_DNSSEC 0x00200000 /* use DNSSEC using OK bit in OPT */
/* KAME extensions: use higher bit to avoid conflict with ISC use */
#define RES_USE_DNAME 0x10000000 /* use DNAME */
-#define RES_USE_A6 0x20000000 /* use A6 */
#define RES_USE_EDNS0 0x40000000 /* use EDNS0 if configured */
#define RES_NO_NIBBLE2 0x80000000 /* disable alternate nibble lookup */
@@ -361,6 +356,7 @@ extern const struct res_sym __p_rcode_syms[];
#define p_time __p_time
#define p_type __p_type
#define p_rcode __p_rcode
+#define p_sockun __p_sockun
#define putlong __putlong
#define putshort __putshort
#define res_dnok __res_dnok
@@ -392,6 +388,18 @@ extern const struct res_sym __p_rcode_syms[];
#define res_nametotype __res_nametotype
#define res_setservers __res_setservers
#define res_getservers __res_getservers
+#define res_buildprotolist __res_buildprotolist
+#define res_destroyprotolist __res_destroyprotolist
+#define res_destroyservicelist __res_destroyservicelist
+#define res_get_nibblesuffix __res_get_nibblesuffix
+#define res_get_nibblesuffix2 __res_get_nibblesuffix2
+#define res_ourserver_p __res_ourserver_p
+#define res_protocolname __res_protocolname
+#define res_protocolnumber __res_protocolnumber
+#define res_send_setqhook __res_send_setqhook
+#define res_send_setrhook __res_send_setrhook
+#define res_servicename __res_servicename
+#define res_servicenumber __res_servicenumber
__BEGIN_DECLS
int res_hnok __P((const char *));
int res_ownok __P((const char *));
@@ -402,25 +410,26 @@ const char * sym_ntos __P((const struct res_sym *, int, int *));
const char * sym_ntop __P((const struct res_sym *, int, int *));
int b64_ntop __P((u_char const *, size_t, char *, size_t));
int b64_pton __P((char const *, u_char *, size_t));
-int loc_aton __P((const char *ascii, u_char *binary));
-const char * loc_ntoa __P((const u_char *binary, char *ascii));
+int loc_aton __P((const char *, u_char *));
+const char * loc_ntoa __P((const u_char *, char *));
int dn_skipname __P((const u_char *, const u_char *));
void putlong __P((u_int32_t, u_char *));
void putshort __P((u_int16_t, u_char *));
#ifndef __ultrix__
-u_int16_t _getshort __P((const u_char *src));
-u_int32_t _getlong __P((const u_char *src));
+u_int16_t _getshort __P((const u_char *));
+u_int32_t _getlong __P((const u_char *));
#endif
const char * p_class __P((int));
const char * p_time __P((u_int32_t));
const char * p_type __P((int));
const char * p_rcode __P((int));
+const char * p_sockun __P((union res_sockaddr_union, char *, size_t));
const u_char * p_cdnname __P((const u_char *, const u_char *, int, FILE *));
const u_char * p_cdname __P((const u_char *, const u_char *, FILE *));
-const u_char * p_fqnname __P((const u_char *cp, const u_char *msg,
+const u_char * p_fqnname __P((const u_char *, const u_char *,
int, char *, int));
const u_char * p_fqname __P((const u_char *, const u_char *, FILE *));
-const char * p_option __P((u_long option));
+const char * p_option __P((u_long));
char * p_secstodate __P((u_long));
int dn_count_labels __P((const char *));
int dn_comp __P((const char *, u_char *, int,
@@ -428,11 +437,11 @@ int dn_comp __P((const char *, u_char *, int,
int dn_expand __P((const u_char *, const u_char *, const u_char *,
char *, int));
u_int res_randomid __P((void));
-int res_nameinquery __P((const char *, int, int,
- const u_char *, const u_char *));
+int res_nameinquery __P((const char *, int, int, const u_char *,
+ const u_char *));
int res_queriesmatch __P((const u_char *, const u_char *,
const u_char *, const u_char *));
-const char * p_section __P((int section, int opcode));
+const char * p_section __P((int, int));
/* Things involving a resolver context. */
int res_ninit __P((res_state));
int res_nisourserver __P((const res_state,
@@ -441,16 +450,15 @@ void fp_resstat __P((const res_state, FILE *));
void res_pquery __P((const res_state, const u_char *, int, FILE *));
const char * res_hostalias __P((const res_state, const char *,
char *, size_t));
-int res_nquery __P((res_state,
- const char *, int, int, u_char *, int));
-int res_nsearch __P((res_state, const char *, int,
- int, u_char *, int));
-int res_nquerydomain __P((res_state,
- const char *, const char *, int, int,
- u_char *, int));
-int res_nmkquery __P((res_state,
- int, const char *, int, int, const u_char *,
- int, const u_char *, u_char *, int));
+int res_nquery __P((res_state, const char *, int, int,
+ u_char *, int));
+int res_nsearch __P((res_state, const char *, int, int, u_char *,
+ int));
+int res_nquerydomain __P((res_state, const char *, const char *,
+ int, int, u_char *, int));
+int res_nmkquery __P((res_state, int, const char *, int, int,
+ const u_char *, int, const u_char *,
+ u_char *, int));
int res_nsend __P((res_state, const u_char *, int, u_char *, int));
int res_nsendsigned __P((res_state, const u_char *, int,
ns_tsig_key *, u_char *, int));
@@ -461,20 +469,19 @@ int res_findzonecut2 __P((res_state, const char *, ns_class, int,
union res_sockaddr_union *, int));
void res_nclose __P((res_state));
int res_nopt __P((res_state, int, u_char *, int, int));
-void res_send_setqhook __P((res_send_qhook hook));
-void res_send_setrhook __P((res_send_rhook hook));
+void res_send_setqhook __P((res_send_qhook));
+void res_send_setrhook __P((res_send_rhook));
int __res_vinit __P((res_state, int));
void res_destroyservicelist __P((void));
-const char * res_servicename __P((u_int16_t port, const char *proto));
-const char * res_protocolname __P((int num));
+const char * res_servicename __P((u_int16_t, const char *));
+const char * res_protocolname __P((int));
void res_destroyprotolist __P((void));
void res_buildprotolist __P((void));
const char * res_get_nibblesuffix __P((res_state));
const char * res_get_nibblesuffix2 __P((res_state));
-const char * res_get_bitstringsuffix __P((res_state));
void res_ndestroy __P((res_state));
-u_int16_t res_nametoclass __P((const char *buf, int *success));
-u_int16_t res_nametotype __P((const char *buf, int *success));
+u_int16_t res_nametoclass __P((const char *, int *));
+u_int16_t res_nametotype __P((const char *, int *));
void res_setservers __P((res_state,
const union res_sockaddr_union *, int));
int res_getservers __P((res_state,
diff --git a/lib/bind/irs/dns_gr.c b/lib/bind/irs/dns_gr.c
index a47ba1e4..a5d7bd5f 100644
--- a/lib/bind/irs/dns_gr.c
+++ b/lib/bind/irs/dns_gr.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: dns_gr.c,v 1.1 2001/03/29 06:31:42 marka Exp $";
+static const char rcsid[] = "$Id: dns_gr.c,v 1.1.2.1 2003/06/27 03:51:39 marka Exp $";
#endif
/*
@@ -226,7 +226,7 @@ get_hes_group(struct irs_gr *this, const char *name, const char *type) {
goto cleanup;
*cp++ = '\0';
- errno = -1;
+ errno = 0;
t = strtoul(cp, NULL, 10);
if (errno == ERANGE)
goto cleanup;
diff --git a/lib/bind/irs/dns_ho.c b/lib/bind/irs/dns_ho.c
index d90c6655..3ad0eee0 100644
--- a/lib/bind/irs/dns_ho.c
+++ b/lib/bind/irs/dns_ho.c
@@ -52,7 +52,7 @@
/* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: dns_ho.c,v 1.5.2.6 2002/07/14 04:31:43 marka Exp $";
+static const char rcsid[] = "$Id: dns_ho.c,v 1.5.2.7 2003/06/27 03:51:39 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/* Imports. */
@@ -95,7 +95,7 @@ static const char rcsid[] = "$Id: dns_ho.c,v 1.5.2.6 2002/07/14 04:31:43 marka E
#define MAXALIASES 35
#define MAXADDRS 35
-#define MAXPACKET (1024*64)
+#define MAXPACKET (65535) /* Maximum TCP message size */
#define BOUNDS_CHECK(ptr, count) \
if ((ptr) + (count) > eom) { \
@@ -172,15 +172,6 @@ static struct hostent * gethostans(struct irs_ho *this,
const struct addrinfo *pai);
static int add_hostent(struct pvt *pvt, char *bp, char **hap,
struct addrinfo *ai);
-static const u_char * ar_head(const u_char *, int, const u_char *,
- const u_char *, struct pvt *,
- int (*)(const char *));
-static struct addrinfo * a6_expand(const u_char *, const u_char *, int,
- const u_char *, const u_char *,
- const struct in6_addr *, int,
- const struct addrinfo *,
- struct pvt *, int (*)(const char *), int *);
-static const char *dname_subst(const char *, const char *, const char *);
static int init(struct irs_ho *this);
/* Exports. */
@@ -257,21 +248,19 @@ ho_byname2(struct irs_ho *this, const char *name, int af)
char tmp[NS_MAXDNAME];
const char *cp;
struct addrinfo ai;
- struct dns_res_target *q, *q2, *p;
+ struct dns_res_target *q, *p;
int querystate = RESQRY_FAIL;
if (init(this) == -1)
return (NULL);
q = memget(sizeof(*q));
- q2 = memget(sizeof(*q2));
- if (q == NULL || q2 == NULL) {
+ if (q == NULL) {
RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
errno = ENOMEM;
goto cleanup;
}
memset(q, 0, sizeof(q));
- memset(q2, 0, sizeof(q2));
switch (af) {
case AF_INET:
@@ -285,21 +274,10 @@ ho_byname2(struct irs_ho *this, const char *name, int af)
case AF_INET6:
size = IN6ADDRSZ;
q->qclass = C_IN;
- q->qtype = ns_t_a6;
+ q->qtype = T_AAAA;
q->answer = q->qbuf.buf;
q->anslen = sizeof(q->qbuf);
- q->next = q2;
-#ifdef RES_USE_A6
- if ((pvt->res->options & RES_USE_A6) == 0)
- q->action = RESTGT_IGNORE;
- else
-#endif
- q->action = RESTGT_DOALWAYS;
- q2->qclass = C_IN;
- q2->qtype = T_AAAA;
- q2->answer = q2->qbuf.buf;
- q2->anslen = sizeof(q2->qbuf);
- q2->action = RESTGT_AFTERFAILURE;
+ q->action = RESTGT_DOALWAYS;
break;
default:
RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
@@ -349,8 +327,6 @@ ho_byname2(struct irs_ho *this, const char *name, int af)
cleanup:
if (q != NULL)
memput(q, sizeof(*q));
- if (q2 != NULL)
- memput(q2, sizeof(*q2));
return(hp);
}
@@ -363,7 +339,7 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
struct hostent *hp = NULL;
struct addrinfo ai;
struct dns_res_target *q, *q2, *p;
- int n, size;
+ int n, size, i;
int querystate = RESQRY_FAIL;
if (init(this) == -1)
@@ -440,20 +416,36 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
if (q->action != RESTGT_IGNORE) {
qp = q->qname;
for (n = IN6ADDRSZ - 1; n >= 0; n--) {
- qp += SPRINTF((qp, "%x.%x.",
+ i = SPRINTF((qp, "%x.%x.",
uaddr[n] & 0xf,
(uaddr[n] >> 4) & 0xf));
+ if (i < 0)
+ abort();
+ qp += i;
}
+#ifdef HAVE_STRLCAT
+ strlcat(q->qname, res_get_nibblesuffix(pvt->res),
+ sizeof(q->qname));
+#else
strcpy(qp, res_get_nibblesuffix(pvt->res));
+#endif
}
if (q2->action != RESTGT_IGNORE) {
qp = q2->qname;
for (n = IN6ADDRSZ - 1; n >= 0; n--) {
- qp += SPRINTF((qp, "%x.%x.",
+ i = SPRINTF((qp, "%x.%x.",
uaddr[n] & 0xf,
(uaddr[n] >> 4) & 0xf));
+ if (i < 0)
+ abort();
+ qp += i;
}
+#ifdef HAVE_STRLCAT
+ strlcat(q->qname, res_get_nibblesuffix2(pvt->res),
+ sizeof(q->qname));
+#else
strcpy(qp, res_get_nibblesuffix2(pvt->res));
+#endif
}
break;
default:
@@ -563,7 +555,7 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
int n;
char tmp[NS_MAXDNAME];
const char *cp;
- struct dns_res_target *q, *q2, *q3, *p;
+ struct dns_res_target *q, *q2, *p;
struct addrinfo sentinel, *cur;
int querystate = RESQRY_FAIL;
@@ -575,42 +567,28 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
q = memget(sizeof(*q));
q2 = memget(sizeof(*q2));
- q3 = memget(sizeof(*q3));
- if (q == NULL || q2 == NULL || q3 == NULL) {
+ if (q == NULL || q2 == NULL) {
RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
errno = ENOMEM;
goto cleanup;
}
memset(q, 0, sizeof(q2));
memset(q2, 0, sizeof(q2));
- memset(q3, 0, sizeof(q3));
switch (pai->ai_family) {
case AF_UNSPEC:
/* prefer IPv6 */
q->qclass = C_IN;
- q->qtype = ns_t_a6;
+ q->qtype = T_AAAA;
q->answer = q->qbuf.buf;
q->anslen = sizeof(q->qbuf);
q->next = q2;
-#ifdef RES_USE_A6
- if ((pvt->res->options & RES_USE_A6) == 0)
- q->action = RESTGT_IGNORE;
- else
-#endif
- q->action = RESTGT_DOALWAYS;
+ q->action = RESTGT_DOALWAYS;
q2->qclass = C_IN;
- q2->qtype = T_AAAA;
+ q2->qtype = T_A;
q2->answer = q2->qbuf.buf;
q2->anslen = sizeof(q2->qbuf);
- q2->next = q3;
- /* try AAAA only when A6 query fails */
- q2->action = RESTGT_AFTERFAILURE;
- q3->qclass = C_IN;
- q3->qtype = T_A;
- q3->answer = q3->qbuf.buf;
- q3->anslen = sizeof(q3->qbuf);
- q3->action = RESTGT_DOALWAYS;
+ q2->action = RESTGT_DOALWAYS;
break;
case AF_INET:
q->qclass = C_IN;
@@ -621,21 +599,10 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
break;
case AF_INET6:
q->qclass = C_IN;
- q->qtype = ns_t_a6;
+ q->qtype = T_AAAA;
q->answer = q->qbuf.buf;
q->anslen = sizeof(q->qbuf);
- q->next = q2;
-#ifdef RES_USE_A6
- if ((pvt->res->options & RES_USE_A6) == 0)
- q->action = RESTGT_IGNORE;
- else
-#endif
- q->action = RESTGT_DOALWAYS;
- q2->qclass = C_IN;
- q2->qtype = T_AAAA;
- q2->answer = q2->qbuf.buf;
- q2->anslen = sizeof(q2->qbuf);
- q2->action = RESTGT_AFTERFAILURE;
+ q->action = RESTGT_DOALWAYS;
break;
default:
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY); /* better error? */
@@ -688,375 +655,9 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
memput(q, sizeof(*q));
if (q2 != NULL)
memput(q2, sizeof(*q2));
- if (q3 != NULL)
- memput(q3, sizeof(*q3));
return(sentinel.ai_next);
}
-static const u_char *
-ar_head(cp, count, msg, eom, pvt, name_ok)
- const u_char *cp, *msg, *eom;
- int count;
- struct pvt *pvt;
- int (*name_ok)(const char *);
-{
- int n;
- char buf[1024]; /* XXX */
-
- while (count-- > 0 && cp < eom) {
- n = dn_expand(msg, eom, cp, buf, sizeof(buf));
- if (n < 0 || !maybe_ok(pvt->res, buf, name_ok))
- goto end;
- cp += n; /* name */
- if (cp + 3 * INT16SZ + INT32SZ >= eom)
- goto end;
- cp += INT16SZ; /* type */
- cp += INT16SZ + INT32SZ; /* class, TTL */
- n = ns_get16(cp);
- cp += n + INT16SZ; /* len */
- }
- return(cp);
-
- end:
- return(eom); /* XXX */
-}
-
-/* XXX: too many arguments */
-static struct addrinfo *
-a6_expand(const u_char *ansbuf, const u_char *a6p,
- int a6len, const u_char *arp, const u_char *eom,
- const struct in6_addr *in6, int plen, const struct addrinfo *pai,
- struct pvt *pvt, int (*name_ok)(const char *), int *errorp)
-{
- struct in6_addr a;
- int n, pbyte, plen1, pbyte1, error = 0;
- const u_char *cp;
- struct addrinfo sentinel, *cur;
- char pname[1024], buf[1024]; /* XXX */
-
- *errorp = NETDB_SUCCESS;
- memset(&sentinel, 0, sizeof(sentinel));
- cur = &sentinel;
-
- /*
- * Validate A6 parameters.
- */
- if (a6len == 0) { /* an A6 record must contain at least 1 byte. */
- error = NO_RECOVERY;
- goto bad;
- }
- /* prefix length check. */
- if ((plen1 = *a6p) > 128) {
- error = NO_RECOVERY;
- goto bad;
- }
- if (plen1 > plen) {
- /*
- * New length must not be greater than old one.
- * Ignore the record as specified in RFC 2874
- * Section 3.1.2.
- */
- return(NULL); /* just ignore. */
- }
- /* boundary check for new plen and prefix addr */
- pbyte1 = (plen1 & ~7) / 8;
- if ((int)sizeof(struct in6_addr) - pbyte1 > a6len - 1) {
- error = NO_RECOVERY;
- goto bad;
- }
-
- /*
- * merge the new prefix portion.
- * <--- plen(bits) --->
- * <--- pbyte ---><-b->
- * 000000000000000pppppxxxxxxxxxxx(= in6, 0: unknown, x: known, p: pad)
- * PP++++++++(+ should be merged. P: padding, must be 0)
- * <-- plen1-->
- * <-pbyte1->
- * ^a6p+1
- * The result should be:
- * 0000000000PP++++++++xxxxxxxxxxx(= a)
- */
- pbyte = (plen & ~7) / 8;
- a = *in6;
- if (pbyte > pbyte1) {
- /* N.B. the case of "pbyte1 == 128" is implicitly excluded. */
- int b = plen % 8; /* = the length of "pp..." above */
- u_char c_hi, c_lo;
-
- memcpy(&a.s6_addr[pbyte1], a6p + 1, pbyte - pbyte1);
- if (b > 0) {
- c_hi = a6p[pbyte - pbyte1 + 1];
- c_lo = in6->s6_addr[pbyte];
- a.s6_addr[pbyte] =
- (c_hi & (0xff << (8 - b))) |
- ((0x00ff >> b) & c_lo);
- }
- }
-
-#if 0 /* for debug */
- if ((pvt->res->options & RES_DEBUG) != 0) {
- u_char ntopbuf[INET6_ADDRSTRLEN];
-
- inet_ntop(AF_INET6, &a, ntopbuf, sizeof(ntopbuf));
- printf("a6_expand: %s\\%d\n", ntopbuf, plen1);
- }
-#endif
-
- if (plen1 == 0) {
- /* Here is the end of A6 chain. make addrinfo, then return. */
- return(addr2addrinfo(pai, (const char *)&a));
- }
-
- /*
- * Expand the new prefix name. Since the prefix name must not be
- * compressed (RFC 2874 Section 3.1.1), we could use ns_name_ntop()
- * here if it had a stricter boundary check.
- */
- cp = a6p + 1 + (sizeof(*in6) - pbyte1);
- n = dn_expand(ansbuf, eom, cp, pname, sizeof(pname));
- if (n < 0 || !maybe_ok(pvt->res, pname, name_ok)) {
- error = NO_RECOVERY;
- goto bad;
- }
- if (cp + n != a6p + a6len) { /* length mismatch */
- error = NO_RECOVERY;
- goto bad;
- }
-
- /*
- * we need (more) additional section records, but no one is
- * available, which possibly means a malformed answer.
- */
- if (arp == NULL) {
- error = NO_RECOVERY; /* we can't resolve the chain. */
- goto bad;
- }
-
- /*
- * Loop thru the rest of the buffer, searching for the next A6 record
- * that has the same owner name as the prefix name. If found, then
- * recursively call this function to expand the whole A6 chain.
- */
- plen = plen1;
- for (cp = arp; cp != NULL && cp < eom; cp += n) {
- int class, type;
-
- n = dn_expand(ansbuf, eom, cp, buf, sizeof(buf));
- if (n < 0 || !maybe_ok(pvt->res, buf, name_ok)) {
- error = NO_RECOVERY;
- goto bad;
- }
- cp += n; /* name */
- if (cp + 3 * INT16SZ + INT32SZ > eom) {
- error = NO_RECOVERY;
- goto bad;
- }
- type = ns_get16(cp);
- cp += INT16SZ; /* type */
- class = ns_get16(cp);
- cp += INT16SZ + INT32SZ; /* class, TTL */
- n = ns_get16(cp);
- cp += INT16SZ; /* len */
- if (cp + n > eom) {
- error = NO_RECOVERY;
- goto bad;
- }
- if (class != C_IN || type != ns_t_a6) {
- /* we are only interested in A6 records. skip others */
- continue;
- }
-
- if (ns_samename(buf, pname) != 1) {
- continue;
- }
-
- /* Proceed to the next record in the chain. */
- cur->ai_next = a6_expand(ansbuf, cp, n, cp + n, eom,
- (const struct in6_addr *)&a,
- plen, pai, pvt, name_ok, &error);
- if (error != NETDB_SUCCESS)
- goto bad;
- while (cur && cur->ai_next)
- cur = cur->ai_next;
- }
-
- return(sentinel.ai_next);
-
- bad:
- *errorp = error;
- if (sentinel.ai_next)
- freeaddrinfo(sentinel.ai_next);
- return(NULL);
-}
-
-static const char *
-dname_subst(const char *qname0, const char *owner0, const char *target) {
- char owner[MAXDNAME];
- static char qname[MAXDNAME];
- const char blabelhead[] = "\\[x"; /* we can assume hex strings */
- int qlen, olen;
- int bufsiz = sizeof(qname);
-
- /* make local copies, which are canonicalized. */
- if (ns_makecanon(qname0, qname, sizeof(qname)) < 0 ||
- ns_makecanon(owner0, owner, sizeof(owner)) < 0)
- return(NULL);
- qlen = strlen(qname);
- olen = strlen(owner);
- /* from now on, do not refer to qname0 nor owner0. */
-
- /*
- * check if QNAME is a subdomain of OWNER.
- * XXX: currently, we only handle the following two cases:
- * (A) none of the labels are bitlabels, or
- * (B) both of the head labels are bitlabels (and the following
- * labels are NOT bitlabels).
- * If we pass the check, then subtract the remaining part from QNAME.
- * ex. (A) qname=www.foo.com,owner=foo.com => new qname=www.
- * (B) qname=\[x3ffe0501/32].foo.com,owner=\[x3ffe/16].foo.com
- * => new qname=\[x0501/16].
- */
- if (ns_samedomain(qname, owner)) { /* check (A) */
- /* at this point, qlen must not be smaller than olen */
- qname[qlen - olen] = 0;
- bufsiz -= (qlen - olen);
- } else { /* check (B) */
- char *parent0, *parent1;
- /* the following 3 have enough size to store 1 bitlabel */
- u_char qlabel[64], olabel[64], newlabel[64];
- int qlabellen, olabellen;
-
- if (strncmp(qname, blabelhead, 3) != 0 ||
- strncmp(owner, blabelhead, 3) != 0)
- return(NULL);
- /*
- * Both two begin with bitlabels. The succeeding parts
- * must exact match.
- */
- if ((parent0 = strchr(qname, '.')) == NULL ||
- (parent1 = strchr(owner, '.')) == NULL)
- return(NULL);
-
- /* ns_samename allows names to begin with '.' */
- if (ns_samename(parent0, parent1) != 1)
- return(NULL);
-
- /* cut the upper domain parts off. */
- *(parent0 + 1) = 0;
- *(parent1 + 1) = 0;
- /* convert the textual form into binary one. */
- if (ns_name_pton(qname, qlabel, sizeof(qlabel)) < 0 ||
- ns_name_pton(owner, olabel, sizeof(olabel)) < 0)
- return(NULL);
- if ((qlabellen = *(qlabel + 1)) == 0)
- qlabellen = 256;
- if ((olabellen = *(olabel + 1)) == 0)
- olabellen = 256;
- if (olabellen > qlabellen)
- return(NULL); /* owner does not contain qname. */
- else {
- int qplen = (qlabellen + 7) / 8;
- int oplen = (olabellen + 7) / 8;
- int sft = olabellen % 8;
- int nllen, n;
- u_char *qp, *op, *np;
-
- /* skip ELT and Count. */
- qp = qlabel + 2;
- op = olabel + 2;
-
- /* check if olabel is a "subdomain" of qlabel. */
- if (memcmp(qp, op, oplen - 1) != 0)
- return(NULL);
- if (sft > 0) {
- /* compare trailing bits (between 1 and 7) */
- if ((qp[qplen - 1] & (0xff << sft)) !=
- op[qplen - 1])
- return(NULL);
- }
-
- /* OK, get remaining bits from qlabel. */
- np = newlabel;
- if (olabellen == qlabellen) {
- /*
- * Two names (including bitlabels) are exactly
- * same. Discard the whole names.
- * XXX: ns_samename() above should exclude
- * this case...
- */
- qname[0] = 0;
- goto maketarget;
- }
- *np++ = 0x41; /* XXX hardcoding */
- *np++ = nllen = (qlabellen - olabellen);
- if (sft == 0) {
- /*
- * No alignment issue. can just use memcpy.
- * Note that the "else" part below contains
- * this case. We separate the two cases just
- * for efficiency.
- * We assume that ns_name_pton above ensures
- * QP does not contain trailing garbages.
- */
- memcpy(np, qp + oplen, qplen - oplen);
- np += qplen - oplen;
- *np = 0;
- } else {
- /*
- * copy the lower (8-SFT) bits of QP to the
- * upper (8-SFT) bits of NP, then copy the
- * upper SFT bits of QP+1 to the lower SFT bits
- * of NP, and so on...
- * if QP is xxxyyyyy zzzwww..., then
- * NP would be yyyyyzzz ...
- * Again, we assume QP does not contain
- * trailing garbages.
- */
- qp += (oplen - 1);
- while (nllen > 0) {
- *np = (*qp << sft) & 0xff;
- if ((nllen -= (8 - sft)) <= 0)
- break; /* done */
- qp++;
- *np |= ((*qp >> sft) & 0xff);
- np++;
- nllen -= sft;
- }
- *++np = 0;
- }
-
- /*
- * make a new bitlabel with the remaining bits.
- * Note that there's no buffer boundary issue, since
- * qlabel, olabel, and newlabel all have the same size.
- * ns_name_ntop() must not return 0, since we have
- * a non-empty bitlabel.
- */
- if ((n = ns_name_ntop(newlabel, qname, sizeof(qname)))
- <= 0)
- return(NULL);
- bufsiz -= n;
- if (qname[n - 1] != '.') { /* XXX no trailing dot */
- qname[n - 1] = '.';
- qname[n] = 0;
- bufsiz--;
- }
-
- }
- }
-
- maketarget:
- /*
- * Finally, append the remaining part (maybe empty) to the new target.
- */
- if (bufsiz < (int)strlen(target)) /* bufsiz takes care of the \0. */
- return(NULL);
- strcat(qname, target);
-
- return((const char *)qname);
-}
-
static void
ho_res_set(struct irs_ho *this, struct __res_state *res,
void (*free_res)(void *)) {
@@ -1092,7 +693,6 @@ gethostans(struct irs_ho *this,
char *bp, *ep, **ap, **hap;
char tbuf[MAXDNAME+1];
struct addrinfo sentinel, *cur, ai;
- const u_char *arp = NULL;
if (pai == NULL) abort();
if (ret_aip != NULL)
@@ -1103,7 +703,6 @@ gethostans(struct irs_ho *this,
tname = qname;
eom = ansbuf + anslen;
switch (qtype) {
- case ns_t_a6:
case T_A:
case T_AAAA:
case T_ANY: /* use T_ANY only for T_A/T_AAAA lookup */
@@ -1148,8 +747,7 @@ gethostans(struct irs_ho *this,
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
return (NULL);
}
- if (qtype == T_A || qtype == T_AAAA ||
- qtype == ns_t_a6 || qtype == T_ANY) {
+ if (qtype == T_A || qtype == T_AAAA || qtype == T_ANY) {
/* res_nsend() has already verified that the query name is the
* same as the one we sent; this just gets the expanded name
* (i.e., with the succeeding search-domain tacked on).
@@ -1193,8 +791,8 @@ gethostans(struct irs_ho *this,
continue;
}
eor = cp + n;
- if ((qtype == T_A || qtype == T_AAAA || qtype == ns_t_a6 ||
- qtype == T_ANY) && type == T_CNAME) {
+ if ((qtype == T_A || qtype == T_AAAA || qtype == T_ANY) &&
+ type == T_CNAME) {
if (haveanswer) {
int level = LOG_CRIT;
#ifdef LOG_SECURITY
@@ -1222,58 +820,16 @@ gethostans(struct irs_ho *this,
had_error++;
continue;
}
+#ifdef HAVE_STRLCPY
+ strlcpy(bp, tbuf, ep - bp);
+#else
strcpy(bp, tbuf);
+#endif
pvt->host.h_name = bp;
hname = bp;
bp += n;
continue;
}
- if (type == ns_t_dname) {
- const char *t0, *t;
-
- /*
- * just replace the query target; do not update the
- * alias list. (Or should we?)
- */
- t0 = (qtype == T_PTR) ? tname : hname;
-
- n = dn_expand(ansbuf, eor, cp, tbuf, sizeof(tbuf));
- if (n < 0 || !maybe_dnok(pvt->res, tbuf)) {
- had_error++;
- continue;
- }
-#ifdef RES_USE_DNAME
- if ((pvt ->res->options & RES_USE_DNAME) == 0) {
- cp += n;
- continue;
- }
-#endif
- if ((t = dname_subst(t0, bp, tbuf)) == NULL) {
- cp += n;
- continue;
- }
-#if 0 /* for debug */
- if ((pvt->res->options & RES_DEBUG) != 0) {
- printf("DNAME owner=%s, target=%s, next=%s\n",
- bp, tbuf, t);
- }
-#endif
- cp += n;
-
- n = strlen(t) + 1; /* for the \0 */
- if (n > (ep - bp)) {
- had_error++;
- continue;
- }
- strcpy(bp, t);
- if (qtype == T_PTR)
- tname = bp;
- else
- hname = bp;
- bp += n;
-
- continue;
- }
if (qtype == T_PTR && type == T_CNAME) {
n = dn_expand(ansbuf, eor, cp, tbuf, sizeof tbuf);
if (n < 0 || !maybe_dnok(pvt->res, tbuf)) {
@@ -1300,14 +856,17 @@ gethostans(struct irs_ho *this,
had_error++;
continue;
}
+#ifdef HAVE_STRLCPY
+ strlcpy(bp, tbuf, ep - bp);
+#else
strcpy(bp, tbuf);
+#endif
tname = bp;
bp += n;
continue;
}
if (qtype == T_ANY) {
- if (!(type == T_A || type == T_AAAA ||
- type == ns_t_a6)) {
+ if (!(type == T_A || type == T_AAAA)) {
cp += n;
continue;
}
@@ -1346,66 +905,6 @@ gethostans(struct irs_ho *this,
bp += n;
}
break;
- case ns_t_a6: {
- struct in6_addr in6;
- struct addrinfo ai;
-
-#ifdef RES_USE_A6
- if ((pvt->res->options & RES_USE_A6) == 0) {
- cp += n;
- continue;
- }
-#endif
-
- if (ns_samename(hname, bp) != 1) {
- cp += n;
- continue;
- }
-
- /*
- * search for the top of the additional section.
- * once found, keep it for the case where we have
- * more than one A6 record.
- * XXX: however, we may not need this part.
- */
- if (arp == NULL && arcount > 0) {
- int nscount = ntohs(hp->nscount);
-
- arp = ar_head(cp + n, nscount + ancount - 1,
- ansbuf, eom, pvt, name_ok);
- }
-
- /* recursively collect the whole A6 chain */
- ai = *pai; /* XXX: we can't override constant pai */
- ai.ai_family = AF_INET6;
- memset(&in6, 0, sizeof(in6)); /* just for safety */
- cur->ai_next = a6_expand(ansbuf, cp, n, arp, eom,
- &in6, 128,
- (const struct addrinfo *)&ai,
- pvt, name_ok, &error);
- if (error != NETDB_SUCCESS) {
-#ifdef DEBUG
- /* in this case, cur->ai_next must be NULL. */
- if (cur->ai_next != NULL)
- abort();
-#endif
- had_error++;
- continue;
- }
-
- /*
- * We don't bother even if cur->ai_next is NULL unless
- * the expansion failed by a fatal error. The list
- * can be NULL if the given A6 is incomplete, but we
- * may have another complete A6 chain in this answer.
- * See the last paragraph of RFC 2874 Section 3.1.4.
- */
- if (cur->ai_next == NULL) {
- cp += n;
- continue; /* no error, no answer */
- }
- goto convertinfo;
- } /* FALLTHROUGH */
case T_A:
case T_AAAA:
if (ns_samename(hname, bp) != 1) {
@@ -1430,7 +929,6 @@ gethostans(struct irs_ho *this,
if (cur->ai_next == NULL)
had_error++;
- convertinfo: /* convert addrinfo into hostent form */
if (!haveanswer) {
int nn;
@@ -1471,7 +969,7 @@ gethostans(struct irs_ho *this,
continue;
if (hap < &pvt->h_addr_ptrs[MAXADDRS-1])
hap++;
-
+ *hap = NULL;
bp += m;
}
@@ -1498,7 +996,11 @@ gethostans(struct irs_ho *this,
n = strlen(qname) + 1; /* for the \0 */
if (n > (ep - bp) || n >= MAXHOSTNAMELEN)
goto no_recovery;
+#ifdef HAVE_STRLCPY
+ strlcpy(bp, qname, ep - bp);
+#else
strcpy(bp, qname);
+#endif
pvt->host.h_name = bp;
bp += n;
}
diff --git a/lib/bind/irs/dns_nw.c b/lib/bind/irs/dns_nw.c
index 197de7e1..805c447c 100644
--- a/lib/bind/irs/dns_nw.c
+++ b/lib/bind/irs/dns_nw.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: dns_nw.c,v 1.3.2.3 2002/07/11 05:55:05 marka Exp $";
+static const char rcsid[] = "$Id: dns_nw.c,v 1.3.2.4 2003/06/27 03:51:39 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/* Imports. */
@@ -349,7 +349,12 @@ get1101answer(struct irs_nw *this,
RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
return (NULL);
}
+#ifdef HAVE_STRLCPY
+ strlcpy(bp, name, ep - bp);
+ pvt->net.n_name = bp;
+#else
pvt->net.n_name = strcpy(bp, name);
+#endif
bp += n;
}
break;
@@ -522,37 +527,37 @@ get1101mask(struct irs_nw *this, struct nwent *nwent) {
static int
make1101inaddr(const u_char *net, int bits, char *name, int size) {
int n, m;
+ char *ep;
+
+ ep = name + size;
/* Zero fill any whole bytes left out of the prefix. */
for (n = (32 - bits) / 8; n > 0; n--) {
- if (size < (int)(sizeof "0."))
+ if (ep - name < (int)(sizeof "0."))
goto emsgsize;
m = SPRINTF((name, "0."));
name += m;
- size -= m;
}
/* Format the partial byte, if any, within the prefix. */
if ((n = bits % 8) != 0) {
- if (size < (int)(sizeof "255."))
+ if (ep - name < (int)(sizeof "255."))
goto emsgsize;
m = SPRINTF((name, "%u.",
net[bits / 8] & ~((1 << (8 - n)) - 1)));
name += m;
- size -= m;
}
/* Format the whole bytes within the prefix. */
for (n = bits / 8; n > 0; n--) {
- if (size < (int)(sizeof "255."))
+ if (ep - name < (int)(sizeof "255."))
goto emsgsize;
m = SPRINTF((name, "%u.", net[n - 1]));
name += m;
- size -= m;
}
/* Add the static text. */
- if (size < (int)(sizeof "in-addr.arpa"))
+ if (ep - name < (int)(sizeof "in-addr.arpa"))
goto emsgsize;
(void) SPRINTF((name, "in-addr.arpa"));
return (0);
diff --git a/lib/bind/irs/gen_gr.c b/lib/bind/irs/gen_gr.c
index cb1c926c..0829da40 100644
--- a/lib/bind/irs/gen_gr.c
+++ b/lib/bind/irs/gen_gr.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: gen_gr.c,v 1.4 2001/06/07 02:14:52 marka Exp $";
+static const char rcsid[] = "$Id: gen_gr.c,v 1.4.2.1 2003/06/27 03:51:39 marka Exp $";
#endif
/* Imports */
@@ -324,7 +324,7 @@ gr_res_set(struct irs_gr *this, struct __res_state *res,
static void
grmerge(struct irs_gr *this, const struct group *src, int preserve) {
struct pvt *pvt = (struct pvt *)this->private;
- char *cp, **m, **p, *oldmembuf;
+ char *cp, **m, **p, *oldmembuf, *ep;
int n, ndst, nnew;
size_t used;
@@ -379,6 +379,7 @@ grmerge(struct irs_gr *this, const struct group *src, int preserve) {
/* No harm done, no work done. */
return;
}
+ ep = cp + used + n;
if (used != 0)
memcpy(cp, pvt->membuf, used);
oldmembuf = pvt->membuf;
@@ -400,7 +401,11 @@ grmerge(struct irs_gr *this, const struct group *src, int preserve) {
if (isnew(pvt->group.gr_mem, *m)) {
*p++ = cp;
*p = NULL;
+#ifdef HAVE_STRLCPY
+ strlcpy(cp, *m, ep - cp);
+#else
strcpy(cp, *m);
+#endif
cp += strlen(cp) + 1;
}
if (preserve) {
@@ -410,10 +415,18 @@ grmerge(struct irs_gr *this, const struct group *src, int preserve) {
(pvt->group.gr_passwd - oldmembuf);
} else {
pvt->group.gr_name = cp;
+#ifdef HAVE_STRLCPY
+ strlcpy(cp, src->gr_name, ep - cp);
+#else
strcpy(cp, src->gr_name);
+#endif
cp += strlen(src->gr_name) + 1;
pvt->group.gr_passwd = cp;
+#ifdef HAVE_STRLCPY
+ strlcpy(cp, src->gr_passwd, ep - cp);
+#else
strcpy(cp, src->gr_passwd);
+#endif
cp += strlen(src->gr_passwd) + 1;
}
if (oldmembuf != NULL)
diff --git a/lib/bind/irs/getaddrinfo.c b/lib/bind/irs/getaddrinfo.c
index 243f1065..89db519f 100644
--- a/lib/bind/irs/getaddrinfo.c
+++ b/lib/bind/irs/getaddrinfo.c
@@ -101,17 +101,12 @@
#include <stdarg.h>
#include <irs.h>
+#include <isc/assertions.h>
#include "port_after.h"
#include "irs_data.h"
-/*
- * if we enable it, we will see duplicated addrinfo entries on reply if both
- * AAAA and A6 records are found. disable it for default installation.
- */
-#undef T_A6
-
#define SUCCESS 0
#define ANY 0
#define YES 1
@@ -192,7 +187,8 @@ static int get_portmatch __P((const struct addrinfo *, const char *));
static int get_port __P((const struct addrinfo *, const char *, int));
static const struct afd *find_afd __P((int));
static int addrconfig __P((int));
-static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *));
+static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *,
+ u_int32_t *scopeidp));
static struct net_data *init __P((void));
struct addrinfo *hostent2addrinfo __P((struct hostent *,
@@ -297,8 +293,9 @@ str_isnumber(p)
if (*p == '\0')
return NO;
ep = NULL;
+ errno = 0;
(void)strtoul(p, &ep, 10);
- if (ep && *ep == '\0')
+ if (errno == 0 && ep && *ep == '\0')
return YES;
else
return NO;
@@ -595,7 +592,7 @@ explore_fqdn(pai, hostname, servname, res)
char tmp[NS_MAXDNAME];
const char *cp;
- result = NULL;
+ INSIST(res != NULL && *res == NULL);
/*
* if the servname does not match socktype/protocol, ignore it.
@@ -854,13 +851,13 @@ explore_numeric_scope(pai, hostname, servname, res)
error = explore_numeric(pai, addr, servname, res);
if (error == 0) {
- int scopeid;
+ u_int32_t scopeid = 0;
for (cur = *res; cur; cur = cur->ai_next) {
if (cur->ai_family != AF_INET6)
continue;
sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr;
- if ((scopeid = ip6_str2scopeid(scope, sin6)) == -1) {
+ if (!ip6_str2scopeid(scope, sin6, &scopeid)) {
free(hostname2);
return(EAI_NONAME); /* XXX: is return OK? */
}
@@ -990,7 +987,17 @@ get_port(const struct addrinfo *ai, const char *servname, int matchonly) {
allownumeric = 1;
break;
case ANY:
- allownumeric = 0;
+ switch (ai->ai_family) {
+ case AF_INET:
+#ifdef AF_INET6
+ case AF_INET6:
+#endif
+ allownumeric = 1;
+ break;
+ default:
+ allownumeric = 0;
+ break;
+ }
break;
default:
return EAI_SOCKTYPE;
@@ -999,9 +1006,10 @@ get_port(const struct addrinfo *ai, const char *servname, int matchonly) {
if (str_isnumber(servname)) {
if (!allownumeric)
return EAI_SERVICE;
- port = htons(atoi(servname));
+ port = atoi(servname);
if (port < 0 || port > 65535)
return EAI_SERVICE;
+ port = htons(port);
} else {
switch (ai->ai_socktype) {
case SOCK_DGRAM:
@@ -1075,17 +1083,17 @@ addrconfig(af)
/* convert a string to a scope identifier. XXX: IPv6 specific */
static int
-ip6_str2scopeid(scope, sin6)
- char *scope;
- struct sockaddr_in6 *sin6;
+ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6,
+ u_int32_t *scopeidp)
{
- int scopeid;
+ u_int32_t scopeid;
+ u_long lscopeid;
struct in6_addr *a6 = &sin6->sin6_addr;
char *ep;
-
+
/* empty scopeid portion is invalid */
if (*scope == '\0')
- return -1;
+ return (0);
#ifdef USE_IFNAMELINKID
if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) {
@@ -1096,8 +1104,8 @@ ip6_str2scopeid(scope, sin6)
*/
scopeid = if_nametoindex(scope);
if (scopeid == 0)
- goto trynumeric;
- return(scopeid);
+ *scopeidp = scopeid;
+ return (1);
}
#endif
@@ -1111,11 +1119,14 @@ ip6_str2scopeid(scope, sin6)
/* try to convert to a numeric id as a last resort */
trynumeric:
- scopeid = (int)strtoul(scope, &ep, 10);
- if (*ep == '\0')
- return scopeid;
- else
- return -1;
+ errno = 0;
+ lscopeid = strtoul(scope, &ep, 10);
+ scopeid = lscopeid & 0xffffffff;
+ if (errno == 0 && ep && *ep == '\0' && scopeid == lscopeid) {
+ *scopeidp = scopeid;
+ return (1);
+ } else
+ return (0);
}
struct addrinfo *
diff --git a/lib/bind/irs/gethostent.c b/lib/bind/irs/gethostent.c
index 02f5b0b5..855cb164 100644
--- a/lib/bind/irs/gethostent.c
+++ b/lib/bind/irs/gethostent.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: gethostent.c,v 1.1.2.1 2002/07/10 06:36:26 marka Exp $";
+static const char rcsid[] = "$Id: gethostent.c,v 1.1.2.2 2003/06/27 03:51:40 marka Exp $";
#endif
/* Imports */
@@ -482,7 +482,7 @@ freehostent(struct hostent *he) {
#define LIFREQ lifreq
#endif
-static int
+static void
scan_interfaces6(int *have_v4, int *have_v6) {
struct LIFCONF lifc;
struct LIFREQ lifreq;
@@ -492,12 +492,9 @@ scan_interfaces6(int *have_v4, int *have_v6) {
static unsigned int bufsiz = 4095;
int s, cpsize, n;
- /* Set to zero. Used as loop terminators below. */
- *have_v4 = *have_v6 = 0;
-
/* Get interface list from system. */
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1)
- goto err_ret;
+ goto cleanup;
/*
* Grow buffer until large enough to contain all interface
@@ -506,7 +503,7 @@ scan_interfaces6(int *have_v4, int *have_v6) {
for (;;) {
buf = memget(bufsiz);
if (buf == NULL)
- goto err_ret;
+ goto cleanup;
#ifdef SETFAMILYFLAGS
lifc.lifc_family = AF_UNSPEC; /* request all families */
lifc.lifc_flags = 0;
@@ -526,10 +523,10 @@ scan_interfaces6(int *have_v4, int *have_v6) {
break;
}
if ((n == -1) && errno != EINVAL)
- goto err_ret;
+ goto cleanup;
if (bufsiz > 1000000)
- goto err_ret;
+ goto cleanup;
memput(buf, bufsiz);
bufsiz += 4096;
@@ -600,16 +597,42 @@ scan_interfaces6(int *have_v4, int *have_v6) {
memput(buf, bufsiz);
close(s);
/* printf("scan interface -> 4=%d 6=%d\n", *have_v4, *have_v6); */
- return (0);
- err_ret:
+ return;
+ cleanup:
if (buf != NULL)
memput(buf, bufsiz);
if (s != -1)
close(s);
/* printf("scan interface -> 4=%d 6=%d\n", *have_v4, *have_v6); */
- return (-1);
+ return;
}
+#endif
+#ifdef __linux
+#ifndef IF_NAMESIZE
+# ifdef IFNAMSIZ
+# define IF_NAMESIZE IFNAMSIZ
+# else
+# define IF_NAMESIZE 16
+# endif
+#endif
+static void
+scan_linux6(int *have_v6) {
+ FILE *proc = NULL;
+ char address[33];
+ char name[IF_NAMESIZE+1];
+ int ifindex, prefix, flag3, flag4;
+
+ proc = fopen("/proc/net/if_inet6", "r");
+ if (proc == NULL)
+ return;
+
+ if (fscanf(proc, "%32[a-f0-9] %x %x %x %x %16s\n",
+ address, &ifindex, &prefix, &flag3, &flag4, name) == 6)
+ *have_v6 = 1;
+ fclose(proc);
+ return;
+}
#endif
static int
@@ -626,17 +649,21 @@ scan_interfaces(int *have_v4, int *have_v6) {
int s, n;
size_t cpsize;
+ /* Set to zero. Used as loop terminators below. */
+ *have_v4 = *have_v6 = 0;
+
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
!defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
/*
* Try to scan the interfaces using IPv6 ioctls().
*/
- if (!scan_interfaces6(have_v4, have_v6))
+ scan_interfaces6(have_v4, have_v6);
+ if (*have_v4 != 0 && *have_v6 != 0)
return (0);
#endif
-
- /* Set to zero. Used as loop terminators below. */
- *have_v4 = *have_v6 = 0;
+#ifdef __linux
+ scan_linux6(have_v6);
+#endif
/* Get interface list from system. */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
diff --git a/lib/bind/irs/getnameinfo.c b/lib/bind/irs/getnameinfo.c
index 9b26c641..702b932b 100644
--- a/lib/bind/irs/getnameinfo.c
+++ b/lib/bind/irs/getnameinfo.c
@@ -44,6 +44,7 @@
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
+#include <net/if.h>
#include <netdb.h>
#include <resolv.h>
diff --git a/lib/bind/irs/getnetgrent.c b/lib/bind/irs/getnetgrent.c
index 07f39a75..3c57fcca 100644
--- a/lib/bind/irs/getnetgrent.c
+++ b/lib/bind/irs/getnetgrent.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: getnetgrent.c,v 1.1 2001/03/29 06:31:46 marka Exp $";
+static const char rcsid[] = "$Id: getnetgrent.c,v 1.1.2.1 2003/06/27 03:51:40 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/* Imports */
@@ -47,8 +47,11 @@ static struct net_data *init(void);
/* Public */
+#ifndef SETNETGRENT_ARGS
+#define SETNETGRENT_ARGS const char *netgroup
+#endif
void
-setnetgrent(const char *netgroup) {
+setnetgrent(SETNETGRENT_ARGS) {
struct net_data *net_data = init();
setnetgrent_p(netgroup, net_data);
@@ -61,19 +64,31 @@ endnetgrent(void) {
endnetgrent_p(net_data);
}
+#ifndef INNETGR_ARGS
+#define INNETGR_ARGS const char *netgroup, const char *host, \
+ const char *user, const char *domain
+#endif
int
-innetgr(const char *netgroup, const char *host,
- const char *user, const char *domain) {
+innetgr(INNETGR_ARGS) {
struct net_data *net_data = init();
return (innetgr_p(netgroup, host, user, domain, net_data));
}
int
-getnetgrent(const char **host, const char **user, const char **domain) {
+getnetgrent(char **host, char **user, char **domain) {
struct net_data *net_data = init();
+ const char *ch, *cu, *cd;
+ int ret;
- return (getnetgrent_p(host, user, domain, net_data));
+ ret = getnetgrent_p(&ch, &cu, &cd, net_data);
+ if (ret != 1)
+ return (ret);
+
+ DE_CONST(ch, *host);
+ DE_CONST(cu, *user);
+ DE_CONST(cd, *domain);
+ return (ret);
}
/* Shared private. */
diff --git a/lib/bind/irs/getnetgrent_r.c b/lib/bind/irs/getnetgrent_r.c
index d3130e75..08390600 100644
--- a/lib/bind/irs/getnetgrent_r.c
+++ b/lib/bind/irs/getnetgrent_r.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.5 2001/07/04 04:51:05 marka Exp $";
+static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.5.2.1 2003/06/27 03:51:40 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <port_before.h>
@@ -40,9 +40,15 @@ copy_protoent(char **, char **, char **, const char *, const char *,
NGR_R_RETURN
innetgr_r(const char *netgroup, const char *host, const char *user,
- const char *domain) {
+ const char *domain) {
+ char *ng, *ho, *us, *dom;
- return (innetgr(netgroup, host, user, domain));
+ DE_CONST(netgroup, ng);
+ DE_CONST(host, ho);
+ DE_CONST(user, us);
+ DE_CONST(domain, dom);
+
+ return (innetgr(ng, ho, us, dom));
}
/*
@@ -53,7 +59,7 @@ innetgr_r(const char *netgroup, const char *host, const char *user,
NGR_R_RETURN
getnetgrent_r(char **machinep, char **userp, char **domainp, NGR_R_ARGS) {
- const char *mp, *up, *dp;
+ char *mp, *up, *dp;
int res = getnetgrent(&mp, &up, &dp);
if (res != 1)
diff --git a/lib/bind/irs/hesiod.c b/lib/bind/irs/hesiod.c
index 242e875f..0ac8612c 100644
--- a/lib/bind/irs/hesiod.c
+++ b/lib/bind/irs/hesiod.c
@@ -1,5 +1,5 @@
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: hesiod.c,v 1.1 2001/03/29 06:31:48 marka Exp $";
+static const char rcsid[] = "$Id: hesiod.c,v 1.1.2.1 2003/06/27 03:51:40 marka Exp $";
#endif
/*
@@ -98,8 +98,13 @@ hesiod_init(void **context) {
errno = ENOMEM;
goto cleanup;
}
+#ifdef HAVE_STRLCPY
+ strlcpy(ctx->LHS, DEF_LHS, strlen(DEF_LHS) + 1);
+ strlcpy(ctx->RHS, DEF_RHS, strlen(DEF_RHS) + 1);
+#else
strcpy(ctx->LHS, DEF_LHS);
strcpy(ctx->RHS, DEF_RHS);
+#endif
#else
goto cleanup;
#endif
@@ -109,18 +114,31 @@ hesiod_init(void **context) {
* variable.
*/
if ((cp = getenv("HES_DOMAIN")) != NULL) {
+ size_t RHSlen = strlen(cp) + 2;
if (ctx->RHS)
free(ctx->RHS);
- ctx->RHS = malloc(strlen(cp)+2);
+ ctx->RHS = malloc(RHSlen);
if (!ctx->RHS) {
errno = ENOMEM;
goto cleanup;
}
- if (cp[0] == '.')
+ if (cp[0] == '.') {
+#ifdef HAVE_STRLCPY
+ strlcpy(ctx->RHS, cp, RHSlen);
+#else
strcpy(ctx->RHS, cp);
- else {
+#endif
+ } else {
+#ifdef HAVE_STRLCPY
+ strlcpy(ctx->RHS, ".", RHSlen);
+#else
strcpy(ctx->RHS, ".");
+#endif
+#ifdef HAVE_STRLCAT
+ strlcat(ctx->RHS, cp, RHSlen);
+#else
strcat(ctx->RHS, cp);
+#endif
}
}
diff --git a/lib/bind/irs/irp_p.h b/lib/bind/irs/irp_p.h
index c95fcf6f..a7b74ae5 100644
--- a/lib/bind/irs/irp_p.h
+++ b/lib/bind/irs/irp_p.h
@@ -16,7 +16,7 @@
*/
/*
- * $Id: irp_p.h,v 1.1.2.1 2002/07/11 23:32:34 marka Exp $
+ * $Id: irp_p.h,v 1.1.2.2 2003/06/27 03:51:40 marka Exp $
*/
#ifndef _IRP_P_H_INCLUDED
@@ -53,8 +53,6 @@ char *irs_irp_read_body(struct irp_p *pvt, size_t *size);
int irs_irp_get_full_response(struct irp_p *pvt, int *code,
char *text, size_t textlen,
char **body, size_t *bodylen);
-int irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3);
-
extern int irp_log_errors;
diff --git a/lib/bind/irs/irs_data.c b/lib/bind/irs/irs_data.c
index d1bf75b0..c646fb95 100644
--- a/lib/bind/irs/irs_data.c
+++ b/lib/bind/irs/irs_data.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.1 2001/11/02 20:55:24 gson Exp $";
+static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.2 2003/06/27 03:51:40 marka Exp $";
#endif
#include "port_before.h"
@@ -38,6 +38,7 @@ static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.1 2001/11/02 20:55:24 gson
#endif
#include <irs.h>
+#include <stdlib.h>
#include "port_after.h"
@@ -97,6 +98,14 @@ net_data_destroy(void *p) {
(*net_data->ng->close)(net_data->ng);
net_data->ng = NULL;
}
+ if (net_data->ho_data != NULL) {
+ free(net_data->ho_data);
+ net_data->ho_data = NULL;
+ }
+ if (net_data->nw_data != NULL) {
+ free(net_data->nw_data);
+ net_data->nw_data = NULL;
+ }
(*net_data->irs->close)(net_data->irs);
memput(net_data, sizeof *net_data);
@@ -143,19 +152,27 @@ net_data_create(const char *conf_file) {
return (NULL);
memset(net_data, 0, sizeof (struct net_data));
- if ((net_data->irs = irs_gen_acc("", conf_file)) == NULL)
+ if ((net_data->irs = irs_gen_acc("", conf_file)) == NULL) {
+ memput(net_data, sizeof (struct net_data));
return (NULL);
+ }
#ifndef DO_PTHREADS
(*net_data->irs->res_set)(net_data->irs, &_res, NULL);
#endif
net_data->res = (*net_data->irs->res_get)(net_data->irs);
- if (net_data->res == NULL)
+ if (net_data->res == NULL) {
+ (*net_data->irs->close)(net_data->irs);
+ memput(net_data, sizeof (struct net_data));
return (NULL);
+ }
if ((net_data->res->options & RES_INIT) == 0 &&
- res_ninit(net_data->res) == -1)
+ res_ninit(net_data->res) == -1) {
+ (*net_data->irs->close)(net_data->irs);
+ memput(net_data, sizeof (struct net_data));
return (NULL);
+ }
return (net_data);
}
diff --git a/lib/bind/irs/nis_gr.c b/lib/bind/irs/nis_gr.c
index a617fd3e..a3a2a93e 100644
--- a/lib/bind/irs/nis_gr.c
+++ b/lib/bind/irs/nis_gr.c
@@ -49,7 +49,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: nis_gr.c,v 1.1 2001/03/29 06:31:51 marka Exp $";
+static const char rcsid[] = "$Id: nis_gr.c,v 1.1.2.1 2003/06/27 03:51:41 marka Exp $";
/* from getgrent.c 8.2 (Berkeley) 3/21/94"; */
/* from BSDI Id: getgrent.c,v 2.8 1996/05/28 18:15:14 bostic Exp $ */
#endif /* LIBC_SCCS and not lint */
@@ -286,7 +286,7 @@ makegroupent(struct irs_gr *this) {
goto cleanup;
*cp++ = '\0';
- errno = -1;
+ errno = 0;
t = strtoul(cp, NULL, 10);
if (errno == ERANGE)
goto cleanup;
diff --git a/lib/bind/irs/nis_ho.c b/lib/bind/irs/nis_ho.c
index 5d7c44c6..fa3032a7 100644
--- a/lib/bind/irs/nis_ho.c
+++ b/lib/bind/irs/nis_ho.c
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: nis_ho.c,v 1.2 2001/04/04 05:32:23 marka Exp $";
+static const char rcsid[] = "$Id: nis_ho.c,v 1.2.2.1 2003/06/27 03:51:41 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/* Imports */
@@ -87,6 +87,9 @@ static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
static /*const*/ char hosts_byname[] = "hosts.byname";
static /*const*/ char hosts_byaddr[] = "hosts.byaddr";
+static /*const*/ char ipnode_byname[] = "ipnode.byname";
+static /*const*/ char ipnode_byaddr[] = "ipnode.byaddr";
+static /*const*/ char yp_multi[] = "YP_MULTI_";
/* Forwards */
@@ -186,10 +189,33 @@ ho_byname2(struct irs_ho *this, const char *name, int af) {
return (NULL);
nisfree(pvt, do_val);
- DE_CONST(name, tmp);
- r = yp_match(pvt->nis_domain, hosts_byname, tmp,
+
+ strcpy(pvt->hostbuf, yp_multi);
+ strncat(pvt->hostbuf, name, sizeof(pvt->hostbuf) - sizeof(yp_multi));
+ pvt->hostbuf[sizeof(pvt->hostbuf) - 1] = '\0';
+ for (r = sizeof(yp_multi) - 1; pvt->hostbuf[r] != '\0'; r++)
+ if (isupper((unsigned char)pvt->hostbuf[r]))
+ tolower(pvt->hostbuf[r]);
+
+ tmp = pvt->hostbuf;
+ r = yp_match(pvt->nis_domain, ipnode_byname, tmp,
strlen(tmp), &pvt->curval_data, &pvt->curval_len);
if (r != 0) {
+ tmp = pvt->hostbuf + sizeof(yp_multi) - 1;
+ r = yp_match(pvt->nis_domain, ipnode_byname, tmp,
+ strlen(tmp), &pvt->curval_data, &pvt->curval_len);
+ }
+ if (r != 0) {
+ tmp = pvt->hostbuf;
+ r = yp_match(pvt->nis_domain, hosts_byname, tmp,
+ strlen(tmp), &pvt->curval_data, &pvt->curval_len);
+ }
+ if (r != 0) {
+ tmp = pvt->hostbuf + sizeof(yp_multi) - 1;
+ r = yp_match(pvt->nis_domain, hosts_byname, tmp,
+ strlen(tmp), &pvt->curval_data, &pvt->curval_len);
+ }
+ if (r != 0) {
RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);
return (NULL);
}
@@ -220,8 +246,11 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af) {
return (NULL);
}
nisfree(pvt, do_val);
- r = yp_match(pvt->nis_domain, hosts_byaddr, tmp, strlen(tmp),
+ r = yp_match(pvt->nis_domain, ipnode_byaddr, tmp, strlen(tmp),
&pvt->curval_data, &pvt->curval_len);
+ if (r != 0)
+ r = yp_match(pvt->nis_domain, hosts_byaddr, tmp, strlen(tmp),
+ &pvt->curval_data, &pvt->curval_len);
if (r != 0) {
RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);
return (NULL);
@@ -382,12 +411,35 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
/* Private */
+/*
+ipnodes:
+::1 localhost
+127.0.0.1 localhost
+1.2.3.4 FOO bar
+1.2.6.4 FOO bar
+1.2.6.5 host
+
+ipnodes.byname:
+YP_MULTI_localhost ::1,127.0.0.1 localhost
+YP_MULTI_foo 1.2.3.4,1.2.6.4 FOO bar
+YP_MULTI_bar 1.2.3.4,1.2.6.4 FOO bar
+host 1.2.6.5 host
+
+hosts.byname:
+localhost 127.0.0.1 localhost
+host 1.2.6.5 host
+YP_MULTI_foo 1.2.3.4,1.2.6.4 FOO bar
+YP_MULTI_bar 1.2.3.4,1.2.6.4 FOO bar
+*/
+
static struct hostent *
makehostent(struct irs_ho *this) {
struct pvt *pvt = (struct pvt *)this->private;
static const char spaces[] = " \t";
- char *cp, **q, *p;
- int af, len;
+ char *cp, **q, *p, *comma, *ap;
+ int af = 0, len = 0;
+ int multi = 0;
+ int addr = 0;
p = pvt->curval_data;
if ((cp = strpbrk(p, "#\n")) != NULL)
@@ -395,25 +447,40 @@ makehostent(struct irs_ho *this) {
if (!(cp = strpbrk(p, spaces)))
return (NULL);
*cp++ = '\0';
- if ((pvt->res->options & RES_USE_INET6) &&
- inet_pton(AF_INET6, p, pvt->host_addr) > 0) {
- af = AF_INET6;
- len = IN6ADDRSZ;
- } else if (inet_pton(AF_INET, p, pvt->host_addr) > 0) {
- if (pvt->res->options & RES_USE_INET6) {
- map_v4v6_address((char*)pvt->host_addr,
- (char*)pvt->host_addr);
+ ap = pvt->hostbuf;
+ do {
+ if ((comma = strchr(p, ',')) != NULL) {
+ *comma++ = '\0';
+ multi = 1;
+ }
+ if ((ap + IN6ADDRSZ) > (pvt->hostbuf + sizeof(pvt->hostbuf)))
+ break;
+ if ((pvt->res->options & RES_USE_INET6) &&
+ inet_pton(AF_INET6, p, ap) > 0) {
af = AF_INET6;
len = IN6ADDRSZ;
+ } else if (inet_pton(AF_INET, p, pvt->host_addr) > 0) {
+ if (pvt->res->options & RES_USE_INET6) {
+ map_v4v6_address((char*)pvt->host_addr, ap);
+ af = AF_INET6;
+ len = IN6ADDRSZ;
+ } else {
+ af = AF_INET;
+ len = INADDRSZ;
+ }
} else {
- af = AF_INET;
- len = INADDRSZ;
+ if (!multi)
+ return (NULL);
+ continue;
+ }
+ if (addr < MAXADDRS) {
+ pvt->h_addr_ptrs[addr++] = ap;
+ pvt->h_addr_ptrs[addr] = NULL;
+ ap += len;
}
- } else {
+ } while ((p = comma) != NULL);
+ if (ap == pvt->hostbuf)
return (NULL);
- }
- pvt->h_addr_ptrs[0] = (char *)pvt->host_addr;
- pvt->h_addr_ptrs[1] = NULL;
pvt->host.h_addr_list = pvt->h_addr_ptrs;
pvt->host.h_length = len;
pvt->host.h_addrtype = af;
diff --git a/lib/bind/isc/ctl_clnt.c b/lib/bind/isc/ctl_clnt.c
index cfe0d7e0..f0c391ab 100644
--- a/lib/bind/isc/ctl_clnt.c
+++ b/lib/bind/isc/ctl_clnt.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ctl_clnt.c,v 1.4 2001/06/06 01:56:32 marka Exp $";
+static const char rcsid[] = "$Id: ctl_clnt.c,v 1.4.2.1 2003/06/27 03:51:41 marka Exp $";
#endif /* not lint */
/*
@@ -185,7 +185,7 @@ ctl_client(evContext lev, const struct sockaddr *cap, size_t cap_len,
if (evConnect(lev, ctx->sock, (const struct sockaddr *)sap, sap_len,
conn_done, ctx, &ctx->coID) < 0) {
(*ctx->logger)(ctl_error, "%s: evConnect(fd %d): %s",
- me, (void *)ctx->sock, strerror(errno));
+ me, ctx->sock, strerror(errno));
fatal:
if (ctx != NULL) {
if (ctx->sock >= 0)
diff --git a/lib/bind/isc/ctl_srvr.c b/lib/bind/isc/ctl_srvr.c
index 1d2f449e..bb5a4674 100644
--- a/lib/bind/isc/ctl_srvr.c
+++ b/lib/bind/isc/ctl_srvr.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ctl_srvr.c,v 1.3 2001/04/03 06:42:30 marka Exp $";
+static const char rcsid[] = "$Id: ctl_srvr.c,v 1.3.2.1 2003/06/27 03:51:41 marka Exp $";
#endif /* not lint */
/*
@@ -252,7 +252,7 @@ ctl_server(evContext lev, const struct sockaddr *sap, size_t sap_len,
&ctx->acID) < 0) {
save_errno = errno;
(*ctx->logger)(ctl_error, "%s: evListen(fd %d): %s",
- me, (void *)ctx->sock, strerror(errno));
+ me, ctx->sock, strerror(errno));
close(ctx->sock);
memput(ctx, sizeof *ctx);
errno = save_errno;
diff --git a/lib/bind/isc/ev_files.c b/lib/bind/isc/ev_files.c
index 52802649..6f4b617d 100644
--- a/lib/bind/isc/ev_files.c
+++ b/lib/bind/isc/ev_files.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_files.c,v 1.3 2001/07/02 02:02:27 marka Exp $";
+static const char rcsid[] = "$Id: ev_files.c,v 1.3.2.1 2003/06/27 03:51:41 marka Exp $";
#endif
#include "port_before.h"
@@ -54,7 +54,7 @@ evSelectFD(evContext opaqueCtx,
int mode;
evPrintf(ctx, 1,
- "evSelectFD(ctx %#x, fd %d, mask 0x%x, func %#x, uap %#x)\n",
+ "evSelectFD(ctx %p, fd %d, mask 0x%x, func %p, uap %p)\n",
ctx, fd, eventmask, func, uap);
if (eventmask == 0 || (eventmask & ~EV_MASK_ALL) != 0)
EV_ERR(EINVAL);
diff --git a/lib/bind/isc/ev_timers.c b/lib/bind/isc/ev_timers.c
index 0a59ad1e..d293658c 100644
--- a/lib/bind/isc/ev_timers.c
+++ b/lib/bind/isc/ev_timers.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_timers.c,v 1.2 2001/06/27 03:55:46 marka Exp $";
+static const char rcsid[] = "$Id: ev_timers.c,v 1.2.2.1 2003/06/27 03:51:41 marka Exp $";
#endif
/* Import. */
@@ -152,10 +152,10 @@ evSetTimer(evContext opaqueCtx,
evTimer *id;
evPrintf(ctx, 1,
-"evSetTimer(ctx %#x, func %#x, uap %#x, due %d.%09ld, inter %d.%09ld)\n",
+"evSetTimer(ctx %p, func %p, uap %p, due %ld.%09ld, inter %ld.%09ld)\n",
ctx, func, uap,
- due.tv_sec, due.tv_nsec,
- inter.tv_sec, inter.tv_nsec);
+ (long)due.tv_sec, due.tv_nsec,
+ (long)inter.tv_sec, inter.tv_nsec);
/* due={0,0} is a magic cookie meaning "now." */
if (due.tv_sec == 0 && due.tv_nsec == 0L)
@@ -379,10 +379,10 @@ print_timer(void *what, void *uap) {
cur = what;
evPrintf(ctx, 7,
- " func %p, uap %p, due %d.%09ld, inter %d.%09ld\n",
+ " func %p, uap %p, due %ld.%09ld, inter %ld.%09ld\n",
cur->func, cur->uap,
- cur->due.tv_sec, cur->due.tv_nsec,
- cur->inter.tv_sec, cur->inter.tv_nsec);
+ (long)cur->due.tv_sec, cur->due.tv_nsec,
+ (long)cur->inter.tv_sec, cur->inter.tv_nsec);
}
static void
diff --git a/lib/bind/isc/ev_waits.c b/lib/bind/isc/ev_waits.c
index d6b15fa6..3dfebfda 100644
--- a/lib/bind/isc/ev_waits.c
+++ b/lib/bind/isc/ev_waits.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_waits.c,v 1.1 2001/03/29 06:31:54 marka Exp $";
+static const char rcsid[] = "$Id: ev_waits.c,v 1.1.2.1 2003/06/27 03:51:41 marka Exp $";
#endif
#include "port_before.h"
@@ -190,14 +190,14 @@ print_waits(evContext_p *ctx) {
evPrintf(ctx, 9, "wait waiting:\n");
for (wl = ctx->waitLists; wl != NULL; wl = wl->next) {
INSIST(wl->first != NULL);
- evPrintf(ctx, 9, " tag %#x:", wl->first->tag);
+ evPrintf(ctx, 9, " tag %p:", wl->first->tag);
for (this = wl->first; this != NULL; this = this->next)
- evPrintf(ctx, 9, " %#x", this);
+ evPrintf(ctx, 9, " %p", this);
evPrintf(ctx, 9, "\n");
}
evPrintf(ctx, 9, "wait done:");
for (this = ctx->waitDone.first; this != NULL; this = this->next)
- evPrintf(ctx, 9, " %#x", this);
+ evPrintf(ctx, 9, " %p", this);
evPrintf(ctx, 9, "\n");
}
diff --git a/lib/bind/isc/eventlib.c b/lib/bind/isc/eventlib.c
index 96337e38..668c004b 100644
--- a/lib/bind/isc/eventlib.c
+++ b/lib/bind/isc/eventlib.c
@@ -20,7 +20,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: eventlib.c,v 1.2 2001/06/27 03:55:47 marka Exp $";
+static const char rcsid[] = "$Id: eventlib.c,v 1.2.2.1 2003/06/27 03:51:41 marka Exp $";
#endif
#include "port_before.h"
@@ -291,12 +291,12 @@ evGetNext(evContext opaqueCtx, evEvent *opaqueEv, int options) {
}
evPrintf(ctx, 4,
- "pselect(%d, 0x%lx, 0x%lx, 0x%lx, %d.%09ld)\n",
+ "pselect(%d, 0x%lx, 0x%lx, 0x%lx, %ld.%09ld)\n",
ctx->fdMax+1,
(u_long)ctx->rdLast.fds_bits[0],
(u_long)ctx->wrLast.fds_bits[0],
(u_long)ctx->exLast.fds_bits[0],
- tp ? tp->tv_sec : -1,
+ tp ? (long)tp->tv_sec : -1L,
tp ? tp->tv_nsec : -1);
/* XXX should predict system's earliness and adjust. */
@@ -463,7 +463,7 @@ evDispatch(evContext opaqueCtx, evEvent opaqueEv) {
evAccept *this = ev->u.accept.this;
evPrintf(ctx, 5,
- "Dispatch.Accept: fd %d -> %d, func %#x, uap %#x\n",
+ "Dispatch.Accept: fd %d -> %d, func %p, uap %p\n",
this->conn->fd, this->fd,
this->conn->func, this->conn->uap);
errno = this->ioErrno;
@@ -480,7 +480,7 @@ evDispatch(evContext opaqueCtx, evEvent opaqueEv) {
int eventmask = ev->u.file.eventmask;
evPrintf(ctx, 5,
- "Dispatch.File: fd %d, mask 0x%x, func %#x, uap %#x\n",
+ "Dispatch.File: fd %d, mask 0x%x, func %p, uap %p\n",
this->fd, this->eventmask, this->func, this->uap);
(this->func)(opaqueCtx, this->uap, this->fd, eventmask);
#ifdef EVENTLIB_TIME_CHECKS
@@ -492,7 +492,7 @@ evDispatch(evContext opaqueCtx, evEvent opaqueEv) {
evStream *this = ev->u.stream.this;
evPrintf(ctx, 5,
- "Dispatch.Stream: fd %d, func %#x, uap %#x\n",
+ "Dispatch.Stream: fd %d, func %p, uap %p\n",
this->fd, this->func, this->uap);
errno = this->ioErrno;
(this->func)(opaqueCtx, this->uap, this->fd, this->ioDone);
@@ -504,7 +504,7 @@ evDispatch(evContext opaqueCtx, evEvent opaqueEv) {
case Timer: {
evTimer *this = ev->u.timer.this;
- evPrintf(ctx, 5, "Dispatch.Timer: func %#x, uap %#x\n",
+ evPrintf(ctx, 5, "Dispatch.Timer: func %p, uap %p\n",
this->func, this->uap);
(this->func)(opaqueCtx, this->uap, this->due, this->inter);
#ifdef EVENTLIB_TIME_CHECKS
@@ -516,7 +516,7 @@ evDispatch(evContext opaqueCtx, evEvent opaqueEv) {
evWait *this = ev->u.wait.this;
evPrintf(ctx, 5,
- "Dispatch.Wait: tag %#x, func %#x, uap %#x\n",
+ "Dispatch.Wait: tag %p, func %p, uap %p\n",
this->tag, this->func, this->uap);
(this->func)(opaqueCtx, this->uap, this->tag);
#ifdef EVENTLIB_TIME_CHECKS
diff --git a/lib/bind/isc/eventlib_p.h b/lib/bind/isc/eventlib_p.h
index ea4b21c3..cdec3510 100644
--- a/lib/bind/isc/eventlib_p.h
+++ b/lib/bind/isc/eventlib_p.h
@@ -18,7 +18,7 @@
/* eventlib_p.h - private interfaces for eventlib
* vix 09sep95 [initial]
*
- * $Id: eventlib_p.h,v 1.3 2001/07/03 06:49:54 marka Exp $
+ * $Id: eventlib_p.h,v 1.3.2.1 2003/06/27 03:51:41 marka Exp $
*/
#ifndef _EVENTLIB_P_H
@@ -198,7 +198,8 @@ typedef struct {
/* eventlib.c */
#define evPrintf __evPrintf
-void evPrintf(const evContext_p *ctx, int level, const char *fmt, ...);
+void evPrintf(const evContext_p *ctx, int level, const char *fmt, ...)
+ ISC_FORMAT_PRINTF(3, 4);
/* ev_timers.c */
#define evCreateTimers __evCreateTimers
diff --git a/lib/bind/isc/logging.c b/lib/bind/isc/logging.c
index cf191141..05874f4a 100644
--- a/lib/bind/isc/logging.c
+++ b/lib/bind/isc/logging.c
@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: logging.c,v 1.3 2001/06/21 08:26:15 marka Exp $";
+static const char rcsid[] = "$Id: logging.c,v 1.3.2.1 2003/06/27 03:51:41 marka Exp $";
#endif /* not lint */
#include "port_before.h"
@@ -282,6 +282,10 @@ log_vwrite(log_context lc, int category, int level, const char *format,
log_channel chan;
struct timeval tv;
struct tm *local_tm;
+#ifdef HAVE_TIME_R
+ struct tm tm_tmp;
+#endif
+ time_t tt;
const char *category_name;
const char *level_str;
char time_buf[256];
@@ -313,10 +317,11 @@ log_vwrite(log_context lc, int category, int level, const char *format,
if (gettimeofday(&tv, NULL) < 0) {
syslog(LOG_INFO, "gettimeofday failed in log_vwrite()");
} else {
+ tt = tv.tv_sec;
#ifdef HAVE_TIME_R
- localtime_r((time_t *)&tv.tv_sec, &local_tm);
+ local_tm = localtime_r(&tt, &tm_tmp);
#else
- local_tm = localtime((time_t *)&tv.tv_sec);
+ local_tm = localtime(&tt);
#endif
if (local_tm != NULL) {
sprintf(time_buf, "%02d-%s-%4d %02d:%02d:%02d.%03ld ",
diff --git a/lib/bind/libtool.m4 b/lib/bind/libtool.m4
index 2d9d1436..6f43c772 100644
--- a/lib/bind/libtool.m4
+++ b/lib/bind/libtool.m4
@@ -1884,7 +1884,7 @@ beos*)
shlibpath_var=LIBRARY_PATH
;;
-bsdi4*)
+bsdi[45]*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
diff --git a/lib/bind/make/rules.in b/lib/bind/make/rules.in
index 4a896330..0810bb2e 100644
--- a/lib/bind/make/rules.in
+++ b/lib/bind/make/rules.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: rules.in,v 1.3.2.1.4.1 2003/02/17 01:35:20 marka Exp $
+# $Id: rules.in,v 1.3.2.3 2003/05/12 06:39:53 marka Exp $
###
### Common Makefile rules for BIND 9.
@@ -126,7 +126,7 @@ MKDEP = ${SHELL} ${top_builddir}/make/mkdep
cleandir: distclean
clean distclean::
- rm -f *.@O@ *.lo *.la core *.core
+ rm -f *.@O@ *.lo *.la core *.core .depend
rm -rf .libs
distclean::
diff --git a/lib/bind/nameser/ns_name.c b/lib/bind/nameser/ns_name.c
index 04041199..c76719f9 100644
--- a/lib/bind/nameser/ns_name.c
+++ b/lib/bind/nameser/ns_name.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_name.c,v 1.3.2.2 2002/07/10 06:32:48 marka Exp $";
+static const char rcsid[] = "$Id: ns_name.c,v 1.3.2.4 2003/07/02 04:10:27 marka Exp $";
#endif
#include "port_before.h"
@@ -341,6 +341,10 @@ ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz)
dn = dst;
eom = dst + dstsiz;
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
while ((n = *cp++) != 0) {
if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
/* Some kind of compression pointer. */
@@ -788,7 +792,7 @@ decode_bitstring(const char **cpp, char *dn, const char *eom)
{
const char *cp = *cpp;
char *beg = dn, tc;
- int b, blen, plen;
+ int b, blen, plen, i;
if ((blen = (*cp & 0xff)) == 0)
blen = 256;
@@ -798,18 +802,34 @@ decode_bitstring(const char **cpp, char *dn, const char *eom)
return(-1);
cp++;
- dn += SPRINTF((dn, "\\[x"));
- for (b = blen; b > 7; b -= 8, cp++)
- dn += SPRINTF((dn, "%02x", *cp & 0xff));
+ i = SPRINTF((dn, "\\[x"));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ for (b = blen; b > 7; b -= 8, cp++) {
+ i = SPRINTF((dn, "%02x", *cp & 0xff));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ }
if (b > 4) {
tc = *cp++;
- dn += SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
+ i = SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
+ if (i < 0)
+ return (-1);
+ dn += i;
} else if (b > 0) {
tc = *cp++;
- dn += SPRINTF((dn, "%1x",
+ i = SPRINTF((dn, "%1x",
((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
+ if (i < 0)
+ return (-1);
+ dn += i;
}
- dn += SPRINTF((dn, "/%d]", blen));
+ i = SPRINTF((dn, "/%d]", blen));
+ if (i < 0)
+ return (-1);
+ dn += i;
*cpp = cp;
return(dn - beg);
diff --git a/lib/bind/nameser/ns_parse.c b/lib/bind/nameser/ns_parse.c
index 6b591d14..4512e59c 100644
--- a/lib/bind/nameser/ns_parse.c
+++ b/lib/bind/nameser/ns_parse.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_parse.c,v 1.3 2001/06/21 08:26:18 marka Exp $";
+static const char rcsid[] = "$Id: ns_parse.c,v 1.3.2.1 2003/06/27 03:51:42 marka Exp $";
#endif
/* Import. */
@@ -132,9 +132,10 @@ ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
int
ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
int b;
+ int tmp;
/* Make section right. */
- if (section >= ns_s_max)
+ if ((tmp = section) < 0 || section >= ns_s_max)
RETERR(ENODEV);
if (section != handle->_sect)
setsection(handle, section);
diff --git a/lib/bind/nameser/ns_print.c b/lib/bind/nameser/ns_print.c
index 0eaf2b98..2b6d65f1 100644
--- a/lib/bind/nameser/ns_print.c
+++ b/lib/bind/nameser/ns_print.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_print.c,v 1.3 2001/06/21 08:26:19 marka Exp $";
+static const char rcsid[] = "$Id: ns_print.c,v 1.3.2.1 2003/06/27 03:51:42 marka Exp $";
#endif
/* Import. */
@@ -31,6 +31,7 @@ static const char rcsid[] = "$Id: ns_print.c,v 1.3 2001/06/21 08:26:19 marka Exp
#include <arpa/inet.h>
#include <isc/assertions.h>
+#include <isc/dst.h>
#include <errno.h>
#include <resolv.h>
#include <string.h>
@@ -58,10 +59,6 @@ static int addstr(const char *src, size_t len,
static int addtab(size_t len, size_t target, int spaced,
char **buf, size_t *buflen);
-/* Proto. */
-
-u_int16_t dst_s_dns_key_id(const u_char *, const int);
-
/* Macros. */
#define T(x) \
@@ -640,9 +637,10 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
len = SPRINTF((tmp, "%u %u %u ", mode, err, keysize));
T(addstr(tmp, len, &buf, &buflen));
- /* needs to dump key, print otherdata length & other data */
+ /* XXX need to dump key, print otherdata length & other data */
break;
}
+
case ns_t_tsig: {
/* BEW - need to complete this */
int n;
@@ -690,13 +688,13 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
break;
- }
+ }
case ns_t_opt: {
len = SPRINTF((tmp, "%u bytes", class));
T(addstr(tmp, len, &buf, &buflen));
break;
- }
+ }
default:
comment = "unknown RR type";
diff --git a/lib/bind/nameser/ns_samedomain.c b/lib/bind/nameser/ns_samedomain.c
index 52489309..ded6c678 100644
--- a/lib/bind/nameser/ns_samedomain.c
+++ b/lib/bind/nameser/ns_samedomain.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.1 2001/11/27 23:21:56 gson Exp $";
+static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2 2003/06/27 03:51:43 marka Exp $";
#endif
#include "port_before.h"
@@ -166,14 +166,14 @@ int
ns_makecanon(const char *src, char *dst, size_t dstsize) {
size_t n = strlen(src);
- if (n + sizeof "." > dstsize) {
+ if (n + sizeof "." > dstsize) { /* Note: sizeof == 2 */
errno = EMSGSIZE;
return (-1);
}
strcpy(dst, src);
- while (n > 0 && dst[n - 1] == '.') /* Ends in "." */
- if (n > 1 && dst[n - 2] == '\\' && /* Ends in "\." */
- (n < 2 || dst[n - 3] != '\\')) /* But not "\\." */
+ while (n >= 1 && dst[n - 1] == '.') /* Ends in "." */
+ if (n >= 2 && dst[n - 2] == '\\' && /* Ends in "\." */
+ (n < 3 || dst[n - 3] != '\\')) /* But not "\\." */
break;
else
dst[--n] = '\0';
diff --git a/lib/bind/nameser/ns_sign.c b/lib/bind/nameser/ns_sign.c
index 4523fe1c..a56d6ccd 100644
--- a/lib/bind/nameser/ns_sign.c
+++ b/lib/bind/nameser/ns_sign.c
@@ -16,7 +16,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_sign.c,v 1.1.2.1 2002/07/10 05:19:27 marka Exp $";
+static const char rcsid[] = "$Id: ns_sign.c,v 1.1.2.2 2003/06/27 03:51:43 marka Exp $";
#endif
/* Import. */
@@ -41,6 +41,7 @@ static const char rcsid[] = "$Id: ns_sign.c,v 1.1.2.1 2002/07/10 05:19:27 marka
#include <unistd.h>
#include <isc/dst.h>
+#include <isc/assertions.h>
#include "port_after.h"
@@ -90,22 +91,30 @@ ns_sign2(u_char *msg, int *msglen, int msgsize, int error, void *k,
DST_KEY *key = (DST_KEY *)k;
u_char *cp = msg + *msglen, *eob = msg + msgsize;
u_char *lenp;
- u_char *name, *alg;
+ u_char *alg;
int n;
time_t timesigned;
+ u_char name[NS_MAXCDNAME];
dst_init();
if (msg == NULL || msglen == NULL || sig == NULL || siglen == NULL)
return (-1);
/* Name. */
- if (key != NULL && error != ns_r_badsig && error != ns_r_badkey)
- n = dn_comp(key->dk_key_name, cp, eob - cp, dnptrs, lastdnptr);
- else
- n = dn_comp("", cp, eob - cp, NULL, NULL);
+ if (key != NULL && error != ns_r_badsig && error != ns_r_badkey) {
+ n = ns_name_pton(key->dk_key_name, name, sizeof name);
+ if (n != -1)
+ n = ns_name_pack(name, cp, eob - cp,
+ (const u_char **)dnptrs,
+ (const u_char **)lastdnptr);
+
+ } else {
+ n = ns_name_pton("", name, sizeof name);
+ if (n != -1)
+ n = ns_name_pack(name, cp, eob - cp, NULL, NULL);
+ }
if (n < 0)
return (NS_TSIG_ERROR_NO_SPACE);
- name = cp;
cp += n;
/* Type, class, ttl, length (not filled in yet). */
@@ -142,7 +151,7 @@ ns_sign2(u_char *msg, int *msglen, int msgsize, int error, void *k,
/* Compute the signature. */
if (key != NULL && error != ns_r_badsig && error != ns_r_badkey) {
void *ctx;
- u_char buf[MAXDNAME], *cp2;
+ u_char buf[NS_MAXCDNAME], *cp2;
int n;
dst_sign_data(SIG_MODE_INIT, key, &ctx, NULL, 0, NULL, 0);
@@ -162,6 +171,7 @@ ns_sign2(u_char *msg, int *msglen, int msgsize, int error, void *k,
/* Digest the key name. */
n = ns_name_ntol(name, buf, sizeof(buf));
+ INSIST(n > 0);
dst_sign_data(SIG_MODE_UPDATE, key, &ctx, buf, n, NULL, 0);
/* Digest the class and TTL. */
@@ -173,6 +183,7 @@ ns_sign2(u_char *msg, int *msglen, int msgsize, int error, void *k,
/* Digest the algorithm. */
n = ns_name_ntol(alg, buf, sizeof(buf));
+ INSIST(n > 0);
dst_sign_data(SIG_MODE_UPDATE, key, &ctx, buf, n, NULL, 0);
/* Digest the time signed, fudge, error, and other data */
diff --git a/lib/bind/port_after.h.in b/lib/bind/port_after.h.in
index fcbc99c9..9095982e 100644
--- a/lib/bind/port_after.h.in
+++ b/lib/bind/port_after.h.in
@@ -24,6 +24,8 @@
@HAVE_STRNDUP@
@USE_FIONBIO_IOCTL@
@USE_SYSERROR_LIST@
+@INNETGR_ARGS@
+@SETNETGRENT_ARGS@
/* XXX sunos and cygwin needs O_NDELAY */
#define PORT_NONBLOCK O_NONBLOCK
@@ -363,17 +365,24 @@ int isc__gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp);
int isc__gettimeofday(struct timeval *tp, struct timezone *tzp);
#endif
-int getnetgrent(const char **machinep, const char **userp,
- const char **domainp);
+int getnetgrent(char **machinep, char **userp, char **domainp);
int getnetgrent_r(char **machinep, char **userp, char **domainp, NGR_R_ARGS);
+#ifdef SETNETGRENT_ARGS
+void setnetgrent(SETNETGRENT_ARGS);
+#else
void setnetgrent(const char *netgroup);
+#endif
void endnetgrent(void);
+#ifdef INNETGR_ARGS
+int innetgr(INNETGR_ARGS);
+#else
int innetgr(const char *netgroup, const char *machine,
const char *user, const char *domain);
+#endif
#ifdef NGR_R_ENT_ARGS
NGR_R_SET_RETURN
diff --git a/lib/bind/resolv/res_comp.c b/lib/bind/resolv/res_comp.c
index cb86b3f5..298acbd5 100644
--- a/lib/bind/resolv/res_comp.c
+++ b/lib/bind/resolv/res_comp.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_comp.c,v 1.1 2001/03/29 06:31:58 marka Exp $";
+static const char rcsid[] = "$Id: res_comp.c,v 1.1.2.1 2003/06/27 03:51:43 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -86,10 +86,10 @@ static const char rcsid[] = "$Id: res_comp.c,v 1.1 2001/03/29 06:31:58 marka Exp
#include "port_after.h"
/*
- * Expand compressed domain name 'comp_dn' to full domain name.
+ * Expand compressed domain name 'src' to full domain name.
* 'msg' is a pointer to the begining of the message,
- * 'eomorig' points to the first location after the message,
- * 'exp_dn' is a pointer to a buffer of size 'length' for the result.
+ * 'eom' points to the first location after the message,
+ * 'dst' is a pointer to a buffer of size 'dstsiz' for the result.
* Return size of compressed name or -1 if there was an error.
*/
int
diff --git a/lib/bind/resolv/res_debug.c b/lib/bind/resolv/res_debug.c
index 53873080..e7fa9ded 100644
--- a/lib/bind/resolv/res_debug.c
+++ b/lib/bind/resolv/res_debug.c
@@ -95,7 +95,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_debug.c,v 1.3.2.4 2002/07/14 04:26:56 marka Exp $";
+static const char rcsid[] = "$Id: res_debug.c,v 1.3.2.5 2003/06/27 03:51:43 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -615,9 +615,6 @@ p_option(u_long option) {
#ifdef RES_USE_EDNS0 /* KAME extension */
case RES_USE_EDNS0: return "edns0";
#endif
-#ifdef RES_USE_A6
- case RES_USE_A6: return "a6";
-#endif
#ifdef RES_USE_DNAME
case RES_USE_DNAME: return "dname";
#endif
@@ -655,6 +652,33 @@ p_rcode(int rcode) {
}
/*
+ * Return a string for a res_sockaddr_union.
+ */
+const char *
+p_sockun(union res_sockaddr_union u, char *buf, size_t size) {
+ char ret[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:123.123.123.123"];
+
+ switch (u.sin.sin_family) {
+ case AF_INET:
+ inet_ntop(AF_INET, &u.sin.sin_addr, ret, sizeof ret);
+ break;
+#ifdef HAS_INET6_STRUCTS
+ case AF_INET6:
+ inet_ntop(AF_INET6, &u.sin6.sin6_addr, ret, sizeof ret);
+ break;
+#endif
+ default:
+ sprintf(ret, "[af%d]", u.sin.sin_family);
+ break;
+ }
+ if (size > 0) {
+ strncpy(buf, ret, size - 1);
+ buf[size - 1] = '0';
+ }
+ return (buf);
+}
+
+/*
* routines to convert between on-the-wire RR format and zone file format.
* Does not contain conversion to/from decimal degrees; divide or multiply
* by 60*60*1000 for that.
@@ -1101,8 +1125,9 @@ res_nametoclass(const char *buf, int *successp) {
if (strncasecmp(buf, "CLASS", 5) != 0 ||
!isdigit((unsigned char)buf[5]))
goto done;
+ errno = 0;
result = strtoul(buf + 5, &endptr, 10);
- if (*endptr == '\0' && result <= 0xffff)
+ if (errno == 0 && *endptr == '\0' && result <= 0xffff)
success = 1;
done:
if (successp)
@@ -1123,8 +1148,9 @@ res_nametotype(const char *buf, int *successp) {
if (strncasecmp(buf, "type", 4) != 0 ||
!isdigit((unsigned char)buf[4]))
goto done;
+ errno = 0;
result = strtoul(buf + 4, &endptr, 10);
- if (*endptr == '\0' && result <= 0xffff)
+ if (errno == 0 && *endptr == '\0' && result <= 0xffff)
success = 1;
done:
if (successp)
diff --git a/lib/bind/resolv/res_findzonecut.c b/lib/bind/resolv/res_findzonecut.c
index 0116067a..1b11a5cf 100644
--- a/lib/bind/resolv/res_findzonecut.c
+++ b/lib/bind/resolv/res_findzonecut.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_findzonecut.c,v 1.2.2.2 2002/07/11 23:32:35 marka Exp $";
+static const char rcsid[] = "$Id: res_findzonecut.c,v 1.2.2.3 2003/06/27 03:51:43 marka Exp $";
#endif /* not lint */
/*
@@ -49,19 +49,21 @@ static const char rcsid[] = "$Id: res_findzonecut.c,v 1.2.2.2 2002/07/11 23:32:3
typedef struct rr_a {
LINK(struct rr_a) link;
- union res_sockaddr_union addr;
+ union res_sockaddr_union addr;
} rr_a;
typedef LIST(rr_a) rrset_a;
typedef struct rr_ns {
LINK(struct rr_ns) link;
const char * name;
- int have_v4;
- int have_v6;
+ unsigned int flags;
rrset_a addrs;
} rr_ns;
typedef LIST(rr_ns) rrset_ns;
+#define RR_NS_HAVE_V4 0x01
+#define RR_NS_HAVE_V6 0x02
+
/* Forward. */
static int satisfy(res_state, const char *, rrset_ns *,
@@ -149,7 +151,8 @@ static void res_dprintf(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
int
res_findzonecut(res_state statp, const char *dname, ns_class class, int opts,
- char *zname, size_t zsize, struct in_addr *addrs, int naddrs) {
+ char *zname, size_t zsize, struct in_addr *addrs, int naddrs)
+{
int result, i;
union res_sockaddr_union *u;
@@ -267,7 +270,7 @@ get_soa(res_state statp, const char *dname, ns_class class, int opts,
rrset_ns *nsrrsp)
{
char tname[NS_MAXDNAME];
- u_char resp[NS_PACKETSZ];
+ u_char *resp = NULL;
int n, i, ancount, nscount;
ns_sect sect;
ns_msg msg;
@@ -279,9 +282,13 @@ get_soa(res_state statp, const char *dname, ns_class class, int opts,
/* First canonicalize dname (exactly one unescaped trailing "."). */
if (ns_makecanon(dname, tname, sizeof tname) < 0)
- return (-1);
+ goto cleanup;
dname = tname;
+ resp = malloc(NS_MAXMSG);
+ if (resp == NULL)
+ goto cleanup;
+
/* Now grovel the subdomains, hunting for an SOA answer or auth. */
for (;;) {
/* Leading or inter-label '.' are skipped here. */
@@ -293,7 +300,7 @@ get_soa(res_state statp, const char *dname, ns_class class, int opts,
if (n < 0) {
DPRINTF(("get_soa: do_query('%s', %s) failed (%d)",
dname, p_class(class), n));
- return (-1);
+ goto cleanup;
}
if (n > 0) {
DPRINTF(("get_soa: CNAME or DNAME found"));
@@ -318,7 +325,7 @@ get_soa(res_state statp, const char *dname, ns_class class, int opts,
if (ns_parserr(&msg, sect, i, &rr) < 0) {
DPRINTF(("get_soa: ns_parserr(%s, %d) failed",
p_section(sect, ns_o_query), i));
- return (-1);
+ goto cleanup;
}
if (ns_rr_type(rr) == ns_t_cname ||
ns_rr_type(rr) == ns_t_dname)
@@ -330,19 +337,23 @@ get_soa(res_state statp, const char *dname, ns_class class, int opts,
switch (sect) {
case ns_s_an:
if (ns_samedomain(dname, t) == 0) {
- DPRINTF(("get_soa: ns_samedomain('%s', '%s') == 0",
- dname, t));
+ DPRINTF(
+ ("get_soa: ns_samedomain('%s', '%s') == 0",
+ dname, t)
+ );
errno = EPROTOTYPE;
- return (-1);
+ goto cleanup;
}
break;
case ns_s_ns:
if (ns_samename(dname, t) == 1 ||
ns_samedomain(dname, t) == 0) {
- DPRINTF(("get_soa: ns_samename() || !ns_samedomain('%s', '%s')",
- dname, t));
+ DPRINTF(
+ ("get_soa: ns_samename() || !ns_samedomain('%s', '%s')",
+ dname, t)
+ );
errno = EPROTOTYPE;
- return (-1);
+ goto cleanup;
}
break;
default:
@@ -352,21 +363,23 @@ get_soa(res_state statp, const char *dname, ns_class class, int opts,
DPRINTF(("get_soa: zname(%d) too small (%d)",
zsize, strlen(t) + 1));
errno = EMSGSIZE;
- return (-1);
+ goto cleanup;
}
strcpy(zname, t);
rdata = ns_rr_rdata(rr);
rdlen = ns_rr_rdlen(rr);
if (ns_name_uncompress(resp, ns_msg_end(msg), rdata,
mname, msize) < 0) {
- DPRINTF(("get_soa: ns_name_uncompress failed"));
- return (-1);
+ DPRINTF(("get_soa: ns_name_uncompress failed")
+ );
+ goto cleanup;
}
if (save_ns(statp, &msg, ns_s_ns,
zname, class, opts, nsrrsp) < 0) {
DPRINTF(("get_soa: save_ns failed"));
- return (-1);
+ goto cleanup;
}
+ free(resp);
return (0);
}
@@ -379,13 +392,16 @@ get_soa(res_state statp, const char *dname, ns_class class, int opts,
if (*dname == '\\')
if (*++dname == '\0') {
errno = EMSGSIZE;
- return (-1);
+ goto cleanup;
}
dname++;
}
}
DPRINTF(("get_soa: out of labels"));
errno = EDESTADDRREQ;
+ cleanup:
+ if (resp != NULL)
+ free(resp);
return (-1);
}
@@ -393,15 +409,20 @@ static int
get_ns(res_state statp, const char *zname, ns_class class, int opts,
rrset_ns *nsrrsp)
{
- u_char resp[NS_PACKETSZ];
+ u_char *resp;
ns_msg msg;
int n;
+ resp = malloc(NS_MAXMSG);
+ if (resp == NULL)
+ return (-1);
+
/* Go and get the NS RRs for this zone. */
n = do_query(statp, zname, class, ns_t_ns, resp, &msg);
if (n != 0) {
DPRINTF(("get_ns: do_query('%s', %s) failed (%d)",
zname, p_class(class), n));
+ free(resp);
return (-1);
}
@@ -409,31 +430,38 @@ get_ns(res_state statp, const char *zname, ns_class class, int opts,
if (save_ns(statp, &msg, ns_s_an, zname, class, opts, nsrrsp) < 0) {
DPRINTF(("get_ns save_ns('%s', %s) failed",
zname, p_class(class)));
+ free(resp);
return (-1);
}
+ free(resp);
return (0);
}
static int
get_glue(res_state statp, ns_class class, int opts, rrset_ns *nsrrsp) {
rr_ns *nsrr, *nsrr_n;
+ u_char *resp;
+
+ resp = malloc(NS_MAXMSG);
+ if (resp == NULL)
+ return(-1);
/* Go and get the A RRs for each empty NS RR on our list. */
for (nsrr = HEAD(*nsrrsp); nsrr != NULL; nsrr = nsrr_n) {
- u_char resp[NS_PACKETSZ];
ns_msg msg;
int n;
nsrr_n = NEXT(nsrr, link);
- if (!nsrr->have_v4) {
+ if ((nsrr->flags & RR_NS_HAVE_V4) == 0) {
n = do_query(statp, nsrr->name, class, ns_t_a,
resp, &msg);
if (n < 0) {
- DPRINTF(("get_glue: do_query('%s', %s') failed",
- nsrr->name, p_class(class)));
- return (-1);
+ DPRINTF(
+ ("get_glue: do_query('%s', %s') failed",
+ nsrr->name, p_class(class)));
+ goto cleanup;
}
if (n > 0) {
DPRINTF((
@@ -444,17 +472,18 @@ get_glue(res_state statp, ns_class class, int opts, rrset_ns *nsrrsp) {
opts, nsrr) < 0) {
DPRINTF(("get_glue: save_r('%s', %s) failed",
nsrr->name, p_class(class)));
- return (-1);
+ goto cleanup;
}
}
- if (!nsrr->have_v6) {
+ if ((nsrr->flags & RR_NS_HAVE_V6) == 0) {
n = do_query(statp, nsrr->name, class, ns_t_aaaa,
resp, &msg);
if (n < 0) {
- DPRINTF(("get_glue: do_query('%s', %s') failed",
- nsrr->name, p_class(class)));
- return (-1);
+ DPRINTF(
+ ("get_glue: do_query('%s', %s') failed",
+ nsrr->name, p_class(class)));
+ goto cleanup;
}
if (n > 0) {
DPRINTF((
@@ -465,7 +494,7 @@ get_glue(res_state statp, ns_class class, int opts, rrset_ns *nsrrsp) {
opts, nsrr) < 0) {
DPRINTF(("get_glue: save_r('%s', %s) failed",
nsrr->name, p_class(class)));
- return (-1);
+ goto cleanup;
}
}
@@ -476,7 +505,12 @@ get_glue(res_state statp, ns_class class, int opts, rrset_ns *nsrrsp) {
free_nsrr(nsrrsp, nsrr);
}
}
+ free(resp);
return (0);
+
+ cleanup:
+ free(resp);
+ return (-1);
}
static int
@@ -514,7 +548,8 @@ save_ns(res_state statp, ns_msg *msg, ns_sect sect,
if (ns_name_uncompress(ns_msg_base(*msg),
ns_msg_end(*msg), rdata,
tname, sizeof tname) < 0) {
- DPRINTF(("save_ns: ns_name_uncompress failed"));
+ DPRINTF(("save_ns: ns_name_uncompress failed")
+ );
free(nsrr);
return (-1);
}
@@ -526,8 +561,7 @@ save_ns(res_state statp, ns_msg *msg, ns_sect sect,
}
INIT_LINK(nsrr, link);
INIT_LIST(nsrr->addrs);
- nsrr->have_v4 = 0;
- nsrr->have_v6 = 0;
+ nsrr->flags = 0;
APPEND(*nsrrsp, nsrr, link);
}
if (save_a(statp, msg, ns_s_ar,
@@ -556,7 +590,8 @@ save_a(res_state statp, ns_msg *msg, ns_sect sect,
p_section(sect, ns_o_query), i));
return (-1);
}
- if ((ns_rr_type(rr) != ns_t_a && ns_rr_type(rr) != ns_t_aaaa) ||
+ if ((ns_rr_type(rr) != ns_t_a &&
+ ns_rr_type(rr) != ns_t_aaaa) ||
ns_rr_class(rr) != class ||
ns_samename(ns_rr_name(rr), owner) != 1 ||
ns_rr_rdlen(rr) != NS_INADDRSZ)
@@ -581,7 +616,7 @@ save_a(res_state statp, ns_msg *msg, ns_sect sect,
memcpy(&arr->addr.sin.sin_addr, ns_rr_rdata(rr),
NS_INADDRSZ);
arr->addr.sin.sin_port = htons(NAMESERVER_PORT);
- nsrr->have_v4 = 1;
+ nsrr->flags |= RR_NS_HAVE_V4;
break;
case ns_t_aaaa:
arr->addr.sin6.sin6_family = AF_INET6;
@@ -590,7 +625,7 @@ save_a(res_state statp, ns_msg *msg, ns_sect sect,
#endif
memcpy(&arr->addr.sin6.sin6_addr, ns_rr_rdata(rr), 16);
arr->addr.sin.sin_port = htons(NAMESERVER_PORT);
- nsrr->have_v6 = 1;
+ nsrr->flags |= RR_NS_HAVE_V6;
break;
default:
abort();
@@ -646,7 +681,7 @@ do_query(res_state statp, const char *dname, ns_class class, ns_type qtype,
DPRINTF(("do_query: res_nmkquery failed"));
return (-1);
}
- n = res_nsend(statp, req, n, resp, NS_PACKETSZ);
+ n = res_nsend(statp, req, n, resp, NS_MAXMSG);
if (n < 0) {
DPRINTF(("do_query: res_nsend failed"));
return (-1);
diff --git a/lib/bind/resolv/res_init.c b/lib/bind/resolv/res_init.c
index d71a7a72..a47b0005 100644
--- a/lib/bind/resolv/res_init.c
+++ b/lib/bind/resolv/res_init.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 1.9.2.3 2002/07/14 04:31:44 marka Exp $";
+static const char rcsid[] = "$Id: res_init.c,v 1.9.2.5 2003/07/02 04:10:28 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -161,6 +161,7 @@ __res_vinit(res_state statp, int preinit) {
char *net;
#endif
int dots;
+ union res_sockaddr_union u[2];
if (!preinit) {
statp->retrans = RES_TIMEOUT;
@@ -172,17 +173,32 @@ __res_vinit(res_state statp, int preinit) {
if ((statp->options & RES_INIT) != 0)
res_ndestroy(statp);
+ memset(u, 0, sizeof(u));
#ifdef USELOOPBACK
- statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
+ u[nserv].sin.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
#else
- statp->nsaddr.sin_addr.s_addr = INADDR_ANY;
+ u[nserv].sin.sin_addr.s_addr = INADDR_ANY;
#endif
- statp->nsaddr.sin_family = AF_INET;
- statp->nsaddr.sin_port = htons(NAMESERVER_PORT);
+ u[nserv].sin.sin_family = AF_INET;
+ u[nserv].sin.sin_port = htons(NAMESERVER_PORT);
#ifdef HAVE_SA_LEN
- statp->nsaddr.sin_len = sizeof(struct sockaddr_in);
+ u[nserv].sin.sin_len = sizeof(struct sockaddr_in);
#endif
- statp->nscount = 1;
+ nserv++;
+#ifdef HAS_INET6_STRUCTS
+#ifdef USELOOPBACK
+ u[nserv].sin6.sin6_addr = in6addr_loopback;
+#else
+ u[nserv].sin6.sin6_addr = in6addr_any;
+#endif
+ u[nserv].sin6.sin6_family = AF_INET6;
+ u[nserv].sin6.sin6_port = htons(NAMESERVER_PORT);
+#ifdef HAVE_SA_LEN
+ u[nserv].sin6.sin6_len = sizeof(struct sockaddr_in6);
+#endif
+ nserv++;
+#endif
+ statp->nscount = 0;
statp->ndots = 1;
statp->pfcode = 0;
statp->_vcsock = -1;
@@ -196,11 +212,11 @@ __res_vinit(res_state statp, int preinit) {
statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");
strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");
- strcpy(statp->_u._ext.ext->bsuffix, "ip6.arpa");
}
#ifdef RESOLVSORT
statp->nsort = 0;
#endif
+ res_setservers(statp, u, nserv);
/* Allow user to override the local domain definition */
if ((cp = getenv("LOCALDOMAIN")) != NULL) {
@@ -242,6 +258,7 @@ __res_vinit(res_state statp, int preinit) {
(line[sizeof(name) - 1] == ' ' || \
line[sizeof(name) - 1] == '\t'))
+ nserv = 0;
if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
/* read the config file */
while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -507,9 +524,6 @@ res_setoptions(res_state statp, const char *options, const char *source)
statp->options |= RES_USE_EDNS0;
}
#endif
- else if (!strncmp(cp, "a6", sizeof("a6") - 1)) {
- statp->options |= RES_USE_A6;
- }
else if (!strncmp(cp, "dname", sizeof("dname") - 1)) {
statp->options |= RES_USE_DNAME;
}
@@ -529,14 +543,6 @@ res_setoptions(res_state statp, const char *options, const char *source)
strncpy(ext->nsuffix2, cp, i);
ext->nsuffix2[i] = '\0';
}
- else if (!strncmp(cp, "bitstring:", sizeof("bitstring:") - 1)) {
- if (ext == NULL)
- goto skip;
- cp += sizeof("bitstring:") - 1;
- i = MIN(strcspn(cp, " \t"), sizeof(ext->bsuffix) - 1);
- strncpy(ext->bsuffix, cp, i);
- ext->bsuffix[i] = '\0';
- }
else if (!strncmp(cp, "v6revmode:", sizeof("v6revmode:") - 1)) {
cp += sizeof("v6revmode:") - 1;
/* "nibble" and "bitstring" used to be valid */
@@ -628,13 +634,6 @@ res_get_nibblesuffix2(res_state statp) {
return ("ip6.int");
}
-const char *
-res_get_bitstringsuffix(res_state statp) {
- if (statp->_u._ext.ext)
- return (statp->_u._ext.ext->bsuffix);
- return ("ip6.arpa");
-}
-
void
res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) {
int i, nserv;
@@ -662,6 +661,7 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) {
nserv++;
break;
+#ifdef HAS_INET6_STRUCTS
case AF_INET6:
size = sizeof(set->sin6);
if (statp->_u._ext.ext)
@@ -674,6 +674,7 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) {
statp->nsaddr_list[nserv].sin_family = 0;
nserv++;
break;
+#endif
default:
break;
@@ -708,6 +709,7 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) {
size);
break;
+#ifdef HAS_INET6_STRUCTS
case AF_INET6:
size = sizeof(set->sin6);
if (statp->_u._ext.ext)
@@ -718,6 +720,7 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) {
memcpy(&set->sin6, &statp->nsaddr_list[i],
size);
break;
+#endif
default:
set->sin.sin_family = 0;
diff --git a/lib/bind/resolv/res_mkquery.c b/lib/bind/resolv/res_mkquery.c
index 757f6d34..86419772 100644
--- a/lib/bind/resolv/res_mkquery.c
+++ b/lib/bind/resolv/res_mkquery.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_mkquery.c,v 1.1.2.1 2002/07/14 04:26:57 marka Exp $";
+static const char rcsid[] = "$Id: res_mkquery.c,v 1.1.2.2 2003/06/27 03:51:43 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -105,7 +105,7 @@ res_nmkquery(res_state statp,
int buflen) /* size of buffer */
{
register HEADER *hp;
- register u_char *cp;
+ register u_char *cp, *ep;
register int n;
u_char *dnptrs[20], **dpp, **lastdnptr;
@@ -128,7 +128,7 @@ res_nmkquery(res_state statp,
hp->rd = (statp->options & RES_RECURSE) != 0;
hp->rcode = NOERROR;
cp = buf + HFIXEDSZ;
- buflen -= HFIXEDSZ;
+ ep = buf + buflen;
dpp = dnptrs;
*dpp++ = buf;
*dpp++ = NULL;
@@ -139,15 +139,15 @@ res_nmkquery(res_state statp,
switch (op) {
case QUERY: /*FALLTHROUGH*/
case NS_NOTIFY_OP:
- if ((buflen -= QFIXEDSZ) < 0)
+ if (ep - cp < QFIXEDSZ)
return (-1);
- if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
+ if ((n = dn_comp(dname, cp, ep - cp - QFIXEDSZ, dnptrs,
+ lastdnptr)) < 0)
return (-1);
cp += n;
- buflen -= n;
- __putshort(type, cp);
+ ns_put16(type, cp);
cp += INT16SZ;
- __putshort(class, cp);
+ ns_put16(class, cp);
cp += INT16SZ;
hp->qdcount = htons(1);
if (op == QUERY || data == NULL)
@@ -155,19 +155,20 @@ res_nmkquery(res_state statp,
/*
* Make an additional record for completion domain.
*/
- buflen -= RRFIXEDSZ;
- n = dn_comp((const char *)data, cp, buflen, dnptrs, lastdnptr);
+ if ((ep - cp) < RRFIXEDSZ)
+ return (-1);
+ n = dn_comp((const char *)data, cp, ep - cp - RRFIXEDSZ,
+ dnptrs, lastdnptr);
if (n < 0)
return (-1);
cp += n;
- buflen -= n;
- __putshort(T_NULL, cp);
+ ns_put16(T_NULL, cp);
cp += INT16SZ;
- __putshort(class, cp);
+ ns_put16(class, cp);
cp += INT16SZ;
- __putlong(0, cp);
+ ns_put32(0, cp);
cp += INT32SZ;
- __putshort(0, cp);
+ ns_put16(0, cp);
cp += INT16SZ;
hp->arcount = htons(1);
break;
@@ -176,16 +177,16 @@ res_nmkquery(res_state statp,
/*
* Initialize answer section
*/
- if (buflen < 1 + RRFIXEDSZ + datalen)
+ if (ep - cp < 1 + RRFIXEDSZ + datalen)
return (-1);
*cp++ = '\0'; /* no domain name */
- __putshort(type, cp);
+ ns_put16(type, cp);
cp += INT16SZ;
- __putshort(class, cp);
+ ns_put16(class, cp);
cp += INT16SZ;
- __putlong(0, cp);
+ ns_put32(0, cp);
cp += INT32SZ;
- __putshort(datalen, cp);
+ ns_put16(datalen, cp);
cp += INT16SZ;
if (datalen) {
memcpy(cp, data, datalen);
@@ -207,15 +208,14 @@ res_nmkquery(res_state statp,
#endif
int
-res_nopt(statp, n0, buf, buflen, anslen)
- res_state statp;
- int n0;
- u_char *buf; /* buffer to put query */
- int buflen; /* size of buffer */
- int anslen; /* answer buffer length */
+res_nopt(res_state statp,
+ int n0, /* current offset in buffer */
+ u_char *buf, /* buffer to put query */
+ int buflen, /* size of buffer */
+ int anslen) /* UDP answer buffer size */
{
register HEADER *hp;
- register u_char *cp;
+ register u_char *cp, *ep;
u_int16_t flags = 0;
#ifdef DEBUG
@@ -225,17 +225,16 @@ res_nopt(statp, n0, buf, buflen, anslen)
hp = (HEADER *) buf;
cp = buf + n0;
- buflen -= n0;
+ ep = buf + buflen;
- if (buflen < 1 + RRFIXEDSZ)
- return -1;
+ if ((ep - cp) < 1 + RRFIXEDSZ)
+ return (-1);
*cp++ = 0; /* "." */
- buflen--;
- __putshort(T_OPT, cp); /* TYPE */
+ ns_put16(T_OPT, cp); /* TYPE */
cp += INT16SZ;
- __putshort(anslen & 0xffff, cp); /* CLASS = UDP payload size */
+ ns_put16(anslen & 0xffff, cp); /* CLASS = UDP payload size */
cp += INT16SZ;
*cp++ = NOERROR; /* extended RCODE */
*cp++ = 0; /* EDNS version */
@@ -246,13 +245,12 @@ res_nopt(statp, n0, buf, buflen, anslen)
#endif
flags |= NS_OPT_DNSSEC_OK;
}
- __putshort(flags, cp);
+ ns_put16(flags, cp);
cp += INT16SZ;
- __putshort(0, cp); /* RDLEN */
+ ns_put16(0, cp); /* RDLEN */
cp += INT16SZ;
hp->arcount = htons(ntohs(hp->arcount) + 1);
- buflen -= RRFIXEDSZ;
- return cp - buf;
+ return (cp - buf);
}
#endif
diff --git a/lib/bind/resolv/res_mkupdate.c b/lib/bind/resolv/res_mkupdate.c
index 3eea590e..9b1dc99e 100644
--- a/lib/bind/resolv/res_mkupdate.c
+++ b/lib/bind/resolv/res_mkupdate.c
@@ -21,7 +21,7 @@
*/
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_mkupdate.c,v 1.1 2001/03/29 06:31:59 marka Exp $";
+static const char rcsid[] = "$Id: res_mkupdate.c,v 1.1.2.1 2003/06/27 03:51:43 marka Exp $";
#endif /* not lint */
#include "port_before.h"
@@ -302,7 +302,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
if (!getword_str(buf2, sizeof buf2, &startp, endp))
return (-1);
- n = dn_comp(buf2, cp, buflen, dnptrs, lastdnptr);
+ n = dn_comp(buf2, cp, buflen, NULL, NULL);
if (n < 0)
return (-1);
cp += n;
@@ -482,8 +482,10 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
char *ulendp;
u_int32_t ottl;
+ errno = 0;
ottl = strtoul(buf2, &ulendp, 10);
- if (ulendp != NULL && *ulendp != '\0')
+ if (errno != 0 ||
+ (ulendp != NULL && *ulendp != '\0'))
return (-1);
ShrinkBuffer(INT32SZ);
PUTLONG(ottl, cp);
@@ -572,7 +574,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
/* next name */
if (!getword_str(buf2, sizeof buf2, &startp, endp))
return (-1);
- n = dn_comp(buf2, cp, buflen, dnptrs, lastdnptr);
+ n = dn_comp(buf2, cp, buflen, NULL, NULL);
if (n < 0)
return (-1);
cp += n;
@@ -636,6 +638,62 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
memcpy(cp, &in6a, NS_IN6ADDRSZ);
cp += NS_IN6ADDRSZ;
break;
+ case ns_t_naptr:
+ /* Order Preference Flags Service Replacement Regexp */
+ /* Order */
+ n = getnum_str(&startp, endp);
+ if (n < 0 || n > 65535)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ /* Preference */
+ n = getnum_str(&startp, endp);
+ if (n < 0 || n > 65535)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ /* Flags */
+ if ((n = getstr_str(buf2, sizeof buf2,
+ &startp, endp)) < 0) {
+ return (-1);
+ }
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ /* Service Classes */
+ if ((n = getstr_str(buf2, sizeof buf2,
+ &startp, endp)) < 0) {
+ return (-1);
+ }
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ /* Pattern */
+ if ((n = getstr_str(buf2, sizeof buf2,
+ &startp, endp)) < 0) {
+ return (-1);
+ }
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ /* Replacement */
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, NULL, NULL);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ break;
default:
return (-1);
} /*switch*/
@@ -807,7 +865,7 @@ gethexnum_str(u_char **startpp, u_char *endp) {
}
/*
- * Get a whitespace delimited base 16 number from a string (not file) into buf
+ * Get a whitespace delimited base 10 number from a string (not file) into buf
* update the start pointer to point after the number in the string.
*/
static int
diff --git a/lib/bind/resolv/res_private.h b/lib/bind/resolv/res_private.h
index ec9b384b..d7b66cd6 100644
--- a/lib/bind/resolv/res_private.h
+++ b/lib/bind/resolv/res_private.h
@@ -11,7 +11,6 @@ struct __res_state_ext {
} addr, mask;
} sort_list[MAXRESOLVSORT];
char nsuffix[64];
- char bsuffix[64];
char nsuffix2[64];
};
diff --git a/lib/bind/resolv/res_query.c b/lib/bind/resolv/res_query.c
index e6b1106e..bf9b5cf2 100644
--- a/lib/bind/resolv/res_query.c
+++ b/lib/bind/resolv/res_query.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_query.c,v 1.2.2.2 2002/07/14 04:26:59 marka Exp $";
+static const char rcsid[] = "$Id: res_query.c,v 1.2.2.3 2003/06/27 03:51:44 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -167,8 +167,11 @@ again:
if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
#ifdef DEBUG
if (statp->options & RES_DEBUG)
- printf(";; rcode = %d, ancount=%d\n", hp->rcode,
- ntohs(hp->ancount));
+ printf(";; rcode = (%s), counts = an:%d ns:%d ar:%d\n",
+ p_rcode(hp->rcode),
+ ntohs(hp->ancount),
+ ntohs(hp->nscount),
+ ntohs(hp->arcount));
#endif
switch (hp->rcode) {
case NXDOMAIN:
diff --git a/lib/bind/resolv/res_send.c b/lib/bind/resolv/res_send.c
index 967f3b13..f5cef13b 100644
--- a/lib/bind/resolv/res_send.c
+++ b/lib/bind/resolv/res_send.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_send.c,v 1.5.2.1 2002/07/10 05:10:35 marka Exp $";
+static const char rcsid[] = "$Id: res_send.c,v 1.5.2.2 2003/06/27 03:51:44 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -171,6 +171,9 @@ res_ourserver_p(const res_state statp, const struct sockaddr *sa) {
srv6 = (struct sockaddr_in6 *)get_nsaddr(statp, ns);
if (srv6->sin6_family == in6p->sin6_family &&
srv6->sin6_port == in6p->sin6_port &&
+#ifdef HAVE_SIN6_SCOPE_ID
+ srv6->sin6_scope_id == in6p->sin6_scope_id &&
+#endif
(IN6_IS_ADDR_UNSPECIFIED(&srv6->sin6_addr) ||
IN6_ARE_ADDR_EQUAL(&srv6->sin6_addr, &in6p->sin6_addr)))
return (1);
@@ -386,6 +389,8 @@ res_nsend(res_state statp,
int nsaplen;
nsap = get_nsaddr(statp, ns);
nsaplen = get_salen(nsap);
+ statp->_flags &= ~RES_F_LASTMASK;
+ statp->_flags |= (ns << RES_F_LASTSHIFT);
same_ns:
if (statp->qhook) {
int done = 0, loops = 0;
@@ -623,7 +628,7 @@ send_vc(res_state statp,
/*
* Send length & message
*/
- putshort((u_short)buflen, (u_char*)&len);
+ ns_put16((u_short)buflen, (u_char*)&len);
iov[0] = evConsIovec(&len, INT16SZ);
DE_CONST(buf, tmp);
iov[1] = evConsIovec(tmp, buflen);
diff --git a/lib/bind/resolv/res_update.c b/lib/bind/resolv/res_update.c
index f1c65fc2..57e3d473 100644
--- a/lib/bind/resolv/res_update.c
+++ b/lib/bind/resolv/res_update.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_update.c,v 1.6.2.3 2002/07/10 05:15:24 marka Exp $";
+static const char rcsid[] = "$Id: res_update.c,v 1.6.2.4 2003/06/27 03:51:44 marka Exp $";
#endif /* not lint */
/*
@@ -77,7 +77,7 @@ struct zonegrp {
/* Forward. */
-static void res_dprintf(const char *, ...);
+static void res_dprintf(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
/* Macros. */
@@ -92,12 +92,18 @@ static void res_dprintf(const char *, ...);
int
res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
ns_updrec *rrecp;
- u_char answer[PACKETSZ], packet[2*PACKETSZ];
+ u_char answer[PACKETSZ];
+ u_char *packet;
struct zonegrp *zptr, tgrp;
LIST(struct zonegrp) zgrps;
int nzones = 0, nscount = 0, n;
union res_sockaddr_union nsaddrs[MAXNS];
+ packet = malloc(NS_MAXMSG);
+ if (packet == NULL) {
+ DPRINTF(("malloc failed"));
+ return (0);
+ }
/* Thread all of the updates onto a list of groups. */
INIT_LIST(zgrps);
memset(&tgrp, 0, sizeof (tgrp));
@@ -150,7 +156,7 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
/* Marshall the update message. */
n = res_nmkupdate(statp, HEAD(zptr->z_rrlist),
- packet, sizeof packet);
+ packet, NS_MAXMSG);
DPRINTF(("res_mkupdate -> %d", n));
if (n < 0)
goto done;
@@ -188,6 +194,7 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
if (nscount != 0)
res_setservers(statp, nsaddrs, nscount);
+ free(packet);
return (nzones);
}
diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in
index 853ed7c8..0e1e6b2f 100644
--- a/lib/dns/Makefile.in
+++ b/lib/dns/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2001 Internet Software Consortium.
+# Copyright (C) 1998-2001, 2003 Internet Software Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.126.2.1 2001/11/15 01:24:06 marka Exp $
+# $Id: Makefile.in,v 1.126.2.3 2003/07/22 04:03:40 marka Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -34,13 +34,13 @@ LIBS = @LIBS@
# Alphabetically
-DSTOBJS = sec/dst/dst_api.@O@ \
- sec/dst/dst_lib.@O@ sec/dst/dst_parse.@O@ \
- sec/dst/dst_result.@O@ sec/dst/gssapi_link.@O@ \
- sec/dst/gssapictx.@O@ sec/dst/hmac_link.@O@ \
- sec/dst/key.@O@ sec/dst/openssl_link.@O@ \
- sec/dst/openssldh_link.@O@ sec/dst/openssldsa_link.@O@ \
- sec/dst/opensslrsa_link.@O@
+DSTOBJS = sec/dst/dst_api.@O@ sec/dst/dst_lib.@O@ sec/dst/dst_parse.@O@ \
+ sec/dst/dst_result.@O@ sec/dst/hmac_link.@O@ sec/dst/key.@O@
+
+OPENSSLOBJS = sec/dst/openssl_link.@O@ sec/dst/openssldh_link.@O@ \
+ sec/dst/openssldsa_link.@O@ sec/dst/opensslrsa_link.@O@
+
+GSSAPIOBJS = sec/dst/gssapi_link.@O@ sec/dst/gssapictx.@O@
# Alphabetically
OBJS = a6.@O@ acl.@O@ adb.@O@ byaddr.@O@ \
@@ -56,7 +56,7 @@ OBJS = a6.@O@ acl.@O@ adb.@O@ byaddr.@O@ \
stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \
tsig.@O@ ttl.@O@ validator.@O@ \
version.@O@ view.@O@ xfrin.@O@ zone.@O@ zonekey.@O@ zt.@O@ \
- ${OTHEROBJS} ${DSTOBJS}
+ ${OTHEROBJS} ${DSTOBJS} ${OPENSSLOBJS} ${GSSAPIOBJS}
# Alphabetically
SRCS = a6.c acl.c adb.c byaddr.c \
@@ -100,6 +100,26 @@ libdns.la: ${OBJS}
-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
${OBJS} ${LIBS}
+libdstcypto.@SA@: ${OPENSSLOBJS}
+ ${AR} ${ARFLAGS} $@ ${OPENSSLOBJS}
+ ${RANLIB} $@
+
+libdstcypto.la: ${OPENSSLOBJS}
+ ${LIBTOOL} --mode=link \
+ ${CC} ${ALL_CFLAGS} -o $@ -rpath ${libdir} \
+ -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
+ ${OPENSSLOBJS} ${LIBS}
+
+libdstgssapi.@SA@: ${GSSAPIOBJS}
+ ${AR} ${ARFLAGS} $@ ${GSSAPIOBJS}
+ ${RANLIB} $@
+
+libdstgssapi.la: ${GSSAPIOBJS}
+ ${LIBTOOL} --mode=link \
+ ${CC} ${ALL_CFLAGS} -o $@ -rpath ${libdir} \
+ -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
+ ${GSSAPIOBJS} ${LIBS}
+
timestamp: libdns.@A@
touch timestamp
diff --git a/lib/dns/adb.c b/lib/dns/adb.c
index 4fb3be4a..7e1cd984 100644
--- a/lib/dns/adb.c
+++ b/lib/dns/adb.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: adb.c,v 1.181.2.4.4.2 2003/02/17 07:05:07 marka Exp $ */
+/* $Id: adb.c,v 1.181.2.11 2003/07/25 04:36:45 marka Exp $ */
/*
* Implementation notes
@@ -87,6 +87,7 @@
*/
#define ADB_CACHE_MINIMUM 10 /* seconds */
#define ADB_CACHE_MAXIMUM 86400 /* seconds (86400 = 24 hours) */
+#define ADB_ENTRY_WINDOW 1800 /* seconds */
/*
* Wake up every CLEAN_SECONDS and clean CLEAN_BUCKETS buckets, so that all
@@ -341,7 +342,7 @@ static isc_result_t dbfind_a6(dns_adbname_t *, isc_stdtime_t);
#define NAME_IS_DEAD 0x40000000
#define NAME_HINT_OK DNS_ADBFIND_HINTOK
#define NAME_GLUE_OK DNS_ADBFIND_GLUEOK
-#define NAME_STARTATROOT DNS_ADBFIND_STARTATROOT
+#define NAME_STARTATZONE DNS_ADBFIND_STARTATZONE
#define NAME_DEAD(n) (((n)->flags & NAME_IS_DEAD) != 0)
#define NAME_NEEDSPOKE(n) (((n)->flags & NAME_NEEDS_POKE) != 0)
#define NAME_GLUEOK(n) (((n)->flags & NAME_GLUE_OK) != 0)
@@ -382,7 +383,7 @@ static isc_result_t dbfind_a6(dns_adbname_t *, isc_stdtime_t);
#define FIND_WANTEMPTYEVENT(fn) (((fn)->options & DNS_ADBFIND_EMPTYEVENT) != 0)
#define FIND_AVOIDFETCHES(fn) (((fn)->options & DNS_ADBFIND_AVOIDFETCHES) \
!= 0)
-#define FIND_STARTATROOT(fn) (((fn)->options & DNS_ADBFIND_STARTATROOT) \
+#define FIND_STARTATZONE(fn) (((fn)->options & DNS_ADBFIND_STARTATZONE) \
!= 0)
#define FIND_HINTOK(fn) (((fn)->options & DNS_ADBFIND_HINTOK) != 0)
#define FIND_GLUEOK(fn) (((fn)->options & DNS_ADBFIND_GLUEOK) != 0)
@@ -406,8 +407,8 @@ static isc_result_t dbfind_a6(dns_adbname_t *, isc_stdtime_t);
#define GLUE_OK(nf, o) (!NAME_GLUEOK(nf) || (((o) & DNS_ADBFIND_GLUEOK) != 0))
#define HINT_OK(nf, o) (!NAME_HINTOK(nf) || (((o) & DNS_ADBFIND_HINTOK) != 0))
#define GLUEHINT_OK(nf, o) (GLUE_OK(nf, o) || HINT_OK(nf, o))
-#define STARTATROOT_MATCHES(nf, o) (((nf)->flags & NAME_STARTATROOT) == \
- ((o) & DNS_ADBFIND_STARTATROOT))
+#define STARTATZONE_MATCHES(nf, o) (((nf)->flags & NAME_STARTATZONE) == \
+ ((o) & DNS_ADBFIND_STARTATZONE))
#define ENTER_LEVEL 50
#define EXIT_LEVEL ENTER_LEVEL
@@ -496,6 +497,7 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
isc_result_t result;
dns_adb_t *adb;
dns_adbnamehook_t *nh;
+ dns_adbnamehook_t *anh;
dns_rdata_t rdata = DNS_RDATA_INIT;
struct in_addr ina;
struct in6_addr in6a;
@@ -561,17 +563,26 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
link_entry(adb, addr_bucket, entry);
} else {
- foundentry->refcnt++;
- nh->entry = foundentry;
+ for (anh = ISC_LIST_HEAD(adbname->v4);
+ anh != NULL;
+ anh = ISC_LIST_NEXT(anh, plink))
+ if (anh->entry == foundentry)
+ break;
+ if (anh == NULL) {
+ foundentry->refcnt++;
+ nh->entry = foundentry;
+ } else
+ free_adbnamehook(adb, &nh);
}
new_addresses_added = ISC_TRUE;
- if (rdtype == dns_rdatatype_a)
- ISC_LIST_APPEND(adbname->v4, nh, plink);
- else
- ISC_LIST_APPEND(adbname->v6, nh, plink);
+ if (nh != NULL) {
+ if (rdtype == dns_rdatatype_a)
+ ISC_LIST_APPEND(adbname->v4, nh, plink);
+ else
+ ISC_LIST_APPEND(adbname->v6, nh, plink);
+ }
nh = NULL;
-
result = dns_rdataset_next(rdataset);
}
@@ -582,7 +593,11 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
if (addr_bucket != DNS_ADB_INVALIDBUCKET)
UNLOCK(&adb->entrylocks[addr_bucket]);
- rdataset->ttl = ttlclamp(rdataset->ttl);
+ if (rdataset->trust == dns_trust_glue ||
+ rdataset->trust == dns_trust_additional)
+ rdataset->ttl = ADB_CACHE_MINIMUM;
+ else
+ rdataset->ttl = ttlclamp(rdataset->ttl);
if (rdtype == dns_rdatatype_a) {
DP(NCACHE_LEVEL, "expire_v4 set to MIN(%u,%u) import_rdataset",
@@ -749,6 +764,7 @@ check_expire_namehooks(dns_adbname_t *name, isc_stdtime_t now) {
name->partial_result &= ~DNS_ADBFIND_INET;
}
name->expire_v4 = INT_MAX;
+ name->fetch_err = FIND_ERR_UNEXPECTED;
}
/*
@@ -761,6 +777,7 @@ check_expire_namehooks(dns_adbname_t *name, isc_stdtime_t now) {
name->partial_result &= ~DNS_ADBFIND_INET6;
}
name->expire_v6 = INT_MAX;
+ name->fetch6_err = FIND_ERR_UNEXPECTED;
}
/*
@@ -1775,7 +1792,7 @@ find_name_and_lock(dns_adb_t *adb, dns_name_t *name,
dns_adbname_t *adbname;
int bucket;
- bucket = dns_name_hash(name, ISC_FALSE) % NBUCKETS;
+ bucket = dns_fullname_hash(name, ISC_FALSE) % NBUCKETS;
if (*bucketp == DNS_ADB_INVALIDBUCKET) {
LOCK(&adb->namelocks[bucket]);
@@ -1791,7 +1808,7 @@ find_name_and_lock(dns_adb_t *adb, dns_name_t *name,
if (!NAME_DEAD(adbname)) {
if (dns_name_equal(name, &adbname->name)
&& GLUEHINT_OK(adbname, options)
- && STARTATROOT_MATCHES(adbname, options))
+ && STARTATZONE_MATCHES(adbname, options))
return (adbname);
}
adbname = ISC_LIST_NEXT(adbname, plink);
@@ -2452,7 +2469,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
dns_adbfind_t *find;
dns_adbname_t *adbname;
int bucket;
- isc_boolean_t want_event, start_at_root, alias, have_address;
+ isc_boolean_t want_event, start_at_zone, alias, have_address;
isc_result_t result;
unsigned int wanted_addresses;
unsigned int wanted_fetches;
@@ -2474,7 +2491,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
wanted_fetches = 0;
query_pending = 0;
want_event = ISC_FALSE;
- start_at_root = ISC_FALSE;
+ start_at_zone = ISC_FALSE;
alias = ISC_FALSE;
if (now == 0)
@@ -2544,8 +2561,8 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
adbname->flags |= NAME_HINT_OK;
if (FIND_GLUEOK(find))
adbname->flags |= NAME_GLUE_OK;
- if (FIND_STARTATROOT(find))
- adbname->flags |= NAME_STARTATROOT;
+ if (FIND_STARTATZONE(find))
+ adbname->flags |= NAME_STARTATZONE;
}
/*
@@ -2572,8 +2589,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
* start fetches. First try looking for an A record
* in the database.
*/
- if (!NAME_HAS_V4(adbname) && !NAME_FETCH_V4(adbname)
- && EXPIRE_OK(adbname->expire_v4, now)
+ if (!NAME_HAS_V4(adbname) && EXPIRE_OK(adbname->expire_v4, now)
&& WANT_INET(wanted_addresses)) {
result = dbfind_name(adbname, now, dns_rdatatype_a);
if (result == ISC_R_SUCCESS) {
@@ -2608,12 +2624,12 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
else if (NXRRSET_RESULT(result))
goto v6;
- wanted_fetches |= DNS_ADBFIND_INET;
+ if (!NAME_FETCH_V4(adbname))
+ wanted_fetches |= DNS_ADBFIND_INET;
}
v6:
- if (!NAME_HAS_V6(adbname) && !NAME_FETCH_V6(adbname)
- && EXPIRE_OK(adbname->expire_v6, now)
+ if (!NAME_HAS_V6(adbname) && EXPIRE_OK(adbname->expire_v6, now)
&& WANT_INET6(wanted_addresses)) {
result = dbfind_a6(adbname, now);
if (result == ISC_R_SUCCESS) {
@@ -2669,7 +2685,8 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
if (NCACHE_RESULT(result) || AUTH_NX(result))
goto fetch;
- wanted_fetches |= DNS_ADBFIND_INET6;
+ if (!NAME_FETCH_V6(adbname))
+ wanted_fetches |= DNS_ADBFIND_INET6;
}
fetch:
@@ -2687,14 +2704,14 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
* be acceptable so we have to launch fetches.
*/
- if (FIND_STARTATROOT(find))
- start_at_root = ISC_TRUE;
+ if (FIND_STARTATZONE(find))
+ start_at_zone = ISC_TRUE;
/*
* Start V4.
*/
if (WANT_INET(wanted_fetches) &&
- fetch_name_v4(adbname, start_at_root) == ISC_R_SUCCESS) {
+ fetch_name_v4(adbname, start_at_zone) == ISC_R_SUCCESS) {
DP(DEF_LEVEL,
"dns_adb_createfind: started A fetch for name %p",
adbname);
@@ -2704,7 +2721,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
* Start V6.
*/
if (WANT_INET6(wanted_fetches) &&
- fetch_name_a6(adbname, start_at_root) == ISC_R_SUCCESS) {
+ fetch_name_a6(adbname, start_at_zone) == ISC_R_SUCCESS) {
DP(DEF_LEVEL,
"dns_adb_createfind: started A6 fetch for name %p",
adbname);
@@ -3285,7 +3302,6 @@ dbfind_a6(dns_adbname_t *adbname, isc_stdtime_t now) {
INSIST(DNS_ADBNAME_VALID(adbname));
adb = adbname->adb;
INSIST(DNS_ADB_VALID(adb));
- INSIST(!NAME_FETCH_V6(adbname));
result = ISC_R_UNEXPECTED;
@@ -3731,10 +3747,11 @@ fetch_callback_a6(isc_task_t *task, isc_event_t *ev) {
}
static isc_result_t
-fetch_name_v4(dns_adbname_t *adbname, isc_boolean_t start_at_root) {
+fetch_name_v4(dns_adbname_t *adbname, isc_boolean_t start_at_zone) {
isc_result_t result;
dns_adbfetch_t *fetch = NULL;
dns_adb_t *adb;
+ dns_fixedname_t fixed;
dns_name_t *name;
dns_rdataset_t rdataset;
dns_rdataset_t *nameservers;
@@ -3753,12 +3770,14 @@ fetch_name_v4(dns_adbname_t *adbname, isc_boolean_t start_at_root) {
dns_rdataset_init(&rdataset);
options = 0;
- if (start_at_root) {
- DP(50, "fetch_name_v4: starting at DNS root for name %p",
+ if (start_at_zone) {
+ DP(50, "fetch_name_v4: starting at zone for name %p",
adbname);
- name = dns_rootname;
- result = dns_view_simplefind(adb->view, name, dns_rdatatype_ns,
- 0, 0, ISC_TRUE, &rdataset, NULL);
+ dns_fixedname_init(&fixed);
+ name = dns_fixedname_name(&fixed);
+ result = dns_view_findzonecut2(adb->view, &adbname->name, name,
+ 0, 0, ISC_TRUE, ISC_FALSE,
+ &rdataset, NULL);
if (result != ISC_R_SUCCESS && result != DNS_R_HINT)
goto cleanup;
nameservers = &rdataset;
@@ -3833,10 +3852,11 @@ fetch_name_aaaa(dns_adbname_t *adbname) {
}
static isc_result_t
-fetch_name_a6(dns_adbname_t *adbname, isc_boolean_t start_at_root) {
+fetch_name_a6(dns_adbname_t *adbname, isc_boolean_t start_at_zone) {
isc_result_t result;
dns_adbfetch6_t *fetch = NULL;
dns_adb_t *adb;
+ dns_fixedname_t fixed;
dns_name_t *name;
dns_rdataset_t rdataset;
dns_rdataset_t *nameservers;
@@ -3855,12 +3875,14 @@ fetch_name_a6(dns_adbname_t *adbname, isc_boolean_t start_at_root) {
dns_rdataset_init(&rdataset);
options = 0;
- if (start_at_root) {
- DP(50, "fetch_name_a6: starting at DNS root for name %p",
+ if (start_at_zone) {
+ DP(50, "fetch_name_a6: starting at zone for name %p",
adbname);
- name = dns_rootname;
- result = dns_view_simplefind(adb->view, name, dns_rdatatype_ns,
- 0, 0, ISC_TRUE, &rdataset, NULL);
+ dns_fixedname_init(&fixed);
+ name = dns_fixedname_name(&fixed);
+ result = dns_view_findzonecut2(adb->view, &adbname->name, name,
+ 0, 0, ISC_TRUE, ISC_FALSE,
+ &rdataset, NULL);
if (result != ISC_R_SUCCESS && result != DNS_R_HINT)
goto cleanup;
nameservers = &rdataset;
@@ -3930,6 +3952,7 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
{
int bucket;
unsigned int new_srtt;
+ isc_stdtime_t now;
REQUIRE(DNS_ADB_VALID(adb));
REQUIRE(DNS_ADBADDRINFO_VALID(addr));
@@ -3947,6 +3970,9 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
addr->entry->srtt = new_srtt;
addr->srtt = new_srtt;
+ isc_stdtime_get(&now);
+ addr->entry->expires = now + ADB_ENTRY_WINDOW;
+
UNLOCK(&adb->entrylocks[bucket]);
}
@@ -4044,7 +4070,7 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp) {
bucket = addr->entry->lock_bucket;
LOCK(&adb->entrylocks[bucket]);
- entry->expires = now + 1800; /* XXXRTH */
+ entry->expires = now + ADB_ENTRY_WINDOW;
want_check_exit = dec_entry_refcnt(adb, entry, ISC_FALSE);
diff --git a/lib/dns/api b/lib/dns/api
index c5d85110..60211f35 100644
--- a/lib/dns/api
+++ b/lib/dns/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 8
-LIBREVISION = 1
+LIBINTERFACE = 9
+LIBREVISION = 2
LIBAGE = 0
diff --git a/lib/dns/byaddr.c b/lib/dns/byaddr.c
index ae4240c1..d185a352 100644
--- a/lib/dns/byaddr.c
+++ b/lib/dns/byaddr.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: byaddr.c,v 1.29 2001/06/04 19:32:57 tale Exp $ */
+/* $Id: byaddr.c,v 1.29.2.1 2003/07/25 04:36:45 marka Exp $ */
#include <config.h>
@@ -68,6 +68,18 @@ isc_result_t
dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble,
dns_name_t *name)
{
+ unsigned int options = DNS_BYADDROPT_IPV6INT;
+
+ if (nibble)
+ options |= DNS_BYADDROPT_IPV6NIBBLE;
+
+ return (dns_byaddr_createptrname2(address, options, name));
+}
+
+isc_result_t
+dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options,
+ dns_name_t *name)
+{
char textname[128];
unsigned char *bytes;
int i;
@@ -91,7 +103,7 @@ dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble,
(bytes[1] & 0xff),
(bytes[0] & 0xff));
} else if (address->family == AF_INET6) {
- if (nibble) {
+ if ((options & DNS_BYADDROPT_IPV6NIBBLE) != 0) {
cp = textname;
for (i = 15; i >= 0; i--) {
*cp++ = hex_digits[bytes[i] & 0x0f];
@@ -99,7 +111,10 @@ dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble,
*cp++ = hex_digits[(bytes[i] >> 4) & 0x0f];
*cp++ = '.';
}
- strcpy(cp, "ip6.int.");
+ if ((options & DNS_BYADDROPT_IPV6INT) != 0)
+ strcpy(cp, "ip6.int.");
+ else
+ strcpy(cp, "ip6.arpa.");
} else {
cp = textname;
*cp++ = '\\';
@@ -241,9 +256,8 @@ dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view,
dns_fixedname_init(&byaddr->name);
- result = dns_byaddr_createptrname(address,
- ISC_TF(byaddr->options & DNS_BYADDROPT_IPV6NIBBLE),
- dns_fixedname_name(&byaddr->name));
+ result = dns_byaddr_createptrname2(address, byaddr->options,
+ dns_fixedname_name(&byaddr->name));
if (result != ISC_R_SUCCESS)
goto cleanup_lock;
diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c
index 3b33f2ed..73e90446 100644
--- a/lib/dns/dispatch.c
+++ b/lib/dns/dispatch.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dispatch.c,v 1.101.2.3 2002/05/08 06:38:14 marka Exp $ */
+/* $Id: dispatch.c,v 1.101.2.6 2003/07/22 04:03:40 marka Exp $ */
#include <config.h>
@@ -501,12 +501,7 @@ allocate_event(dns_dispatch_t *disp) {
*
* If I/O result == CANCELED or error, free the buffer.
*
- * If query:
- * if no listeners: free the buffer, restart.
- * if listener: allocate event, fill in details.
- * If cannot allocate, free buffer, restart.
- * if rq event queue is not empty, queue. else, send.
- * restart.
+ * If query, free the buffer, restart.
*
* If response:
* Allocate event, fill in details.
@@ -544,7 +539,12 @@ udp_recv(isc_task_t *task, isc_event_t *ev_in) {
"got packet: requests %d, buffers %d, recvs %d",
disp->requests, disp->mgr->buffers, disp->recv_pending);
- if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) == 0) {
+ if (ev->ev_type == ISC_SOCKEVENT_RECVDONE) {
+ /*
+ * Unless the receive event was imported from a listening
+ * interface, in which case the event type is
+ * DNS_EVENT_IMPORTRECVDONE, receive operation must be pending.
+ */
INSIST(disp->recv_pending != 0);
disp->recv_pending = 0;
}
@@ -687,20 +687,15 @@ udp_recv(isc_task_t *task, isc_event_t *ev_in) {
/*
* General flow:
*
- * If I/O result == CANCELED, EOF, or error, free the buffer
- * and notify everyone as the various queues drain.
+ * If I/O result == CANCELED, EOF, or error, notify everyone as the
+ * various queues drain.
*
- * If query:
- * if no listeners: free the buffer, restart.
- * if listener: allocate event, fill in details.
- * If cannot allocate, free buffer, restart.
- * if rq event queue is not empty, queue. else, send.
- * restart.
+ * If query, restart.
*
* If response:
* Allocate event, fill in details.
- * If cannot allocate, free buffer, restart.
- * find target. If not found, free buffer, restart.
+ * If cannot allocate, restart.
+ * find target. If not found, restart.
* if event queue is not empty, queue. else, send.
* restart.
*/
@@ -765,7 +760,7 @@ tcp_recv(isc_task_t *task, isc_event_t *ev_in) {
* free the event *before* calling destroy_disp().
*/
isc_event_free(&ev_in);
-
+
disp->shutting_down = 1;
disp->shutdown_why = tcpmsg->result;
@@ -1316,7 +1311,7 @@ qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets,
*/
isc_lfsr_init(&qid->qid_lfsr1, 0, 32, 0x80000057U,
0, reseed_lfsr, mgr);
- isc_lfsr_init(&qid->qid_lfsr2, 0, 32, 0x800000c2U,
+ isc_lfsr_init(&qid->qid_lfsr2, 0, 32, 0x80000062U,
0, reseed_lfsr, mgr);
*qidp = qid;
return (ISC_R_SUCCESS);
@@ -1577,7 +1572,7 @@ dns_dispatch_getudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
{
disp->attributes |= DNS_DISPATCHATTR_NOLISTEN;
if (disp->recv_pending != 0)
- isc_socket_cancel(disp->socket, NULL,
+ isc_socket_cancel(disp->socket, disp->task,
ISC_SOCKCANCEL_RECV);
}
@@ -1715,7 +1710,7 @@ dns_dispatch_detach(dns_dispatch_t **dispp) {
killit = ISC_FALSE;
if (disp->refcount == 0) {
if (disp->recv_pending > 0)
- isc_socket_cancel(disp->socket, NULL,
+ isc_socket_cancel(disp->socket, disp->task,
ISC_SOCKCANCEL_RECV);
disp->shutting_down = 1;
}
@@ -1878,7 +1873,7 @@ dns_dispatch_removeresponse(dns_dispentry_t **resp,
killit = ISC_FALSE;
if (disp->refcount == 0) {
if (disp->recv_pending > 0)
- isc_socket_cancel(disp->socket, NULL,
+ isc_socket_cancel(disp->socket, disp->task,
ISC_SOCKCANCEL_RECV);
disp->shutting_down = 1;
}
@@ -2044,11 +2039,19 @@ dns_dispatch_changeattributes(dns_dispatch_t *disp,
LOCK(&disp->lock);
- if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) != 0 &&
- (attributes & DNS_DISPATCHATTR_NOLISTEN) == 0)
- {
- disp->attributes &= ~DNS_DISPATCHATTR_NOLISTEN;
- startrecv(disp);
+ if ((mask & DNS_DISPATCHATTR_NOLISTEN) != 0) {
+ if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN) != 0 &&
+ (attributes & DNS_DISPATCHATTR_NOLISTEN) == 0) {
+ disp->attributes &= ~DNS_DISPATCHATTR_NOLISTEN;
+ startrecv(disp);
+ } else if ((disp->attributes & DNS_DISPATCHATTR_NOLISTEN)
+ == 0 &&
+ (attributes & DNS_DISPATCHATTR_NOLISTEN) != 0) {
+ disp->attributes |= DNS_DISPATCHATTR_NOLISTEN;
+ if (disp->recv_pending != 0)
+ isc_socket_cancel(disp->socket, disp->task,
+ ISC_SOCKCANCEL_RECV);
+ }
}
disp->attributes &= ~mask;
@@ -2070,7 +2073,7 @@ dns_dispatch_importrecv(dns_dispatch_t *disp, isc_event_t *event) {
INSIST(sevent->n <= disp->mgr->buffersize);
newsevent = (isc_socketevent_t *)
isc_event_allocate(disp->mgr->mctx, NULL,
- ISC_SOCKEVENT_RECVDONE, udp_recv,
+ DNS_EVENT_IMPORTRECVDONE, udp_recv,
disp, sizeof(isc_socketevent_t));
if (newsevent == NULL)
return;
diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c
index 4c1e3089..92740790 100644
--- a/lib/dns/dnssec.c
+++ b/lib/dns/dnssec.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -16,7 +16,7 @@
*/
/*
- * $Id: dnssec.c,v 1.69.2.3 2002/08/02 05:08:49 marka Exp $
+ * $Id: dnssec.c,v 1.69.2.5 2003/07/22 04:03:41 marka Exp $
*/
@@ -26,6 +26,7 @@
#include <isc/buffer.h>
#include <isc/mem.h>
+#include <isc/serial.h>
#include <isc/string.h>
#include <isc/util.h>
@@ -360,15 +361,18 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
if (ret != ISC_R_SUCCESS)
return (ret);
+ if (isc_serial_lt(sig.timesigned, sig.timeexpire))
+ return (DNS_R_SIGINVALID);
+
if (!ignoretime) {
isc_stdtime_get(&now);
/*
* Is SIG temporally valid?
*/
- if (sig.timesigned > now)
+ if (isc_serial_lt((isc_uint32_t)now, sig.timesigned))
return (DNS_R_SIGFUTURE);
- else if (sig.timeexpire < now)
+ else if (isc_serial_lt(sig.timeexpire, (isc_uint32_t)now))
return (DNS_R_SIGEXPIRED);
}
@@ -723,13 +727,19 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg,
goto failure;
}
+ if (isc_serial_lt(sig.timeexpire, sig.timesigned)) {
+ result = DNS_R_SIGINVALID;
+ msg->sig0status = dns_tsigerror_badtime;
+ goto failure;
+ }
+
isc_stdtime_get(&now);
- if (sig.timesigned > now) {
+ if (isc_serial_lt((isc_uint32_t)now, sig.timesigned)) {
result = DNS_R_SIGFUTURE;
msg->sig0status = dns_tsigerror_badtime;
goto failure;
}
- else if (sig.timeexpire < now) {
+ else if (isc_serial_lt(sig.timeexpire, (isc_uint32_t)now)) {
result = DNS_R_SIGEXPIRED;
msg->sig0status = dns_tsigerror_badtime;
goto failure;
diff --git a/lib/dns/gen.c b/lib/dns/gen.c
index 3373ac3c..0de13357 100644
--- a/lib/dns/gen.c
+++ b/lib/dns/gen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2002 Internet Software Consortium.
+ * Copyright (C) 1998-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: gen.c,v 1.65.2.2 2002/03/26 00:54:54 marka Exp $ */
+/* $Id: gen.c,v 1.65.2.5 2003/07/23 06:57:48 marka Exp $ */
#include <config.h>
@@ -110,6 +110,8 @@ const char copyright[] =
" ***************/\n"
"\n";
+#define TYPENAMES 256
+
struct cc {
struct cc *next;
int rdclass;
@@ -130,7 +132,10 @@ struct ttnam {
char macroname[11];
char attr[256];
unsigned int sorted;
-} typenames[256];
+ int type;
+} typenames[TYPENAMES];
+
+int maxtype = -1;
char *
upper(char *);
@@ -274,25 +279,48 @@ dodecl(char *type, char *function, char *args) {
funname(tt->typename, buf1), args);
}
+static struct ttnam *
+find_typename(int type) {
+ int i;
+
+ for (i = 0; i < TYPENAMES; i++) {
+ if (typenames[i].typename[0] != 0 &&
+ typenames[i].type == type)
+ return (&typenames[i]);
+ }
+ return (NULL);
+}
+
void
insert_into_typenames(int type, const char *typename, const char *attr) {
- struct ttnam *ttn;
- int c;
+ struct ttnam *ttn = NULL;
+ int c, i;
char tmp[256];
- ttn = &typenames[type];
- if (ttn->typename[0] == 0) {
- if (strlen(typename) > sizeof(ttn->typename) - 1) {
- fprintf(stderr, "Error: type name %s is too long\n",
- typename);
+ for (i = 0; i < TYPENAMES; i++) {
+ if (typenames[i].typename[0] != 0 &&
+ typenames[i].type == type &&
+ strcmp(typename, typenames[i].typename) != 0) {
+ fprintf(stderr,
+ "Error: type %d has two names: %s, %s\n",
+ type, typenames[i].typename, typename);
exit(1);
}
- strcpy(ttn->typename, typename);
- } else if (strcmp(typename, ttn->typename) != 0) {
- fprintf(stderr, "Error: type %d has two names: %s, %s\n",
- type, ttn->typename, typename);
+ if (typenames[i].typename[0] == 0 && ttn == NULL)
+ ttn = &typenames[i];
+ }
+ if (ttn == NULL) {
+ fprintf(stderr, "Error: typenames array too small\n");
exit(1);
}
+
+ if (strlen(typename) > sizeof(ttn->typename) - 1) {
+ fprintf(stderr, "Error: type name %s is too long\n",
+ typename);
+ exit(1);
+ }
+ strcpy(ttn->typename, typename);
+ ttn->type = type;
strcpy(ttn->macroname, ttn->typename);
c = strlen(ttn->macroname);
@@ -320,6 +348,8 @@ insert_into_typenames(int type, const char *typename, const char *attr) {
}
strcpy(ttn->attr, attr);
ttn->sorted = 0;
+ if (maxtype < type)
+ maxtype = type;
}
void
@@ -469,7 +499,7 @@ main(int argc, char **argv) {
char *file = NULL;
isc_dir_t dir;
- for (i = 0 ; i <= 255 ; i++)
+ for (i = 0; i < TYPENAMES ; i++)
memset(&typenames[i], 0, sizeof(typenames[i]));
strcpy(srcdir, "");
@@ -596,7 +626,7 @@ main(int argc, char **argv) {
* attributes.
*/
-#define PRINT_COMMA(x) (x == 255 ? "" : ",")
+#define PRINT_COMMA(x) (x == maxtype ? "" : ",")
#define METANOTQUESTION "DNS_RDATATYPEATTR_META | " \
"DNS_RDATATYPEATTR_NOTQUESTION"
@@ -626,9 +656,9 @@ main(int argc, char **argv) {
fprintf(stdout, "\tunsigned int flags;\n");
fprintf(stdout, "} typeattr_t;\n");
fprintf(stdout, "static typeattr_t typeattr[] = {\n");
- for (i = 0 ; i <= 255 ; i++) {
- ttn = &typenames[i];
- if (ttn->typename[0] == 0) {
+ for (i = 0; i <= maxtype ; i++) {
+ ttn = find_typename(i);
+ if (ttn == NULL) {
const char *attrs;
if (i >= 128 && i < 255)
attrs = "DNS_RDATATYPEATTR_UNKNOWN | "
@@ -636,7 +666,7 @@ main(int argc, char **argv) {
else
attrs = "DNS_RDATATYPEATTR_UNKNOWN";
fprintf(stdout, "\t{ \"TYPE%d\", %s}%s\n",
- i, attrs, PRINT_COMMA(i));
+ i, attrs, PRINT_COMMA(i));
} else {
fprintf(stdout, "\t{ \"%s\", %s }%s\n",
upper(ttn->typename),
@@ -647,16 +677,6 @@ main(int argc, char **argv) {
fprintf(stdout, "};\n");
/*
- * Run through the list of types and pre-mark the unused
- * ones as "sorted" so we simply ignore them below.
- */
- for (i = 0 ; i <= 255 ; i++) {
- ttn = &typenames[i];
- if (ttn->typename[0] == 0)
- ttn->sorted = 1;
- }
-
- /*
* Spit out a quick and dirty hash function. Here,
* we walk through the list of type names, and calculate
* a hash. This isn't perfect, but it will generate "pretty
@@ -682,8 +702,10 @@ main(int argc, char **argv) {
fprintf(stdout, "#define RDATATYPE_FROMTEXT_SW(_hash,"
"_typename,_length,_typep) \\\n");
fprintf(stdout, "\tswitch (_hash) { \\\n");
- for (i = 0 ; i <= 255 ; i++) {
- ttn = &typenames[i];
+ for (i = 0; i <= maxtype ; i++) {
+ ttn = find_typename(i);
+ if (ttn == NULL)
+ continue;
/*
* Skip entries we already processed.
@@ -698,15 +720,15 @@ main(int argc, char **argv) {
* Find all other entries that happen to match
* this hash.
*/
- for (j = 0 ; j <= 255 ; j++) {
- ttn2 = &typenames[j];
- if (ttn2->sorted != 0)
+ for (j = 0; j <= maxtype ; j++) {
+ ttn2 = find_typename(j);
+ if (ttn2 == NULL)
continue;
if (hash == HASH(ttn2->typename)) {
fprintf(stdout, "\t\t\tRDATATYPE_COMPARE"
"(\"%s\", %u, "
"_typename, _length, _typep); \\\n",
- ttn2->typename, j);
+ ttn2->typename, ttn2->type);
ttn2->sorted = 1;
}
}
@@ -750,7 +772,7 @@ main(int argc, char **argv) {
"#define dns_rdatatype_%s\t%s"
"((dns_rdatatype_t)dns_rdatatype_%s)"
"\n",
- s, strlen(s) < 2 ? "\t" : "", s);
+ s, strlen(s) < 2U ? "\t" : "", s);
lasttype = tt->type;
}
diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h
index d6e4fede..84ba8c50 100644
--- a/lib/dns/include/dns/adb.h
+++ b/lib/dns/include/dns/adb.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: adb.h,v 1.66.2.3 2002/08/05 06:57:13 marka Exp $ */
+/* $Id: adb.h,v 1.66.2.5 2003/07/22 04:03:45 marka Exp $ */
#ifndef DNS_ADB_H
#define DNS_ADB_H 1
@@ -147,9 +147,9 @@ struct dns_adbfind {
* If set, fetches will not be generated unless no addresses are
* available in any of the address families requested.
*
- * _STARTATROOT:
- * Fetches will start at the root nameservers, instead of the closest
- * ancestor. This is useful for reestablishing glue that has expired.
+ * _STARTATZONE:
+ * Fetches will start using the closest zone data or use the root servers.
+ * This is useful for reestablishing glue that has expired.
*
* _GLUEOK:
* _HINTOK:
@@ -170,7 +170,7 @@ struct dns_adbfind {
#define DNS_ADBFIND_EMPTYEVENT 0x00000004
#define DNS_ADBFIND_WANTEVENT 0x00000008
#define DNS_ADBFIND_AVOIDFETCHES 0x00000010
-#define DNS_ADBFIND_STARTATROOT 0x00000020
+#define DNS_ADBFIND_STARTATZONE 0x00000020
#define DNS_ADBFIND_GLUEOK 0x00000040
#define DNS_ADBFIND_HINTOK 0x00000080
#define DNS_ADBFIND_RETURNLAME 0x00000100
diff --git a/lib/dns/include/dns/byaddr.h b/lib/dns/include/dns/byaddr.h
index 3c211643..25ca85e8 100644
--- a/lib/dns/include/dns/byaddr.h
+++ b/lib/dns/include/dns/byaddr.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: byaddr.h,v 1.12 2001/01/09 21:52:18 bwelling Exp $ */
+/* $Id: byaddr.h,v 1.12.2.1 2003/07/25 04:36:46 marka Exp $ */
#ifndef DNS_BYADDR_H
#define DNS_BYADDR_H 1
@@ -69,6 +69,7 @@ typedef struct dns_byaddrevent {
} dns_byaddrevent_t;
#define DNS_BYADDROPT_IPV6NIBBLE 0x0001
+#define DNS_BYADDROPT_IPV6INT 0x0002 /* Use IP6.INT nibble lookups */
isc_result_t
dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view,
@@ -79,17 +80,13 @@ dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view,
*
* Notes:
*
- * There are two reverse lookup formats for IPv6 addresses, 'bitstring'
- * and 'nibble'. The newer 'bitstring' format for the address fe80::1 is
- *
- * \[xfe800000000000000000000000000001].ip6.int.
+ * There is a reverse lookup format for IPv6 addresses, 'nibble'
*
* The 'nibble' format for that address is
*
- * 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.int.
+ * 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa.
*
- * The 'bitstring' format will be used unless the DNS_BYADDROPT_IPV6NIBBLE
- * option has been set.
+ * DNS_BYADDROPT_IPV6INT can be used to get nibble lookups under ip6.int.
*
* Requires:
*
@@ -147,10 +144,15 @@ dns_byaddr_destroy(dns_byaddr_t **byaddrp);
isc_result_t
dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble,
dns_name_t *name);
+
+isc_result_t
+dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options,
+ dns_name_t *name);
/*
* Creates a name that would be used in a PTR query for this address. The
* nibble flag indicates that the 'nibble' format is to be used if an IPv6
- * address is provided, instead of the 'bitstring' format.
+ * address is provided, instead of the 'bitstring' format. 'options' are
+ * the same as for dns_byaddr_create().
*
* Requires:
*
diff --git a/lib/dns/include/dns/dispatch.h b/lib/dns/include/dns/dispatch.h
index 03407a72..ecbcd55d 100644
--- a/lib/dns/include/dns/dispatch.h
+++ b/lib/dns/include/dns/dispatch.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dispatch.h,v 1.45.22.2 2003/02/17 07:05:10 marka Exp $ */
+/* $Id: dispatch.h,v 1.45.2.2 2003/03/06 04:38:22 marka Exp $ */
#ifndef DNS_DISPATCH_H
#define DNS_DISPATCH_H 1
diff --git a/lib/dns/include/dns/events.h b/lib/dns/include/dns/events.h
index 6f3db80b..9935327d 100644
--- a/lib/dns/include/dns/events.h
+++ b/lib/dns/include/dns/events.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: events.h,v 1.37 2001/02/13 02:49:07 gson Exp $ */
+/* $Id: events.h,v 1.37.2.1 2002/09/04 02:47:08 jinmei Exp $ */
#ifndef DNS_EVENTS_H
#define DNS_EVENTS_H 1
@@ -60,6 +60,7 @@
#define DNS_EVENT_QUERYABORTED (ISC_EVENTCLASS_DNS + 31)
#define DNS_EVENT_DISPATCHCONTROL (ISC_EVENTCLASS_DNS + 32)
#define DNS_EVENT_REQUESTCONTROL (ISC_EVENTCLASS_DNS + 33)
+#define DNS_EVENT_IMPORTRECVDONE (ISC_EVENTCLASS_DNS + 35)
#define DNS_EVENT_FIRSTEVENT (ISC_EVENTCLASS_DNS + 0)
#define DNS_EVENT_LASTEVENT (ISC_EVENTCLASS_DNS + 65535)
diff --git a/lib/dns/include/dns/master.h b/lib/dns/include/dns/master.h
index a6df12f2..5416cebe 100644
--- a/lib/dns/include/dns/master.h
+++ b/lib/dns/include/dns/master.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: master.h,v 1.31.2.1 2001/09/04 22:51:41 gson Exp $ */
+/* $Id: master.h,v 1.31.2.3 2003/07/22 04:03:45 marka Exp $ */
#ifndef DNS_MASTER_H
#define DNS_MASTER_H 1
@@ -37,6 +37,7 @@
#define DNS_MASTER_MANYERRORS 0x00000002 /* Continue processing on errors. */
#define DNS_MASTER_NOINCLUDE 0x00000004 /* Disallow $INCLUDE directives. */
#define DNS_MASTER_ZONE 0x00000008 /* Loading a zone master file. */
+#define DNS_MASTER_SLAVE 0x00000020 /* Loading a slave master file. */
ISC_LANG_BEGINDECLS
diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h
index 8995b53b..14781d0b 100644
--- a/lib/dns/include/dns/name.h
+++ b/lib/dns/include/dns/name.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: name.h,v 1.95.2.2 2002/04/23 02:28:51 marka Exp $ */
+/* $Id: name.h,v 1.95.2.3 2003/07/25 03:31:44 marka Exp $ */
#ifndef DNS_NAME_H
#define DNS_NAME_H 1
@@ -390,6 +390,22 @@ dns_name_hash(dns_name_t *name, isc_boolean_t case_sensitive);
* A hash value
*/
+unsigned int
+dns_fullname_hash(dns_name_t *name, isc_boolean_t case_sensitive);
+/*
+ * Provide a hash value for 'name'. Unlike dns_name_hash(), this function
+ * always takes into account of the entire name to calculate the hash value.
+ *
+ * Note: if 'case_sensitive' is ISC_FALSE, then names which differ only in
+ * case will have the same hash value.
+ *
+ * Requires:
+ * 'name' is a valid name
+ *
+ * Returns:
+ * A hash value
+ */
+
/***
*** Comparisons
***/
diff --git a/lib/dns/include/dns/rdata.h b/lib/dns/include/dns/rdata.h
index 46c18824..fbe4830f 100644
--- a/lib/dns/include/dns/rdata.h
+++ b/lib/dns/include/dns/rdata.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.h,v 1.51.2.2 2002/02/20 02:17:25 marka Exp $ */
+/* $Id: rdata.h,v 1.51.2.3 2003/07/30 01:04:15 marka Exp $ */
#ifndef DNS_RDATA_H
#define DNS_RDATA_H 1
@@ -468,10 +468,6 @@ dns_rdatatype_ismeta(dns_rdatatype_t type);
/*
* Return true iff the rdata type 'type' is a meta-type
* like ANY or AXFR.
- *
- * Requires:
- * 'type' is a valid rdata type.
- *
*/
isc_boolean_t
@@ -490,10 +486,6 @@ dns_rdataclass_ismeta(dns_rdataclass_t rdclass);
/*
* Return true iff the rdata class 'rdclass' is a meta-class
* like ANY or NONE.
- *
- * Requires:
- * 'rdclass' is a valid rdata class.
- *
*/
isc_boolean_t
diff --git a/lib/dns/include/dns/rdataset.h b/lib/dns/include/dns/rdataset.h
index c434cade..18ed4ed6 100644
--- a/lib/dns/include/dns/rdataset.h
+++ b/lib/dns/include/dns/rdataset.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataset.h,v 1.41.2.2 2002/04/23 02:28:52 marka Exp $ */
+/* $Id: rdataset.h,v 1.41.2.5 2003/07/22 04:03:45 marka Exp $ */
#ifndef DNS_RDATASET_H
#define DNS_RDATASET_H 1
@@ -104,7 +104,7 @@ struct dns_rdataset {
void * private1;
void * private2;
void * private3;
- void * private4;
+ unsigned int privateuint4;
void * private5;
};
@@ -129,6 +129,7 @@ struct dns_rdataset {
#define DNS_RDATASETATTR_FIXEDORDER 0x0400
#define DNS_RDATASETATTR_RANDOMIZE 0x0800
#define DNS_RDATASETATTR_CHASE 0x1000 /* Used by resolver. */
+#define DNS_RDATASETATTR_NXDOMAIN 0x2000
void
dns_rdataset_init(dns_rdataset_t *rdataset);
diff --git a/lib/dns/include/dns/rdataslab.h b/lib/dns/include/dns/rdataslab.h
index 68b3546b..999d772e 100644
--- a/lib/dns/include/dns/rdataslab.h
+++ b/lib/dns/include/dns/rdataslab.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataslab.h,v 1.20 2001/01/09 21:53:19 bwelling Exp $ */
+/* $Id: rdataslab.h,v 1.20.2.2 2003/07/22 04:03:45 marka Exp $ */
#ifndef DNS_RDATASLAB_H
#define DNS_RDATASLAB_H 1
@@ -121,7 +121,8 @@ isc_boolean_t
dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2,
unsigned int reservelen);
-/* Compare two rdataslabs for equality. This does _not_ do a full
+/*
+ * Compare two rdataslabs for equality. This does _not_ do a full
* DNSSEC comparison.
*
* Requires:
@@ -131,6 +132,20 @@ dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2,
* ISC_TRUE if the slabs are equal, ISC_FALSE otherwise.
*/
+isc_boolean_t
+dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2,
+ unsigned int reservelen, dns_rdataclass_t rdclass,
+ dns_rdatatype_t type);
+/*
+ * Compare two rdataslabs for DNSSEC equality.
+ *
+ * Requires:
+ * 'slab1' and 'slab2' point to slabs.
+ *
+ * Returns:
+ * ISC_TRUE if the slabs are equal, ISC_FALSE otherwise.
+ */
+
ISC_LANG_ENDDECLS
#endif /* DNS_RDATASLAB_H */
diff --git a/lib/dns/include/dns/result.h b/lib/dns/include/dns/result.h
index 768033cb..bac13978 100644
--- a/lib/dns/include/dns/result.h
+++ b/lib/dns/include/dns/result.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2002 Internet Software Consortium.
+ * Copyright (C) 1998-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.h,v 1.81.2.3 2002/03/26 00:55:02 marka Exp $ */
+/* $Id: result.h,v 1.81.2.7 2003/07/22 04:03:46 marka Exp $ */
#ifndef DNS_RESULT_H
#define DNS_RESULT_H 1
@@ -120,9 +120,11 @@
#define DNS_R_FROZEN (ISC_RESULTCLASS_DNS + 81)
#define DNS_R_UNKNOWNFLAG (ISC_RESULTCLASS_DNS + 82)
#define DNS_R_EXPECTEDRESPONSE (ISC_RESULTCLASS_DNS + 83)
+#define DNS_R_EMPTYNAME (ISC_RESULTCLASS_DNS + 92)
+#define DNS_R_EMPTYWILD (ISC_RESULTCLASS_DNS + 93)
+#define DNS_R_BADBITMAP (ISC_RESULTCLASS_DNS + 94)
-
-#define DNS_R_NRESULTS 84 /* Number of results */
+#define DNS_R_NRESULTS 95 /* Number of results */
/*
* DNS wire format rcodes.
diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h
index 4d45665e..cb6794bd 100644
--- a/lib/dns/include/dns/view.h
+++ b/lib/dns/include/dns/view.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: view.h,v 1.73.2.2 2002/08/05 06:57:13 marka Exp $ */
+/* $Id: view.h,v 1.73.2.4 2003/07/22 04:03:46 marka Exp $ */
#ifndef DNS_VIEW_H
#define DNS_VIEW_H 1
@@ -512,6 +512,12 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
isc_stdtime_t now, unsigned int options,
isc_boolean_t use_hints,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
+
+isc_result_t
+dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
+ isc_stdtime_t now, unsigned int options,
+ isc_boolean_t use_hints, isc_boolean_t use_cache,
+ dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
/*
* Find the best known zonecut containing 'name'.
*
@@ -525,6 +531,9 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then
* it will be searched last.
*
+ * If 'use_cache' is ISC_TRUE, and the view has a cache, then it will be
+ * searched.
+ *
* If 'sigrdataset' is not NULL, and there is a SIG rdataset which
* covers 'type', then 'sigrdataset' will be bound to it.
*
diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h
index a6c5c343..8635a7f1 100644
--- a/lib/dns/include/dns/zone.h
+++ b/lib/dns/include/dns/zone.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.h,v 1.106.2.5.4.2 2003/02/17 07:05:10 marka Exp $ */
+/* $Id: zone.h,v 1.106.2.7 2003/03/06 04:38:22 marka Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
diff --git a/lib/dns/master.c b/lib/dns/master.c
index f8a2b90d..566bce87 100644
--- a/lib/dns/master.c
+++ b/lib/dns/master.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: master.c,v 1.122.2.5 2002/03/20 19:15:13 marka Exp $ */
+/* $Id: master.c,v 1.122.2.8 2003/07/22 04:03:41 marka Exp $ */
#include <config.h>
@@ -24,6 +24,7 @@
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/print.h>
+#include <isc/serial.h>
#include <isc/stdtime.h>
#include <isc/string.h>
#include <isc/task.h>
@@ -690,7 +691,10 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs,
if (result != ISC_R_SUCCESS)
goto error_cleanup;
- if (!dns_name_issubdomain(owner, lctx->top)) {
+ if ((lctx->options & DNS_MASTER_ZONE) != 0 &&
+ (lctx->options & DNS_MASTER_SLAVE) == 0 &&
+ !dns_name_issubdomain(owner, lctx->top))
+ {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(owner, namebuf, sizeof(namebuf));
/*
@@ -1218,7 +1222,10 @@ load(dns_loadctx_t *lctx) {
target_size);
}
}
- if (!dns_name_issubdomain(new_name, lctx->top)) {
+ if ((lctx->options & DNS_MASTER_ZONE) != 0 &&
+ (lctx->options & DNS_MASTER_SLAVE) == 0 &&
+ !dns_name_issubdomain(new_name, lctx->top))
+ {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(new_name, namebuf,
sizeof(namebuf));
@@ -1474,7 +1481,7 @@ load(dns_loadctx_t *lctx) {
if (type == dns_rdatatype_sig && lctx->warn_sigexpired) {
dns_rdata_sig_t sig;
(void)dns_rdata_tostruct(&rdata[rdcount], &sig, NULL);
- if (now > sig.timeexpire) {
+ if (isc_serial_lt(sig.timeexpire, now)) {
(*callbacks->warn)(callbacks,
"%s: %s:%lu: "
"signature has expired",
diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c
index c8ebac78..f945f46c 100644
--- a/lib/dns/masterdump.c
+++ b/lib/dns/masterdump.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: masterdump.c,v 1.56.2.2 2001/10/30 01:53:24 marka Exp $ */
+/* $Id: masterdump.c,v 1.56.2.5 2003/07/22 04:03:41 marka Exp $ */
#include <config.h>
@@ -124,6 +124,7 @@ typedef struct dns_totext_ctx {
char * linebreak;
char linebreak_buf[DNS_TOTEXT_LINEBREAK_MAXLEN];
dns_name_t * origin;
+ dns_name_t * neworigin;
dns_fixedname_t origin_fixname;
isc_uint32_t current_ttl;
isc_boolean_t current_ttl_valid;
@@ -186,7 +187,7 @@ static char spaces[N_SPACES+1] = " ";
#define N_TABS 10
static char tabs[N_TABS+1] = "\t\t\t\t\t\t\t\t\t\t";
-
+#define NXDOMAIN(x) (((x)->attributes & DNS_RDATASETATTR_NXDOMAIN) != 0)
/*
* Output tabs and spaces to go from column '*current' to
@@ -306,6 +307,7 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) {
}
ctx->origin = NULL;
+ ctx->neworigin = NULL;
ctx->current_ttl = 0;
ctx->current_ttl_valid = ISC_FALSE;
@@ -457,7 +459,10 @@ rdataset_totext(dns_rdataset_t *rdataset,
*/
INDENT_TO(rdata_column);
if (rdataset->type == 0) {
- RETERR(str_totext(";-$\n", target));
+ if (NXDOMAIN(rdataset))
+ RETERR(str_totext(";-$NXDOMAIN\n", target));
+ else
+ RETERR(str_totext(";-$NXRRSET\n", target));
} else {
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_region_t r;
@@ -785,6 +790,7 @@ dump_rdatasets(isc_mem_t *mctx, dns_name_t *name, dns_rdatasetiter_t *rdsiter,
isc_buffer_t *buffer, FILE *f)
{
isc_result_t itresult, dumpresult;
+ isc_region_t r;
dns_rdataset_t rdatasets[MAXSORT];
dns_rdataset_t *sorted[MAXSORT];
int i, n;
@@ -792,6 +798,15 @@ dump_rdatasets(isc_mem_t *mctx, dns_name_t *name, dns_rdatasetiter_t *rdsiter,
itresult = dns_rdatasetiter_first(rdsiter);
dumpresult = ISC_R_SUCCESS;
+ if (itresult == ISC_R_SUCCESS && ctx->neworigin != NULL) {
+ isc_buffer_clear(buffer);
+ itresult = dns_name_totext(ctx->neworigin, ISC_FALSE, buffer);
+ RUNTIME_CHECK(itresult == ISC_R_SUCCESS);
+ isc_buffer_usedregion(buffer, &r);
+ fprintf(f, "$ORIGIN %.*s\n", (int) r.length, (char *) r.base);
+ ctx->neworigin = NULL;
+ }
+
again:
for (i = 0;
itresult == ISC_R_SUCCESS && i < MAXSORT;
@@ -928,14 +943,9 @@ dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db,
dns_fixedname_name(&ctx.origin_fixname);
result = dns_dbiterator_origin(dbiter, origin);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
- isc_buffer_clear(&buffer);
- result = dns_name_totext(origin, ISC_FALSE, &buffer);
- RUNTIME_CHECK(result == ISC_R_SUCCESS);
- isc_buffer_usedregion(&buffer, &r);
- fprintf(f, "$ORIGIN %.*s\n", (int) r.length,
- (char *) r.base);
if ((ctx.style.flags & DNS_STYLEFLAG_REL_DATA) != 0)
ctx.origin = origin;
+ ctx.neworigin = origin;
}
result = dns_db_allrdatasets(db, node, version, now, &rdsiter);
if (result != ISC_R_SUCCESS) {
diff --git a/lib/dns/message.c b/lib/dns/message.c
index 58e58c5a..7521d1cd 100644
--- a/lib/dns/message.c
+++ b/lib/dns/message.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: message.c,v 1.194.2.8 2002/02/28 05:17:49 marka Exp $ */
+/* $Id: message.c,v 1.194.2.10 2003/07/22 04:03:41 marka Exp $ */
/***
*** Imports
@@ -2922,8 +2922,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
ADD_STRING(target, ";; OPT PSEUDOSECTION:\n");
ADD_STRING(target, "; EDNS: version: ");
snprintf(buf, sizeof(buf), "%u",
- (unsigned int)((ps->ttl &
- 0x00ff0000 >> 16)));
+ (unsigned int)((ps->ttl & 0x00ff0000) >> 16));
ADD_STRING(target, buf);
ADD_STRING(target, ", flags:");
if ((ps->ttl & DNS_MESSAGEEXTFLAG_DO) != 0)
diff --git a/lib/dns/name.c b/lib/dns/name.c
index d363f57d..5d71783e 100644
--- a/lib/dns/name.c
+++ b/lib/dns/name.c
@@ -15,13 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: name.c,v 1.127.2.5 2002/08/02 00:33:05 marka Exp $ */
+/* $Id: name.c,v 1.127.2.7 2003/07/25 03:31:43 marka Exp $ */
#include <config.h>
#include <ctype.h>
#include <isc/buffer.h>
+#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/string.h>
@@ -461,6 +462,20 @@ dns_name_hash(dns_name_t *name, isc_boolean_t case_sensitive) {
return (h);
}
+unsigned int
+dns_fullname_hash(dns_name_t *name, isc_boolean_t case_sensitive) {
+ /*
+ * Provide a hash value for 'name'.
+ */
+ REQUIRE(VALID_NAME(name));
+
+ if (name->labels == 0)
+ return (0);
+
+ return (isc_hash_calc((const unsigned char *)name->ndata,
+ name->length, case_sensitive));
+}
+
dns_namereln_t
dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
int *orderp,
@@ -1807,7 +1822,7 @@ dns_name_totext(dns_name_t *name, isc_boolean_t omit_final_dot,
count = 256;
nlen--;
len = sprintf(num, "%u", count); /* XXX */
- INSIST(len <= 4);
+ INSIST(len <= 4U);
bytes = count / 8;
if (count % 8 != 0)
bytes++;
@@ -1960,7 +1975,7 @@ dns_name_tofilenametext(dns_name_t *name, isc_boolean_t omit_final_dot,
count = 256;
nlen--;
len = sprintf(num, "%u", count); /* XXX */
- INSIST(len <= 4);
+ INSIST(len <= 4U);
bytes = count / 8;
if (count % 8 != 0)
bytes++;
diff --git a/lib/dns/ncache.c b/lib/dns/ncache.c
index 841f6d02..61c09bb3 100644
--- a/lib/dns/ncache.c
+++ b/lib/dns/ncache.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ncache.c,v 1.24.2.2 2002/02/08 03:57:29 marka Exp $ */
+/* $Id: ncache.c,v 1.24.2.4 2003/07/22 04:03:42 marka Exp $ */
#include <config.h>
@@ -246,6 +246,8 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
dns_rdataset_init(&ncrdataset);
dns_rdatalist_tordataset(&ncrdatalist, &ncrdataset);
ncrdataset.trust = trust;
+ if (message->rcode == dns_rcode_nxdomain)
+ ncrdataset.attributes |= DNS_RDATASETATTR_NXDOMAIN;
return (dns_db_addrdataset(cache, node, NULL, now, &ncrdataset,
0, addedrdataset));
diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c
index 2e3e0ff3..1a688a37 100644
--- a/lib/dns/rbt.c
+++ b/lib/dns/rbt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rbt.c,v 1.115 2001/06/04 19:33:05 tale Exp $ */
+/* $Id: rbt.c,v 1.115.2.2 2003/07/22 04:03:42 marka Exp $ */
/* Principal Authors: DCL */
@@ -1526,8 +1526,7 @@ dns_rbt_formatnodename(dns_rbtnode_t *node, char *printname, unsigned int size)
if (result == ISC_R_SUCCESS)
dns_name_format(name, printname, size);
else
- snprintf(printname, sizeof(printname),
- "<error building name: %s>",
+ snprintf(printname, size, "<error building name: %s>",
dns_result_totext(result));
return (printname);
diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c
index 79883e3a..67d04f04 100644
--- a/lib/dns/rbtdb.c
+++ b/lib/dns/rbtdb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rbtdb.c,v 1.168.2.3 2002/08/05 06:57:11 marka Exp $ */
+/* $Id: rbtdb.c,v 1.168.2.11 2003/07/22 04:03:43 marka Exp $ */
/*
* Principal Author: Bob Halley
@@ -84,7 +84,7 @@ typedef isc_uint32_t rbtdb_rdatatype_t;
RBTDB_RDATATYPE_VALUE(dns_rdatatype_sig, dns_rdatatype_cname)
#define RBTDB_RDATATYPE_SIGDNAME \
RBTDB_RDATATYPE_VALUE(dns_rdatatype_sig, dns_rdatatype_dname)
-#define RBTDB_RDATATYPE_NXDOMAIN \
+#define RBTDB_RDATATYPE_NCACHEANY \
RBTDB_RDATATYPE_VALUE(0, dns_rdatatype_any)
typedef struct rdatasetheader {
@@ -108,6 +108,7 @@ typedef struct rdatasetheader {
#define RDATASET_ATTR_STALE 0x0002
#define RDATASET_ATTR_IGNORE 0x0004
#define RDATASET_ATTR_RETAIN 0x0008
+#define RDATASET_ATTR_NXDOMAIN 0x0010
/*
* XXX
@@ -127,6 +128,8 @@ typedef struct rdatasetheader {
(((header)->attributes & RDATASET_ATTR_IGNORE) != 0)
#define RETAIN(header) \
(((header)->attributes & RDATASET_ATTR_RETAIN) != 0)
+#define NXDOMAIN(header) \
+ (((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0)
#define DEFAULT_NODE_LOCK_COUNT 7 /* Should be prime. */
@@ -792,10 +795,10 @@ no_references(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
* we only do a trylock.
*/
if (lock == isc_rwlocktype_read)
- RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
-
- result = isc_rwlock_trylock(&rbtdb->tree_lock,
- isc_rwlocktype_write);
+ result = isc_rwlock_tryupgrade(&rbtdb->tree_lock);
+ else
+ result = isc_rwlock_trylock(&rbtdb->tree_lock,
+ isc_rwlocktype_write);
RUNTIME_CHECK(result == ISC_R_SUCCESS ||
result == ISC_R_LOCKBUSY);
@@ -826,12 +829,13 @@ no_references(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
/*
* Relock a read lock, or unlock the write lock if no lock was held.
*/
- if (lock != isc_rwlocktype_write)
+ if (lock == isc_rwlocktype_none)
if (write_locked)
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
if (lock == isc_rwlocktype_read)
- RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
+ if (write_locked)
+ isc_rwlock_downgrade(&rbtdb->tree_lock);
}
static inline void
@@ -1064,6 +1068,34 @@ add_wildcard_magic(dns_rbtdb_t *rbtdb, dns_name_t *name) {
}
static isc_result_t
+add_empty_wildcards(dns_rbtdb_t *rbtdb, dns_name_t *name) {
+ isc_result_t result;
+ dns_name_t foundname;
+ dns_offsets_t offsets;
+ unsigned int n, l, i;
+
+ dns_name_init(&foundname, offsets);
+ n = dns_name_countlabels(name);
+ l = dns_name_countlabels(&rbtdb->common.origin);
+ i = l + 1;
+ while (i < n) {
+ dns_rbtnode_t *node = NULL; /* dummy */
+ dns_name_getlabelsequence(name, n - i, i, &foundname);
+ if (dns_name_iswildcard(&foundname)) {
+ result = add_wildcard_magic(rbtdb, &foundname);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ result = dns_rbt_addnode(rbtdb->tree, &foundname,
+ &node);
+ if (result != ISC_R_SUCCESS && result != ISC_R_EXISTS)
+ return (result);
+ }
+ i++;
+ }
+ return (ISC_R_SUCCESS);
+}
+
+static isc_result_t
findnode(dns_db_t *db, dns_name_t *name, isc_boolean_t create,
dns_dbnode_t **nodep)
{
@@ -1103,6 +1135,8 @@ findnode(dns_db_t *db, dns_name_t *name, isc_boolean_t create,
node->locknum = dns_name_hash(&nodename, ISC_TRUE) %
rbtdb->node_lock_count;
#endif
+ add_empty_wildcards(rbtdb, name);
+
if (dns_name_iswildcard(name)) {
result = add_wildcard_magic(rbtdb, name);
if (result != ISC_R_SUCCESS) {
@@ -1287,6 +1321,8 @@ bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
rdataset->covers = RBTDB_RDATATYPE_EXT(header->type);
rdataset->ttl = header->ttl - now;
rdataset->trust = header->trust;
+ if (NXDOMAIN(header))
+ rdataset->attributes |= DNS_RDATASETATTR_NXDOMAIN;
rdataset->private1 = rbtdb;
rdataset->private2 = node;
raw = (unsigned char *)header + sizeof(*header);
@@ -1295,7 +1331,7 @@ bind_rdataset(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
/*
* Reset iterator state.
*/
- rdataset->private4 = NULL;
+ rdataset->privateuint4 = 0;
rdataset->private5 = NULL;
}
@@ -1411,8 +1447,171 @@ valid_glue(rbtdb_search_t *search, dns_name_t *name, rbtdb_rdatatype_t type,
return (valid);
}
+static inline isc_boolean_t
+activeempty(rbtdb_search_t *search, dns_rbtnodechain_t *chain,
+ dns_name_t *name)
+{
+ dns_fixedname_t fnext;
+ dns_fixedname_t forigin;
+ dns_name_t *next;
+ dns_name_t *origin;
+ dns_name_t prefix;
+ dns_rbtdb_t *rbtdb;
+ dns_rbtnode_t *node;
+ isc_result_t result;
+ isc_boolean_t answer = ISC_FALSE;
+ rdatasetheader_t *header;
+
+ rbtdb = search->rbtdb;
+
+ dns_name_init(&prefix, NULL);
+ dns_fixedname_init(&fnext);
+ next = dns_fixedname_name(&fnext);
+ dns_fixedname_init(&forigin);
+ origin = dns_fixedname_name(&forigin);
+
+ result = dns_rbtnodechain_next(chain, NULL, NULL);
+ while (result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN) {
+ node = NULL;
+ result = dns_rbtnodechain_current(chain, &prefix,
+ origin, &node);
+ if (result != ISC_R_SUCCESS)
+ break;
+ LOCK(&(rbtdb->node_locks[node->locknum].lock));
+ for (header = node->data;
+ header != NULL;
+ header = header->next) {
+ if (header->serial <= search->serial &&
+ !IGNORE(header) && EXISTS(header))
+ break;
+ }
+ UNLOCK(&(rbtdb->node_locks[node->locknum].lock));
+ if (header != NULL)
+ break;
+ result = dns_rbtnodechain_next(chain, NULL, NULL);
+ }
+ if (result == ISC_R_SUCCESS)
+ result = dns_name_concatenate(&prefix, origin, next, NULL);
+ if (result == ISC_R_SUCCESS && dns_name_issubdomain(next, name))
+ answer = ISC_TRUE;
+ return (answer);
+}
+
+static inline isc_boolean_t
+activeemtpynode(rbtdb_search_t *search, dns_name_t *qname, dns_name_t *wname) {
+ dns_fixedname_t fnext;
+ dns_fixedname_t forigin;
+ dns_fixedname_t fprev;
+ dns_name_t *next;
+ dns_name_t *origin;
+ dns_name_t *prev;
+ dns_name_t name;
+ dns_name_t rname;
+ dns_name_t tname;
+ dns_rbtdb_t *rbtdb;
+ dns_rbtnode_t *node;
+ dns_rbtnodechain_t chain;
+ isc_boolean_t check_next = ISC_TRUE;
+ isc_boolean_t check_prev = ISC_TRUE;
+ isc_boolean_t answer = ISC_FALSE;
+ isc_result_t result;
+ rdatasetheader_t *header;
+ unsigned int n;
+
+ rbtdb = search->rbtdb;
+
+ dns_name_init(&name, NULL);
+ dns_name_init(&tname, NULL);
+ dns_name_init(&rname, NULL);
+ dns_fixedname_init(&fnext);
+ next = dns_fixedname_name(&fnext);
+ dns_fixedname_init(&fprev);
+ prev = dns_fixedname_name(&fprev);
+ dns_fixedname_init(&forigin);
+ origin = dns_fixedname_name(&forigin);
+
+ /*
+ * Find if qname is at or below a empty node.
+ * Use our own copy of the chain.
+ */
+
+ chain = search->chain;
+ do {
+ node = NULL;
+ result = dns_rbtnodechain_current(&chain, &name,
+ origin, &node);
+ if (result != ISC_R_SUCCESS)
+ break;
+ LOCK(&(rbtdb->node_locks[node->locknum].lock));
+ for (header = node->data;
+ header != NULL;
+ header = header->next) {
+ if (header->serial <= search->serial &&
+ !IGNORE(header) && EXISTS(header))
+ break;
+ }
+ UNLOCK(&(rbtdb->node_locks[node->locknum].lock));
+ if (header != NULL)
+ break;
+ result = dns_rbtnodechain_prev(&chain, NULL, NULL);
+ } while (result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN);
+ if (result == ISC_R_SUCCESS)
+ result = dns_name_concatenate(&name, origin, prev, NULL);
+ if (result != ISC_R_SUCCESS)
+ check_prev = ISC_FALSE;
+
+ result = dns_rbtnodechain_next(&chain, NULL, NULL);
+ while (result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN) {
+ node = NULL;
+ result = dns_rbtnodechain_current(&chain, &name,
+ origin, &node);
+ if (result != ISC_R_SUCCESS)
+ break;
+ LOCK(&(rbtdb->node_locks[node->locknum].lock));
+ for (header = node->data;
+ header != NULL;
+ header = header->next) {
+ if (header->serial <= search->serial &&
+ !IGNORE(header) && EXISTS(header))
+ break;
+ }
+ UNLOCK(&(rbtdb->node_locks[node->locknum].lock));
+ if (header != NULL)
+ break;
+ result = dns_rbtnodechain_next(&chain, NULL, NULL);
+ }
+ if (result == ISC_R_SUCCESS)
+ result = dns_name_concatenate(&name, origin, next, NULL);
+ if (result != ISC_R_SUCCESS)
+ check_next = ISC_FALSE;
+
+ dns_name_clone(qname, &rname);
+
+ /*
+ * Remove the wildcard label to find the terminal name.
+ */
+ n = dns_name_countlabels(wname);
+ dns_name_getlabelsequence(wname, 1, n - 1, &tname);
+
+ do {
+ if ((check_prev && dns_name_issubdomain(prev, &rname)) ||
+ (check_next && dns_name_issubdomain(next, &rname))) {
+ answer = ISC_TRUE;
+ break;
+ }
+ /*
+ * Remove the left hand label.
+ */
+ n = dns_name_countlabels(&rname);
+ dns_name_getlabelsequence(&rname, 1, n - 1, &rname);
+ } while (!dns_name_equal(&rname, &tname));
+ return (answer);
+}
+
static inline isc_result_t
-find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep) {
+find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep,
+ dns_name_t *qname)
+{
unsigned int i, j;
dns_rbtnode_t *node, *level_node, *wnode;
rdatasetheader_t *header;
@@ -1422,6 +1621,7 @@ find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep) {
dns_fixedname_t fwname;
dns_rbtdb_t *rbtdb;
isc_boolean_t done, wild, active;
+ dns_rbtnodechain_t wchain;
/*
* Caller must be holding the tree lock and MUST NOT be holding
@@ -1495,8 +1695,9 @@ find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep) {
break;
wnode = NULL;
+ dns_rbtnodechain_init(&wchain, NULL);
result = dns_rbt_findnode(rbtdb->tree, wname,
- NULL, &wnode, NULL,
+ NULL, &wnode, &wchain,
DNS_RBTFIND_EMPTYDATA,
NULL, NULL);
if (result == ISC_R_SUCCESS) {
@@ -1514,7 +1715,10 @@ find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep) {
break;
}
UNLOCK(&(rbtdb->node_locks[wnode->locknum].lock));
- if (header != NULL) {
+ if (header != NULL ||
+ activeempty(search, &wchain, wname)) {
+ if (activeemtpynode(search, qname, wname))
+ return (ISC_R_NOTFOUND);
/*
* The wildcard node is active!
*
@@ -1704,6 +1908,9 @@ zone_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
rdatasetheader_t *header, *header_next, *found, *nxtheader;
rdatasetheader_t *foundsig, *cnamesig, *nxtsig;
rbtdb_rdatatype_t sigtype;
+ isc_boolean_t active;
+ dns_rbtnodechain_t chain;
+
search.rbtdb = (dns_rbtdb_t *)db;
@@ -1765,7 +1972,7 @@ zone_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
* we must see if there's a matching wildcard active
* in the current version.
*/
- result = find_wildcard(&search, &node);
+ result = find_wildcard(&search, &node, name);
if (result == ISC_R_SUCCESS) {
result = dns_name_copy(name, foundname, NULL);
if (result != ISC_R_SUCCESS)
@@ -1777,6 +1984,9 @@ zone_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
goto tree_exit;
}
+ chain = search.chain;
+ active = activeempty(&search, &chain, name);
+
/*
* If we're here, then the name does not exist, is not
* beneath a zonecut, and there's no matching wildcard.
@@ -1785,9 +1995,10 @@ zone_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
result = find_closest_nxt(&search, nodep, foundname,
rdataset, sigrdataset);
if (result == ISC_R_SUCCESS)
- result = DNS_R_NXDOMAIN;
+ result = active ? DNS_R_EMPTYNAME :
+ DNS_R_NXDOMAIN;
} else
- result = DNS_R_NXDOMAIN;
+ result = active ? DNS_R_EMPTYNAME : DNS_R_NXDOMAIN;
goto tree_exit;
} else if (result != ISC_R_SUCCESS)
goto tree_exit;
@@ -1970,14 +2181,11 @@ zone_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
* active rdatasets in the desired version. That means that
* this node doesn't exist in the desired version, and that
* we really have a partial match.
- *
- * If the node is the result of a wildcard match, then
- * it must be active in the desired version, and hence
- * empty_node should never be true. We INSIST upon it.
*/
- INSIST(!wild);
- UNLOCK(&(search.rbtdb->node_locks[node->locknum].lock));
- goto partial_match;
+ if (!wild) {
+ UNLOCK(&(search.rbtdb->node_locks[node->locknum].lock));
+ goto partial_match;
+ }
}
/*
@@ -1995,30 +2203,37 @@ zone_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
result = setup_delegation(&search, nodep, foundname,
rdataset, sigrdataset);
goto tree_exit;
- } else {
+ }
+ /*
+ * The desired type doesn't exist.
+ */
+ result = DNS_R_NXRRSET;
+ if (search.rbtdb->secure &&
+ (nxtheader == NULL || nxtsig == NULL)) {
/*
- * The desired type doesn't exist.
+ * The zone is secure but there's no NXT,
+ * or the NXT has no signature!
*/
- result = DNS_R_NXRRSET;
- if (search.rbtdb->secure &&
- (nxtheader == NULL || nxtsig == NULL)) {
- /*
- * The zone is secure but there's no NXT,
- * or the NXT has no signature!
- */
+ if (!wild) {
result = DNS_R_BADDB;
goto node_exit;
}
- if (nodep != NULL) {
- new_reference(search.rbtdb, node);
- *nodep = node;
- }
- if (search.rbtdb->secure) {
- bind_rdataset(search.rbtdb, node, nxtheader,
- 0, rdataset);
- bind_rdataset(search.rbtdb, node, nxtsig,
- 0, sigrdataset);
- }
+ UNLOCK(&(search.rbtdb->node_locks[node->locknum].lock));
+ result = find_closest_nxt(&search, nodep, foundname,
+ rdataset, sigrdataset);
+ if (result == ISC_R_SUCCESS)
+ result = DNS_R_EMPTYWILD;
+ goto tree_exit;
+ }
+ if (nodep != NULL) {
+ new_reference(search.rbtdb, node);
+ *nodep = node;
+ }
+ if (search.rbtdb->secure) {
+ bind_rdataset(search.rbtdb, node, nxtheader,
+ 0, rdataset);
+ bind_rdataset(search.rbtdb, node, nxtsig,
+ 0, sigrdataset);
}
goto node_exit;
}
@@ -2510,7 +2725,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
* target type. Remember it.
*/
foundsig = header;
- } else if (header->type == RBTDB_RDATATYPE_NXDOMAIN ||
+ } else if (header->type == RBTDB_RDATATYPE_NCACHEANY ||
header->type == nxtype) {
/*
* We've found a negative cache entry.
@@ -2598,7 +2813,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
/*
* We found a negative cache entry.
*/
- if (found->type == RBTDB_RDATATYPE_NXDOMAIN)
+ if (NXDOMAIN(found))
result = DNS_R_NCACHENXDOMAIN;
else
result = DNS_R_NCACHENXRRSET;
@@ -2618,7 +2833,8 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
result = ISC_R_SUCCESS;
}
- if (type != dns_rdatatype_any || result == DNS_R_NCACHENXDOMAIN) {
+ if (type != dns_rdatatype_any || result == DNS_R_NCACHENXDOMAIN ||
+ result == DNS_R_NCACHENXRRSET) {
bind_rdataset(search.rbtdb, node, found, search.now,
rdataset);
if (foundsig != NULL)
@@ -3140,7 +3356,7 @@ cache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
0) {
if (header->type == matchtype)
found = header;
- else if (header->type == RBTDB_RDATATYPE_NXDOMAIN ||
+ else if (header->type == RBTDB_RDATATYPE_NCACHEANY ||
header->type == nxtype)
found = header;
else if (header->type == sigmatchtype)
@@ -3163,7 +3379,7 @@ cache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
/*
* We found a negative cache entry.
*/
- if (found->type == RBTDB_RDATATYPE_NXDOMAIN)
+ if (NXDOMAIN(found))
result = DNS_R_NCACHENXDOMAIN;
else
result = DNS_R_NCACHENXRRSET;
@@ -3391,8 +3607,7 @@ add(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
for (topheader = rbtnode->data;
topheader != NULL;
topheader = topheader->next) {
- if (topheader->type ==
- RBTDB_RDATATYPE_NXDOMAIN)
+ if (NXDOMAIN(topheader))
break;
}
if (topheader != NULL && EXISTS(topheader) &&
@@ -3516,6 +3731,52 @@ add(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
return (result);
}
}
+ /*
+ * Don't replace existing NS, A and AAAA RRsets
+ * in the cache if they are already exist. This
+ * prevents named being locked to old servers.
+ */
+ if (IS_CACHE(rbtdb) && header->ttl > now &&
+ header->type == dns_rdatatype_ns &&
+ !header_nx && !newheader_nx &&
+ header->trust == newheader->trust &&
+ dns_rdataslab_equalx((unsigned char *)header,
+ (unsigned char *)newheader,
+ (unsigned int)(sizeof(*newheader)),
+ rbtdb->common.rdclass,
+ (dns_rdatatype_t)header->type)) {
+ /*
+ * Honour the new ttl if it is less than the
+ * older one.
+ */
+ if (header->ttl > newheader->ttl)
+ header->ttl = newheader->ttl;
+ free_rdataset(rbtdb->common.mctx, newheader);
+ if (addedrdataset != NULL)
+ bind_rdataset(rbtdb, rbtnode, header, now,
+ addedrdataset);
+ return (ISC_R_SUCCESS);
+ }
+ if (IS_CACHE(rbtdb) && header->ttl > now &&
+ (header->type == dns_rdatatype_a ||
+ header->type == dns_rdatatype_aaaa) &&
+ !header_nx && !newheader_nx &&
+ header->trust == newheader->trust &&
+ dns_rdataslab_equal((unsigned char *)header,
+ (unsigned char *)newheader,
+ (unsigned int)(sizeof(*newheader)))) {
+ /*
+ * Honour the new ttl if it is less than the
+ * older one.
+ */
+ if (header->ttl > newheader->ttl)
+ header->ttl = newheader->ttl;
+ free_rdataset(rbtdb->common.mctx, newheader);
+ if (addedrdataset != NULL)
+ bind_rdataset(rbtdb, rbtnode, header, now,
+ addedrdataset);
+ return (ISC_R_SUCCESS);
+ }
INSIST(rbtversion == NULL ||
rbtversion->serial >= topheader->serial);
if (topheader_prev != NULL)
@@ -3653,6 +3914,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
} else {
newheader->serial = 1;
newheader->trust = rdataset->trust;
+ if ((rdataset->attributes & DNS_RDATASETATTR_NXDOMAIN) != 0)
+ newheader->attributes |= RDATASET_ATTR_NXDOMAIN;
}
/*
@@ -3881,6 +4144,8 @@ loading_addrdataset(void *arg, dns_name_t *name, dns_rdataset_t *rdataset) {
!IS_CACHE(rbtdb) && !dns_name_equal(name, &rbtdb->common.origin))
return (DNS_R_NOTZONETOP);
+ add_empty_wildcards(rbtdb, name);
+
if (dns_name_iswildcard(name)) {
/*
* NS record owners cannot legally be wild cards.
@@ -4365,12 +4630,12 @@ rdataset_first(dns_rdataset_t *rdataset) {
}
raw += 2;
/*
- * The private4 field is the number of rdata beyond the cursor
+ * The privateuint4 field is the number of rdata beyond the cursor
* position, so we decrement the total count by one before storing
* it.
*/
count--;
- rdataset->private4 = (void *)count;
+ rdataset->privateuint4 = count;
rdataset->private5 = raw;
return (ISC_R_SUCCESS);
@@ -4382,11 +4647,11 @@ rdataset_next(dns_rdataset_t *rdataset) {
unsigned int length;
unsigned char *raw;
- count = (unsigned int)rdataset->private4;
+ count = rdataset->privateuint4;
if (count == 0)
return (ISC_R_NOMORE);
count--;
- rdataset->private4 = (void *)count;
+ rdataset->privateuint4 = count;
raw = rdataset->private5;
length = raw[0] * 256 + raw[1];
raw += length + 2;
@@ -4420,7 +4685,7 @@ rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) {
/*
* Reset iterator state.
*/
- target->private4 = NULL;
+ target->privateuint4 = 0;
target->private5 = NULL;
}
@@ -4702,6 +4967,7 @@ static void
dbiterator_destroy(dns_dbiterator_t **iteratorp) {
rbtdb_dbiterator_t *rbtdbiter = (rbtdb_dbiterator_t *)(*iteratorp);
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)rbtdbiter->common.db;
+ dns_db_t *db = NULL;
if (rbtdbiter->tree_locked == isc_rwlocktype_read) {
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
@@ -4713,10 +4979,12 @@ dbiterator_destroy(dns_dbiterator_t **iteratorp) {
flush_deletions(rbtdbiter);
+ dns_db_attach(rbtdbiter->common.db, &db);
dns_db_detach(&rbtdbiter->common.db);
dns_rbtnodechain_reset(&rbtdbiter->chain);
- isc_mem_put(rbtdb->common.mctx, rbtdbiter, sizeof *rbtdbiter);
+ isc_mem_put(db->mctx, rbtdbiter, sizeof(*rbtdbiter));
+ dns_db_detach(&db);
*iteratorp = NULL;
}
diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c
index 9fc7b675..44cbde47 100644
--- a/lib/dns/rdata.c
+++ b/lib/dns/rdata.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2002 Internet Software Consortium.
+ * Copyright (C) 1998-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.c,v 1.147.2.7 2002/03/27 23:52:33 marka Exp $ */
+/* $Id: rdata.c,v 1.147.2.11 2003/07/30 01:04:15 marka Exp $ */
#include <config.h>
#include <ctype.h>
@@ -620,7 +620,7 @@ unknown_fromtext(dns_rdataclass_t rdclass, dns_rdatatype_t type,
result = isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE);
- if (result == ISC_R_SUCCESS && token.value.as_ulong > 65535)
+ if (result == ISC_R_SUCCESS && token.value.as_ulong > 65535U)
return (ISC_R_RANGE);
result = isc_buffer_allocate(mctx, &buf, token.value.as_ulong);
if (result != ISC_R_SUCCESS)
@@ -759,7 +759,7 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
{
isc_result_t result = ISC_R_NOTIMPLEMENTED;
isc_boolean_t use_default = ISC_FALSE;
- char buf[sizeof "65536"];
+ char buf[sizeof("65536")];
isc_region_t sr;
REQUIRE(rdata != NULL);
@@ -952,10 +952,9 @@ dns_rdata_digest(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) {
unsigned int
dns_rdatatype_attributes(dns_rdatatype_t type)
{
- if (type > 255)
- return (DNS_RDATATYPEATTR_UNKNOWN);
-
- return (typeattr[type].flags);
+ if (type < (sizeof(typeattr)/sizeof(typeattr[0])))
+ return (typeattr[type].flags);
+ return (DNS_RDATATYPEATTR_UNKNOWN);
}
#define NUMBERSIZE sizeof("037777777777") /* 2^32-1 octal + NUL */
@@ -1084,7 +1083,7 @@ dns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source) {
isc_result_t
dns_rdataclass_totext(dns_rdataclass_t rdclass, isc_buffer_t *target) {
- char buf[sizeof("CLASS65536")];
+ char buf[sizeof("CLASS65535")];
switch (rdclass) {
case dns_rdataclass_any:
@@ -1172,14 +1171,12 @@ dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
isc_result_t
dns_rdatatype_totext(dns_rdatatype_t type, isc_buffer_t *target) {
- char buf[sizeof "TYPE65536"];
+ char buf[sizeof("TYPE65536")];
- if (type > 255) {
- sprintf(buf, "TYPE%u", type);
- return (str_totext(buf, target));
- }
-
- return (str_totext(typeattr[type].name, target));
+ if (type < (sizeof(typeattr)/sizeof(typeattr[0])))
+ return (str_totext(typeattr[type].name, target));
+ snprintf(buf, sizeof buf, "TYPE%u", type);
+ return (str_totext(buf, target));
}
void
@@ -1820,7 +1817,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if ((token.value.as_ulong % 4) != 0)
+ if ((token.value.as_ulong % 4) != 0U)
isc_buffer_subtract(target, 4 - (token.value.as_ulong % 4));
/*
@@ -2055,7 +2052,6 @@ dns_rdatatype_questiononly(dns_rdatatype_t type) {
isc_boolean_t
dns_rdataclass_ismeta(dns_rdataclass_t rdclass) {
- REQUIRE(rdclass < 65536);
if (rdclass == dns_rdataclass_reserved0
|| rdclass == dns_rdataclass_none
diff --git a/lib/dns/rdata/any_255/tsig_250.c b/lib/dns/rdata/any_255/tsig_250.c
index 776316e9..64d74129 100644
--- a/lib/dns/rdata/any_255/tsig_250.c
+++ b/lib/dns/rdata/any_255/tsig_250.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: tsig_250.c,v 1.52 2001/07/16 03:05:58 marka Exp $ */
+/* $Id: tsig_250.c,v 1.52.2.1 2003/07/23 06:57:49 marka Exp $ */
/* Reviewed: Thu Mar 16 13:39:43 PST 2000 by gson */
@@ -70,7 +70,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -79,7 +79,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -93,7 +93,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -119,7 +119,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdata/generic/afsdb_18.c b/lib/dns/rdata/generic/afsdb_18.c
index 68ac619e..44f21e70 100644
--- a/lib/dns/rdata/generic/afsdb_18.c
+++ b/lib/dns/rdata/generic/afsdb_18.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: afsdb_18.c,v 1.39 2001/07/16 03:06:00 marka Exp $ */
+/* $Id: afsdb_18.c,v 1.39.2.1 2003/07/23 06:57:50 marka Exp $ */
/* Reviewed: Wed Mar 15 14:59:00 PST 2000 by explorer */
@@ -43,7 +43,7 @@ fromtext_afsdb(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdata/generic/cert_37.c b/lib/dns/rdata/generic/cert_37.c
index 51713502..a32c6db9 100644
--- a/lib/dns/rdata/generic/cert_37.c
+++ b/lib/dns/rdata/generic/cert_37.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: cert_37.c,v 1.40 2001/07/16 03:06:01 marka Exp $ */
+/* $Id: cert_37.c,v 1.40.2.1 2003/07/23 06:57:50 marka Exp $ */
/* Reviewed: Wed Mar 15 21:14:32 EST 2000 by tale */
@@ -53,7 +53,7 @@ fromtext_cert(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdata/generic/loc_29.c b/lib/dns/rdata/generic/loc_29.c
index 2cb2e2b0..b9ac7980 100644
--- a/lib/dns/rdata/generic/loc_29.c
+++ b/lib/dns/rdata/generic/loc_29.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: loc_29.c,v 1.30.2.2 2002/08/05 06:57:14 marka Exp $ */
+/* $Id: loc_29.c,v 1.30.2.3 2003/07/23 06:57:50 marka Exp $ */
/* Reviewed: Wed Mar 15 18:13:09 PST 2000 by explorer */
@@ -73,7 +73,7 @@ fromtext_loc(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 90)
+ if (token.value.as_ulong > 90U)
RETTOK(ISC_R_RANGE);
d1 = (int)token.value.as_ulong;
/*
@@ -142,7 +142,7 @@ fromtext_loc(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 180)
+ if (token.value.as_ulong > 180U)
RETTOK(ISC_R_RANGE);
d2 = (int)token.value.as_ulong;
@@ -505,7 +505,7 @@ totext_loc(ARGS_TOTEXT) {
altitude = uint32_fromregion(&sr);
isc_region_consume(&sr, 4);
- if (altitude < 10000000) {
+ if (altitude < 10000000U) {
below = ISC_TRUE;
altitude = 10000000 - altitude;
} else {
diff --git a/lib/dns/rdata/generic/mx_15.c b/lib/dns/rdata/generic/mx_15.c
index 5be0a3ae..704cb124 100644
--- a/lib/dns/rdata/generic/mx_15.c
+++ b/lib/dns/rdata/generic/mx_15.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mx_15.c,v 1.48 2001/07/16 03:06:19 marka Exp $ */
+/* $Id: mx_15.c,v 1.48.2.1 2003/07/23 06:57:51 marka Exp $ */
/* reviewed: Wed Mar 15 18:05:46 PST 2000 by brister */
@@ -38,7 +38,7 @@ fromtext_mx(ARGS_FROMTEXT) {
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdata/generic/nxt_30.c b/lib/dns/rdata/generic/nxt_30.c
index c0c719de..09e2eba4 100644
--- a/lib/dns/rdata/generic/nxt_30.c
+++ b/lib/dns/rdata/generic/nxt_30.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: nxt_30.c,v 1.49 2001/07/16 03:06:23 marka Exp $ */
+/* $Id: nxt_30.c,v 1.49.2.2 2003/07/22 04:03:46 marka Exp $ */
/* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */
@@ -142,9 +142,9 @@ fromwire_nxt(ARGS_FROMWIRE) {
RETERR(dns_name_fromwire(&name, source, dctx, downcase, target));
isc_buffer_activeregion(source, &sr);
- /* XXXRTH Enforce RFC 2535 length rules if bit 0 is not set. */
- if (sr.length > 8 * 1024)
- return (DNS_R_EXTRADATA);
+ if (sr.length > 0 && (sr.base[0] & 0x80) == 0 &&
+ ((sr.length > 16) || sr.base[sr.length - 1] == 0))
+ return (DNS_R_BADBITMAP);
RETERR(mem_tobuffer(target, sr.base, sr.length));
isc_buffer_forward(source, sr.length);
return (ISC_R_SUCCESS);
@@ -206,6 +206,10 @@ fromstruct_nxt(ARGS_FROMSTRUCT) {
REQUIRE(nxt->common.rdtype == type);
REQUIRE(nxt->common.rdclass == rdclass);
REQUIRE(nxt->typebits != NULL || nxt->len == 0);
+ if (nxt->typebits != NULL && (nxt->typebits[0] & 0x80) == 0) {
+ REQUIRE(nxt->len <= 16);
+ REQUIRE(nxt->typebits[nxt->len - 1] != 0);
+ }
UNUSED(type);
UNUSED(rdclass);
diff --git a/lib/dns/rdata/generic/rt_21.c b/lib/dns/rdata/generic/rt_21.c
index ad763828..6a78f1b9 100644
--- a/lib/dns/rdata/generic/rt_21.c
+++ b/lib/dns/rdata/generic/rt_21.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rt_21.c,v 1.37 2001/07/16 03:06:28 marka Exp $ */
+/* $Id: rt_21.c,v 1.37.2.1 2003/07/23 06:57:51 marka Exp $ */
/* reviewed: Thu Mar 16 15:02:31 PST 2000 by brister */
@@ -40,7 +40,7 @@ fromtext_rt(ARGS_FROMTEXT) {
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdata/generic/sig_24.c b/lib/dns/rdata/generic/sig_24.c
index 36d3140e..9fa5398f 100644
--- a/lib/dns/rdata/generic/sig_24.c
+++ b/lib/dns/rdata/generic/sig_24.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sig_24.c,v 1.54 2001/07/16 03:06:29 marka Exp $ */
+/* $Id: sig_24.c,v 1.54.2.1 2003/07/23 06:57:51 marka Exp $ */
/* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */
@@ -73,7 +73,7 @@ fromtext_sig(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xff)
+ if (token.value.as_ulong > 0xffU)
RETTOK(ISC_R_RANGE);
c = (unsigned char)token.value.as_ulong;
RETERR(mem_tobuffer(target, &c, 1));
diff --git a/lib/dns/rdata/generic/tkey_249.c b/lib/dns/rdata/generic/tkey_249.c
index 159cfda4..1e226479 100644
--- a/lib/dns/rdata/generic/tkey_249.c
+++ b/lib/dns/rdata/generic/tkey_249.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: tkey_249.c,v 1.48 2001/07/16 03:06:32 marka Exp $ */
+/* $Id: tkey_249.c,v 1.48.2.1 2003/07/23 06:57:51 marka Exp $ */
/*
* Reviewed: Thu Mar 16 17:35:30 PST 2000 by halley.
@@ -73,7 +73,7 @@ fromtext_tkey(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -99,7 +99,7 @@ fromtext_tkey(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -113,7 +113,7 @@ fromtext_tkey(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -221,7 +221,7 @@ totext_tkey(ARGS_TOTEXT) {
* Other Data.
*/
REQUIRE(n <= sr.length);
- if (n != 0) {
+ if (n != 0U) {
dr = sr;
dr.length = n;
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
diff --git a/lib/dns/rdata/in_1/a6_38.c b/lib/dns/rdata/in_1/a6_38.c
index 6a8d8dc6..3abe7f9b 100644
--- a/lib/dns/rdata/in_1/a6_38.c
+++ b/lib/dns/rdata/in_1/a6_38.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: a6_38.c,v 1.46 2001/07/26 21:34:00 gson Exp $ */
+/* $Id: a6_38.c,v 1.46.2.1 2003/07/23 06:57:51 marka Exp $ */
/* RFC2874 */
@@ -48,7 +48,7 @@ fromtext_in_a6(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 128)
+ if (token.value.as_ulong > 128U)
RETTOK(ISC_R_RANGE);
prefixlen = (unsigned char)token.value.as_ulong;
diff --git a/lib/dns/rdata/in_1/kx_36.c b/lib/dns/rdata/in_1/kx_36.c
index 3795f2ce..047022d1 100644
--- a/lib/dns/rdata/in_1/kx_36.c
+++ b/lib/dns/rdata/in_1/kx_36.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: kx_36.c,v 1.37 2001/07/16 03:06:43 marka Exp $ */
+/* $Id: kx_36.c,v 1.37.2.1 2003/07/23 06:57:51 marka Exp $ */
/* Reviewed: Thu Mar 16 17:24:54 PST 2000 by explorer */
@@ -41,7 +41,7 @@ fromtext_in_kx(ARGS_FROMTEXT) {
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdata/in_1/naptr_35.c b/lib/dns/rdata/in_1/naptr_35.c
index 292b50ef..a493e8f3 100644
--- a/lib/dns/rdata/in_1/naptr_35.c
+++ b/lib/dns/rdata/in_1/naptr_35.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: naptr_35.c,v 1.43 2001/07/16 03:06:44 marka Exp $ */
+/* $Id: naptr_35.c,v 1.43.2.1 2003/07/23 06:57:51 marka Exp $ */
/* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */
@@ -44,7 +44,7 @@ fromtext_in_naptr(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -53,7 +53,7 @@ fromtext_in_naptr(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdata/in_1/px_26.c b/lib/dns/rdata/in_1/px_26.c
index e5f8588d..fd0d3668 100644
--- a/lib/dns/rdata/in_1/px_26.c
+++ b/lib/dns/rdata/in_1/px_26.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: px_26.c,v 1.34 2001/07/16 03:06:48 marka Exp $ */
+/* $Id: px_26.c,v 1.34.2.1 2003/07/23 06:57:52 marka Exp $ */
/* Reviewed: Mon Mar 20 10:44:27 PST 2000 */
@@ -44,7 +44,7 @@ fromtext_in_px(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdata/in_1/srv_33.c b/lib/dns/rdata/in_1/srv_33.c
index 5c33bdc2..e6451988 100644
--- a/lib/dns/rdata/in_1/srv_33.c
+++ b/lib/dns/rdata/in_1/srv_33.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: srv_33.c,v 1.36 2001/07/16 03:06:49 marka Exp $ */
+/* $Id: srv_33.c,v 1.36.2.1 2003/07/23 06:57:52 marka Exp $ */
/* Reviewed: Fri Mar 17 13:01:00 PST 2000 by bwelling */
@@ -44,7 +44,7 @@ fromtext_in_srv(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -53,7 +53,7 @@ fromtext_in_srv(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
@@ -62,7 +62,7 @@ fromtext_in_srv(ARGS_FROMTEXT) {
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
- if (token.value.as_ulong > 0xffff)
+ if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
diff --git a/lib/dns/rdatalist.c b/lib/dns/rdatalist.c
index f8b84dca..3bfc85ac 100644
--- a/lib/dns/rdatalist.c
+++ b/lib/dns/rdatalist.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdatalist.c,v 1.25 2001/01/09 21:51:21 bwelling Exp $ */
+/* $Id: rdatalist.c,v 1.25.2.2 2003/07/22 04:03:43 marka Exp $ */
#include <config.h>
@@ -74,7 +74,7 @@ dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist,
rdataset->private1 = rdatalist;
rdataset->private2 = NULL;
rdataset->private3 = NULL;
- rdataset->private4 = NULL;
+ rdataset->privateuint4 = 0;
rdataset->private5 = NULL;
return (ISC_R_SUCCESS);
diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c
index f2287019..f8ab7731 100644
--- a/lib/dns/rdataset.c
+++ b/lib/dns/rdataset.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,13 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataset.c,v 1.58 2001/06/05 09:23:14 marka Exp $ */
+/* $Id: rdataset.c,v 1.58.2.3 2003/08/05 00:42:55 marka Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/buffer.h>
+#include <isc/random.h>
#include <isc/util.h>
#include <dns/name.h>
@@ -51,7 +52,7 @@ dns_rdataset_init(dns_rdataset_t *rdataset) {
rdataset->private1 = NULL;
rdataset->private2 = NULL;
rdataset->private3 = NULL;
- rdataset->private4 = NULL;
+ rdataset->privateuint4 = 0;
rdataset->private5 = NULL;
}
@@ -76,7 +77,7 @@ dns_rdataset_invalidate(dns_rdataset_t *rdataset) {
rdataset->private1 = NULL;
rdataset->private2 = NULL;
rdataset->private3 = NULL;
- rdataset->private4 = NULL;
+ rdataset->privateuint4 = 0;
rdataset->private5 = NULL;
}
@@ -102,7 +103,7 @@ dns_rdataset_disassociate(dns_rdataset_t *rdataset) {
rdataset->private1 = NULL;
rdataset->private2 = NULL;
rdataset->private3 = NULL;
- rdataset->private4 = NULL;
+ rdataset->privateuint4 = 0;
rdataset->private5 = NULL;
}
@@ -363,7 +364,11 @@ towiresorted(dns_rdataset_t *rdataset, dns_name_t *owner_name,
/*
* "Cyclic" order.
*/
- unsigned int j = (((unsigned int)rand()) >> 3) % count;
+ isc_uint32_t val;
+ unsigned int j;
+
+ isc_random_get(&val);
+ j = val % count;
for (i = 0; i < count; i++) {
sorted[j].key = 0; /* Unused */
sorted[j].rdata = &shuffled[i];
diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c
index 13f0a86f..d75c84a5 100644
--- a/lib/dns/rdataslab.c
+++ b/lib/dns/rdataslab.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataslab.c,v 1.29 2001/01/09 21:51:25 bwelling Exp $ */
+/* $Id: rdataslab.c,v 1.29.2.2 2003/07/22 04:03:43 marka Exp $ */
#include <config.h>
@@ -563,3 +563,35 @@ dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2,
}
return (ISC_TRUE);
}
+
+isc_boolean_t
+dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2,
+ unsigned int reservelen, dns_rdataclass_t rdclass,
+ dns_rdatatype_t type)
+{
+ unsigned char *current1, *current2;
+ unsigned int count1, count2;
+ dns_rdata_t rdata1 = DNS_RDATA_INIT;
+ dns_rdata_t rdata2 = DNS_RDATA_INIT;
+
+ current1 = slab1 + reservelen;
+ count1 = *current1++ * 256;
+ count1 += *current1++;
+
+ current2 = slab2 + reservelen;
+ count2 = *current2++ * 256;
+ count2 += *current2++;
+
+ if (count1 != count2)
+ return (ISC_FALSE);
+
+ while (count1-- > 0) {
+ rdata_from_slab(&current1, rdclass, type, &rdata1);
+ rdata_from_slab(&current2, rdclass, type, &rdata2);
+ if (dns_rdata_compare(&rdata1, &rdata2) != 0)
+ return (ISC_FALSE);
+ dns_rdata_reset(&rdata1);
+ dns_rdata_reset(&rdata2);
+ }
+ return (ISC_TRUE);
+}
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
index e008b9d5..2ffd29f6 100644
--- a/lib/dns/resolver.c
+++ b/lib/dns/resolver.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.218.2.12.4.4 2003/02/18 03:32:01 marka Exp $ */
+/* $Id: resolver.c,v 1.218.2.18 2003/07/18 04:35:51 marka Exp $ */
#include <config.h>
@@ -277,6 +277,8 @@ struct dns_resolver {
#define ISFORWARDER(a) (((a)->flags & \
FCTX_ADDRINFO_FORWARDER) != 0)
+#define NXDOMAIN(r) (((r)->attributes & DNS_RDATASETATTR_NXDOMAIN) != 0)
+
static void destroy(dns_resolver_t *res);
static void empty_bucket(dns_resolver_t *res);
static isc_result_t resquery_send(resquery_t *query);
@@ -1504,20 +1506,13 @@ fctx_getaddresses(fetchctx_t *fctx) {
options = stdoptions;
/*
* If this name is a subdomain of the query domain, tell
- * the ADB to start looking at "." if it doesn't know the
- * address. This keeps us from getting stuck if the
- * nameserver is beneath the zone cut and we don't know its
- * address (e.g. because the A record has expired).
- * By restarting from ".", we ensure that any missing glue
- * will be reestablished.
- *
- * A further optimization would be to get the ADB to start
- * looking at the most enclosing zone cut above fctx->domain.
- * We don't expect this situation to happen very frequently,
- * so we've chosen the simple solution.
+ * the ADB to start looking using zone/hint data. This keeps
+ * us from getting stuck if the nameserver is beneath the
+ * zone cut and we don't know its address (e.g. because the
+ * A record has expired).
*/
if (dns_name_issubdomain(&ns.name, &fctx->domain))
- options |= DNS_ADBFIND_STARTATROOT;
+ options |= DNS_ADBFIND_STARTATZONE;
options |= DNS_ADBFIND_GLUEOK;
options |= DNS_ADBFIND_HINTOK;
@@ -2234,7 +2229,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
/*
* Compute an expiration time for the entire fetch.
*/
- isc_interval_set(&interval, 90, 0); /* XXXRTH constant */
+ isc_interval_set(&interval, 30, 0); /* XXXRTH constant */
iresult = isc_time_nowplusinterval(&fctx->expires, &interval);
if (iresult != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
@@ -2939,7 +2934,10 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, isc_stdtime_t now) {
eresult = DNS_R_DNAME;
}
}
- if (rdataset->trust == dns_trust_glue) {
+ if (rdataset->trust == dns_trust_glue &&
+ (rdataset->type == dns_rdatatype_ns ||
+ (rdataset->type == dns_rdatatype_sig &&
+ rdataset->covers == dns_rdatatype_ns))) {
/*
* If the trust level is 'dns_trust_glue'
* then we are adding data from a referral
@@ -2968,8 +2966,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, isc_stdtime_t now) {
* a negative cache entry, so we
* must set eresult appropriately.
*/
- if (ardataset->covers ==
- dns_rdatatype_any)
+ if (NXDOMAIN(ardataset))
eresult =
DNS_R_NCACHENXDOMAIN;
else
@@ -3076,7 +3073,7 @@ ncache_adderesult(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
* The cache data is also a negative cache
* entry.
*/
- if (ardataset->covers == dns_rdatatype_any)
+ if (NXDOMAIN(ardataset))
*eresultp = DNS_R_NCACHENXDOMAIN;
else
*eresultp = DNS_R_NCACHENXRRSET;
@@ -3095,7 +3092,7 @@ ncache_adderesult(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
result = ISC_R_SUCCESS;
}
} else if (result == ISC_R_SUCCESS) {
- if (covers == dns_rdatatype_any)
+ if (NXDOMAIN(ardataset))
*eresultp = DNS_R_NCACHENXDOMAIN;
else
*eresultp = DNS_R_NCACHENXRRSET;
@@ -4486,15 +4483,19 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
}
if (get_nameservers) {
+ dns_name_t *name;
dns_fixedname_init(&foundname);
fname = dns_fixedname_name(&foundname);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, DNS_R_SERVFAIL);
return;
}
+ if ((options & DNS_FETCHOPT_UNSHARED) == 0)
+ name = &fctx->name;
+ else
+ name = &fctx->domain;
result = dns_view_findzonecut(fctx->res->view,
- &fctx->domain,
- fname,
+ name, fname,
now, 0, ISC_TRUE,
&fctx->nameservers,
NULL);
diff --git a/lib/dns/result.c b/lib/dns/result.c
index 2bc2d098..21c22b2b 100644
--- a/lib/dns/result.c
+++ b/lib/dns/result.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2002 Internet Software Consortium.
+ * Copyright (C) 1998-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.c,v 1.90.2.5 2002/03/26 00:55:00 marka Exp $ */
+/* $Id: result.c,v 1.90.2.9 2003/07/22 04:03:44 marka Exp $ */
#include <config.h>
@@ -125,7 +125,20 @@ static const char *text[DNS_R_NRESULTS] = {
"obsolete", /* 80 DNS_R_OBSOLETE */
"already frozen", /* 81 DNS_R_FROZEN */
"unknown flag", /* 82 DNS_R_UNKNOWNFLAG */
- "expected a response" /* 83 DNS_R_EXPECTEDRESPONSE */
+ "expected a response", /* 83 DNS_R_EXPECTEDRESPONSE */
+ "<unused 84>",
+
+ "<unused 85>",
+ "<unused 86>",
+ "<unused 87>",
+ "<unused 88>",
+ "<unused 89>",
+
+ "<unused 90>",
+ "<unused 91>",
+ "empty name", /* 92 DNS_R_EMPTYNAME */
+ "empty wild", /* 93 DNS_R_EMPTYWILD */
+ "bad bitmap" /* 94 DNS_R_BADBITMAP */
};
static const char *rcode_text[DNS_R_NRCODERESULTS] = {
diff --git a/lib/dns/rootns.c b/lib/dns/rootns.c
index 579a4fb0..80005063 100644
--- a/lib/dns/rootns.c
+++ b/lib/dns/rootns.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rootns.c,v 1.20.2.1 2001/10/03 22:30:17 gson Exp $ */
+/* $Id: rootns.c,v 1.20.2.3 2003/07/22 04:03:44 marka Exp $ */
#include <config.h>
@@ -65,7 +65,7 @@ static char root_ns[] =
"G.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4\n"
"H.ROOT-SERVERS.NET. 3600000 IN A 128.63.2.53\n"
"I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17\n"
-"J.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.10\n"
+"J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30\n"
"K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129\n"
"L.ROOT-SERVERS.NET. 3600000 IN A 198.32.64.12\n"
"M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33\n";
diff --git a/lib/dns/sec/dst/dst_api.c b/lib/dns/sec/dst/dst_api.c
index 84afc48a..1ab3b044 100644
--- a/lib/dns/sec/dst/dst_api.c
+++ b/lib/dns/sec/dst/dst_api.c
@@ -19,7 +19,7 @@
/*
* Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.88.2.2 2001/12/19 01:09:56 marka Exp $
+ * $Id: dst_api.c,v 1.88.2.3 2003/07/23 06:57:53 marka Exp $
*/
#include <config.h>
@@ -987,7 +987,7 @@ buildfilename(dns_name_t *name, dns_keytag_t id,
if (isc_buffer_availablelength(out) < strlen(directory))
return (ISC_R_NOSPACE);
isc_buffer_putstr(out, directory);
- if (strlen(directory) > 0 &&
+ if (strlen(directory) > 0U &&
directory[strlen(directory) - 1] != '/')
isc_buffer_putstr(out, "/");
}
@@ -1106,7 +1106,7 @@ dst__mem_realloc(void *ptr, size_t size) {
INSIST(dst_memory_pool != NULL);
p = NULL;
- if (size > 0) {
+ if (size > 0U) {
p = dst__mem_alloc(size);
if (p != NULL && ptr != NULL)
memcpy(p, ptr, size);
diff --git a/lib/dns/sec/dst/openssl_link.c b/lib/dns/sec/dst/openssl_link.c
index adb784ba..3bad9480 100644
--- a/lib/dns/sec/dst/openssl_link.c
+++ b/lib/dns/sec/dst/openssl_link.c
@@ -1,5 +1,5 @@
/*
- * Portions Copyright (C) 1999-2001 Internet Software Consortium.
+ * Portions Copyright (C) 1999-2001, 2003 Internet Software Consortium.
* Portions Copyright (C) 1995-2000 by Network Associates, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
@@ -19,7 +19,7 @@
/*
* Principal Author: Brian Wellington
- * $Id: openssl_link.c,v 1.46.8.1 2003/02/18 06:24:45 marka Exp $
+ * $Id: openssl_link.c,v 1.46.2.2 2003/07/22 04:03:47 marka Exp $
*/
#ifdef OPENSSL
diff --git a/lib/dns/sec/dst/opensslrsa_link.c b/lib/dns/sec/dst/opensslrsa_link.c
index b13a6c1b..cebb9045 100644
--- a/lib/dns/sec/dst/opensslrsa_link.c
+++ b/lib/dns/sec/dst/opensslrsa_link.c
@@ -17,7 +17,7 @@
/*
* Principal Author: Brian Wellington
- * $Id: opensslrsa_link.c,v 1.12.2.3 2001/12/19 01:29:31 marka Exp $
+ * $Id: opensslrsa_link.c,v 1.12.2.4 2003/07/24 06:18:42 marka Exp $
*/
#ifdef OPENSSL
@@ -217,6 +217,7 @@ opensslrsa_generate(dst_key_t *key, int exp) {
}
rsa->flags &= ~(RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE);
+ rsa->flags |= RSA_FLAG_BLINDING;
key->opaque = rsa;
@@ -296,6 +297,7 @@ opensslrsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
if (rsa == NULL)
return (ISC_R_NOMEMORY);
rsa->flags &= ~(RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE);
+ rsa->flags |= RSA_FLAG_BLINDING;
if (r.length < 1) {
RSA_free(rsa);
@@ -434,6 +436,7 @@ opensslrsa_fromfile(dst_key_t *key, const char *filename) {
if (rsa == NULL)
DST_RET(ISC_R_NOMEMORY);
rsa->flags &= ~(RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE);
+ rsa->flags |= RSA_FLAG_BLINDING;
key->opaque = rsa;
for (i = 0; i < priv.nelements; i++) {
diff --git a/lib/dns/time.c b/lib/dns/time.c
index 95db294c..39757627 100644
--- a/lib/dns/time.c
+++ b/lib/dns/time.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.18 2001/05/15 22:05:35 gson Exp $ */
+/* $Id: time.c,v 1.18.2.4 2003/07/23 06:57:48 marka Exp $ */
#include <config.h>
@@ -127,7 +127,7 @@ dns_time64_fromtext(char *source, isc_int64_t *target) {
return (ISC_R_RANGE); \
} while (0)
- if (strlen(source) != 14)
+ if (strlen(source) != 14U)
return (DNS_R_SYNTAX);
if (sscanf(source, "%4d%2d%2d%2d%2d%2d",
&year, &month, &day, &hour, &minute, &second) != 6)
@@ -161,15 +161,11 @@ dns_time64_fromtext(char *source, isc_int64_t *target) {
isc_result_t
dns_time32_fromtext(char *source, isc_uint32_t *target) {
isc_int64_t value64;
- isc_int32_t value32;
isc_result_t result;
result = dns_time64_fromtext(source, &value64);
if (result != ISC_R_SUCCESS)
return (result);
- value32 = (isc_uint32_t)value64;
- if (value32 != value64)
- return (ISC_R_RANGE);
- *target = value32;
+ *target = (isc_uint32_t)value64;
return (ISC_R_SUCCESS);
}
diff --git a/lib/dns/view.c b/lib/dns/view.c
index 4076010e..6c2348fb 100644
--- a/lib/dns/view.c
+++ b/lib/dns/view.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,10 +15,11 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: view.c,v 1.103.2.2 2002/08/05 06:57:12 marka Exp $ */
+/* $Id: view.c,v 1.103.2.5 2003/07/25 03:31:43 marka Exp $ */
#include <config.h>
+#include <isc/hash.h>
#include <isc/task.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <isc/util.h>
@@ -851,9 +852,20 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
isc_result_t
dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
isc_stdtime_t now, unsigned int options,
- isc_boolean_t use_hints,
+ isc_boolean_t use_hints,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
{
+ return(dns_view_findzonecut2(view, name, fname, now, options,
+ use_hints, ISC_TRUE,
+ rdataset, sigrdataset));
+}
+
+isc_result_t
+dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
+ isc_stdtime_t now, unsigned int options,
+ isc_boolean_t use_hints, isc_boolean_t use_cache,
+ dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
+{
isc_result_t result;
dns_db_t *db;
isc_boolean_t is_cache, use_zone, try_hints;
@@ -890,7 +902,7 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
* is it a subdomain of any zone for which we're
* authoritative.
*/
- if (view->cachedb != NULL) {
+ if (use_cache && view->cachedb != NULL) {
/*
* We have a cache; try it.
*/
@@ -921,7 +933,7 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
result = ISC_R_SUCCESS;
else if (result != ISC_R_SUCCESS)
goto cleanup;
- if (view->cachedb != NULL && db != view->hints) {
+ if (use_cache && view->cachedb != NULL && db != view->hints) {
/*
* We found an answer, but the cache may be better.
*/
diff --git a/lib/dns/win32/gen.dsp b/lib/dns/win32/gen.dsp
index a176787a..1d0fc34e 100644
--- a/lib/dns/win32/gen.dsp
+++ b/lib/dns/win32/gen.dsp
@@ -1,107 +1,107 @@
-# Microsoft Developer Studio Project File - Name="gen" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=gen - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gen.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gen.mak" CFG="gen - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gen - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "gen - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gen - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "./" /I "../../../" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/isc/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "LIBISC_EXPORTS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"../gen.exe"
-
-!ELSEIF "$(CFG)" == "gen - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/isc/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "LIBISC_EXPORTS" /FR /FD /GZ /c
-# SUBTRACT CPP /X /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../gen.exe" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "gen - Win32 Release"
-# Name "gen - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\gen.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\gen-win32.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="gen" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=gen - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "gen.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "gen.mak" CFG="gen - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "gen - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "gen - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "gen - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "./" /I "../../../" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/isc/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "LIBISC_EXPORTS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 user32.lib advapi32.lib /nologo /subsystem:console /machine:I386 /out:"../gen.exe"
+
+!ELSEIF "$(CFG)" == "gen - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/isc/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "LIBISC_EXPORTS" /FR /FD /GZ /c
+# SUBTRACT CPP /X /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../gen.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "gen - Win32 Release"
+# Name "gen - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\gen.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE="..\gen-win32.h"
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/lib/dns/win32/gen.dsw b/lib/dns/win32/gen.dsw
index e4c143cc..e44f5893 100644
--- a/lib/dns/win32/gen.dsw
+++ b/lib/dns/win32/gen.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "gen"=".\gen.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "gen"=".\gen.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/lib/dns/win32/libdns.def b/lib/dns/win32/libdns.def
index 42db163d..5347c1f9 100644
--- a/lib/dns/win32/libdns.def
+++ b/lib/dns/win32/libdns.def
@@ -1,717 +1,718 @@
-LIBRARY libdns
-
-; Exported Functions
-EXPORTS
-
-dns_a6_init
-dns_a6_reset
-dns_a6_invalidate
-dns_a6_copy
-dns_a6_foreach
-dns_acl_create
-dns_acl_appendelement
-dns_acl_any
-dns_acl_none
-dns_acl_attach
-dns_acl_detach
-dns_aclelement_equal
-dns_acl_equal
-dns_acl_isinsecure
-dns_aclenv_init
-dns_aclenv_copy
-dns_aclenv_destroy
-dns_acl_match
-dns_aclelement_match
-dns_adb_create
-dns_adb_attach
-dns_adb_detach
-dns_adb_whenshutdown
-dns_adb_shutdown
-dns_adb_createfind
-dns_adb_cancelfind
-dns_adb_destroyfind
-dns_adb_dump
-dns_adb_dumpfind
-dns_adb_marklame
-dns_adb_adjustsrtt
-dns_adb_changeflags
-dns_adb_findaddrinfo
-dns_adb_freeaddrinfo
-dns_adb_flush
-dns_byaddr_create
-dns_byaddr_cancel
-dns_byaddr_destroy
-dns_byaddr_createptrname
-dns_cache_create
-dns_cache_attach
-dns_cache_detach
-dns_cache_attachdb
-dns_cache_setfilename
-dns_cache_load
-dns_cache_dump
-dns_cache_clean
-dns_cache_setcleaninginterval
-dns_cache_setcachesize
-dns_cache_flush
-dns_rdatacallbacks_init
-dns_rdatacallbacks_init_stdio
-dns_cert_fromtext
-dns_cert_totext
-dns_compress_init
-dns_compress_invalidate
-dns_compress_setmethods
-dns_compress_getmethods
-dns_compress_getedns
-dns_compress_findglobal
-dns_compress_add
-dns_compress_rollback
-dns_decompress_init
-dns_decompress_invalidate
-dns_decompress_setmethods
-dns_decompress_getmethods
-dns_decompress_edns
-dns_decompress_type
-dns_db_create
-dns_db_attach
-dns_db_detach
-dns_db_ondestroy
-dns_db_iscache
-dns_db_iszone
-dns_db_isstub
-dns_db_issecure
-dns_db_origin
-dns_db_class
-dns_db_beginload
-dns_db_endload
-dns_db_load
-dns_db_dump
-dns_db_currentversion
-dns_db_newversion
-dns_db_attachversion
-dns_db_closeversion
-dns_db_findnode
-dns_db_find
-dns_db_findzonecut
-dns_db_attachnode
-dns_db_detachnode
-dns_db_expirenode
-dns_db_printnode
-dns_db_createiterator
-dns_db_findrdataset
-dns_db_allrdatasets
-dns_db_addrdataset
-dns_db_subtractrdataset
-dns_db_deleterdataset
-dns_db_getsoaserial
-dns_db_overmem
-dns_db_nodecount
-dns_db_ispersistent
-dns_db_register
-dns_db_unregister
-dns_dbiterator_destroy
-dns_dbiterator_first
-dns_dbiterator_last
-dns_dbiterator_seek
-dns_dbiterator_prev
-dns_dbiterator_next
-dns_dbiterator_current
-dns_dbiterator_pause
-dns_dbiterator_origin
-dns_dbiterator_setcleanmode
-dns_dbtable_create
-dns_dbtable_attach
-dns_dbtable_detach
-dns_dbtable_add
-dns_dbtable_remove
-dns_dbtable_adddefault
-dns_dbtable_getdefault
-dns_dbtable_removedefault
-dns_dbtable_find
-
-dns_difftuple_create
-dns_difftuple_free
-dns_difftuple_copy
-dns_diff_init
-dns_diff_clear
-dns_diff_append
-dns_diff_appendminimal
-dns_diff_sort
-dns_diff_apply
-dns_diff_load
-dns_diff_print
-dns_dispatchmgr_create
-dns_dispatchmgr_destroy
-dns_dispatchmgr_setblackhole
-dns_dispatchmgr_getblackhole
-dns_dispatch_getudp
-dns_dispatch_createtcp
-dns_dispatch_attach
-dns_dispatch_detach
-dns_dispatch_starttcp
-dns_dispatch_addresponse
-dns_dispatch_removeresponse
-dns_dispatch_getsocket
-dns_dispatch_getlocaladdress
-dns_dispatch_cancel
-dns_dispatch_changeattributes
-dns_dispatch_importrecv
-dns_dnssec_keyfromrdata
-dns_dnssec_sign
-dns_dnssec_verify
-dns_dnssec_findzonekeys
-dns_dnssec_signmessage
-dns_dnssec_verifymessage
-dns_fwdtable_create
-dns_fwdtable_add
-dns_fwdtable_find
-dns_fwdtable_destroy
-dns_db_createsoatuple
-dns_journal_open
-dns_journal_destroy
-dns_journal_begin_transaction
-dns_journal_writediff
-dns_journal_commit
-dns_journal_writediff
-dns_journal_write_transaction
-dns_diff_sort
-dns_journal_writediff
-dns_journal_first_serial
-dns_journal_last_serial
-dns_journal_iter_init
-dns_journal_first_rr
-dns_journal_next_rr
-dns_journal_iter_init
-dns_journal_current_rr
-dns_journal_rollforward
-dns_journal_print
-dns_db_diff
-dns_keyflags_fromtext
-dns_keytable_create
-dns_keytable_attach
-dns_keytable_detach
-dns_keytable_add
-dns_keytable_findkeynode
-dns_keytable_findnextkeynode
-dns_keytable_finddeepestmatch
-dns_keytable_detachkeynode
-dns_keytable_issecuredomain
-dns_keynode_key
-dns_lib_initmsgcat
-dns_log_init
-dns_log_setcontext
-dns_lookup_create
-dns_lookup_cancel
-dns_lookup_destroy
-dns_master_loadfile
-dns_master_loadstream
-dns_master_loadbuffer
-dns_master_loadfileinc
-dns_master_loadstreaminc
-dns_master_loadbufferinc
-dns_loadctx_detach
-dns_loadctx_attach
-dns_loadctx_cancel
-dns_master_dumptostream
-dns_master_dump
-dns_master_rdatasettotext
-dns_master_questiontotext
-dns_rdataset_towire
-dns_master_dumpnodetostream
-dns_master_dumpnode
-dns_message_gettempname
-dns_message_create
-dns_message_reset
-dns_message_destroy
-dns_message_sectiontotext
-dns_message_pseudosectiontotext
-dns_message_totext
-dns_message_parse
-dns_message_firstname
-dns_message_renderbegin
-dns_message_renderend
-dns_message_renderchangebuffer
-dns_message_renderend
-dns_message_renderreserve
-dns_message_renderrelease
-dns_message_rendersection
-dns_message_renderheader
-dns_message_renderend
-dns_message_renderend
-dns_message_renderreset
-dns_message_firstname
-dns_message_nextname
-dns_message_currentname
-dns_message_findname
-dns_message_findtype
-dns_message_movename
-dns_message_addname
-dns_message_gettempname
-dns_message_gettempoffsets
-dns_message_gettemprdata
-dns_message_gettemprdataset
-dns_message_gettemprdatalist
-dns_message_puttempname
-dns_message_puttemprdata
-dns_message_puttemprdataset
-dns_message_puttemprdatalist
-dns_message_peekheader
-dns_message_reply
-dns_message_getopt
-dns_message_setopt
-dns_message_gettsig
-dns_message_settsigkey
-dns_message_gettsigkey
-dns_message_setquerytsig
-dns_message_getquerytsig
-dns_message_getsig0
-dns_message_setsig0key
-dns_message_getsig0key
-dns_message_takebuffer
-dns_message_signer
-dns_message_checksig
-dns_message_getrawmessage
-dns_message_setsortorder
-dns_message_rendersection
-dns_message_settimeadjust
-dns_message_gettimeadjust
-dns_label_type
-dns_label_countbits
-dns_label_getbit
-dns_name_init
-dns_name_reset
-dns_name_invalidate
-dns_name_setbuffer
-dns_name_hasbuffer
-dns_name_isabsolute
-dns_name_iswildcard
-dns_name_requiresedns
-dns_name_hash
-dns_name_fullcompare
-dns_name_compare
-dns_name_equal
-dns_name_rdatacompare
-dns_name_issubdomain
-dns_name_matcheswildcard
-dns_name_depth
-dns_name_countlabels
-dns_name_getlabel
-dns_name_getlabelsequence
-dns_name_clone
-dns_name_fromregion
-dns_name_toregion
-dns_name_fromwire
-dns_name_towire
-dns_name_fromtext
-dns_name_totext
-dns_name_tofilenametext
-dns_name_downcase
-dns_name_concatenate
-dns_name_split
-dns_name_splitatdepth
-dns_name_dup
-dns_name_dupwithoffsets
-dns_name_free
-dns_name_digest
-dns_name_dynamic
-dns_name_print
-dns_name_format
-dns_name_copy
-dns_ncache_add
-dns_ncache_towire
-dns_nxt_buildrdata
-dns_nxt_build
-dns_nxt_typepresent
-dns_soa_getserial
-dns_soa_setserial
-dns_soa_getminimum
-dns_peerlist_new
-dns_peerlist_attach
-dns_peerlist_detach
-dns_peerlist_addpeer
-dns_peerlist_peerbyaddr
-dns_peerlist_currpeer
-dns_peer_new
-dns_peer_attach
-dns_peer_detach
-dns_peer_setbogus
-dns_peer_getbogus
-
-
-dns_peer_setrequestixfr
-dns_peer_getrequestixfr
-dns_peer_setprovideixfr
-dns_peer_getprovideixfr
-dns_peer_setsupportedns
-dns_peer_getsupportedns
-dns_peer_settransfers
-dns_peer_gettransfers
-dns_peer_settransferformat
-dns_peer_gettransferformat
-dns_peer_setkeybycharp
-dns_peer_getkey
-dns_peer_setkey
-dns_name_concatenate
-dns_name_totext
-dns_rbt_create
-dns_rbt_addname
-dns_rbt_addnode
-dns_rbt_findname
-dns_rbt_findnode
-dns_rbt_deletename
-dns_rbt_deletenode
-dns_rbt_namefromnode
-dns_rbt_fullnamefromnode
-dns_rbt_formatnodename
-dns_rbt_nodecount
-dns_rbt_destroy
-dns_rbt_printall
-dns_rbtnodechain_init
-dns_rbtnodechain_reset
-dns_rbtnodechain_invalidate
-dns_rbtnodechain_current
-dns_rbtnodechain_first
-dns_rbtnodechain_last
-dns_rbtnodechain_prev
-dns_rbtnodechain_next
-dns_rcode_fromtext
-dns_rcode_totext
-dns_tsigrcode_fromtext
-dns_tsigrcode_totext
-dns_rdata_init
-dns_rdata_reset
-dns_rdata_clone
-dns_rdata_compare
-dns_rdata_fromregion
-dns_rdata_toregion
-dns_rdata_fromwire
-dns_rdata_towire
-dns_rdata_fromtext
-
-dns_rdata_totext
-dns_rdata_tofmttext
-dns_rdata_fromstruct
-dns_rdata_tostruct
-dns_rdata_freestruct
-dns_rdatatype_ismeta
-dns_rdatatype_issingleton
-dns_rdataclass_ismeta
-dns_rdatatype_isdnssec
-dns_rdatatype_iszonecutauth
-dns_rdatatype_isknown
-dns_rdata_additionaldata
-dns_rdata_digest
-dns_rdatatype_questiononly
-dns_rdatatype_notquestion
-dns_rdatatype_attributes
-dns_rdata_covers
-dns_rdataclass_fromtext
-dns_rdataclass_totext
-dns_rdataclass_format
-dns_rdatalist_init
-dns_rdatalist_tordataset
-dns_rdataset_init
-dns_rdataset_invalidate
-dns_rdataset_disassociate
-dns_rdataset_isassociated
-dns_rdataset_makequestion
-dns_rdataset_clone
-dns_rdataset_count
-dns_rdataset_first
-dns_rdataset_next
-dns_rdataset_current
-dns_rdataset_totext
-dns_rdataset_towire
-dns_rdataset_towiresorted
-dns_rdataset_additionaldata
-dns_rdatasetiter_destroy
-dns_rdatasetiter_first
-dns_rdatasetiter_next
-dns_rdatasetiter_current
-dns_rdataslab_fromrdataset
-dns_rdataslab_size
-dns_rdataslab_merge
-dns_rdataslab_subtract
-dns_rdataslab_equal
-dns_rdatatype_fromtext
-dns_rdatatype_totext
-dns_rdatatype_format
-dns_requestmgr_create
-dns_requestmgr_whenshutdown
-dns_requestmgr_shutdown
-dns_requestmgr_attach
-dns_requestmgr_detach
-dns_request_create
-dns_request_createvia
-dns_request_createraw
-dns_request_cancel
-dns_request_getresponse
-dns_request_usedtcp
-dns_request_destroy
-dns_resolver_createfetch
-dns_resolver_create
-dns_resolver_freeze
-dns_resolver_prime
-dns_resolver_whenshutdown
-dns_resolver_shutdown
-dns_resolver_attach
-dns_resolver_detach
-dns_resolver_createfetch
-dns_resolver_cancelfetch
-dns_resolver_destroyfetch
-dns_resolver_dispatchmgr
-dns_resolver_dispatchv4
-dns_resolver_dispatchv6
-dns_resolver_socketmgr
-dns_resolver_taskmgr
-dns_resolver_getlamettl
-dns_resolver_setlamettl
-dns_result_totext
-dns_result_register
-dns_result_torcode
-dns_rootns_create
-dns_sdb_register
-dns_sdb_unregister
-dns_sdb_putrr
-dns_sdb_putnamedrr
-dns_sdb_putsoa
-dns_secalg_fromtext
-dns_secalg_totext
-dns_secproto_fromtext
-dns_secproto_totext
-dns_ssutable_create
-dns_ssutable_attach
-dns_ssutable_detach
-dns_ssutable_addrule
-dns_ssutable_checkrules
-dns_stats_alloccounters
-dns_stats_freecounters
-dns_tcpmsg_init
-dns_tcpmsg_setmaxsize
-dns_tcpmsg_readmessage
-dns_tcpmsg_cancelread
-dns_tcpmsg_keepbuffer
-dns_tcpmsg_invalidate
-dns_time64_fromtext
-dns_time32_fromtext
-dns_time64_totext
-dns_time32_totext
-dns_timer_setidle
-dns_tkeyctx_create
-dns_tkeyctx_destroy
-dns_tkey_processquery
-dns_tkey_builddhquery
-dns_tkey_buildgssquery
-dns_tkey_builddeletequery
-dns_tkey_processdhresponse
-dns_tkey_processgssresponse
-dns_tkey_processdeleteresponse
-dns_tsigkey_create
-dns_tsigkey_createfromkey
-dns_tsigkey_attach
-dns_tsigkey_detach
-dns_tsigkey_setdeleted
-dns_tsig_sign
-dns_tsig_verify
-dns_tsigkey_find
-dns_tsigkeyring_create
-dns_tsigkeyring_destroy
-dns_ttl_totext
-dns_counter_fromtext
-dns_ttl_fromtext
-dns_validator_create
-dns_validator_cancel
-dns_validator_destroy
-dns_view_create
-dns_view_attach
-dns_view_detach
-dns_view_flushanddetach
-dns_view_weakattach
-dns_view_weakdetach
-dns_view_createresolver
-dns_view_setcache
-dns_view_sethints
-dns_view_setkeyring
-dns_view_setdstport
-dns_view_addzone
-dns_view_freeze
-dns_view_find
-dns_view_simplefind
-dns_view_findzonecut
-dns_viewlist_find
-dns_view_findzone
-dns_view_load
-dns_view_loadnew
-dns_view_gettsig
-dns_view_getpeertsig
-dns_view_checksig
-dns_view_dialup
-dns_view_dumpdbtostream
-dns_view_flushcache
-dns_xfrin_create
-dns_xfrin_shutdown
-dns_xfrin_detach
-dns_xfrin_attach
-dns_zone_create
-dns_zone_setclass
-dns_zone_getclass
-dns_zone_settype
-dns_zone_setview
-dns_zone_getview
-dns_zone_setorigin
-dns_zone_getorigin
-dns_zone_setfile
-dns_zone_getfile
-dns_zone_load
-dns_zone_attach
-dns_zone_detach
-dns_zone_iattach
-dns_zone_idetach
-dns_zone_setflag
-dns_zone_getdb
-dns_zone_setdbtype
-dns_zone_markdirty
-dns_zone_expire
-dns_zone_refresh
-dns_zone_flush
-dns_zone_dump
-dns_zone_dumptostream
-dns_zone_maintenance
-dns_zone_setmasters
-dns_zone_setmasterswithkeys
-dns_zone_setmasters
-dns_zone_setalsonotify
-dns_zone_unload
-dns_zone_setoption
-
-dns_zone_getoptions
-dns_zone_setminrefreshtime
-dns_zone_setmaxrefreshtime
-dns_zone_setminretrytime
-dns_zone_setmaxretrytime
-dns_zone_setxfrsource4
-dns_zone_getxfrsource4
-dns_zone_setxfrsource6
-dns_zone_getxfrsource6
-dns_zone_setnotifysrc4
-dns_zone_getnotifysrc4
-dns_zone_setnotifysrc6
-dns_zone_getnotifysrc6
-dns_zone_setnotifyacl
-dns_zone_setqueryacl
-dns_zone_setupdateacl
-dns_zone_setforwardacl
-dns_zone_setxfracl
-dns_zone_getnotifyacl
-dns_zone_getqueryacl
-dns_zone_getupdateacl
-dns_zone_getforwardacl
-dns_zone_getxfracl
-dns_zone_clearupdateacl
-dns_zone_clearforwardacl
-dns_zone_clearnotifyacl
-dns_zone_clearqueryacl
-dns_zone_clearxfracl
-dns_zone_setchecknames
-dns_zone_getchecknames
-dns_zone_setjournalsize
-dns_zone_getjournalsize
-dns_zone_notifyreceive
-dns_zone_setmaxxfrin
-dns_zone_getmaxxfrin
-dns_zone_setmaxxfrout
-dns_zone_getmaxxfrout
-dns_zone_setjournal
-dns_zone_getjournal
-dns_zone_gettype
-dns_zone_settask
-dns_zone_gettask
-dns_zone_notify
-dns_zone_replacedb
-dns_zone_getidlein
-dns_zone_setidlein
-dns_zone_getidleout
-dns_zone_setidleout
-dns_zone_getssutable
-dns_zone_setssutable
-dns_zone_getmctx
-dns_zone_getmgr
-dns_zone_setsigvalidityinterval
-dns_zone_getsigvalidityinterval
-dns_zone_setnotifytype
-dns_zone_forwardupdate
-dns_zone_next
-dns_zone_first
-dns_zonemgr_create
-dns_zonemgr_managezone
-dns_zonemgr_forcemaint
-dns_zonemgr_shutdown
-dns_zonemgr_attach
-dns_zonemgr_detach
-dns_zonemgr_releasezone
-dns_zonemgr_settransfersin
-dns_zonemgr_getttransfersin
-dns_zonemgr_settransfersperns
-dns_zonemgr_getttransfersperns
-dns_zonemgr_setiolimit
-dns_zonemgr_getiolimit
-dns_zonemgr_setserialqueryrate
-dns_zonemgr_getserialqueryrate
-dns_zonemgr_getcount
-dns_zone_forcereload
-dns_zone_isforced
-dns_zone_setstatistics
-dns_zone_getstatscounters
-dns_zone_dialup
-dns_zone_setdialup
-dns_zone_log
-dns_zonekey_iszonekey
-dns_zt_create
-dns_zt_mount
-dns_zt_unmount
-dns_zt_find
-dns_zt_detach
-dns_zt_flushanddetach
-dns_zt_attach
-dns_zt_load
-dns_zt_apply
-dst_lib_init
-dst_lib_destroy
-dst_algorithm_supported
-dst_context_create
-dst_context_destroy
-dst_context_adddata
-dst_context_sign
-dst_context_verify
-dst_key_computesecret
-dst_key_fromfile
-dst_key_fromnamedfile
-dst_key_tofile
-dst_key_fromdns
-dst_key_todns
-dst_key_frombuffer
-dst_key_tobuffer
-dst_key_fromgssapi
-dst_key_generate
-dst_key_compare
-dst_key_paramcompare
-dst_key_free
-dst_key_name
-dst_key_size
-dst_key_proto
-dst_key_alg
-dst_key_flags
-dst_key_id
-dst_key_class
-dst_key_isprivate
-dst_key_iszonekey
-dst_key_isnullkey
-dst_key_buildfilename
-dst_key_sigsize
-dst_key_secretsize
-dst_region_computeid
-dst_gssapi_acquirecred
-dst_gssapi_initctx
-dst_gssapi_acceptctx
-dst_lib_initmsgcat
-dst_result_totext
-dst_result_register
+LIBRARY libdns
+
+; Exported Functions
+EXPORTS
+
+dns_a6_init
+dns_a6_reset
+dns_a6_invalidate
+dns_a6_copy
+dns_a6_foreach
+dns_acl_create
+dns_acl_appendelement
+dns_acl_any
+dns_acl_none
+dns_acl_attach
+dns_acl_detach
+dns_aclelement_equal
+dns_acl_equal
+dns_acl_isinsecure
+dns_aclenv_init
+dns_aclenv_copy
+dns_aclenv_destroy
+dns_acl_match
+dns_aclelement_match
+dns_adb_create
+dns_adb_attach
+dns_adb_detach
+dns_adb_whenshutdown
+dns_adb_shutdown
+dns_adb_createfind
+dns_adb_cancelfind
+dns_adb_destroyfind
+dns_adb_dump
+dns_adb_dumpfind
+dns_adb_marklame
+dns_adb_adjustsrtt
+dns_adb_changeflags
+dns_adb_findaddrinfo
+dns_adb_freeaddrinfo
+dns_adb_flush
+dns_byaddr_create
+dns_byaddr_cancel
+dns_byaddr_destroy
+dns_byaddr_createptrname
+dns_byaddr_createptrname2
+dns_cache_create
+dns_cache_attach
+dns_cache_detach
+dns_cache_attachdb
+dns_cache_setfilename
+dns_cache_load
+dns_cache_dump
+dns_cache_clean
+dns_cache_setcleaninginterval
+dns_cache_setcachesize
+dns_cache_flush
+dns_rdatacallbacks_init
+dns_rdatacallbacks_init_stdio
+dns_cert_fromtext
+dns_cert_totext
+dns_compress_init
+dns_compress_invalidate
+dns_compress_setmethods
+dns_compress_getmethods
+dns_compress_getedns
+dns_compress_findglobal
+dns_compress_add
+dns_compress_rollback
+dns_decompress_init
+dns_decompress_invalidate
+dns_decompress_setmethods
+dns_decompress_getmethods
+dns_decompress_edns
+dns_decompress_type
+dns_db_create
+dns_db_attach
+dns_db_detach
+dns_db_ondestroy
+dns_db_iscache
+dns_db_iszone
+dns_db_isstub
+dns_db_issecure
+dns_db_origin
+dns_db_class
+dns_db_beginload
+dns_db_endload
+dns_db_load
+dns_db_dump
+dns_db_currentversion
+dns_db_newversion
+dns_db_attachversion
+dns_db_closeversion
+dns_db_findnode
+dns_db_find
+dns_db_findzonecut
+dns_db_attachnode
+dns_db_detachnode
+dns_db_expirenode
+dns_db_printnode
+dns_db_createiterator
+dns_db_findrdataset
+dns_db_allrdatasets
+dns_db_addrdataset
+dns_db_subtractrdataset
+dns_db_deleterdataset
+dns_db_getsoaserial
+dns_db_overmem
+dns_db_nodecount
+dns_db_ispersistent
+dns_db_register
+dns_db_unregister
+dns_dbiterator_destroy
+dns_dbiterator_first
+dns_dbiterator_last
+dns_dbiterator_seek
+dns_dbiterator_prev
+dns_dbiterator_next
+dns_dbiterator_current
+dns_dbiterator_pause
+dns_dbiterator_origin
+dns_dbiterator_setcleanmode
+dns_dbtable_create
+dns_dbtable_attach
+dns_dbtable_detach
+dns_dbtable_add
+dns_dbtable_remove
+dns_dbtable_adddefault
+dns_dbtable_getdefault
+dns_dbtable_removedefault
+dns_dbtable_find
+
+dns_difftuple_create
+dns_difftuple_free
+dns_difftuple_copy
+dns_diff_init
+dns_diff_clear
+dns_diff_append
+dns_diff_appendminimal
+dns_diff_sort
+dns_diff_apply
+dns_diff_load
+dns_diff_print
+dns_dispatchmgr_create
+dns_dispatchmgr_destroy
+dns_dispatchmgr_setblackhole
+dns_dispatchmgr_getblackhole
+dns_dispatch_getudp
+dns_dispatch_createtcp
+dns_dispatch_attach
+dns_dispatch_detach
+dns_dispatch_starttcp
+dns_dispatch_addresponse
+dns_dispatch_removeresponse
+dns_dispatch_getsocket
+dns_dispatch_getlocaladdress
+dns_dispatch_cancel
+dns_dispatch_changeattributes
+dns_dispatch_importrecv
+dns_dnssec_keyfromrdata
+dns_dnssec_sign
+dns_dnssec_verify
+dns_dnssec_findzonekeys
+dns_dnssec_signmessage
+dns_dnssec_verifymessage
+dns_fwdtable_create
+dns_fwdtable_add
+dns_fwdtable_find
+dns_fwdtable_destroy
+dns_db_createsoatuple
+dns_journal_open
+dns_journal_destroy
+dns_journal_begin_transaction
+dns_journal_writediff
+dns_journal_commit
+dns_journal_writediff
+dns_journal_write_transaction
+dns_diff_sort
+dns_journal_writediff
+dns_journal_first_serial
+dns_journal_last_serial
+dns_journal_iter_init
+dns_journal_first_rr
+dns_journal_next_rr
+dns_journal_iter_init
+dns_journal_current_rr
+dns_journal_rollforward
+dns_journal_print
+dns_db_diff
+dns_keyflags_fromtext
+dns_keytable_create
+dns_keytable_attach
+dns_keytable_detach
+dns_keytable_add
+dns_keytable_findkeynode
+dns_keytable_findnextkeynode
+dns_keytable_finddeepestmatch
+dns_keytable_detachkeynode
+dns_keytable_issecuredomain
+dns_keynode_key
+dns_lib_initmsgcat
+dns_log_init
+dns_log_setcontext
+dns_lookup_create
+dns_lookup_cancel
+dns_lookup_destroy
+dns_master_loadfile
+dns_master_loadstream
+dns_master_loadbuffer
+dns_master_loadfileinc
+dns_master_loadstreaminc
+dns_master_loadbufferinc
+dns_loadctx_detach
+dns_loadctx_attach
+dns_loadctx_cancel
+dns_master_dumptostream
+dns_master_dump
+dns_master_rdatasettotext
+dns_master_questiontotext
+dns_rdataset_towire
+dns_master_dumpnodetostream
+dns_master_dumpnode
+dns_message_gettempname
+dns_message_create
+dns_message_reset
+dns_message_destroy
+dns_message_sectiontotext
+dns_message_pseudosectiontotext
+dns_message_totext
+dns_message_parse
+dns_message_firstname
+dns_message_renderbegin
+dns_message_renderend
+dns_message_renderchangebuffer
+dns_message_renderend
+dns_message_renderreserve
+dns_message_renderrelease
+dns_message_rendersection
+dns_message_renderheader
+dns_message_renderend
+dns_message_renderend
+dns_message_renderreset
+dns_message_firstname
+dns_message_nextname
+dns_message_currentname
+dns_message_findname
+dns_message_findtype
+dns_message_movename
+dns_message_addname
+dns_message_gettempname
+dns_message_gettempoffsets
+dns_message_gettemprdata
+dns_message_gettemprdataset
+dns_message_gettemprdatalist
+dns_message_puttempname
+dns_message_puttemprdata
+dns_message_puttemprdataset
+dns_message_puttemprdatalist
+dns_message_peekheader
+dns_message_reply
+dns_message_getopt
+dns_message_setopt
+dns_message_gettsig
+dns_message_settsigkey
+dns_message_gettsigkey
+dns_message_setquerytsig
+dns_message_getquerytsig
+dns_message_getsig0
+dns_message_setsig0key
+dns_message_getsig0key
+dns_message_takebuffer
+dns_message_signer
+dns_message_checksig
+dns_message_getrawmessage
+dns_message_setsortorder
+dns_message_rendersection
+dns_message_settimeadjust
+dns_message_gettimeadjust
+dns_label_type
+dns_label_countbits
+dns_label_getbit
+dns_name_init
+dns_name_reset
+dns_name_invalidate
+dns_name_setbuffer
+dns_name_hasbuffer
+dns_name_isabsolute
+dns_name_iswildcard
+dns_name_requiresedns
+dns_name_hash
+dns_name_fullcompare
+dns_name_compare
+dns_name_equal
+dns_name_rdatacompare
+dns_name_issubdomain
+dns_name_matcheswildcard
+dns_name_depth
+dns_name_countlabels
+dns_name_getlabel
+dns_name_getlabelsequence
+dns_name_clone
+dns_name_fromregion
+dns_name_toregion
+dns_name_fromwire
+dns_name_towire
+dns_name_fromtext
+dns_name_totext
+dns_name_tofilenametext
+dns_name_downcase
+dns_name_concatenate
+dns_name_split
+dns_name_splitatdepth
+dns_name_dup
+dns_name_dupwithoffsets
+dns_name_free
+dns_name_digest
+dns_name_dynamic
+dns_name_print
+dns_name_format
+dns_name_copy
+dns_ncache_add
+dns_ncache_towire
+dns_nxt_buildrdata
+dns_nxt_build
+dns_nxt_typepresent
+dns_soa_getserial
+dns_soa_setserial
+dns_soa_getminimum
+dns_peerlist_new
+dns_peerlist_attach
+dns_peerlist_detach
+dns_peerlist_addpeer
+dns_peerlist_peerbyaddr
+dns_peerlist_currpeer
+dns_peer_new
+dns_peer_attach
+dns_peer_detach
+dns_peer_setbogus
+dns_peer_getbogus
+
+
+dns_peer_setrequestixfr
+dns_peer_getrequestixfr
+dns_peer_setprovideixfr
+dns_peer_getprovideixfr
+dns_peer_setsupportedns
+dns_peer_getsupportedns
+dns_peer_settransfers
+dns_peer_gettransfers
+dns_peer_settransferformat
+dns_peer_gettransferformat
+dns_peer_setkeybycharp
+dns_peer_getkey
+dns_peer_setkey
+dns_name_concatenate
+dns_name_totext
+dns_rbt_create
+dns_rbt_addname
+dns_rbt_addnode
+dns_rbt_findname
+dns_rbt_findnode
+dns_rbt_deletename
+dns_rbt_deletenode
+dns_rbt_namefromnode
+dns_rbt_fullnamefromnode
+dns_rbt_formatnodename
+dns_rbt_nodecount
+dns_rbt_destroy
+dns_rbt_printall
+dns_rbtnodechain_init
+dns_rbtnodechain_reset
+dns_rbtnodechain_invalidate
+dns_rbtnodechain_current
+dns_rbtnodechain_first
+dns_rbtnodechain_last
+dns_rbtnodechain_prev
+dns_rbtnodechain_next
+dns_rcode_fromtext
+dns_rcode_totext
+dns_tsigrcode_fromtext
+dns_tsigrcode_totext
+dns_rdata_init
+dns_rdata_reset
+dns_rdata_clone
+dns_rdata_compare
+dns_rdata_fromregion
+dns_rdata_toregion
+dns_rdata_fromwire
+dns_rdata_towire
+dns_rdata_fromtext
+
+dns_rdata_totext
+dns_rdata_tofmttext
+dns_rdata_fromstruct
+dns_rdata_tostruct
+dns_rdata_freestruct
+dns_rdatatype_ismeta
+dns_rdatatype_issingleton
+dns_rdataclass_ismeta
+dns_rdatatype_isdnssec
+dns_rdatatype_iszonecutauth
+dns_rdatatype_isknown
+dns_rdata_additionaldata
+dns_rdata_digest
+dns_rdatatype_questiononly
+dns_rdatatype_notquestion
+dns_rdatatype_attributes
+dns_rdata_covers
+dns_rdataclass_fromtext
+dns_rdataclass_totext
+dns_rdataclass_format
+dns_rdatalist_init
+dns_rdatalist_tordataset
+dns_rdataset_init
+dns_rdataset_invalidate
+dns_rdataset_disassociate
+dns_rdataset_isassociated
+dns_rdataset_makequestion
+dns_rdataset_clone
+dns_rdataset_count
+dns_rdataset_first
+dns_rdataset_next
+dns_rdataset_current
+dns_rdataset_totext
+dns_rdataset_towire
+dns_rdataset_towiresorted
+dns_rdataset_additionaldata
+dns_rdatasetiter_destroy
+dns_rdatasetiter_first
+dns_rdatasetiter_next
+dns_rdatasetiter_current
+dns_rdataslab_fromrdataset
+dns_rdataslab_size
+dns_rdataslab_merge
+dns_rdataslab_subtract
+dns_rdataslab_equal
+dns_rdatatype_fromtext
+dns_rdatatype_totext
+dns_rdatatype_format
+dns_requestmgr_create
+dns_requestmgr_whenshutdown
+dns_requestmgr_shutdown
+dns_requestmgr_attach
+dns_requestmgr_detach
+dns_request_create
+dns_request_createvia
+dns_request_createraw
+dns_request_cancel
+dns_request_getresponse
+dns_request_usedtcp
+dns_request_destroy
+dns_resolver_createfetch
+dns_resolver_create
+dns_resolver_freeze
+dns_resolver_prime
+dns_resolver_whenshutdown
+dns_resolver_shutdown
+dns_resolver_attach
+dns_resolver_detach
+dns_resolver_createfetch
+dns_resolver_cancelfetch
+dns_resolver_destroyfetch
+dns_resolver_dispatchmgr
+dns_resolver_dispatchv4
+dns_resolver_dispatchv6
+dns_resolver_socketmgr
+dns_resolver_taskmgr
+dns_resolver_getlamettl
+dns_resolver_setlamettl
+dns_result_totext
+dns_result_register
+dns_result_torcode
+dns_rootns_create
+dns_sdb_register
+dns_sdb_unregister
+dns_sdb_putrr
+dns_sdb_putnamedrr
+dns_sdb_putsoa
+dns_secalg_fromtext
+dns_secalg_totext
+dns_secproto_fromtext
+dns_secproto_totext
+dns_ssutable_create
+dns_ssutable_attach
+dns_ssutable_detach
+dns_ssutable_addrule
+dns_ssutable_checkrules
+dns_stats_alloccounters
+dns_stats_freecounters
+dns_tcpmsg_init
+dns_tcpmsg_setmaxsize
+dns_tcpmsg_readmessage
+dns_tcpmsg_cancelread
+dns_tcpmsg_keepbuffer
+dns_tcpmsg_invalidate
+dns_time64_fromtext
+dns_time32_fromtext
+dns_time64_totext
+dns_time32_totext
+dns_timer_setidle
+dns_tkeyctx_create
+dns_tkeyctx_destroy
+dns_tkey_processquery
+dns_tkey_builddhquery
+dns_tkey_buildgssquery
+dns_tkey_builddeletequery
+dns_tkey_processdhresponse
+dns_tkey_processgssresponse
+dns_tkey_processdeleteresponse
+dns_tsigkey_create
+dns_tsigkey_createfromkey
+dns_tsigkey_attach
+dns_tsigkey_detach
+dns_tsigkey_setdeleted
+dns_tsig_sign
+dns_tsig_verify
+dns_tsigkey_find
+dns_tsigkeyring_create
+dns_tsigkeyring_destroy
+dns_ttl_totext
+dns_counter_fromtext
+dns_ttl_fromtext
+dns_validator_create
+dns_validator_cancel
+dns_validator_destroy
+dns_view_create
+dns_view_attach
+dns_view_detach
+dns_view_flushanddetach
+dns_view_weakattach
+dns_view_weakdetach
+dns_view_createresolver
+dns_view_setcache
+dns_view_sethints
+dns_view_setkeyring
+dns_view_setdstport
+dns_view_addzone
+dns_view_freeze
+dns_view_find
+dns_view_simplefind
+dns_view_findzonecut
+dns_viewlist_find
+dns_view_findzone
+dns_view_load
+dns_view_loadnew
+dns_view_gettsig
+dns_view_getpeertsig
+dns_view_checksig
+dns_view_dialup
+dns_view_dumpdbtostream
+dns_view_flushcache
+dns_xfrin_create
+dns_xfrin_shutdown
+dns_xfrin_detach
+dns_xfrin_attach
+dns_zone_create
+dns_zone_setclass
+dns_zone_getclass
+dns_zone_settype
+dns_zone_setview
+dns_zone_getview
+dns_zone_setorigin
+dns_zone_getorigin
+dns_zone_setfile
+dns_zone_getfile
+dns_zone_load
+dns_zone_attach
+dns_zone_detach
+dns_zone_iattach
+dns_zone_idetach
+dns_zone_setflag
+dns_zone_getdb
+dns_zone_setdbtype
+dns_zone_markdirty
+dns_zone_expire
+dns_zone_refresh
+dns_zone_flush
+dns_zone_dump
+dns_zone_dumptostream
+dns_zone_maintenance
+dns_zone_setmasters
+dns_zone_setmasterswithkeys
+dns_zone_setmasters
+dns_zone_setalsonotify
+dns_zone_unload
+dns_zone_setoption
+
+dns_zone_getoptions
+dns_zone_setminrefreshtime
+dns_zone_setmaxrefreshtime
+dns_zone_setminretrytime
+dns_zone_setmaxretrytime
+dns_zone_setxfrsource4
+dns_zone_getxfrsource4
+dns_zone_setxfrsource6
+dns_zone_getxfrsource6
+dns_zone_setnotifysrc4
+dns_zone_getnotifysrc4
+dns_zone_setnotifysrc6
+dns_zone_getnotifysrc6
+dns_zone_setnotifyacl
+dns_zone_setqueryacl
+dns_zone_setupdateacl
+dns_zone_setforwardacl
+dns_zone_setxfracl
+dns_zone_getnotifyacl
+dns_zone_getqueryacl
+dns_zone_getupdateacl
+dns_zone_getforwardacl
+dns_zone_getxfracl
+dns_zone_clearupdateacl
+dns_zone_clearforwardacl
+dns_zone_clearnotifyacl
+dns_zone_clearqueryacl
+dns_zone_clearxfracl
+dns_zone_setchecknames
+dns_zone_getchecknames
+dns_zone_setjournalsize
+dns_zone_getjournalsize
+dns_zone_notifyreceive
+dns_zone_setmaxxfrin
+dns_zone_getmaxxfrin
+dns_zone_setmaxxfrout
+dns_zone_getmaxxfrout
+dns_zone_setjournal
+dns_zone_getjournal
+dns_zone_gettype
+dns_zone_settask
+dns_zone_gettask
+dns_zone_notify
+dns_zone_replacedb
+dns_zone_getidlein
+dns_zone_setidlein
+dns_zone_getidleout
+dns_zone_setidleout
+dns_zone_getssutable
+dns_zone_setssutable
+dns_zone_getmctx
+dns_zone_getmgr
+dns_zone_setsigvalidityinterval
+dns_zone_getsigvalidityinterval
+dns_zone_setnotifytype
+dns_zone_forwardupdate
+dns_zone_next
+dns_zone_first
+dns_zonemgr_create
+dns_zonemgr_managezone
+dns_zonemgr_forcemaint
+dns_zonemgr_shutdown
+dns_zonemgr_attach
+dns_zonemgr_detach
+dns_zonemgr_releasezone
+dns_zonemgr_settransfersin
+dns_zonemgr_getttransfersin
+dns_zonemgr_settransfersperns
+dns_zonemgr_getttransfersperns
+dns_zonemgr_setiolimit
+dns_zonemgr_getiolimit
+dns_zonemgr_setserialqueryrate
+dns_zonemgr_getserialqueryrate
+dns_zonemgr_getcount
+dns_zone_forcereload
+dns_zone_isforced
+dns_zone_setstatistics
+dns_zone_getstatscounters
+dns_zone_dialup
+dns_zone_setdialup
+dns_zone_log
+dns_zonekey_iszonekey
+dns_zt_create
+dns_zt_mount
+dns_zt_unmount
+dns_zt_find
+dns_zt_detach
+dns_zt_flushanddetach
+dns_zt_attach
+dns_zt_load
+dns_zt_apply
+dst_lib_init
+dst_lib_destroy
+dst_algorithm_supported
+dst_context_create
+dst_context_destroy
+dst_context_adddata
+dst_context_sign
+dst_context_verify
+dst_key_computesecret
+dst_key_fromfile
+dst_key_fromnamedfile
+dst_key_tofile
+dst_key_fromdns
+dst_key_todns
+dst_key_frombuffer
+dst_key_tobuffer
+dst_key_fromgssapi
+dst_key_generate
+dst_key_compare
+dst_key_paramcompare
+dst_key_free
+dst_key_name
+dst_key_size
+dst_key_proto
+dst_key_alg
+dst_key_flags
+dst_key_id
+dst_key_class
+dst_key_isprivate
+dst_key_iszonekey
+dst_key_isnullkey
+dst_key_buildfilename
+dst_key_sigsize
+dst_key_secretsize
+dst_region_computeid
+dst_gssapi_acquirecred
+dst_gssapi_initctx
+dst_gssapi_acceptctx
+dst_lib_initmsgcat
+dst_result_totext
+dst_result_register
diff --git a/lib/dns/win32/libdns.dsp b/lib/dns/win32/libdns.dsp
index fd73d687..0c2dd7f5 100644
--- a/lib/dns/win32/libdns.dsp
+++ b/lib/dns/win32/libdns.dsp
@@ -1,398 +1,398 @@
-# Microsoft Developer Studio Project File - Name="libdns" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libdns - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libdns.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libdns.mak" CFG="libdns - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libdns - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libdns - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libdns - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libdns_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../../../openssl-0.9.6e/inc32/openssl/include" /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6e/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /YX /FD /c
-# SUBTRACT CPP /X
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/Release/libisc.lib ../../../../openssl-0.9.6e/out32dll/libeay32.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libdns.dll"
-
-!ELSEIF "$(CFG)" == "libdns - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libdns_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6e/inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /FR /YX /FD /GZ /c
-# SUBTRACT CPP /X
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/debug/libisc.lib ../../../../openssl-0.9.6e/out32dll/libeay32.lib /nologo /dll /map /debug /machine:I386 /out:"../../../Build/Debug/libdns.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "libdns - Win32 Release"
-# Name "libdns - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "Main Dns Lib"
-
-# PROP Default_Filter "c"
-# Begin Source File
-
-SOURCE=..\a6.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\acl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\adb.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\byaddr.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\cache.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\callbacks.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\compress.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\db.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\dbiterator.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\dbtable.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\diff.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\dispatch.c
-
-!IF "$(CFG)" == "libdns - Win32 Release"
-
-!ELSEIF "$(CFG)" == "libdns - Win32 Debug"
-
-# ADD CPP /I "../sec/dst/include"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\DLLMain.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\dnssec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\forward.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\journal.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\keytable.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\log.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lookup.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\master.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\masterdump.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\message.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\name.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ncache.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\nxt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\peer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rbt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rbtdb.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rbtdb64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rdata.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rdatalist.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rdataset.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rdatasetiter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rdataslab.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\request.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\resolver.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\result.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rootns.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sdb.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\soa.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ssu.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\stats.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\tcpmsg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\timer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\tkey.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\tsig.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ttl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\validator.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\version.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\view.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\xfrin.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\zone.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\zonekey.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\zt.c
-# End Source File
-# End Group
-# Begin Group "dst"
-
-# PROP Default_Filter "c"
-# Begin Source File
-
-SOURCE=..\sec\dst\dst_api.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\dst_lib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\dst_parse.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\dst_result.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\gssapi_link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\gssapictx.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\hmac_link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\key.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\openssl_link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\openssldh_link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\openssldsa_link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sec\dst\opensslrsa_link.c
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\libdns.def
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="libdns" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libdns - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libdns.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libdns.mak" CFG="libdns - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libdns - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libdns - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libdns - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libdns_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../../../openssl-0.9.6f/inc32/openssl/include" /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6f/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /YX /FD /c
+# SUBTRACT CPP /X
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/Release/libisc.lib ../../../../openssl-0.9.6f/out32dll/libeay32.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libdns.dll"
+
+!ELSEIF "$(CFG)" == "libdns - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libdns_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6f/inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /FR /YX /FD /GZ /c
+# SUBTRACT CPP /X
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/debug/libisc.lib ../../../../openssl-0.9.6f/out32dll/libeay32.lib /nologo /dll /map /debug /machine:I386 /out:"../../../Build/Debug/libdns.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "libdns - Win32 Release"
+# Name "libdns - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Main Dns Lib"
+
+# PROP Default_Filter "c"
+# Begin Source File
+
+SOURCE=..\a6.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\acl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\adb.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\byaddr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\cache.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\callbacks.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\compress.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\db.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\dbiterator.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\dbtable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\diff.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\dispatch.c
+
+!IF "$(CFG)" == "libdns - Win32 Release"
+
+!ELSEIF "$(CFG)" == "libdns - Win32 Debug"
+
+# ADD CPP /I "../sec/dst/include"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\DLLMain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\dnssec.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\forward.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\journal.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\keytable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\log.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lookup.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\master.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\masterdump.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\message.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\name.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ncache.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\nxt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\peer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rbt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rbtdb.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rbtdb64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rdata.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rdatalist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rdataset.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rdatasetiter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rdataslab.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\request.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\resolver.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\result.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rootns.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sdb.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\soa.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ssu.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\stats.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\tcpmsg.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\time.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\timer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\tkey.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\tsig.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ttl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\validator.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\version.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\view.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\xfrin.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\zone.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\zonekey.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\zt.c
+# End Source File
+# End Group
+# Begin Group "dst"
+
+# PROP Default_Filter "c"
+# Begin Source File
+
+SOURCE=..\sec\dst\dst_api.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\dst_lib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\dst_parse.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\dst_result.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\gssapi_link.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\gssapictx.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\hmac_link.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\key.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\openssl_link.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\openssldh_link.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\openssldsa_link.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sec\dst\opensslrsa_link.c
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\libdns.def
+# End Source File
+# End Target
+# End Project
diff --git a/lib/dns/win32/libdns.dsw b/lib/dns/win32/libdns.dsw
index c1685a0e..424a2cbb 100644
--- a/lib/dns/win32/libdns.dsw
+++ b/lib/dns/win32/libdns.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "libdns"=".\libdns.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libdns"=".\libdns.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/lib/dns/win32/libdns.mak b/lib/dns/win32/libdns.mak
index 35592a01..28febeed 100644
--- a/lib/dns/win32/libdns.mak
+++ b/lib/dns/win32/libdns.mak
@@ -111,7 +111,7 @@ CLEAN :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "../../../../../openssl-0.9.6e/inc32/openssl/include" /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6e/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /Fp"$(INTDIR)\libdns.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "../../../../../openssl-0.9.6f/inc32/openssl/include" /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6f/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /Fp"$(INTDIR)\libdns.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
@@ -151,7 +151,7 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libdns.bsc"
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=user32.lib advapi32.lib ws2_32.lib ../../isc/win32/Release/libisc.lib ../../../../openssl-0.9.6e/out32dll/libeay32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\libdns.pdb" /machine:I386 /def:".\libdns.def" /out:"../../../Build/Release/libdns.dll" /implib:"$(OUTDIR)\libdns.lib"
+LINK32_FLAGS=user32.lib advapi32.lib ws2_32.lib ../../isc/win32/Release/libisc.lib ../../../../openssl-0.9.6f/out32dll/libeay32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\libdns.pdb" /machine:I386 /def:".\libdns.def" /out:"../../../Build/Release/libdns.dll" /implib:"$(OUTDIR)\libdns.lib"
DEF_FILE= \
".\libdns.def"
LINK32_OBJS= \
@@ -391,7 +391,7 @@ CLEAN :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6e/inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\libdns.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6f/inc32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\libdns.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
@@ -504,7 +504,7 @@ BSC32_SBRS= \
<<
LINK32=link.exe
-LINK32_FLAGS=user32.lib advapi32.lib ws2_32.lib ../../isc/win32/debug/libisc.lib ../../../../openssl-0.9.6e/out32dll/libeay32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\libdns.pdb" /map:"$(INTDIR)\libdns.map" /debug /machine:I386 /def:".\libdns.def" /out:"../../../Build/Debug/libdns.dll" /implib:"$(OUTDIR)\libdns.lib" /pdbtype:sept
+LINK32_FLAGS=user32.lib advapi32.lib ws2_32.lib ../../isc/win32/debug/libisc.lib ../../../../openssl-0.9.6f/out32dll/libeay32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\libdns.pdb" /map:"$(INTDIR)\libdns.map" /debug /machine:I386 /def:".\libdns.def" /out:"../../../Build/Debug/libdns.dll" /implib:"$(OUTDIR)\libdns.lib" /pdbtype:sept
DEF_FILE= \
".\libdns.def"
LINK32_OBJS= \
@@ -797,7 +797,7 @@ SOURCE=..\dispatch.c
!IF "$(CFG)" == "libdns - Win32 Release"
-CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /I "../../../../../openssl-0.9.6e/inc32/openssl/include" /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6e/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /Fp"$(INTDIR)\libdns.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /I "../../../../../openssl-0.9.6f/inc32/openssl/include" /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6f/inc32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /Fp"$(INTDIR)\libdns.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
"$(INTDIR)\dispatch.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
@@ -807,7 +807,7 @@ CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /I "../../../../../openssl-0.9.6e/inc32/ope
!ELSEIF "$(CFG)" == "libdns - Win32 Debug"
-CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6e/inc32" /I "../sec/dst/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\libdns.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
+CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../isc/win32" /I "../../isc/win32/include" /I "../../isc/include" /I "../../dns/sec/dst/include" /I "../../../../openssl-0.9.6f/inc32" /I "../sec/dst/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBDNS_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\libdns.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
"$(INTDIR)\dispatch.obj" "$(INTDIR)\dispatch.sbr" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c
index d1ca5617..5a1e4bcc 100644
--- a/lib/dns/xfrin.c
+++ b/lib/dns/xfrin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: xfrin.c,v 1.124.2.2 2001/09/12 20:44:04 gson Exp $ */
+/* $Id: xfrin.c,v 1.124.2.4 2003/07/22 04:03:45 marka Exp $ */
#include <config.h>
@@ -1166,11 +1166,6 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) {
name = NULL;
dns_message_currentname(msg, DNS_SECTION_ANSWER, &name);
- if (!dns_name_issubdomain(name, &xfr->name)) {
- xfrin_log(xfr, ISC_LOG_WARNING,
- "ignoring out-of-zone data");
- continue;
- }
for (rds = ISC_LIST_HEAD(name->list);
rds != NULL;
rds = ISC_LIST_NEXT(rds, link))
diff --git a/lib/dns/zone.c b/lib/dns/zone.c
index cfa85852..74ce9ff1 100644
--- a/lib/dns/zone.c
+++ b/lib/dns/zone.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.333.2.13.4.2 2003/02/17 07:05:08 marka Exp $ */
+/* $Id: zone.c,v 1.333.2.23 2003/07/28 07:03:15 marka Exp $ */
#include <config.h>
@@ -409,7 +409,7 @@ static isc_result_t zone_dump(dns_zone_t *);
static void got_transfer_quota(isc_task_t *task, isc_event_t *event);
static isc_result_t zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr,
dns_zone_t *zone);
-static void zmgr_resume_xfrs(dns_zonemgr_t *zmgr);
+static void zmgr_resume_xfrs(dns_zonemgr_t *zmgr, isc_boolean_t multi);
static void zonemgr_free(dns_zonemgr_t *zmgr);
static isc_result_t zonemgr_getio(dns_zonemgr_t *zmgr, isc_boolean_t high,
isc_task_t *task, isc_taskaction_t action,
@@ -950,6 +950,24 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
goto cleanup;
}
}
+ }
+
+ INSIST(zone->db_argc >= 1);
+
+ if ((zone->type == dns_zone_slave || zone->type == dns_zone_stub) &&
+ (strcmp(zone->db_argv[0], "rbt") == 0 ||
+ strcmp(zone->db_argv[0], "rbt64") == 0)) {
+ if (zone->masterfile == NULL ||
+ !isc_file_exists(zone->masterfile)) {
+ if (zone->masterfile != NULL)
+ dns_zone_log(zone, ISC_LOG_DEBUG(1),
+ "no master file");
+ zone->refreshtime = now;
+ if (zone->task != NULL)
+ zone_settimer(zone, &now);
+ result = ISC_R_SUCCESS;
+ goto cleanup;
+ }
}
dns_zone_log(zone, ISC_LOG_DEBUG(1), "starting load");
@@ -964,7 +982,6 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
if (result != ISC_R_SUCCESS)
goto cleanup;
- INSIST(zone->db_argc >= 1);
result = dns_db_create(zone->mctx, zone->db_argv[0],
&zone->origin, (zone->type == dns_zone_stub) ?
dns_dbtype_stub : dns_dbtype_zone,
@@ -1024,6 +1041,7 @@ static void
zone_gotreadhandle(isc_task_t *task, isc_event_t *event) {
dns_load_t *load = event->ev_arg;
isc_result_t result = ISC_R_SUCCESS;
+ unsigned int options;
REQUIRE(DNS_LOAD_VALID(load));
@@ -1033,11 +1051,14 @@ zone_gotreadhandle(isc_task_t *task, isc_event_t *event) {
if (result == ISC_R_CANCELED)
goto fail;
+ options = DNS_MASTER_ZONE;
+ if (load->zone->type == dns_zone_slave)
+ options |= DNS_MASTER_SLAVE;
result = dns_master_loadfileinc(load->zone->masterfile,
dns_db_origin(load->db),
dns_db_origin(load->db),
load->zone->rdclass,
- DNS_MASTER_ZONE,
+ options,
&load->callbacks, task,
zone_loaddone, load,
&load->zone->lctx, load->zone->mctx);
@@ -1055,7 +1076,13 @@ zone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) {
dns_load_t *load;
isc_result_t result;
isc_result_t tresult;
+ unsigned int options;
+ options = DNS_MASTER_ZONE;
+ if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_MANYERRORS))
+ options |= DNS_MASTER_MANYERRORS;
+ if (zone->type == dns_zone_slave)
+ options |= DNS_MASTER_SLAVE;
if (zone->zmgr != NULL && zone->db != NULL && zone->task != NULL) {
load = isc_mem_get(zone->mctx, sizeof(*load));
if (load == NULL)
@@ -1088,14 +1115,12 @@ zone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) {
result = DNS_R_CONTINUE;
} else if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_MANYERRORS)) {
dns_rdatacallbacks_t callbacks;
- unsigned int options;
dns_rdatacallbacks_init(&callbacks);
result = dns_db_beginload(db, &callbacks.add,
&callbacks.add_private);
if (result != ISC_R_SUCCESS)
return (result);
- options = DNS_MASTER_MANYERRORS|DNS_MASTER_ZONE;
result = dns_master_loadfile(zone->masterfile, &zone->origin,
&zone->origin, zone->rdclass,
options, &callbacks, zone->mctx);
@@ -1318,6 +1343,8 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
/* Mark the zone for immediate refresh. */
zone->refreshtime = now;
+ if (zone->task != NULL)
+ zone_settimer(zone, &now);
result = ISC_R_SUCCESS;
}
return (result);
@@ -3477,7 +3504,24 @@ soa_query(isc_task_t *task, isc_event_t *event) {
zone->masteraddr = zone->masters[zone->curmaster];
isc_netaddr_fromsockaddr(&masterip, &zone->masteraddr);
- (void)dns_view_getpeertsig(zone->view, &masterip, &key);
+ /*
+ * First, look for a tsig key in the master statement, then
+ * try for a server key.
+ */
+ if ((zone->masterkeynames != NULL) &&
+ (zone->masterkeynames[zone->curmaster] != NULL)) {
+ dns_view_t *view = dns_zone_getview(zone);
+ dns_name_t *keyname = zone->masterkeynames[zone->curmaster];
+ result = dns_view_gettsig(view, keyname, &key);
+ if (result != ISC_R_SUCCESS) {
+ char namebuf[DNS_NAME_FORMATSIZE];
+ dns_name_format(keyname, namebuf, sizeof(namebuf));
+ dns_zone_log(zone, ISC_LOG_ERROR,
+ "unable to find key: %s", namebuf);
+ }
+ }
+ if (key == NULL)
+ (void)dns_view_getpeertsig(zone->view, &masterip, &key);
options = DNS_ZONE_FLAG(zone, DNS_ZONEFLG_USEVC) ?
DNS_REQUESTOPT_TCP : 0;
@@ -3618,7 +3662,24 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
zone->masteraddr = zone->masters[zone->curmaster];
isc_netaddr_fromsockaddr(&masterip, &zone->masteraddr);
- (void)dns_view_getpeertsig(zone->view, &masterip, &key);
+ /*
+ * First, look for a tsig key in the master statement, then
+ * try for a server key.
+ */
+ if ((zone->masterkeynames != NULL) &&
+ (zone->masterkeynames[zone->curmaster] != NULL)) {
+ dns_view_t *view = dns_zone_getview(zone);
+ dns_name_t *keyname = zone->masterkeynames[zone->curmaster];
+ result = dns_view_gettsig(view, keyname, &key);
+ if (result != ISC_R_SUCCESS) {
+ char namebuf[DNS_NAME_FORMATSIZE];
+ dns_name_format(keyname, namebuf, sizeof(namebuf));
+ dns_zone_log(zone, ISC_LOG_ERROR,
+ "unable to find key: %s", namebuf);
+ }
+ }
+ if (key == NULL)
+ (void)dns_view_getpeertsig(zone->view, &masterip, &key);
/*
* Always use TCP so that we shouldn't truncate in additional section.
@@ -3667,6 +3728,8 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
if (message != NULL)
dns_message_destroy(&message);
unlock:
+ if (key != NULL)
+ dns_tsigkey_detach(&key);
UNLOCK_ZONE(zone);
return;
}
@@ -3678,7 +3741,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
static void
zone_shutdown(isc_task_t *task, isc_event_t *event) {
dns_zone_t *zone = (dns_zone_t *) event->ev_arg;
- isc_boolean_t free_needed;
+ isc_boolean_t free_needed, linked = ISC_FALSE;
UNUSED(task);
REQUIRE(DNS_ZONE_VALID(zone));
@@ -3704,6 +3767,7 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) {
if (zone->statelist == &zone->zmgr->waiting_for_xfrin) {
ISC_LIST_UNLINK(zone->zmgr->waiting_for_xfrin, zone,
statelink);
+ linked = ISC_TRUE;
zone->statelist = NULL;
}
RWUNLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write);
@@ -3716,6 +3780,10 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) {
dns_xfrin_shutdown(zone->xfr);
LOCK_ZONE(zone);
+ if (linked) {
+ INSIST(zone->irefs > 0);
+ zone->irefs--;
+ }
if (zone->request != NULL) {
dns_request_cancel(zone->request);
}
@@ -4339,7 +4407,7 @@ zone_tostr(dns_zone_t *zone, char *buf, size_t length) {
isc_buffer_t buffer;
REQUIRE(buf != NULL);
- REQUIRE(length > 1);
+ REQUIRE(length > 1U);
/*
* Leave space for terminating '\0'.
@@ -4689,6 +4757,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
unsigned int nscount;
isc_uint32_t serial, refresh, retry, expire, minimum;
isc_result_t xfrresult = result;
+ isc_boolean_t free_needed;
REQUIRE(DNS_ZONE_VALID(zone));
@@ -4820,8 +4889,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
RWLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write);
ISC_LIST_UNLINK(zone->zmgr->xfrin_in_progress, zone, statelink);
zone->statelist = NULL;
- if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
- zmgr_resume_xfrs(zone->zmgr);
+ zmgr_resume_xfrs(zone->zmgr, ISC_FALSE);
RWUNLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write);
/*
@@ -4829,7 +4897,13 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
*/
if (again && !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING))
queue_soa_query(zone);
+
+ INSIST(zone->irefs > 0);
+ zone->irefs--;
+ free_needed = exit_check(zone);
UNLOCK_ZONE(zone);
+ if (free_needed)
+ zone_free(zone);
}
static void
@@ -4913,6 +4987,9 @@ queue_xfrin(dns_zone_t *zone) {
RWLOCK(&zmgr->rwlock, isc_rwlocktype_write);
ISC_LIST_APPEND(zmgr->waiting_for_xfrin, zone, statelink);
+ LOCK_ZONE(zone);
+ zone->irefs++;
+ UNLOCK_ZONE(zone);
zone->statelist = &zmgr->waiting_for_xfrin;
result = zmgr_start_xfrin_ifquota(zmgr, zone);
RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write);
@@ -5043,9 +5120,6 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) {
dns_tsigkey_detach(&tsigkey);
isc_event_free(&event);
-
- dns_zone_detach(&zone); /* XXXAG */
- return;
}
/*
@@ -5494,6 +5568,7 @@ dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr) {
{
dns_zone_maintenance(p);
}
+ RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_read);
/*
* Recent configuration changes may have increased the
@@ -5501,9 +5576,9 @@ dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr) {
* transfers currently blocked on quota get started if
* possible.
*/
- zmgr_resume_xfrs(zmgr);
-
- RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_read);
+ RWLOCK(&zmgr->rwlock, isc_rwlocktype_write);
+ zmgr_resume_xfrs(zmgr, ISC_TRUE);
+ RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write);
return (ISC_R_SUCCESS);
}
@@ -5573,16 +5648,20 @@ dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr) {
* The zone manager is locked by the caller.
*/
static void
-zmgr_resume_xfrs(dns_zonemgr_t *zmgr) {
+zmgr_resume_xfrs(dns_zonemgr_t *zmgr, isc_boolean_t multi) {
dns_zone_t *zone;
+ dns_zone_t *next;
for (zone = ISC_LIST_HEAD(zmgr->waiting_for_xfrin);
zone != NULL;
- zone = ISC_LIST_NEXT(zone, statelink))
+ zone = next)
{
isc_result_t result;
+ next = ISC_LIST_NEXT(zone, statelink);
result = zmgr_start_xfrin_ifquota(zmgr, zone);
if (result == ISC_R_SUCCESS) {
+ if (multi)
+ continue;
/*
* We successfully filled the slot. We're done.
*/
@@ -5590,7 +5669,7 @@ zmgr_resume_xfrs(dns_zonemgr_t *zmgr) {
} else if (result == ISC_R_QUOTA) {
/*
* Not enough quota. This is probably the per-server
- * quota, because we only get called when a unit of
+ * quota, because we usually get called when a unit of
* global quota has just been freed. Try the next
* zone, it may succeed if it uses another master.
*/
@@ -5686,14 +5765,6 @@ zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr, dns_zone_t *zone) {
ISC_LIST_UNLINK(zmgr->waiting_for_xfrin, zone, statelink);
ISC_LIST_APPEND(zmgr->xfrin_in_progress, zone, statelink);
zone->statelist = &zmgr->xfrin_in_progress;
- /*
- * Make sure the zone does not go away before it has processed
- * the event; in effect, the event is attached to the zone.
- *
- * XXXAG This should be done as soon as the zone goes on the
- * queue, using irefs.
- */
- isc_refcount_increment(&zone->erefs, NULL);
isc_task_send(zone->task, &e);
UNLOCK_ZONE(zone);
@@ -5895,7 +5966,7 @@ dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value) {
s = 1;
ns = 0;
pertic = 1;
- } else if (value < 10) {
+ } else if (value <= 10) {
s = 0;
ns = 1000000000 / value;
pertic = 1;
diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in
index 40a2ee6e..2345ff48 100644
--- a/lib/isc/Makefile.in
+++ b/lib/isc/Makefile.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: Makefile.in,v 1.71.2.1 2001/10/22 23:28:13 gson Exp $
+# $Id: Makefile.in,v 1.71.2.2 2003/07/25 03:31:44 marka Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -52,7 +52,7 @@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \
OBJS = @ISC_EXTRA_OBJS@ \
assertions.@O@ base64.@O@ bitstring.@O@ buffer.@O@ \
bufferlist.@O@ commandline.@O@ error.@O@ event.@O@ \
- heap.@O@ hex.@O@ hmacmd5.@O@ \
+ hash.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ \
lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \
md5.@O@ mem.@O@ mutexblock.@O@ netaddr.@O@ ondestroy.@O@ \
quota.@O@ random.@O@ \
diff --git a/lib/isc/api b/lib/isc/api
index ca855cad..9886607d 100644
--- a/lib/isc/api
+++ b/lib/isc/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 6
+LIBINTERFACE = 7
LIBREVISION = 0
-LIBAGE = 2
+LIBAGE = 0
diff --git a/lib/isc/base64.c b/lib/isc/base64.c
index 183e822f..278c2f06 100644
--- a/lib/isc/base64.c
+++ b/lib/isc/base64.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: base64.c,v 1.23 2001/03/22 00:07:04 bwelling Exp $ */
+/* $Id: base64.c,v 1.23.2.2 2003/07/22 04:03:47 marka Exp $ */
#include <config.h>
@@ -126,6 +126,17 @@ base64_decode_char(base64_decode_ctx_t *ctx, int c) {
return (ISC_R_BADBASE64);
if (ctx->val[2] == 64 && ctx->val[3] != 64)
return (ISC_R_BADBASE64);
+ /*
+ * Check that bits that should be zero are.
+ */
+ if (ctx->val[2] == 64 && (ctx->val[1] & 0xf) != 0)
+ return (ISC_R_BADBASE64);
+ /*
+ * We don't need to test for ctx->val[2] != 64 as
+ * the bottom two bits of 64 are zero.
+ */
+ if (ctx->val[3] == 64 && (ctx->val[2] & 0x3) != 0)
+ return (ISC_R_BADBASE64);
n = (ctx->val[2] == 64) ? 1 :
(ctx->val[3] == 64) ? 2 : 3;
if (n != 3) {
diff --git a/lib/isc/entropy.c b/lib/isc/entropy.c
index d046e3e7..3f9ec233 100644
--- a/lib/isc/entropy.c
+++ b/lib/isc/entropy.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: entropy.c,v 1.3.2.1 2001/09/06 00:14:17 gson Exp $ */
+/* $Id: entropy.c,v 1.3.2.2 2003/07/23 06:57:53 marka Exp $ */
/*
* This is the system independent part of the entropy module. It is
@@ -303,7 +303,7 @@ entropypool_adddata(isc_entropy_t *ent, void *p, unsigned int len,
addr = (unsigned long)p;
buf = p;
- if ((addr & 0x03) != 0) {
+ if ((addr & 0x03U) != 0U) {
val = 0;
switch (len) {
case 3:
diff --git a/lib/isc/hash.c b/lib/isc/hash.c
new file mode 100644
index 00000000..87bd804e
--- /dev/null
+++ b/lib/isc/hash.c
@@ -0,0 +1,387 @@
+/*
+ * Copyright (C) 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: hash.c,v 1.2.2.4 2003/07/30 01:15:18 marka Exp $ */
+
+/*
+ * Some portion of this code was derived from universal hash function
+ * libraries of Rice University.
+ */
+
+/* "UH Universal Hashing Library"
+
+Copyright ((c)) 2002, Rice University
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Rice University (RICE) nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+
+This software is provided by RICE and the contributors on an "as is"
+basis, without any representations or warranties of any kind, express
+or implied including, but not limited to, representations or
+warranties of non-infringement, merchantability or fitness for a
+particular purpose. In no event shall RICE or contributors be liable
+for any direct, indirect, incidental, special, exemplary, or
+consequential damages (including, but not limited to, procurement of
+substitute goods or services; loss of use, data, or profits; or
+business interruption) however caused and on any theory of liability,
+whether in contract, strict liability, or tort (including negligence
+or otherwise) arising in any way out of the use of this software, even
+if advised of the possibility of such damage.
+*/
+
+#include <config.h>
+
+#include <isc/entropy.h>
+#include <isc/hash.h>
+#include <isc/mem.h>
+#include <isc/magic.h>
+#include <isc/mutex.h>
+#include <isc/once.h>
+#include <isc/random.h>
+#include <isc/refcount.h>
+#include <isc/rwlock.h>
+#include <isc/string.h>
+#include <isc/util.h>
+
+#define HASH_MAGIC ISC_MAGIC('H', 'a', 's', 'h')
+#define VALID_HASH(h) ISC_MAGIC_VALID((h), HASH_MAGIC)
+
+/*
+ * A large 32-bit prime number that specifies the range of the hash output.
+ */
+#define PRIME32 0xFFFFFFFB /* 2^32 - 5 */
+
+/*
+ * Types of random seed and hash accumulator. Perhaps they can be system
+ * dependent.
+ */
+typedef isc_uint32_t hash_accum_t;
+typedef isc_uint16_t hash_random_t;
+
+struct isc_hash {
+ unsigned int magic;
+ isc_mem_t *mctx;
+ isc_mutex_t lock;
+ isc_boolean_t initialized;
+ isc_refcount_t refcnt;
+ isc_entropy_t *entropy; /* entropy source */
+ unsigned int limit; /* upper limit of key length */
+ size_t vectorlen; /* size of the vector below */
+ hash_random_t *rndvector; /* random vector for universal hashing */
+};
+
+static isc_rwlock_t createlock;
+static isc_once_t once = ISC_ONCE_INIT;
+static isc_hash_t *hash = NULL;
+
+static unsigned char maptolower[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
+};
+
+isc_result_t
+isc_hash_ctxcreate(isc_mem_t *mctx, isc_entropy_t *entropy,
+ unsigned int limit, isc_hash_t **hctxp)
+{
+ isc_result_t ret;
+ isc_hash_t *hctx;
+ size_t vlen;
+ hash_random_t *rv;
+ hash_accum_t overflow_limit;
+
+ REQUIRE(mctx != NULL);
+ REQUIRE(hctxp != NULL && *hctxp == NULL);
+
+ /*
+ * Overflow check. Since our implementation only does a modulo
+ * operation at the last stage of hash calculation, the accumulator
+ * must not overflow.
+ */
+ overflow_limit =
+ 1 << (((sizeof(hash_accum_t) - sizeof(hash_random_t))) * 8);
+ if (overflow_limit < (limit + 1) * 0xff)
+ return (ISC_R_RANGE);
+
+ hctx = isc_mem_get(mctx, sizeof(isc_hash_t));
+ if (hctx == NULL)
+ return (ISC_R_NOMEMORY);
+
+ vlen = sizeof(hash_random_t) * (limit + 1);
+ rv = isc_mem_get(mctx, vlen);
+ if (rv == NULL) {
+ ret = ISC_R_NOMEMORY;
+ goto errout;
+ }
+
+ /*
+ * We need a lock.
+ */
+ if (isc_mutex_init(&hctx->lock) != ISC_R_SUCCESS) {
+ ret = ISC_R_UNEXPECTED;
+ goto errout;
+ }
+
+ /*
+ * From here down, no failures will/can occur.
+ */
+ hctx->magic = HASH_MAGIC;
+ hctx->mctx = NULL;
+ isc_mem_attach(mctx, &hctx->mctx);
+ hctx->initialized = ISC_FALSE;
+ isc_refcount_init(&hctx->refcnt, 1);
+ hctx->entropy = NULL;
+ hctx->limit = limit;
+ hctx->vectorlen = vlen;
+ hctx->rndvector = rv;
+
+ if (entropy != NULL)
+ isc_entropy_attach(entropy, &hctx->entropy);
+
+ *hctxp = hctx;
+ return (ISC_R_SUCCESS);
+
+ errout:
+ isc_mem_put(mctx, hctx, sizeof(isc_hash_t));
+ if (rv != NULL)
+ isc_mem_put(mctx, rv, vlen);
+
+ return (ret);
+}
+
+static void
+initialize_lock(void) {
+ RUNTIME_CHECK(isc_rwlock_init(&createlock, 0, 0) == ISC_R_SUCCESS);
+}
+
+isc_result_t
+isc_hash_create(isc_mem_t *mctx, isc_entropy_t *entropy, size_t limit) {
+ isc_result_t result = ISC_R_SUCCESS;
+
+ REQUIRE(mctx != NULL);
+ INSIST(hash == NULL);
+
+ RUNTIME_CHECK(isc_once_do(&once, initialize_lock) == ISC_R_SUCCESS);
+
+ RWLOCK(&createlock, isc_rwlocktype_write);
+
+ if (hash == NULL)
+ result = isc_hash_ctxcreate(mctx, entropy, limit, &hash);
+
+ RWUNLOCK(&createlock, isc_rwlocktype_write);
+
+ return (result);
+}
+
+void
+isc_hash_ctxinit(isc_hash_t *hctx) {
+ isc_result_t result;
+
+ LOCK(&hctx->lock);
+
+ if (hctx->initialized == ISC_TRUE)
+ goto out;
+
+ if (hctx->entropy) {
+ result = isc_entropy_getdata(hctx->entropy,
+ hctx->rndvector, hctx->vectorlen,
+ NULL, 0);
+ INSIST(result == ISC_R_SUCCESS);
+ } else {
+ isc_uint32_t pr;
+ unsigned int i, copylen;
+ unsigned char *p;
+
+ p = (unsigned char *)hctx->rndvector;
+ for (i = 0; i < hctx->vectorlen; i += copylen, p += copylen) {
+ isc_random_get(&pr);
+ if (i + sizeof(pr) <= hctx->vectorlen)
+ copylen = sizeof(pr);
+ else
+ copylen = hctx->vectorlen - i;
+
+ memcpy(p, &pr, copylen);
+ }
+ INSIST(p == (unsigned char *)hctx->rndvector +
+ hctx->vectorlen);
+ }
+
+ hctx->initialized = ISC_TRUE;
+
+ out:
+ UNLOCK(&hctx->lock);
+}
+
+void
+isc_hash_init() {
+ INSIST(hash != NULL && VALID_HASH(hash));
+
+ isc_hash_ctxinit(hash);
+}
+
+void
+isc_hash_ctxattach(isc_hash_t *hctx, isc_hash_t **hctxp) {
+ REQUIRE(VALID_HASH(hctx));
+ REQUIRE(hctxp != NULL && *hctxp == NULL);
+
+ isc_refcount_increment(&hctx->refcnt, NULL);
+ *hctxp = hctx;
+}
+
+static void
+destroy(isc_hash_t **hctxp) {
+ isc_hash_t *hctx;
+ isc_mem_t *mctx;
+
+ REQUIRE(hctxp != NULL && *hctxp != NULL);
+ hctx = *hctxp;
+ *hctxp = NULL;
+
+ LOCK(&hctx->lock);
+
+ isc_refcount_destroy(&hctx->refcnt);
+
+ mctx = hctx->mctx;
+ if (hctx->entropy != NULL)
+ isc_entropy_detach(&hctx->entropy);
+ if (hctx->rndvector != NULL)
+ isc_mem_put(mctx, hctx->rndvector, hctx->vectorlen);
+
+ UNLOCK(&hctx->lock);
+
+ DESTROYLOCK(&hctx->lock);
+
+ memset(hctx, 0, sizeof(isc_hash_t));
+ isc_mem_put(mctx, hctx, sizeof(isc_hash_t));
+ isc_mem_detach(&mctx);
+}
+
+void
+isc_hash_ctxdetach(isc_hash_t **hctxp) {
+ isc_hash_t *hctx;
+ unsigned int refs;
+
+ REQUIRE(hctxp != NULL && VALID_HASH(*hctxp));
+ hctx = *hctxp;
+
+ isc_refcount_decrement(&hctx->refcnt, &refs);
+ if (refs == 0)
+ destroy(&hctx);
+
+ *hctxp = NULL;
+}
+
+void
+isc_hash_destroy() {
+ unsigned int refs;
+
+ INSIST(hash != NULL && VALID_HASH(hash));
+
+ isc_refcount_decrement(&hash->refcnt, &refs);
+ INSIST(refs == 0);
+
+ destroy(&hash);
+}
+
+static inline unsigned int
+hash_calc(isc_hash_t *hctx, const unsigned char *key, unsigned int keylen,
+ isc_boolean_t case_sensitive)
+{
+ hash_accum_t partial_sum = 0;
+ hash_random_t *p = hctx->rndvector;
+ unsigned int i = 0;
+
+ /* Make it sure that the hash context is initialized. */
+ if (hctx->initialized == ISC_FALSE)
+ isc_hash_ctxinit(hctx);
+
+ if (case_sensitive) {
+ for (i = 0; i < keylen; i++)
+ partial_sum += key[i] * (hash_accum_t)p[i];
+ } else {
+ for (i = 0; i < keylen; i++)
+ partial_sum += maptolower[key[i]] * (hash_accum_t)p[i];
+ }
+
+ partial_sum += p[i];
+
+ return ((unsigned int)(partial_sum % PRIME32));
+}
+
+unsigned int
+isc_hash_ctxcalc(isc_hash_t *hctx, const unsigned char *key,
+ unsigned int keylen, isc_boolean_t case_sensitive)
+{
+ REQUIRE(hctx != NULL && VALID_HASH(hctx));
+ REQUIRE(keylen <= hctx->limit);
+
+ return (hash_calc(hctx, key, keylen, case_sensitive));
+}
+
+unsigned int
+isc_hash_calc(const unsigned char *key, unsigned int keylen,
+ isc_boolean_t case_sensitive)
+{
+ INSIST(hash != NULL && VALID_HASH(hash));
+ REQUIRE(keylen <= hash->limit);
+
+ return (hash_calc(hash, key, keylen, case_sensitive));
+}
diff --git a/lib/isc/include/isc/hash.h b/lib/isc/include/isc/hash.h
new file mode 100644
index 00000000..43080df3
--- /dev/null
+++ b/lib/isc/include/isc/hash.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: hash.h,v 1.2.2.1 2003/07/25 07:30:43 marka Exp $ */
+
+#ifndef ISC_HASH_H
+#define ISC_HASH_H 1
+
+/*****
+ ***** Module Info
+ *****/
+
+/*
+ * Hash
+ *
+ * The hash API
+ *
+ * Provides an unpredictable hash value for variable length data.
+ * A hash object contains a random vector (which is hidden from clients
+ * of this API) to make the actual hash value unpredictable.
+ *
+ * The algorithm used in the API guarantees the probability of hash
+ * collision; in the current implementation, as long as the values stored
+ * in the random vector are unpredictable, the probability of hash
+ * collision between arbitrary two different values is at most 1/2^16.
+ *
+ * Altough the API is generic about the hash keys, it mainly expects
+ * DNS names (and sometimes IPv4/v6 addresses) as inputs. It has an
+ * upper limit of the input length, and may run slow to calculaate the
+ * has values for large inputs.
+ *
+ * This API is designed to be general so that it can provide multiple
+ * different hash contexts that have different random vectors. However,
+ * it should be typical to have a single context for an entire system.
+ * To support such cases, the API also provides a single-context mode.
+ *
+ * MP:
+ * The hash object is almost read-only. Once the internal random vector
+ * is initialized, no write operation will occur, and there will be no
+ * need to lock the object to calculate actual hash values.
+ *
+ * Reliability:
+ * In some cases this module uses low-level data copy to initialize the
+ * random vector. Errors in this part are likely to crash the server or
+ * corrupt memory.
+ *
+ * Resources:
+ * A buffer, used as a random vector for calculating hash values.
+ *
+ * Security:
+ * This module intends to provide unpredictable hash values in
+ * adversarial environments in order to avoid denial of service attacks
+ * to hash buckets.
+ * Its unpredictability relies on the quality of entropy to build the
+ * random vector.
+ *
+ * Standards:
+ * None.
+ */
+
+/***
+ *** Imports
+ ***/
+
+#include <isc/types.h>
+
+/***
+ *** Functions
+ ***/
+ISC_LANG_BEGINDECLS
+
+isc_result_t
+isc_hash_ctxcreate(isc_mem_t *mctx, isc_entropy_t *entropy, unsigned int limit,
+ isc_hash_t **hctx);
+isc_result_t
+isc_hash_create(isc_mem_t *mctx, isc_entropy_t *entropy, size_t limit);
+/*
+ * Create a new hash object.
+ *
+ * isc_hash_ctxcreate() creates a different object.
+ * isc_hash_create() creates a module-internal object to support the
+ * single-context mode. It should be called only once.
+ *
+ * 'entropy' must be NULL or a valid entropy object. If 'entropy' is NULL,
+ * pseudo random values will be used to build the random vector, which may
+ * weaken security.
+ *
+ * 'limit' specifies the maximum number of hash keys. If it is too large,
+ * these functions may fail.
+ */
+
+void
+isc_hash_ctxattach(isc_hash_t *hctx, isc_hash_t **hctxp);
+/*
+ * Attach to a hash object.
+ * This function is only necessary for the multiple-context mode.
+ */
+
+void
+isc_hash_ctxdetach(isc_hash_t **hctxp);
+/*
+ * Detach from a hash object.
+ *
+ * This function is for the multiple-context mode, and takes a valid
+ * hash object as an argument.
+ */
+
+void
+isc_hash_destroy(void);
+/*
+ * This function is for the single-context mode, and is expected to be used
+ * as a counterpart of isc_hash_create().
+ * A valid module-internal hash object must have been created, and this
+ * function should be called only once.
+ */
+
+void
+isc_hash_ctxinit(isc_hash_t *hctx);
+void
+isc_hash_init(void);
+/*
+ * Initialize a hash object. It fills in the random vector with a proper
+ * source of entropy, which is typically from the entropy object specified
+ * at the creation. Thus, it is desirable to call these functions after
+ * initializing the entropy object with some good entropy sources.
+ *
+ * These functions should be called before the first hash calculation.
+ *
+ * isc_hash_ctxinit() is for the multiple-context mode, and takes a valid hash
+ * object as an argument.
+ * isc_hash_init() is for the single-context mode. A valid module-internal
+ * hash object must have been created, and this function should be called only
+ * once.
+ */
+
+unsigned int
+isc_hash_ctxcalc(isc_hash_t *hctx, const unsigned char *key,
+ unsigned int keylen, isc_boolean_t case_sensitive);
+unsigned int
+isc_hash_calc(const unsigned char *key, unsigned int keylen,
+ isc_boolean_t case_sensitive);
+/*
+ * Calculate a hash value.
+ *
+ * isc_hash_ctxinit() is for the multiple-context mode, and takes a valid hash
+ * object as an argument.
+ * isc_hash_init() is for the single-context mode. A valid module-internal
+ * hash object must have been created.
+ *
+ * 'key' is the hash key, which is a variable length buffer.
+ * 'keylen' specifies the key length, which must not be larger than the limit
+ * specified for the corresponding hash object.
+ *
+ * 'case_sensitive' specifies whether the hash key should be treated as
+ * case_sensitive values. It should typically be ISC_FALSE if the hash key
+ * is a DNS name.
+ */
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_HASH_H */
diff --git a/lib/isc/include/isc/log.h b/lib/isc/include/isc/log.h
index 481cb85e..0bfaebb5 100644
--- a/lib/isc/include/isc/log.h
+++ b/lib/isc/include/isc/log.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.h,v 1.39.2.2 2002/08/05 06:57:15 marka Exp $ */
+/* $Id: log.h,v 1.39.2.4 2003/07/22 04:03:49 marka Exp $ */
#ifndef ISC_LOG_H
#define ISC_LOG_H 1
@@ -61,6 +61,7 @@
#define ISC_LOG_PRINTTAG 0x0010
#define ISC_LOG_PRINTALL 0x001F
#define ISC_LOG_DEBUGONLY 0x1000
+#define ISC_LOG_OPENERR 0x8000 /* internal */
/*
* Other options.
diff --git a/lib/isc/include/isc/refcount.h b/lib/isc/include/isc/refcount.h
index 265ed8ce..b52e5a29 100644
--- a/lib/isc/include/isc/refcount.h
+++ b/lib/isc/include/isc/refcount.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: refcount.h,v 1.3 2001/02/09 00:26:20 gson Exp $ */
+/* $Id: refcount.h,v 1.3.2.2 2003/07/25 05:05:28 marka Exp $ */
#ifndef ISC_REFCOUNT_H
#define ISC_REFCOUNT_H 1
@@ -111,21 +111,23 @@ typedef struct isc_refcount {
#define isc_refcount_increment(rp, tp) \
do { \
+ unsigned int *_tmp = (unsigned int *)(tp); \
LOCK(&(rp)->lock); \
REQUIRE((rp)->refs > 0); \
++((rp)->refs); \
- if ((tp) != NULL) \
- *(unsigned int *)(tp) = ((rp)->refs); \
+ if (_tmp != NULL) \
+ *_tmp = ((rp)->refs); \
UNLOCK(&(rp)->lock); \
} while (0)
#define isc_refcount_decrement(rp, tp) \
do { \
+ unsigned int *_tmp = (unsigned int *)(tp); \
LOCK(&(rp)->lock); \
REQUIRE((rp)->refs > 0); \
--((rp)->refs); \
- if ((tp) != NULL) \
- *(unsigned int *)(tp) = ((rp)->refs); \
+ if (_tmp != NULL) \
+ *_tmp = ((rp)->refs); \
UNLOCK(&(rp)->lock); \
} while (0)
diff --git a/lib/isc/include/isc/rwlock.h b/lib/isc/include/isc/rwlock.h
index 0313c050..569cea46 100644
--- a/lib/isc/include/isc/rwlock.h
+++ b/lib/isc/include/isc/rwlock.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rwlock.h,v 1.18 2001/03/08 00:55:15 tale Exp $ */
+/* $Id: rwlock.h,v 1.18.2.3 2003/07/22 04:03:49 marka Exp $ */
#ifndef ISC_RWLOCK_H
#define ISC_RWLOCK_H 1
@@ -57,6 +57,7 @@ struct isc_rwlock {
unsigned int writers_waiting;
unsigned int read_quota;
unsigned int write_quota;
+ isc_rwlocktype_t original;
};
#else /* ISC_PLATFORM_USETHREADS */
struct isc_rwlock {
@@ -80,6 +81,12 @@ isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type);
isc_result_t
isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type);
+isc_result_t
+isc_rwlock_tryupgrade(isc_rwlock_t *rwl);
+
+void
+isc_rwlock_downgrade(isc_rwlock_t *rwl);
+
void
isc_rwlock_destroy(isc_rwlock_t *rwl);
diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h
index f0399d15..54eb868f 100644
--- a/lib/isc/include/isc/types.h
+++ b/lib/isc/include/isc/types.h
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: types.h,v 1.32.2.2 2002/08/06 06:09:07 marka Exp $ */
+/* $Id: types.h,v 1.32.2.3 2003/07/25 03:31:45 marka Exp $ */
#ifndef ISC_TYPES_H
#define ISC_TYPES_H 1
@@ -52,6 +52,7 @@ typedef struct isc_event isc_event_t;
typedef ISC_LIST(isc_event_t) isc_eventlist_t;
typedef unsigned int isc_eventtype_t;
typedef isc_uint32_t isc_fsaccess_t;
+typedef struct isc_hash isc_hash_t;
typedef struct isc_interface isc_interface_t;
typedef struct isc_interfaceiter isc_interfaceiter_t;
typedef struct isc_interval isc_interval_t;
diff --git a/lib/isc/inet_pton.c b/lib/isc/inet_pton.c
index f05d1331..d0211510 100644
--- a/lib/isc/inet_pton.c
+++ b/lib/isc/inet_pton.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1996-2002 Internet Software Consortium.
+ * Copyright (C) 1996-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -17,7 +17,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] =
- "$Id: inet_pton.c,v 1.10.2.2 2002/03/26 00:55:06 marka Exp $";
+ "$Id: inet_pton.c,v 1.10.2.4 2003/07/22 04:03:47 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
@@ -196,6 +196,8 @@ inet_pton6(const char *src, unsigned char *dst) {
const int n = tp - colonp;
int i;
+ if (tp == endp)
+ return (0);
for (i = 1; i <= n; i++) {
endp[- i] = colonp[n - i];
colonp[n - i] = 0;
diff --git a/lib/isc/lex.c b/lib/isc/lex.c
index a440467f..85813f9f 100644
--- a/lib/isc/lex.c
+++ b/lib/isc/lex.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.c,v 1.66.2.5 2002/03/26 00:55:07 marka Exp $ */
+/* $Id: lex.c,v 1.66.2.6 2003/07/23 06:57:53 marka Exp $ */
#include <config.h>
@@ -92,7 +92,7 @@ isc_lex_create(isc_mem_t *mctx, size_t max_token, isc_lex_t **lexp) {
*/
REQUIRE(lexp != NULL && *lexp == NULL);
- REQUIRE(max_token > 0);
+ REQUIRE(max_token > 0U);
lex = isc_mem_get(mctx, sizeof *lex);
if (lex == NULL)
@@ -623,13 +623,13 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
state = lexstate_string;
}
}
- if (remaining == 0) {
+ if (remaining == 0U) {
result = grow_data(lex, &remaining,
&curr, &prev);
if (result != ISC_R_SUCCESS)
goto done;
}
- INSIST(remaining > 0);
+ INSIST(remaining > 0U);
*curr++ = c;
*curr = '\0';
remaining--;
@@ -653,13 +653,13 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
if ((options & ISC_LEXOPT_ESCAPE) != 0)
escaped = (!escaped && c == '\\') ?
ISC_TRUE : ISC_FALSE;
- if (remaining == 0) {
+ if (remaining == 0U) {
result = grow_data(lex, &remaining,
&curr, &prev);
if (result != ISC_R_SUCCESS)
goto done;
}
- INSIST(remaining > 0);
+ INSIST(remaining > 0U);
*curr++ = c;
*curr = '\0';
remaining--;
@@ -750,13 +750,13 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
escaped = ISC_TRUE;
else
escaped = ISC_FALSE;
- if (remaining == 0) {
+ if (remaining == 0U) {
result = grow_data(lex, &remaining,
&curr, &prev);
if (result != ISC_R_SUCCESS)
goto done;
}
- INSIST(remaining > 0);
+ INSIST(remaining > 0U);
prev = curr;
*curr++ = c;
*curr = '\0';
diff --git a/lib/isc/lfsr.c b/lib/isc/lfsr.c
index e8b1fbbd..6dde5c6e 100644
--- a/lib/isc/lfsr.c
+++ b/lib/isc/lfsr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lfsr.c,v 1.11 2001/01/09 21:56:11 bwelling Exp $ */
+/* $Id: lfsr.c,v 1.11.2.2 2003/07/22 04:03:47 marka Exp $ */
#include <config.h>
@@ -74,7 +74,7 @@ lfsr_generate(isc_lfsr_t *lfsr)
}
if (lfsr->state & 0x01) {
- lfsr->state = ((lfsr->state ^ lfsr->tap) >> 1) | highbit;
+ lfsr->state = (lfsr->state >> 1) ^ lfsr->tap;
return (1);
} else {
lfsr->state >>= 1;
diff --git a/lib/isc/log.c b/lib/isc/log.c
index 1aa9974c..d462123b 100644
--- a/lib/isc/log.c
+++ b/lib/isc/log.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2002 Internet Software Consortium.
+ * Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.70.2.5 2002/07/11 03:39:06 marka Exp $ */
+/* $Id: log.c,v 1.70.2.8 2003/07/22 04:03:47 marka Exp $ */
/* Principal Authors: DCL */
@@ -36,6 +36,7 @@
#include <isc/mem.h>
#include <isc/msgs.h>
#include <isc/print.h>
+#include <isc/stat.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/time.h>
@@ -52,6 +53,10 @@
*/
#define LOG_BUFFER_SIZE (8 * 1024)
+#ifndef PATH_MAX
+#define PATH_MAX 1024 /* AIX and others don't define this. */
+#endif
+
/*
* This is the structure that holds each named channel. A simple linked
* list chains all of the channels together, so an individual channel is
@@ -1186,9 +1191,9 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
static isc_result_t
roll_log(isc_logchannel_t *channel) {
- int i, greatest, digits = 0;
- char current[FILENAME_MAX + 1];
- char new[FILENAME_MAX + 1];
+ int i, n, greatest;
+ char current[PATH_MAX + 1];
+ char new[PATH_MAX + 1];
const char *path;
isc_result_t result;
@@ -1232,37 +1237,58 @@ roll_log(isc_logchannel_t *channel) {
* Remove any excess logs on the way to that value.
*/
while (--greatest >= FILE_VERSIONS(channel)) {
- sprintf(current, "%s.%d", path, greatest);
- (void)remove(current);
+ n = snprintf(current, sizeof(current), "%s.%d",
+ path, greatest);
+ if (n >= (int)sizeof(current) || n < 0)
+ result = ISC_R_NOSPACE;
+ else
+ result = isc_file_remove(current);
+ if (result != ISC_R_SUCCESS &&
+ result != ISC_R_FILENOTFOUND)
+ syslog(LOG_ERR,
+ "unable to remove log file '%s.%d': %s",
+ path, greatest,
+ isc_result_totext(result));
}
- for (i = greatest; i > 0; i /= 10)
- digits++;
-
- /*
- * Ensure the name fits in the filesystem. Note that in this will not
- * trigger failure until there is going to be a log rolled into a name
- * that is too long, not when the maximum possible version name would
- * be too long. Imagine a case where the name for logs 0-9 is exactly
- * as long as the maximum filename, but FILE_VERSIONS is configured as
- * 11. log.10's name will be too long, but no error will be triggered
- * until log.9 exists and needs to be rolled.
- */
- if (strlen(path) + 1 + digits > FILENAME_MAX)
- return (ISC_R_INVALIDFILE);
-
for (i = greatest; i > 0; i--) {
- sprintf(current, "%s.%d", path, i - 1);
- sprintf(new, "%s.%d", path, i);
- (void)isc_file_rename(current, new);
+ result = ISC_R_SUCCESS;
+ n = snprintf(current, sizeof(current), "%s.%d", path, i - 1);
+ if (n >= (int)sizeof(current) || n < 0)
+ result = ISC_R_NOSPACE;
+ if (result == ISC_R_SUCCESS) {
+ n = snprintf(new, sizeof(new), "%s.%d", path, i);
+ if (n >= (int)sizeof(new) || n < 0)
+ result = ISC_R_NOSPACE;
+ }
+ if (result == ISC_R_SUCCESS)
+ result = isc_file_rename(current, new);
+ if (result != ISC_R_SUCCESS &&
+ result != ISC_R_FILENOTFOUND)
+ syslog(LOG_ERR,
+ "unable to rename log file '%s.%d' to "
+ "'%s.%d': %s", path, i - 1, path, i,
+ isc_result_totext(result));
}
if (FILE_VERSIONS(channel) != 0) {
- sprintf(new, "%s.0", path);
- (void)isc_file_rename(path, new);
-
- } else if (FILE_VERSIONS(channel) == 0)
- (void)remove(path);
+ n = snprintf(new, sizeof(new), "%s.0", path);
+ if (n >= (int)sizeof(new) || n < 0)
+ result = ISC_R_NOSPACE;
+ else
+ result = isc_file_rename(path, new);
+ if (result != ISC_R_SUCCESS &&
+ result != ISC_R_FILENOTFOUND)
+ syslog(LOG_ERR,
+ "unable to rename log file '%s' to '%s.0': %s",
+ path, path, isc_result_totext(result));
+ } else {
+ result = isc_file_remove(path);
+ if (result != ISC_R_SUCCESS &&
+ result != ISC_R_FILENOTFOUND)
+ syslog(LOG_ERR, "unable to remove log file '%s': %s",
+ path, isc_result_totext(result));
+ }
return (ISC_R_SUCCESS);
}
@@ -1288,8 +1314,7 @@ isc_log_open(isc_logchannel_t *channel) {
* and either has no size limit or has reached its size limit.
*/
if (stat(path, &statbuf) == 0) {
- regular_file = (statbuf.st_mode & S_IFREG) ?
- ISC_TRUE : ISC_FALSE;
+ regular_file = S_ISREG(statbuf.st_mode) ? ISC_TRUE : ISC_FALSE;
/* XXXDCL if not regular_file complain? */
roll = ISC_TF(regular_file &&
statbuf.st_size >= FILE_MAXSIZE(channel));
@@ -1303,8 +1328,17 @@ isc_log_open(isc_logchannel_t *channel) {
*/
if (result == ISC_R_SUCCESS && roll) {
result = roll_log(channel);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
+ if ((channel->flags & ISC_LOG_OPENERR) == 0) {
+ syslog(LOG_ERR,
+ "isc_log_open: roll_log '%s' "
+ "failed: %s",
+ FILE_NAME(channel),
+ isc_result_totext(result));
+ channel->flags |= ISC_LOG_OPENERR;
+ }
return (result);
+ }
}
result = isc_stdio_open(path, "a", &FILE_STREAM(channel));
@@ -1637,12 +1671,17 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
if (FILE_STREAM(channel) == NULL) {
result = isc_log_open(channel);
+ if (result != ISC_R_SUCCESS &&
+ (channel->flags & ISC_LOG_OPENERR) == 0) {
+ syslog(LOG_ERR,
+ "isc_log_open '%s' failed: %s",
+ FILE_NAME(channel),
+ isc_result_totext(result));
+ channel->flags |= ISC_LOG_OPENERR;
+ }
if (result != ISC_R_SUCCESS)
break;
- /*
- * Probably something more meaningful should be
- * done with an error.
- */
+ channel->flags &= ~ISC_LOG_OPENERR;
}
/* FALLTHROUGH */
diff --git a/lib/isc/mem.c b/lib/isc/mem.c
index 43c6755b..2926a3e8 100644
--- a/lib/isc/mem.c
+++ b/lib/isc/mem.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: mem.c,v 1.98.2.6 2002/07/10 06:10:45 marka Exp $ */
+/* $Id: mem.c,v 1.98.2.7 2003/07/23 06:57:53 marka Exp $ */
#include <config.h>
@@ -647,10 +647,10 @@ mem_putstats(isc_mem_t *ctx, void *ptr, size_t size) {
ctx->inuse -= size;
if (size > ctx->max_size) {
- INSIST(ctx->stats[ctx->max_size].gets > 0);
+ INSIST(ctx->stats[ctx->max_size].gets > 0U);
ctx->stats[ctx->max_size].gets--;
} else {
- INSIST(ctx->stats[size].gets > 0);
+ INSIST(ctx->stats[size].gets > 0U);
ctx->stats[size].gets--;
}
}
@@ -664,7 +664,7 @@ mem_putstats(isc_mem_t *ctx, void *ptr, size_t size) {
static void *
default_memalloc(void *arg, size_t size) {
UNUSED(arg);
- if (size == 0)
+ if (size == 0U)
size = 1;
return (malloc(size));
}
@@ -701,7 +701,7 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
if (ctx == NULL)
return (ISC_R_NOMEMORY);
- if (init_max_size == 0)
+ if (init_max_size == 0U)
ctx->max_size = DEF_MAX_SIZE;
else
ctx->max_size = init_max_size;
@@ -833,7 +833,7 @@ destroy(isc_mem_t *ctx) {
if (ctx->stats[i].gets != 0)
print_active(ctx, stderr);
#endif
- INSIST(ctx->stats[i].gets == 0);
+ INSIST(ctx->stats[i].gets == 0U);
}
}
@@ -992,14 +992,14 @@ isc__mem_get(isc_mem_t *ctx, size_t size FLARG) {
#endif /* ISC_MEM_USE_INTERNAL_MALLOC */
ADD_TRACE(ctx, ptr, size, file, line);
- if (ctx->hi_water != 0 && !ctx->hi_called &&
+ if (ctx->hi_water != 0U && !ctx->hi_called &&
ctx->inuse > ctx->hi_water) {
ctx->hi_called = ISC_TRUE;
call_water = ISC_TRUE;
}
if (ctx->inuse > ctx->maxinuse) {
ctx->maxinuse = ctx->inuse;
- if (ctx->hi_water != 0 && ctx->inuse > ctx->hi_water &&
+ if (ctx->hi_water != 0U && ctx->inuse > ctx->hi_water &&
(isc_mem_debugging & ISC_MEM_DEBUGUSAGE) != 0)
fprintf(stderr, "maxinuse = %lu\n",
(unsigned long)ctx->inuse);
@@ -1038,7 +1038,7 @@ isc__mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG)
* isc_mem_setwater() called with 0 for hi_water and lo_water.
*/
if (ctx->hi_called &&
- (ctx->inuse < ctx->lo_water || ctx->lo_water == 0)) {
+ (ctx->inuse < ctx->lo_water || ctx->lo_water == 0U)) {
ctx->hi_called = ISC_FALSE;
if (ctx->water != NULL)
@@ -1100,7 +1100,7 @@ isc_mem_stats(isc_mem_t *ctx, FILE *out) {
for (i = 0; i <= ctx->max_size; i++) {
s = &ctx->stats[i];
- if (s->totalgets == 0 && s->gets == 0)
+ if (s->totalgets == 0U && s->gets == 0U)
continue;
fprintf(out, "%s%5lu: %11lu gets, %11lu rem",
(i == ctx->max_size) ? ">=" : " ",
@@ -1340,7 +1340,7 @@ isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp) {
isc_mempool_t *mpctx;
REQUIRE(VALID_CONTEXT(mctx));
- REQUIRE(size > 0);
+ REQUIRE(size > 0U);
REQUIRE(mpctxp != NULL && *mpctxp == NULL);
/*
diff --git a/lib/isc/print.c b/lib/isc/print.c
index 53dc5275..57cc5408 100644
--- a/lib/isc/print.c
+++ b/lib/isc/print.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: print.c,v 1.22 2001/05/16 00:52:55 gson Exp $ */
+/* $Id: print.c,v 1.22.2.3 2003/07/22 04:03:47 marka Exp $ */
#include <config.h>
@@ -166,7 +166,6 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
*str++ = *format;
size--;
}
- format++;
count++;
break;
case 'q':
@@ -350,7 +349,7 @@ isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
n = precision;
tp = cp;
- while (n != 0 && *tp != '0')
+ while (n != 0 && *tp != '\0')
n--, tp++;
length = precision - n;
} else {
diff --git a/lib/isc/pthreads/thread.c b/lib/isc/pthreads/thread.c
index 7e24cedc..de020c41 100644
--- a/lib/isc/pthreads/thread.c
+++ b/lib/isc/pthreads/thread.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: thread.c,v 1.9 2001/01/09 21:58:02 bwelling Exp $ */
+/* $Id: thread.c,v 1.9.2.2 2003/07/25 07:38:23 marka Exp $ */
#include <config.h>
@@ -23,7 +23,7 @@
#include <isc/util.h>
#ifndef THREAD_MINSTACKSIZE
-#define THREAD_MINSTACKSIZE (64 * 1024)
+#define THREAD_MINSTACKSIZE (64U * 1024)
#endif
isc_result_t
@@ -36,7 +36,8 @@ isc_thread_create(isc_threadfunc_t func, isc_threadarg_t arg,
pthread_attr_init(&attr);
-#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
+#if defined(HAVE_PTHREAD_ATTR_GETSTACKSIZE) && \
+ defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE)
ret = pthread_attr_getstacksize(&attr, &stacksize);
if (ret != 0)
return (ISC_R_UNEXPECTED);
diff --git a/lib/isc/random.c b/lib/isc/random.c
index 4ed13d97..a4251561 100644
--- a/lib/isc/random.c
+++ b/lib/isc/random.c
@@ -15,11 +15,12 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: random.c,v 1.15 2001/01/09 21:56:22 bwelling Exp $ */
+/* $Id: random.c,v 1.15.2.2 2003/08/05 03:09:52 marka Exp $ */
#include <config.h>
#include <stdlib.h>
+#include <unistd.h>
#include <time.h> /* Required for time(). */
#include <isc/mutex.h>
@@ -33,7 +34,17 @@ static isc_once_t once = ISC_ONCE_INIT;
static void
initialize_rand(void)
{
- srand(time(NULL));
+#ifndef HAVE_ARC4RANDOM
+ unsigned int pid = getpid();
+
+ /*
+ * The low bits of pid generally change faster.
+ * Xor them with the high bits of time which change slowly.
+ */
+ pid = ((pid << 16) & 0xffff0000) | ((pid >> 16) & 0xffff);
+
+ srand(time(NULL) ^ pid);
+#endif
}
static void
@@ -47,7 +58,11 @@ isc_random_seed(isc_uint32_t seed)
{
initialize();
+#ifndef HAVE_ARC4RANDOM
srand(seed);
+#else
+ arc4random_addrandom((u_char *) &seed, sizeof(isc_uint32_t));
+#endif
}
void
@@ -57,7 +72,15 @@ isc_random_get(isc_uint32_t *val)
initialize();
- *val = rand();
+#ifndef HAVE_ARC4RANDOM
+ /*
+ * rand()'s lower bits are not random.
+ * rand()'s upper bit is zero.
+ */
+ *val = ((rand() >> 4) & 0xffff) | ((rand() << 12) & 0xffff0000) ;
+#else
+ *val = arc4random();
+#endif
}
isc_uint32_t
@@ -66,5 +89,9 @@ isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter) {
if (jitter == 0)
return (max);
else
+#ifndef HAVE_ARC4RANDOM
return (max - rand() % jitter);
+#else
+ return (max - arc4random() % jitter);
+#endif
}
diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c
index 6ddcbdba..c31b2a11 100644
--- a/lib/isc/rwlock.c
+++ b/lib/isc/rwlock.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rwlock.c,v 1.33 2001/04/17 14:36:45 tale Exp $ */
+/* $Id: rwlock.c,v 1.33.2.4 2003/07/23 03:20:24 marka Exp $ */
#include <config.h>
@@ -82,6 +82,7 @@ isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
rwl->magic = 0;
rwl->type = isc_rwlocktype_read;
+ rwl->original = isc_rwlocktype_none;
rwl->active = 0;
rwl->granted = 0;
rwl->readers_waiting = 0;
@@ -206,6 +207,50 @@ isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
}
isc_result_t
+isc_rwlock_tryupgrade(isc_rwlock_t *rwl) {
+ isc_result_t result = ISC_R_SUCCESS;
+
+ REQUIRE(VALID_RWLOCK(rwl));
+ LOCK(&rwl->lock);
+ REQUIRE(rwl->type == isc_rwlocktype_read);
+ REQUIRE(rwl->active != 0);
+
+ /* If we are the only reader then succeed. */
+ if (rwl->active == 1) {
+ rwl->original = (rwl->original == isc_rwlocktype_none) ?
+ isc_rwlocktype_read : isc_rwlocktype_none;
+ rwl->type = isc_rwlocktype_write;
+ } else
+ result = ISC_R_LOCKBUSY;
+
+ UNLOCK(&rwl->lock);
+ return (result);
+}
+
+void
+isc_rwlock_downgrade(isc_rwlock_t *rwl) {
+
+ REQUIRE(VALID_RWLOCK(rwl));
+ LOCK(&rwl->lock);
+ REQUIRE(rwl->type == isc_rwlocktype_write);
+ REQUIRE(rwl->active == 1);
+
+ rwl->type = isc_rwlocktype_read;
+ rwl->original = (rwl->original == isc_rwlocktype_none) ?
+ isc_rwlocktype_write : isc_rwlocktype_none;
+ /*
+ * Resume processing any read request that were blocked when
+ * we upgraded.
+ */
+ if (rwl->original == isc_rwlocktype_none &&
+ (rwl->writers_waiting == 0 || rwl->granted < rwl->read_quota) &&
+ rwl->readers_waiting > 0)
+ BROADCAST(&rwl->readable);
+
+ UNLOCK(&rwl->lock);
+}
+
+isc_result_t
isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
REQUIRE(VALID_RWLOCK(rwl));
@@ -222,6 +267,10 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
INSIST(rwl->active > 0);
rwl->active--;
if (rwl->active == 0) {
+ if (rwl->original != isc_rwlocktype_none) {
+ rwl->type = rwl->original;
+ rwl->original = isc_rwlocktype_none;
+ }
if (rwl->type == isc_rwlocktype_read) {
rwl->granted = 0;
if (rwl->writers_waiting > 0) {
@@ -249,6 +298,7 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
}
}
}
+ INSIST(rwl->original == isc_rwlocktype_none);
#ifdef ISC_RWLOCK_TRACE
print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK,
@@ -319,6 +369,32 @@ isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
}
isc_result_t
+isc_rwlock_tryupgrade(isc_rwlock_t *rwl) {
+ isc_result_t result = ISC_R_SUCCESS;
+
+ REQUIRE(VALID_RWLOCK(rwl));
+ REQUIRE(rwl->type == isc_rwlocktype_read);
+ REQUIRE(rwl->active != 0);
+
+ /* If we are the only reader then succeed. */
+ if (rwl->active == 1)
+ rwl->type = isc_rwlocktype_write;
+ else
+ result = ISC_R_LOCKBUSY;
+ return (result);
+}
+
+void
+isc_rwlock_downgrade(isc_rwlock_t *rwl) {
+
+ REQUIRE(VALID_RWLOCK(rwl));
+ REQUIRE(rwl->type == isc_rwlocktype_write);
+ REQUIRE(rwl->active == 1);
+
+ rwl->type = isc_rwlocktype_read;
+}
+
+isc_result_t
isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
REQUIRE(VALID_RWLOCK(rwl));
REQUIRE(rwl->type == type);
diff --git a/lib/isc/sha1.c b/lib/isc/sha1.c
index 6685025c..63d127f0 100644
--- a/lib/isc/sha1.c
+++ b/lib/isc/sha1.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Internet Software Consortium.
+ * Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sha1.c,v 1.10 2001/01/09 21:56:28 bwelling Exp $ */
+/* $Id: sha1.c,v 1.10.2.2 2003/07/22 04:03:48 marka Exp $ */
/* $NetBSD: sha1.c,v 1.5 2000/01/22 22:19:14 mycroft Exp $ */
/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
@@ -85,6 +85,67 @@ typedef union {
unsigned int l[16];
} CHAR64LONG16;
+#ifdef __sparc_v9__
+static void do_R01(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *);
+static void do_R2(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *);
+static void do_R3(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *);
+static void do_R4(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *);
+
+#define nR0(v,w,x,y,z,i) R0(*v,*w,*x,*y,*z,i)
+#define nR1(v,w,x,y,z,i) R1(*v,*w,*x,*y,*z,i)
+#define nR2(v,w,x,y,z,i) R2(*v,*w,*x,*y,*z,i)
+#define nR3(v,w,x,y,z,i) R3(*v,*w,*x,*y,*z,i)
+#define nR4(v,w,x,y,z,i) R4(*v,*w,*x,*y,*z,i)
+
+static void
+do_R01(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *block)
+{
+ nR0(a,b,c,d,e, 0); nR0(e,a,b,c,d, 1); nR0(d,e,a,b,c, 2);
+ nR0(c,d,e,a,b, 3); nR0(b,c,d,e,a, 4); nR0(a,b,c,d,e, 5);
+ nR0(e,a,b,c,d, 6); nR0(d,e,a,b,c, 7); nR0(c,d,e,a,b, 8);
+ nR0(b,c,d,e,a, 9); nR0(a,b,c,d,e,10); nR0(e,a,b,c,d,11);
+ nR0(d,e,a,b,c,12); nR0(c,d,e,a,b,13); nR0(b,c,d,e,a,14);
+ nR0(a,b,c,d,e,15); nR1(e,a,b,c,d,16); nR1(d,e,a,b,c,17);
+ nR1(c,d,e,a,b,18); nR1(b,c,d,e,a,19);
+}
+
+static void
+do_R2(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *block)
+{
+ nR2(a,b,c,d,e,20); nR2(e,a,b,c,d,21); nR2(d,e,a,b,c,22);
+ nR2(c,d,e,a,b,23); nR2(b,c,d,e,a,24); nR2(a,b,c,d,e,25);
+ nR2(e,a,b,c,d,26); nR2(d,e,a,b,c,27); nR2(c,d,e,a,b,28);
+ nR2(b,c,d,e,a,29); nR2(a,b,c,d,e,30); nR2(e,a,b,c,d,31);
+ nR2(d,e,a,b,c,32); nR2(c,d,e,a,b,33); nR2(b,c,d,e,a,34);
+ nR2(a,b,c,d,e,35); nR2(e,a,b,c,d,36); nR2(d,e,a,b,c,37);
+ nR2(c,d,e,a,b,38); nR2(b,c,d,e,a,39);
+}
+
+static void
+do_R3(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *block)
+{
+ nR3(a,b,c,d,e,40); nR3(e,a,b,c,d,41); nR3(d,e,a,b,c,42);
+ nR3(c,d,e,a,b,43); nR3(b,c,d,e,a,44); nR3(a,b,c,d,e,45);
+ nR3(e,a,b,c,d,46); nR3(d,e,a,b,c,47); nR3(c,d,e,a,b,48);
+ nR3(b,c,d,e,a,49); nR3(a,b,c,d,e,50); nR3(e,a,b,c,d,51);
+ nR3(d,e,a,b,c,52); nR3(c,d,e,a,b,53); nR3(b,c,d,e,a,54);
+ nR3(a,b,c,d,e,55); nR3(e,a,b,c,d,56); nR3(d,e,a,b,c,57);
+ nR3(c,d,e,a,b,58); nR3(b,c,d,e,a,59);
+}
+
+static void
+do_R4(u_int32_t *a, u_int32_t *b, u_int32_t *c, u_int32_t *d, u_int32_t *e, CHAR64LONG16 *block)
+{
+ nR4(a,b,c,d,e,60); nR4(e,a,b,c,d,61); nR4(d,e,a,b,c,62);
+ nR4(c,d,e,a,b,63); nR4(b,c,d,e,a,64); nR4(a,b,c,d,e,65);
+ nR4(e,a,b,c,d,66); nR4(d,e,a,b,c,67); nR4(c,d,e,a,b,68);
+ nR4(b,c,d,e,a,69); nR4(a,b,c,d,e,70); nR4(e,a,b,c,d,71);
+ nR4(d,e,a,b,c,72); nR4(c,d,e,a,b,73); nR4(b,c,d,e,a,74);
+ nR4(a,b,c,d,e,75); nR4(e,a,b,c,d,76); nR4(d,e,a,b,c,77);
+ nR4(c,d,e,a,b,78); nR4(b,c,d,e,a,79);
+}
+#endif
+
/*
* Hash a single 512-bit block. This is the core of the algorithm.
*/
@@ -92,12 +153,12 @@ static void
transform(isc_uint32_t state[5], const unsigned char buffer[64]) {
isc_uint32_t a, b, c, d, e;
CHAR64LONG16 *block;
- unsigned char workspace[64];
+ CHAR64LONG16 workspace;
INSIST(buffer != NULL);
INSIST(state != NULL);
- block = (CHAR64LONG16 *)(void *)workspace;
+ block = &workspace;
(void)memcpy(block, buffer, 64);
/* Copy context->state[] to working vars */
@@ -107,6 +168,12 @@ transform(isc_uint32_t state[5], const unsigned char buffer[64]) {
d = state[3];
e = state[4];
+#ifdef __sparc_v9__
+ do_R01(&a, &b, &c, &d, &e, block);
+ do_R2(&a, &b, &c, &d, &e, block);
+ do_R3(&a, &b, &c, &d, &e, block);
+ do_R4(&a, &b, &c, &d, &e, block);
+#else
/* 4 rounds of 20 operations each. Loop unrolled. */
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
@@ -128,6 +195,7 @@ transform(isc_uint32_t state[5], const unsigned char buffer[64]) {
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
+#endif
/* Add the working vars back into context.state[] */
state[0] += a;
diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c
index 84d3f68d..eae14249 100644
--- a/lib/isc/sockaddr.c
+++ b/lib/isc/sockaddr.c
@@ -15,13 +15,14 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sockaddr.c,v 1.48 2001/01/09 21:56:29 bwelling Exp $ */
+/* $Id: sockaddr.c,v 1.48.2.1 2003/07/25 03:31:44 marka Exp $ */
#include <config.h>
#include <stdio.h>
#include <isc/buffer.h>
+#include <isc/hash.h>
#include <isc/msgs.h>
#include <isc/netaddr.h>
#include <isc/print.h>
@@ -175,47 +176,50 @@ isc_sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) {
unsigned int
isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
- unsigned int length;
- const unsigned char *s;
+ unsigned int length = 0;
+ const unsigned char *s = NULL;
unsigned int h = 0;
unsigned int g;
+ unsigned int p = 0;
+ const struct in6_addr *in6;
REQUIRE(sockaddr != NULL);
-
- if (address_only) {
- switch (sockaddr->type.sa.sa_family) {
- case AF_INET:
- return (ntohl(sockaddr->type.sin.sin_addr.s_addr));
- case AF_INET6:
- s = (const unsigned char *)&sockaddr->
- type.sin6.sin6_addr;
- length = sizeof sockaddr->type.sin6.sin6_addr;
- break;
- default:
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- isc_msgcat_get(isc_msgcat,
- ISC_MSGSET_SOCKADDR,
- ISC_MSG_UNKNOWNFAMILY,
- "unknown "
- "address family: %d"),
- (int)sockaddr->type.sa.sa_family);
- s = (const unsigned char *)&sockaddr->type;
- length = sockaddr->length;
+ switch (sockaddr->type.sa.sa_family) {
+ case AF_INET:
+ s = (const unsigned char *)&sockaddr->type.sin.sin_addr;
+ p = ntohs(sockaddr->type.sin.sin_port);
+ length = sizeof(sockaddr->type.sin.sin_addr.s_addr);
+ break;
+ case AF_INET6:
+ in6 = &sockaddr->type.sin6.sin6_addr;
+ if (IN6_IS_ADDR_V4MAPPED(in6)) {
+ s = (const unsigned char *)&in6[12];
+ length = sizeof(sockaddr->type.sin.sin_addr.s_addr);
+ } else {
+ s = (const unsigned char *)in6;
+ length = sizeof(sockaddr->type.sin6.sin6_addr);
}
- } else {
+ p = ntohs(sockaddr->type.sin6.sin6_port);
+ break;
+ default:
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_SOCKADDR,
+ ISC_MSG_UNKNOWNFAMILY,
+ "unknown address family: %d"),
+ (int)sockaddr->type.sa.sa_family);
s = (const unsigned char *)&sockaddr->type;
length = sockaddr->length;
+ p = 0;
}
- while (length > 0) {
- h = ( h << 4 ) + *s;
- if ((g = ( h & 0xf0000000 )) != 0) {
- h = h ^ (g >> 24);
- h = h ^ g;
- }
- s++;
- length--;
+ h = isc_hash_calc(s, length, ISC_TRUE);
+ if (!address_only) {
+ g = isc_hash_calc((const unsigned char *)&p, sizeof(p),
+ ISC_TRUE);
+ h = h ^ g; /* XXX: we should concatenate h and p first */
}
+
return (h);
}
diff --git a/lib/isc/unix/dir.c b/lib/isc/unix/dir.c
index bb852885..a2f8c6a4 100644
--- a/lib/isc/unix/dir.c
+++ b/lib/isc/unix/dir.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dir.c,v 1.18 2001/06/08 23:50:31 tale Exp $ */
+/* $Id: dir.c,v 1.18.2.1 2003/07/23 06:57:54 marka Exp $ */
/* Principal Authors: DCL */
@@ -164,7 +164,7 @@ isc_dir_current(char *dirname, size_t length, isc_boolean_t end_sep) {
* XXXDCL Could automatically allocate memory if dirname == NULL.
*/
REQUIRE(dirname != NULL);
- REQUIRE(length > 0);
+ REQUIRE(length > 0U);
cwd = getcwd(dirname, length);
diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c
index 92ddc781..4eafb6e9 100644
--- a/lib/isc/unix/ifiter_ioctl.c
+++ b/lib/isc/unix/ifiter_ioctl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ifiter_ioctl.c,v 1.19.2.2.4.1 2003/02/19 04:32:41 marka Exp $ */
+/* $Id: ifiter_ioctl.c,v 1.19.2.5 2003/07/22 04:03:49 marka Exp $ */
/*
* Obtain the list of network interfaces using the SIOCGLIFCONF ioctl.
@@ -133,7 +133,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
goto alloc_failure;
}
- memset(&iter->ifc.lifc_len, 0, sizeof(iter->ifc.lifc_len));
+ memset(&iter->ifc, 0, sizeof(iter->ifc));
#ifdef ISC_HAVE_LIFC_FAMILY
iter->ifc.lifc_family = AF_UNSPEC;
#endif
diff --git a/lib/isc/unix/include/isc/stat.h b/lib/isc/unix/include/isc/stat.h
new file mode 100644
index 00000000..eef4f587
--- /dev/null
+++ b/lib/isc/unix/include/isc/stat.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: stat.h,v 1.1.2.1 2003/05/20 00:06:56 marka Exp $ */
+
+#ifndef ISC_STAT_H
+#define ISC_STAT_H 1
+
+/*****
+ ***** Module Info
+ *****/
+
+/*
+ * Portable netdb.h support.
+ *
+ * This module is responsible for defining S_IS??? macros.
+ *
+ * MP:
+ * No impact.
+ *
+ * Reliability:
+ * No anticipated impact.
+ *
+ * Resources:
+ * N/A.
+ *
+ * Security:
+ * No anticipated impact.
+ *
+ */
+
+/***
+ *** Imports.
+ ***/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#endif /* ISC_STAT_H */
diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c
index 8e19b993..c3052f50 100644
--- a/lib/isc/unix/socket.c
+++ b/lib/isc/unix/socket.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1998-2002 Internet Software Consortium.
+ * Copyright (C) 1998-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.207.2.14.4.2 2003/02/18 07:28:41 marka Exp $ */
+/* $Id: socket.c,v 1.207.2.19 2003/07/23 06:57:54 marka Exp $ */
#include <config.h>
@@ -648,7 +648,7 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
buffer = ISC_LIST_NEXT(buffer, link);
}
- INSIST(skip_count == 0);
+ INSIST(skip_count == 0U);
config:
msg->msg_iov = iov;
@@ -990,7 +990,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
dev->n += cc;
actual_count = cc;
buffer = ISC_LIST_HEAD(dev->bufferlist);
- while (buffer != NULL && actual_count > 0) {
+ while (buffer != NULL && actual_count > 0U) {
REQUIRE(ISC_BUFFER_VALID(buffer));
if (isc_buffer_availablelength(buffer) <= actual_count) {
actual_count -= isc_buffer_availablelength(buffer);
@@ -1003,7 +1003,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
}
buffer = ISC_LIST_NEXT(buffer, link);
if (buffer == NULL) {
- INSIST(actual_count == 0);
+ INSIST(actual_count == 0U);
}
}
@@ -1316,6 +1316,20 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
break;
}
+#ifdef F_DUPFD
+ /*
+ * Leave a space for stdio to work in.
+ */
+ if (sock->fd >= 0 && sock->fd < 20) {
+ int new, tmp;
+ new = fcntl(sock->fd, F_DUPFD, 20);
+ tmp = errno;
+ (void)close(sock->fd);
+ errno = tmp;
+ sock->fd = new;
+ }
+#endif
+
if (sock->fd >= (int)FD_SETSIZE) {
(void)close(sock->fd);
isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL,
@@ -1740,6 +1754,21 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
memset(&dev->newsocket->address.type.sa, 0, addrlen);
fd = accept(sock->fd, &dev->newsocket->address.type.sa,
(void *)&addrlen);
+
+#ifdef F_DUPFD
+ /*
+ * Leave a space for stdio to work in.
+ */
+ if (fd >= 0 && fd < 20) {
+ int new, tmp;
+ new = fcntl(fd, F_DUPFD, 20);
+ tmp = errno;
+ (void)close(fd);
+ errno = tmp;
+ fd = new;
+ }
+#endif
+
if (fd < 0) {
if (SOFT_ERROR(errno))
goto soft_error;
diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c
index 328f72b7..2945a878 100644
--- a/lib/isc/unix/time.c
+++ b/lib/isc/unix/time.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.34.2.5 2001/10/22 23:28:26 gson Exp $ */
+/* $Id: time.c,v 1.34.2.6 2003/07/23 06:57:54 marka Exp $ */
#include <config.h>
@@ -173,7 +173,7 @@ isc_time_now(isc_time_t *t) {
* Ensure the tv_sec value fits in t->seconds.
*/
if (sizeof(tv.tv_sec) > sizeof(t->seconds) &&
- ((tv.tv_sec | (unsigned int)-1) ^ (unsigned int)-1) != 0)
+ ((tv.tv_sec | (unsigned int)-1) ^ (unsigned int)-1) != 0U)
return (ISC_R_RANGE);
t->seconds = tv.tv_sec;
@@ -366,7 +366,7 @@ isc_time_secondsastimet(isc_time_t *t, time_t *secondsp) {
(time_t)0.5 != 0.5 && /* Not a floating point type. */
(i = (time_t)-1) != 4294967295u && /* Is signed. */
(seconds &
- (1U << (sizeof(time_t) * CHAR_BIT - 1))) != 0) { /* Negative. */
+ (1U << (sizeof(time_t) * CHAR_BIT - 1))) != 0U) { /* Negative. */
/*
* This UNUSED() is here to shut up the IRIX compiler:
* variable "i" was set but never used
diff --git a/lib/isc/win32/errno2result.c b/lib/isc/win32/errno2result.c
index 9cee47fb..b9cf084d 100644
--- a/lib/isc/win32/errno2result.c
+++ b/lib/isc/win32/errno2result.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: errno2result.c,v 1.4.2.2 2002/02/20 02:17:28 marka Exp $ */
+/* $Id: errno2result.c,v 1.4.2.5 2003/07/22 04:03:50 marka Exp $ */
#include <config.h>
@@ -71,372 +71,3 @@ isc__errno2result(int posixerrno) {
return (ISC_R_UNEXPECTED);
}
}
-
-/*
- * Note this will cause a memory leak unless the memory allocated here
- * is freed by calling LocalFree
- */
-char *
-FormatError(int error) {
- LPVOID lpMsgBuf;
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- error,
- /* Default language */
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL);
-
- return (lpMsgBuf);
-}
-
-char * __cdecl
-NTstrMessage(int err) {
- char *retmsg = NULL;
-
- /* Copy the error value first in case of other errors */
- DWORD errval = err;
-
- /* Get the Winsock2 error messages */
- if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) {
- retmsg = GetWSAErrorMessage(errval);
- if (retmsg != NULL)
- return (retmsg);
- }
- /*
- * If it's not one of the standard Unix error codes,
- * try a system error message
- */
- if (errval > (DWORD) _sys_nerr) {
- return (FormatError(errval));
- } else {
- return (strerror(errval));
- }
-}
-
-char * __cdecl
-NTstrerror(int err) {
- /* Copy the error value first in case of other errors */
- DWORD errval = err;
-
- return (NTstrMessage(errval));
-}
-
-/*
- * This is a replacement for perror, but it also reports the error value.
- */
-void __cdecl
-NTperror(char *errmsg) {
- /* Copy the error value first in case of other errors */
- int errval = errno;
-
- fprintf(stderr, "%s: %s\n", errmsg, NTstrMessage(errval));
-}
-
-/*
- * Return the error string related to Winsock2 errors.
- * This function is necessary since FormatMessage knows nothing about them
- * and there is no function to get them.
- */
-char *
-GetWSAErrorMessage(int errval) {
- char *msg;
-
- switch (errval) {
-
- case WSAEINTR:
- msg = "Interrupted system call";
- break;
-
- case WSAEBADF:
- msg = "Bad file number";
- break;
-
- case WSAEACCES:
- msg = "Permission denied";
- break;
-
- case WSAEFAULT:
- msg = "Bad address";
- break;
-
- case WSAEINVAL:
- msg = "Invalid argument";
- break;
-
- case WSAEMFILE:
- msg = "Too many open sockets";
- break;
-
- case WSAEWOULDBLOCK:
- msg = "Operation would block";
- break;
-
- case WSAEINPROGRESS:
- msg = "Operation now in progress";
- break;
-
- case WSAEALREADY:
- msg = "Operation already in progress";
- break;
-
- case WSAENOTSOCK:
- msg = "Socket operation on non-socket";
- break;
-
- case WSAEDESTADDRREQ:
- msg = "Destination address required";
- break;
-
- case WSAEMSGSIZE:
- msg = "Message too long";
- break;
-
- case WSAEPROTOTYPE:
- msg = "Protocol wrong type for socket";
- break;
-
- case WSAENOPROTOOPT:
- msg = "Bad protocol option";
- break;
-
- case WSAEPROTONOSUPPORT:
- msg = "Protocol not supported";
- break;
-
- case WSAESOCKTNOSUPPORT:
- msg = "Socket type not supported";
- break;
-
- case WSAEOPNOTSUPP:
- msg = "Operation not supported on socket";
- break;
-
- case WSAEPFNOSUPPORT:
- msg = "Protocol family not supported";
- break;
-
- case WSAEAFNOSUPPORT:
- msg = "Address family not supported";
- break;
-
- case WSAEADDRINUSE:
- msg = "Address already in use";
- break;
-
- case WSAEADDRNOTAVAIL:
- msg = "Can't assign requested address";
- break;
-
- case WSAENETDOWN:
- msg = "Network is down";
- break;
-
- case WSAENETUNREACH:
- msg = "Network is unreachable";
- break;
-
- case WSAENETRESET:
- msg = "Net connection reset";
- break;
-
- case WSAECONNABORTED:
- msg = "Software caused connection abort";
- break;
-
- case WSAECONNRESET:
- msg = "Connection reset by peer";
- break;
-
- case WSAENOBUFS:
- msg = "No buffer space available";
- break;
-
- case WSAEISCONN:
- msg = "Socket is already connected";
- break;
-
- case WSAENOTCONN:
- msg = "Socket is not connected";
- break;
-
- case WSAESHUTDOWN:
- msg = "Can't send after socket shutdown";
- break;
-
- case WSAETOOMANYREFS:
- msg = "Too many references: can't splice";
- break;
-
- case WSAETIMEDOUT:
- msg = "Connection timed out";
- break;
-
- case WSAECONNREFUSED:
- msg = "Connection refused";
- break;
-
- case WSAELOOP:
- msg = "Too many levels of symbolic links";
- break;
-
- case WSAENAMETOOLONG:
- msg = "File name too long";
- break;
-
- case WSAEHOSTDOWN:
- msg = "Host is down";
- break;
-
- case WSAEHOSTUNREACH:
- msg = "No route to host";
- break;
-
- case WSAENOTEMPTY:
- msg = "Directory not empty";
- break;
-
- case WSAEPROCLIM:
- msg = "Too many processes";
- break;
-
- case WSAEUSERS:
- msg = "Too many users";
- break;
-
- case WSAEDQUOT:
- msg = "Disc quota exceeded";
- break;
-
- case WSAESTALE:
- msg = "Stale NFS file handle";
- break;
-
- case WSAEREMOTE:
- msg = "Too many levels of remote in path";
- break;
-
- case WSASYSNOTREADY:
- msg = "Network system is unavailable";
- break;
-
- case WSAVERNOTSUPPORTED:
- msg = "Winsock version out of range";
- break;
-
- case WSANOTINITIALISED:
- msg = "WSAStartup not yet called";
- break;
-
- case WSAEDISCON:
- msg = "Graceful shutdown in progress";
- break;
-/*
- case WSAHOST_NOT_FOUND:
- msg = "Host not found";
- break;
-
- case WSANO_DATA:
- msg = "No host data of that type was found";
- break;
-*/
- default:
- msg = NULL;
- break;
- }
- return (msg);
-}
-
-/*
- * These error messages are more informative about CryptAPI Errors than the
- * standard error messages
- */
-
-char *
-GetCryptErrorMessage(int errval) {
- char *msg;
-
- switch (errval) {
-
- case NTE_BAD_FLAGS:
- msg = "The dwFlags parameter has an illegal value.";
- break;
- case NTE_BAD_KEYSET:
- msg = "The Registry entry for the key container "
- "could not be opened and may not exist.";
- break;
- case NTE_BAD_KEYSET_PARAM:
- msg = "The pszContainer or pszProvider parameter "
- "is set to an illegal value.";
- break;
- case NTE_BAD_PROV_TYPE:
- msg = "The value of the dwProvType parameter is out "
- "of range. All provider types must be from "
- "1 to 999, inclusive.";
- break;
- case NTE_BAD_SIGNATURE:
- msg = "The provider DLL signature did not verify "
- "correctly. Either the DLL or the digital "
- "signature has been tampered with.";
- break;
- case NTE_EXISTS:
- msg = "The dwFlags parameter is CRYPT_NEWKEYSET, but the key"
- " container already exists.";
- break;
- case NTE_KEYSET_ENTRY_BAD:
- msg = "The Registry entry for the pszContainer key container "
- "was found (in the HKEY_CURRENT_USER window), but is "
- "corrupt. See the section System Administration for "
- " etails about CryptoAPI's Registry usage.";
- break;
- case NTE_KEYSET_NOT_DEF:
- msg = "No Registry entry exists in the HKEY_CURRENT_USER "
- "window for the key container specified by "
- "pszContainer.";
- break;
- case NTE_NO_MEMORY:
- msg = "The CSP ran out of memory during the operation.";
- break;
- case NTE_PROV_DLL_NOT_FOUND:
- msg = "The provider DLL file does not exist or is not on the "
- "current path.";
- break;
- case NTE_PROV_TYPE_ENTRY_BAD:
- msg = "The Registry entry for the provider type specified by "
- "dwProvType is corrupt. This error may relate to "
- "either the user default CSP list or the machine "
- "default CSP list. See the section System "
- "Administration for details about CryptoAPI's "
- "Registry usage.";
- break;
- case NTE_PROV_TYPE_NO_MATCH:
- msg = "The provider type specified by dwProvType does not "
- "match the provider type found in the Registry. Note "
- "that this error can only occur when pszProvider "
- "specifies an actual CSP name.";
- break;
- case NTE_PROV_TYPE_NOT_DEF:
- msg = "No Registry entry exists for the provider type "
- "specified by dwProvType.";
- break;
- case NTE_PROVIDER_DLL_FAIL:
- msg = "The provider DLL file could not be loaded, and "
- "may not exist. If it exists, then the file is "
- "not a valid DLL.";
- break;
- case NTE_SIGNATURE_FILE_BAD:
- msg = "An error occurred while loading the DLL file image, "
- "prior to verifying its signature.";
- break;
-
- default:
- msg = NULL;
- break;
- }
- return msg;
-}
-
diff --git a/lib/isc/win32/include/isc/ipv6.h b/lib/isc/win32/include/isc/ipv6.h
index 000e9ff6..c45ee52b 100644
--- a/lib/isc/win32/include/isc/ipv6.h
+++ b/lib/isc/win32/include/isc/ipv6.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Internet Software Consortium.
+ * Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ipv6.h,v 1.9 2001/07/17 20:29:33 gson Exp $ */
+/* $Id: ipv6.h,v 1.9.2.2 2003/07/22 04:03:52 marka Exp $ */
#ifndef ISC_IPV6_H
#define ISC_IPV6_H 1
@@ -36,6 +36,7 @@
#define PF_INET6 AF_INET6
#endif
+#if _MSC_VER < 1300
#define s6_addr8 s6_addr
#define in6_addr in_addr6
@@ -98,6 +99,8 @@ struct in6_pktinfo {
#define IN6_IS_ADDR_MULTICAST(a) \
((a)->s6_addr8[0] == 0xffU)
+#endif
+
ISC_LANG_ENDDECLS
#endif /* ISC_IPV6_H */
diff --git a/lib/isc/win32/include/isc/stat.h b/lib/isc/win32/include/isc/stat.h
index 04c92797..b75840f9 100644
--- a/lib/isc/win32/include/isc/stat.h
+++ b/lib/isc/win32/include/isc/stat.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Internet Software Consortium.
+ * Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stat.h,v 1.3 2001/07/09 21:06:30 gson Exp $ */
+/* $Id: stat.h,v 1.3.2.2 2003/07/22 04:03:52 marka Exp $ */
#ifndef ISC_STAT_H
#define ISC_STAT_H 1
@@ -37,7 +37,10 @@
#define S_IWOTH _S_IWRITE /* Other write permission */
#ifndef S_ISDIR
-# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+#ifndef S_ISREG
+# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#endif /* ISC_STAT_H */
diff --git a/lib/isc/win32/include/isc/win32os.h b/lib/isc/win32/include/isc/win32os.h
new file mode 100644
index 00000000..1f4d3348
--- /dev/null
+++ b/lib/isc/win32/include/isc/win32os.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: win32os.h,v 1.2.176.2 2003/07/22 04:03:52 marka Exp $ */
+
+#ifndef ISC_WIN32OS_H
+#define ISC_WIN32OS_H 1
+
+#include <isc/lang.h>
+
+ISC_LANG_BEGINDECLS
+
+/*
+ * Return the number of CPUs available on the system, or 1 if this cannot
+ * be determined.
+ */
+
+unsigned int
+isc_win32os_majorversion(void);
+/*
+ * Major Version of the O/S.
+ */
+
+unsigned int
+isc_win32os_minorversion(void);
+/*
+ * Minor Version of the O/S.
+ */
+
+unsigned int
+isc_win32os_servicepackmajor(void);
+/*
+ * Major Version of the Service Pack for O/S.
+ */
+
+unsigned int
+isc_win32os_servicepackminor(void);
+/*
+ * Minor Version of the Service Pack for O/S.
+ */
+
+int
+isc_win32os_versioncheck(unsigned int major, unsigned int minor,
+ unsigned int updatemajor, unsigned int updateminor);
+
+/*
+ * Checks the current version of the operating system with the
+ * supplied version information.
+ * Returns:
+ * -1 if less than the version information supplied
+ * 0 if equal to all of the version information supplied
+ * +1 if greater than the version information supplied
+ */
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_OS_H */
diff --git a/lib/isc/win32/ipv6.c b/lib/isc/win32/ipv6.c
index 694c427c..a55a8181 100644
--- a/lib/isc/win32/ipv6.c
+++ b/lib/isc/win32/ipv6.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,15 +15,17 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: ipv6.c,v 1.4 2001/07/12 05:58:27 mayer Exp $ */
+/* $Id: ipv6.c,v 1.4.2.2 2003/07/22 04:03:50 marka Exp $ */
#define off_t _off_t
#include <isc/net.h>
#include <isc/platform.h>
+#if _MSC_VER < 1300
LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_any =
IN6ADDR_ANY_INIT;
LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_loopback =
IN6ADDR_LOOPBACK_INIT;
+#endif
diff --git a/lib/isc/win32/libisc.def b/lib/isc/win32/libisc.def
index f0bbf5d4..832d99e2 100644
--- a/lib/isc/win32/libisc.def
+++ b/lib/isc/win32/libisc.def
@@ -1,442 +1,454 @@
-LIBRARY libisc
-
-; Exported Functions
-EXPORTS
-
-isc_assertion_setcallback
-isc_assertion_typetotext
-isc_base64_totext
-isc_base64_decodestring
-isc_base64_tobuffer
-isc_bitstring_init
-isc_bitstring_invalidate
-isc_bitstring_copy
-isc_buffer_allocate
-isc_buffer_free
-isc__buffer_init
-isc__buffer_invalidate
-isc__buffer_region
-isc__buffer_usedregion
-isc__buffer_availableregion
-isc__buffer_add
-isc__buffer_subtract
-isc__buffer_clear
-isc__buffer_consumedregion
-isc__buffer_remainingregion
-isc__buffer_activeregion
-isc__buffer_setactive
-isc__buffer_first
-isc__buffer_forward
-isc__buffer_back
-isc_buffer_compact
-isc_buffer_getuint8
-isc__buffer_putuint8
-isc_buffer_getuint16
-isc__buffer_putuint16
-isc_buffer_getuint32
-isc__buffer_putuint32
-isc__buffer_putmem
-isc__buffer_putstr
-isc_buffer_copyregion
-isc_bufferlist_usedcount
-isc_bufferlist_availablecount
-isc_commandline_parse
-
-
-isc_entropy_create
-isc_entropy_attach
-isc_entropy_detach
-isc_entropy_createfilesource
-isc_entropy_destroysource
-isc_entropy_createsamplesource
-isc_entropy_createcallbacksource
-isc_entropy_stopcallbacksources
-isc_entropy_addcallbacksample
-isc_entropy_addsample
-isc_entropy_getdata
-isc_entropy_putdata
-isc_entropy_stats
-isc_entropy_usebestsource
-isc_error_setunexpected
-isc_error_setfatal
-isc_error_unexpected
-isc_error_fatal
-isc_error_runtimecheck
-isc_event_allocate
-isc_event_free
-isc_file_settime
-isc_file_getmodtime
-isc_file_mktemplate
-isc_file_openunique
-isc_file_remove
-isc_file_rename
-isc_file_exists
-isc_file_ischdiridempotent
-isc_file_isabsolute
-isc_file_iscurrentdir
-isc_file_template
-isc_file_renameunique
-isc_file_basename
-isc_file_progname
-isc_file_safemovefile
-isc_file_absolutepath
-isc_fsaccess_add
-isc_fsaccess_remove
-isc_fsaccess_set
-isc_hex_totext
-isc_hex_decodestring
-isc_hex_tobuffer
-isc_hmacmd5_init
-isc_hmacmd5_invalidate
-isc_hmacmd5_update
-isc_hmacmd5_sign
-isc_hmacmd5_verify
-isc_interfaceiter_create
-isc_interfaceiter_first
-isc_interfaceiter_current
-isc_interfaceiter_next
-isc_interfaceiter_destroy
-isc_lex_setcomments
-isc_lex_create
-isc_lex_destroy
-isc_lex_getcomments
-isc_lex_setcomments
-isc_lex_getspecials
-isc_lex_setspecials
-isc_lex_openfile
-isc_lex_openstream
-isc_lex_openbuffer
-isc_lex_close
-isc_lex_gettoken
-isc_lex_getmastertoken
-isc_lex_ungettoken
-isc_lex_getlasttokentext
-isc_lex_getsourcename
-isc_lex_getsourceline
-isc_lex_isfile
-isc_lfsr_init
-isc_lfsr_generate
-isc_lfsr_skip
-isc_lfsr_generate32
-isc_lib_initmsgcat
-isc_log_createchannel
-isc_log_createchannel
-isc_log_create
-isc_logconfig_create
-isc_logconfig_get
-isc_logconfig_use
-isc_log_destroy
-isc_logconfig_destroy
-isc_log_registercategories
-isc_log_registermodules
-isc_log_createchannel
-isc_log_usechannel
-isc_log_write
-isc_log_vwrite
-isc_log_write1
-isc_log_vwrite1
-isc_log_iwrite
-isc_log_ivwrite
-isc_log_iwrite1
-isc_log_ivwrite1
-isc_log_setdebuglevel
-isc_log_getdebuglevel
-isc_log_wouldlog
-isc_log_write
-isc_log_setduplicateinterval
-isc_log_getduplicateinterval
-isc_log_settag
-isc_log_gettag
-isc_log_opensyslog
-isc_log_closefilelogs
-isc_log_categorybyname
-isc_log_modulebyname
-isc_log_setcontext
-isc_md5_init
-isc_md5_invalidate
-isc_md5_update
-isc_md5_final
-isc_mem_attach
-isc_mem_detach
-isc_mem_detach
-isc_mem_create
-isc_mem_createx
-isc_mem_attach
-isc_mem_detach
-isc_mem_destroy
-isc_mem_ondestroy
-isc_mem_stats
-isc_mem_setdestroycheck
-isc_mem_setquota
-isc_mem_getquota
-isc_mem_inuse
-isc_mem_setwater
-isc_mempool_create
-isc_mempool_destroy
-isc_mempool_setname
-isc_mempool_associatelock
-isc_mempool_getfreemax
-isc_mempool_setfreemax
-isc_mempool_getfreecount
-isc_mempool_getmaxalloc
-isc_mempool_setmaxalloc
-isc_mempool_getallocated
-isc_mempool_getfillcount
-isc_mempool_setfillcount
-isc__mem_get
-isc__mem_putanddetach
-isc__mem_put
-isc__mem_allocate
-isc__mem_free
-isc__mem_strdup
-isc__mempool_get
-isc__mempool_put
-isc_msgcat_open
-isc_msgcat_close
-isc_msgcat_get
-isc_mutexblock_init
-isc_mutexblock_destroy
-isc_netaddr_equal
-isc_netaddr_eqprefix
-isc_netaddr_masktoprefixlen
-isc_netaddr_totext
-isc_netaddr_format
-isc_netaddr_fromsockaddr
-isc_netaddr_fromin
-isc_netaddr_fromin6
-isc_netaddr_any
-isc_netaddr_any6
-isc_netaddr_ismulticast
-isc_netaddr_fromv4mapped
-isc_ntpaths_init
-isc_ntpaths_get
-isc_ondestroy_init
-isc_ondestroy_register
-isc_ondestroy_notify
-isc_task_sendanddetach
-isc_os_ncpus
-isc_quota_init
-isc_quota_destroy
-isc_quota_reserve
-isc_quota_release
-isc_quota_attach
-isc_quota_detach
-isc_random_seed
-isc_random_get
-isc_random_jitter
-isc_ratelimiter_create
-isc_ratelimiter_setinterval
-isc_ratelimiter_setpertic
-isc_ratelimiter_enqueue
-isc_ratelimiter_shutdown
-isc_ratelimiter_attach
-isc_ratelimiter_detach
-isc_resource_setlimit
-isc_resource_getlimit
-isc_result_totext
-isc_result_register
-isc_rwlock_init
-isc_rwlock_lock
-isc_rwlock_trylock
-isc_rwlock_unlock
+LIBRARY libisc
+
+; Exported Functions
+EXPORTS
+
+isc_assertion_setcallback
+isc_assertion_typetotext
+isc_base64_totext
+isc_base64_decodestring
+isc_base64_tobuffer
+isc_bitstring_init
+isc_bitstring_invalidate
+isc_bitstring_copy
+isc_buffer_allocate
+isc_buffer_free
+isc__buffer_init
+isc__buffer_invalidate
+isc__buffer_region
+isc__buffer_usedregion
+isc__buffer_availableregion
+isc__buffer_add
+isc__buffer_subtract
+isc__buffer_clear
+isc__buffer_consumedregion
+isc__buffer_remainingregion
+isc__buffer_activeregion
+isc__buffer_setactive
+isc__buffer_first
+isc__buffer_forward
+isc__buffer_back
+isc_buffer_compact
+isc_buffer_getuint8
+isc__buffer_putuint8
+isc_buffer_getuint16
+isc__buffer_putuint16
+isc_buffer_getuint32
+isc__buffer_putuint32
+isc__buffer_putmem
+isc__buffer_putstr
+isc_buffer_copyregion
+isc_bufferlist_usedcount
+isc_bufferlist_availablecount
+isc_commandline_parse
+
+
+isc_entropy_create
+isc_entropy_attach
+isc_entropy_detach
+isc_entropy_createfilesource
+isc_entropy_destroysource
+isc_entropy_createsamplesource
+isc_entropy_createcallbacksource
+isc_entropy_stopcallbacksources
+isc_entropy_addcallbacksample
+isc_entropy_addsample
+isc_entropy_getdata
+isc_entropy_putdata
+isc_entropy_stats
+isc_entropy_usebestsource
+isc_error_setunexpected
+isc_error_setfatal
+isc_error_unexpected
+isc_error_fatal
+isc_error_runtimecheck
+isc_event_allocate
+isc_event_free
+isc_file_settime
+isc_file_getmodtime
+isc_file_mktemplate
+isc_file_openunique
+isc_file_remove
+isc_file_rename
+isc_file_exists
+isc_file_ischdiridempotent
+isc_file_isabsolute
+isc_file_iscurrentdir
+isc_file_template
+isc_file_renameunique
+isc_file_basename
+isc_file_progname
+isc_file_safemovefile
+isc_file_absolutepath
+isc_fsaccess_add
+isc_fsaccess_remove
+isc_fsaccess_set
+isc_hash_calc
+isc_hash_create
+isc_hash_ctxattach
+isc_hash_ctxcalc
+isc_hash_ctxcreate
+isc_hash_ctxdetach
+isc_hash_ctxinit
+isc_hash_destroy
+isc_hash_init
+isc_hex_totext
+isc_hex_decodestring
+isc_hex_tobuffer
+isc_hmacmd5_init
+isc_hmacmd5_invalidate
+isc_hmacmd5_update
+isc_hmacmd5_sign
+isc_hmacmd5_verify
+isc_interfaceiter_create
+isc_interfaceiter_first
+isc_interfaceiter_current
+isc_interfaceiter_next
+isc_interfaceiter_destroy
+isc_lex_setcomments
+isc_lex_create
+isc_lex_destroy
+isc_lex_getcomments
+isc_lex_setcomments
+isc_lex_getspecials
+isc_lex_setspecials
+isc_lex_openfile
+isc_lex_openstream
+isc_lex_openbuffer
+isc_lex_close
+isc_lex_gettoken
+isc_lex_getmastertoken
+isc_lex_ungettoken
+isc_lex_getlasttokentext
+isc_lex_getsourcename
+isc_lex_getsourceline
+isc_lex_isfile
+isc_lfsr_init
+isc_lfsr_generate
+isc_lfsr_skip
+isc_lfsr_generate32
+isc_lib_initmsgcat
+isc_log_createchannel
+isc_log_createchannel
+isc_log_create
+isc_logconfig_create
+isc_logconfig_get
+isc_logconfig_use
+isc_log_destroy
+isc_logconfig_destroy
+isc_log_registercategories
+isc_log_registermodules
+isc_log_createchannel
+isc_log_usechannel
+isc_log_write
+isc_log_vwrite
+isc_log_write1
+isc_log_vwrite1
+isc_log_iwrite
+isc_log_ivwrite
+isc_log_iwrite1
+isc_log_ivwrite1
+isc_log_setdebuglevel
+isc_log_getdebuglevel
+isc_log_wouldlog
+isc_log_write
+isc_log_setduplicateinterval
+isc_log_getduplicateinterval
+isc_log_settag
+isc_log_gettag
+isc_log_opensyslog
+isc_log_closefilelogs
+isc_log_categorybyname
+isc_log_modulebyname
+isc_log_setcontext
+isc_md5_init
+isc_md5_invalidate
+isc_md5_update
+isc_md5_final
+isc_mem_attach
+isc_mem_detach
+isc_mem_detach
+isc_mem_create
+isc_mem_createx
+isc_mem_attach
+isc_mem_detach
+isc_mem_destroy
+isc_mem_ondestroy
+isc_mem_stats
+isc_mem_setdestroycheck
+isc_mem_setquota
+isc_mem_getquota
+isc_mem_inuse
+isc_mem_setwater
+isc_mempool_create
+isc_mempool_destroy
+isc_mempool_setname
+isc_mempool_associatelock
+isc_mempool_getfreemax
+isc_mempool_setfreemax
+isc_mempool_getfreecount
+isc_mempool_getmaxalloc
+isc_mempool_setmaxalloc
+isc_mempool_getallocated
+isc_mempool_getfillcount
+isc_mempool_setfillcount
+isc__mem_get
+isc__mem_putanddetach
+isc__mem_put
+isc__mem_allocate
+isc__mem_free
+isc__mem_strdup
+isc__mempool_get
+isc__mempool_put
+isc_msgcat_open
+isc_msgcat_close
+isc_msgcat_get
+isc_mutexblock_init
+isc_mutexblock_destroy
+isc_netaddr_equal
+isc_netaddr_eqprefix
+isc_netaddr_masktoprefixlen
+isc_netaddr_totext
+isc_netaddr_format
+isc_netaddr_fromsockaddr
+isc_netaddr_fromin
+isc_netaddr_fromin6
+isc_netaddr_any
+isc_netaddr_any6
+isc_netaddr_ismulticast
+isc_netaddr_fromv4mapped
+isc_ntpaths_init
+isc_ntpaths_get
+isc_ondestroy_init
+isc_ondestroy_register
+isc_ondestroy_notify
+isc_task_sendanddetach
+isc_os_ncpus
+isc_quota_init
+isc_quota_destroy
+isc_quota_reserve
+isc_quota_release
+isc_quota_attach
+isc_quota_detach
+isc_random_seed
+isc_random_get
+isc_random_jitter
+isc_ratelimiter_create
+isc_ratelimiter_setinterval
+isc_ratelimiter_setpertic
+isc_ratelimiter_enqueue
+isc_ratelimiter_shutdown
+isc_ratelimiter_attach
+isc_ratelimiter_detach
+isc_resource_setlimit
+isc_resource_getlimit
+isc_result_totext
+isc_result_register
+isc_rwlock_init
+isc_rwlock_lock
+isc_rwlock_trylock
+isc_rwlock_unlock
isc_rwlock_destroy
-isc_serial_lt
-isc_serial_gt
-isc_serial_le
-isc_serial_ge
-isc_serial_eq
-isc_serial_ne
-isc_sha1_init
-isc_sha1_invalidate
-isc_sha1_update
-isc_sha1_final
-isc_sockaddr_equal
-isc_sockaddr_eqaddr
-isc_sockaddr_eqaddrprefix
-isc_sockaddr_hash
-isc_sockaddr_any
-isc_sockaddr_any6
-isc_sockaddr_anyofpf
-isc_sockaddr_fromin
-isc_sockaddr_fromin6
-isc_sockaddr_v6fromin
-isc_sockaddr_fromnetaddr
-isc_sockaddr_pf
-isc_sockaddr_setport
-isc_sockaddr_getport
-isc_sockaddr_totext
-isc_sockaddr_format
-isc_sockaddr_ismulticast
-isc_socket_create
-isc_socket_cancel
-;isc_socket_shutdown
-isc_socket_attach
-isc_socket_detach
-isc_socket_bind
-isc_socket_listen
-isc_socket_accept
-isc_socket_connect
-isc_socket_getpeername
-isc_socket_getsockname
-isc_socket_recv
-isc_socket_recvv
-isc_socket_recv2
-isc_socket_send
-isc_socket_sendto
-isc_socket_sendv
-isc_socket_sendtov
-isc_socket_sendto2
-isc_socketmgr_create
-isc_socketmgr_destroy
-isc_socket_gettype
-isc_socket_isbound
-isc_stdio_open
-isc_stdio_close
-isc_stdio_seek
-isc_stdio_read
-isc_stdio_write
-isc_stdio_flush
-isc_stdio_sync
-isc_string_touint64
-isc_string_separate
-isc_symtab_create
-isc_symtab_destroy
-isc_symtab_lookup
-isc_symtab_define
-isc_symtab_undefine
-isc_task_create
-isc_task_attach
-isc_task_detach
-isc_task_send
-isc_task_sendanddetach
-isc_task_purgerange
-isc_task_purge
-isc_task_purgeevent
-isc_task_unsendrange
-isc_task_unsend
-isc_task_onshutdown
-isc_task_shutdown
-isc_task_destroy
-isc_task_setname
-isc_task_getname
-isc_task_gettag
-isc_task_beginexclusive
-isc_task_endexclusive
-isc_task_endexclusive
-isc_taskmgr_create
-isc_taskmgr_destroy
-isc_taskpool_create
-isc_taskpool_gettask
-isc_taskpool_destroy
-isc_timer_create
-isc_timer_reset
-isc_timer_touch
-isc_timer_attach
-isc_timer_detach
-isc_timermgr_create
-isc_timermgr_destroy
-isc_condition_init
-isc_condition_wait
-isc_condition_signal
-isc_condition_broadcast
-isc_condition_destroy
-isc_condition_waituntil
-isc_dir_init
-isc_dir_open
-isc_dir_read
-isc_dir_reset
-isc_dir_close
-isc_dir_chdir
-isc_dir_chroot
-isc_dir_current
-isc_net_probeipv4
-isc_net_probeipv6
-isc_net_ntop
-isc_net_pton
-isc_net_aton
-isc_once_do
-isc_stdtime_get
-
-isc_thread_create
-isc_thread_join
-isc_thread_setconcurrency
-isc_interval_set
-isc_time_subtract
-isc_interval_iszero
-isc_time_settoepoch
-isc_time_isepoch
-isc_time_now
-isc_time_nowplusinterval
-isc_time_compare
-isc_time_add
-isc_time_subtract
-isc_time_microdiff
-isc_time_nanoseconds
-isc_keyboard_open
-isc_keyboard_close
-isc_keyboard_getchar
-isc_keyboard_canceled
-isc_app_start
-isc_app_onrun
-isc_app_run
-isc_app_shutdown
-isc_app_reload
-isc_app_finish
-isc_app_block
-isc_app_unblock
-isc_thread_create
-isc_thread_join
-isc_thread_setconcurrency
-isc_net_probeipv4
-isc_net_probeipv6
-isc_net_ntop
-isc_net_pton
-isc_net_aton
-openlog
-syslog
-closelog
-isc_syslog_facilityfromstring
-isc_ntfile_fopen
-isc_ntfile_fclose
-isc_ntfile_fwrite
-isc_ntfile_fread
-isc_ntfile_fseek
-isc_ntfile_flush
-isc_ntfile_sync
-isc_ntfile_printf
-isc_ntfile_fprintf
-isc_ntfile_vfprintf
-isc_ntfile_getaddress
-isc_ntfile_getc
-isc_ntfile_fgetc
-isc_ntfile_fgets
-isc_ntfile_fputc
-isc_ntfile_fputs
-isc_ntfile_fgetpos
-isc_ntfile_freopen
-isc_ntfile_fdopen
-isc_ntfile_open
-isc_ntfile_close
-isc_ntfile_read
-isc_ntfile_write
-
-
-; Exported Data
-
-EXPORTS
-
-;isc_categories
-;isc_lctx
-;isc_modules
-
-isc_mem_debugging DATA
-
-isc_commandline_index
-isc_commandline_option DATA
-isc_commandline_argument DATA
-isc_commandline_progname DATA
-isc_commandline_errprint DATA
-isc_commandline_reset DATA
-isc_assertion_failed DATA
-_iob DATA
-
+isc_rwlock_tryupgrade
+isc_rwlock_downgrade
+isc_serial_lt
+isc_serial_gt
+isc_serial_le
+isc_serial_ge
+isc_serial_eq
+isc_serial_ne
+isc_sha1_init
+isc_sha1_invalidate
+isc_sha1_update
+isc_sha1_final
+isc_sockaddr_equal
+isc_sockaddr_eqaddr
+isc_sockaddr_eqaddrprefix
+isc_sockaddr_hash
+isc_sockaddr_any
+isc_sockaddr_any6
+isc_sockaddr_anyofpf
+isc_sockaddr_fromin
+isc_sockaddr_fromin6
+isc_sockaddr_v6fromin
+isc_sockaddr_fromnetaddr
+isc_sockaddr_pf
+isc_sockaddr_setport
+isc_sockaddr_getport
+isc_sockaddr_totext
+isc_sockaddr_format
+isc_sockaddr_ismulticast
+isc_socket_create
+isc_socket_cancel
+;isc_socket_shutdown
+isc_socket_attach
+isc_socket_detach
+isc_socket_bind
+isc_socket_listen
+isc_socket_accept
+isc_socket_connect
+isc_socket_getpeername
+isc_socket_getsockname
+isc_socket_recv
+isc_socket_recvv
+isc_socket_recv2
+isc_socket_send
+isc_socket_sendto
+isc_socket_sendv
+isc_socket_sendtov
+isc_socket_sendto2
+isc_socketmgr_create
+isc_socketmgr_destroy
+isc_socket_gettype
+isc_socket_isbound
+isc_stdio_open
+isc_stdio_close
+isc_stdio_seek
+isc_stdio_read
+isc_stdio_write
+isc_stdio_flush
+isc_stdio_sync
+isc__strerror
+isc_string_touint64
+isc_string_separate
+isc_symtab_create
+isc_symtab_destroy
+isc_symtab_lookup
+isc_symtab_define
+isc_symtab_undefine
+isc_task_create
+isc_task_attach
+isc_task_detach
+isc_task_send
+isc_task_sendanddetach
+isc_task_purgerange
+isc_task_purge
+isc_task_purgeevent
+isc_task_unsendrange
+isc_task_unsend
+isc_task_onshutdown
+isc_task_shutdown
+isc_task_destroy
+isc_task_setname
+isc_task_getname
+isc_task_gettag
+isc_task_beginexclusive
+isc_task_endexclusive
+isc_task_endexclusive
+isc_taskmgr_create
+isc_taskmgr_destroy
+isc_taskpool_create
+isc_taskpool_gettask
+isc_taskpool_destroy
+isc_timer_create
+isc_timer_reset
+isc_timer_touch
+isc_timer_attach
+isc_timer_detach
+isc_timermgr_create
+isc_timermgr_destroy
+isc_condition_init
+isc_condition_wait
+isc_condition_signal
+isc_condition_broadcast
+isc_condition_destroy
+isc_condition_waituntil
+isc_dir_init
+isc_dir_open
+isc_dir_read
+isc_dir_reset
+isc_dir_close
+isc_dir_chdir
+isc_dir_chroot
+isc_dir_current
+isc_net_probeipv4
+isc_net_probeipv6
+isc_net_ntop
+isc_net_pton
+isc_net_aton
+isc_once_do
+isc_stdtime_get
+
+isc_thread_create
+isc_thread_join
+isc_thread_setconcurrency
+isc_interval_set
+isc_time_subtract
+isc_interval_iszero
+isc_time_settoepoch
+isc_time_isepoch
+isc_time_now
+isc_time_nowplusinterval
+isc_time_compare
+isc_time_add
+isc_time_subtract
+isc_time_microdiff
+isc_time_nanoseconds
+isc_keyboard_open
+isc_keyboard_close
+isc_keyboard_getchar
+isc_keyboard_canceled
+isc_app_start
+isc_app_onrun
+isc_app_run
+isc_app_shutdown
+isc_app_reload
+isc_app_finish
+isc_app_block
+isc_app_unblock
+isc_thread_create
+isc_thread_join
+isc_thread_setconcurrency
+isc_net_probeipv4
+isc_net_probeipv6
+isc_net_ntop
+isc_net_pton
+isc_net_aton
+openlog
+syslog
+closelog
+isc_syslog_facilityfromstring
+isc_ntfile_fopen
+isc_ntfile_fclose
+isc_ntfile_fwrite
+isc_ntfile_fread
+isc_ntfile_fseek
+isc_ntfile_flush
+isc_ntfile_sync
+isc_ntfile_printf
+isc_ntfile_fprintf
+isc_ntfile_vfprintf
+isc_ntfile_getaddress
+isc_ntfile_getc
+isc_ntfile_fgetc
+isc_ntfile_fgets
+isc_ntfile_fputc
+isc_ntfile_fputs
+isc_ntfile_fgetpos
+isc_ntfile_freopen
+isc_ntfile_fdopen
+isc_ntfile_open
+isc_ntfile_close
+isc_ntfile_read
+isc_ntfile_write
+
+
+; Exported Data
+
+EXPORTS
+
+;isc_categories
+;isc_lctx
+;isc_modules
+
+isc_mem_debugging DATA
+
+isc_commandline_index
+isc_commandline_option DATA
+isc_commandline_argument DATA
+isc_commandline_progname DATA
+isc_commandline_errprint DATA
+isc_commandline_reset DATA
+isc_assertion_failed DATA
+_iob DATA
+
diff --git a/lib/isc/win32/libisc.dsp b/lib/isc/win32/libisc.dsp
index a9a4b465..0cfc4522 100644
--- a/lib/isc/win32/libisc.dsp
+++ b/lib/isc/win32/libisc.dsp
@@ -1,676 +1,700 @@
-# Microsoft Developer Studio Project File - Name="libisc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libisc - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libisc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libisc.mak" CFG="libisc - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libisc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libisc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libisc - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../" /I "include" /I "../include" /I "win32" /I "../../isccfg/include" /D "WIN32" /D "NDEBUG" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libisc.dll"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "libisc - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "win32" /I "../../isccfg/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /map /debug /machine:I386 /out:"../../../Build/Debug/libisc.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "libisc - Win32 Release"
-# Name "libisc - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\app.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\condition.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dir.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\DLLMain.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\entropy.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\errno2result.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\fsaccess.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\interfaceiter.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ipv6.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\keyboard.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\net.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ntfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ntpaths.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\once.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\os.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\resource.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\socket.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\stdio.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\stdtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\syslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\thread.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\version.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\include\isc\app.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\assertions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\bind_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\bindevt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\bitstring.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\boolean.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\buffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\bufferlist.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\commandline.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\condition.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\entropy.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\errno2result.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\error.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\event.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\eventclass.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\formatcheck.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\fsaccess.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\heap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\hex.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\hmacmd5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\int.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\interfaceiter.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\ipv6.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\keyboard.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\lang.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\lex.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\lfsr.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\lib.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\list.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\log.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\magic.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\mem.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\msgcat.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\msioctl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\mutex.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\mutexblock.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\net.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\netaddr.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\netdb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\ntfile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\ntpaths.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\offset.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\once.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\ondestroy.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\os.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\platform.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\print.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\quota.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\random.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\ratelimiter.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\region.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\resource.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\result.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\resultclass.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\rwlock.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\serial.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\sha1.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\sockaddr.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\socket.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\stat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\stdio.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\stdtime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\string.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\symtab.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\task.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\taskpool.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\thread.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\isc\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\timer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\types.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\unistd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isc\util.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\versions.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "Main Isc Lib"
-
-# PROP Default_Filter "c"
-# Begin Source File
-
-SOURCE=..\assertions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\bitstring.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\buffer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\bufferlist.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\commandline.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\error.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\event.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\heap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hmacmd5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\inet_aton.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\inet_ntop.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\inet_pton.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lfsr.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\log.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\mem.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\nls\msgcat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\mutexblock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\netaddr.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ondestroy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\quota.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\random.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ratelimiter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\result.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\rwlock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\serial.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sha1.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sockaddr.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\symtab.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\task.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\taskpool.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\timer.c
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\libisc.def
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="libisc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libisc - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libisc.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libisc.mak" CFG="libisc - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libisc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libisc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libisc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../" /I "include" /I "../include" /I "win32" /I "../../isccfg/include" /D "WIN32" /D "NDEBUG" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libisc.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "libisc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "win32" /I "../../isccfg/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /map /debug /machine:I386 /out:"../../../Build/Debug/libisc.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "libisc - Win32 Release"
+# Name "libisc - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\app.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\condition.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\dir.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\DLLMain.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\entropy.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\errno2result.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\file.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\fsaccess.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\interfaceiter.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ipv6.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\keyboard.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\net.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ntfile.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ntpaths.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\once.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\os.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\socket.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strerror.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\stdio.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\stdtime.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\syslog.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\thread.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\time.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\version.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\include\isc\app.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\assertions.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\base64.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\bind_registry.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\bindevt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\bitstring.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\boolean.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\buffer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\bufferlist.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\commandline.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\condition.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\dir.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\entropy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\errno2result.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\error.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\event.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\eventclass.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\file.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\formatcheck.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\fsaccess.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\hash.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\heap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\hex.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\hmacmd5.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\int.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\interfaceiter.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\ipv6.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\keyboard.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\lang.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\lex.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\lfsr.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\lib.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\list.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\log.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\magic.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\md5.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\mem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\msgcat.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\msioctl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\mutex.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\mutexblock.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\net.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\netaddr.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\netdb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\ntfile.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\ntpaths.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\offset.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\once.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\ondestroy.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\os.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\platform.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\print.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\quota.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\random.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\ratelimiter.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\region.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\result.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\resultclass.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\rwlock.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\serial.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\sha1.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\sockaddr.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\socket.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\stat.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\stdio.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\strerror.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\stdtime.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\string.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\symtab.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\syslog.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\syslog.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\task.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\taskpool.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\thread.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\time.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\timer.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\isc\win32os.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\types.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\unistd.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isc\util.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\versions.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Main Isc Lib"
+
+# PROP Default_Filter "c"
+# Begin Source File
+
+SOURCE=..\assertions.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\bitstring.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\buffer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\bufferlist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\commandline.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\error.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\event.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\hash.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\heap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\hex.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\hmacmd5.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\inet_aton.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\inet_ntop.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\inet_pton.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lex.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lfsr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\log.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\md5.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\mem.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\nls\msgcat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\mutexblock.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\netaddr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ondestroy.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\quota.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\random.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ratelimiter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\result.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\rwlock.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\serial.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sha1.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sockaddr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\string.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\symtab.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\task.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\taskpool.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\timer.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\win32os.c
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\libisc.def
+# End Source File
+# End Target
+# End Project
diff --git a/lib/isc/win32/libisc.dsw b/lib/isc/win32/libisc.dsw
index c66c56e5..49c089c8 100644
--- a/lib/isc/win32/libisc.dsw
+++ b/lib/isc/win32/libisc.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "libisc"=".\libisc.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libisc"=".\libisc.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/lib/isc/win32/libisc.mak b/lib/isc/win32/libisc.mak
index aa366c2d..6f4e5f19 100644
--- a/lib/isc/win32/libisc.mak
+++ b/lib/isc/win32/libisc.mak
@@ -50,6 +50,7 @@ CLEAN :
-@erase "$(INTDIR)\event.obj"
-@erase "$(INTDIR)\file.obj"
-@erase "$(INTDIR)\fsaccess.obj"
+ -@erase "$(INTDIR)\hash.obj"
-@erase "$(INTDIR)\heap.obj"
-@erase "$(INTDIR)\hex.obj"
-@erase "$(INTDIR)\hmacmd5.obj"
@@ -85,6 +86,7 @@ CLEAN :
-@erase "$(INTDIR)\sockaddr.obj"
-@erase "$(INTDIR)\socket.obj"
-@erase "$(INTDIR)\stdio.obj"
+ -@erase "$(INTDIR)\strerror.obj"
-@erase "$(INTDIR)\stdtime.obj"
-@erase "$(INTDIR)\string.obj"
-@erase "$(INTDIR)\symtab.obj"
@@ -96,6 +98,7 @@ CLEAN :
-@erase "$(INTDIR)\timer.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\version.obj"
+ -@erase "$(INTDIR)\win32os.obj"
-@erase "$(OUTDIR)\libisc.exp"
-@erase "$(OUTDIR)\libisc.lib"
-@erase "..\..\..\Build\Release\libisc.dll"
@@ -167,6 +170,7 @@ LINK32_OBJS= \
"$(INTDIR)\resource.obj" \
"$(INTDIR)\socket.obj" \
"$(INTDIR)\stdio.obj" \
+ "$(INTDIR)\strerror.obj" \
"$(INTDIR)\stdtime.obj" \
"$(INTDIR)\syslog.obj" \
"$(INTDIR)\thread.obj" \
@@ -180,6 +184,7 @@ LINK32_OBJS= \
"$(INTDIR)\commandline.obj" \
"$(INTDIR)\error.obj" \
"$(INTDIR)\event.obj" \
+ "$(INTDIR)\hash.obj" \
"$(INTDIR)\heap.obj" \
"$(INTDIR)\hex.obj" \
"$(INTDIR)\hmacmd5.obj" \
@@ -208,7 +213,8 @@ LINK32_OBJS= \
"$(INTDIR)\symtab.obj" \
"$(INTDIR)\task.obj" \
"$(INTDIR)\taskpool.obj" \
- "$(INTDIR)\timer.obj"
+ "$(INTDIR)\timer.obj" \
+ "$(INTDIR)\win32os.obj"
"..\..\..\Build\Release\libisc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
@@ -259,6 +265,8 @@ CLEAN :
-@erase "$(INTDIR)\file.sbr"
-@erase "$(INTDIR)\fsaccess.obj"
-@erase "$(INTDIR)\fsaccess.sbr"
+ -@erase "$(INTDIR)\hash.obj"
+ -@erase "$(INTDIR)\hash.sbr"
-@erase "$(INTDIR)\heap.obj"
-@erase "$(INTDIR)\heap.sbr"
-@erase "$(INTDIR)\hex.obj"
@@ -329,6 +337,8 @@ CLEAN :
-@erase "$(INTDIR)\socket.sbr"
-@erase "$(INTDIR)\stdio.obj"
-@erase "$(INTDIR)\stdio.sbr"
+ -@erase "$(INTDIR)\strerror.obj"
+ -@erase "$(INTDIR)\strerror.sbr"
-@erase "$(INTDIR)\stdtime.obj"
-@erase "$(INTDIR)\stdtime.sbr"
-@erase "$(INTDIR)\string.obj"
@@ -351,6 +361,8 @@ CLEAN :
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(INTDIR)\version.obj"
-@erase "$(INTDIR)\version.sbr"
+ -@erase "$(INTDIR)\win32os.obj"
+ -@erase "$(INTDIR)\win32os.sbr"
-@erase "$(OUTDIR)\libisc.bsc"
-@erase "$(OUTDIR)\libisc.exp"
-@erase "$(OUTDIR)\libisc.lib"
@@ -420,6 +432,7 @@ BSC32_SBRS= \
"$(INTDIR)\resource.sbr" \
"$(INTDIR)\socket.sbr" \
"$(INTDIR)\stdio.sbr" \
+ "$(INTDIR)\strerror.sbr" \
"$(INTDIR)\stdtime.sbr" \
"$(INTDIR)\syslog.sbr" \
"$(INTDIR)\thread.sbr" \
@@ -433,6 +446,7 @@ BSC32_SBRS= \
"$(INTDIR)\commandline.sbr" \
"$(INTDIR)\error.sbr" \
"$(INTDIR)\event.sbr" \
+ "$(INTDIR)\hash.sbr" \
"$(INTDIR)\heap.sbr" \
"$(INTDIR)\hex.sbr" \
"$(INTDIR)\hmacmd5.sbr" \
@@ -461,7 +475,8 @@ BSC32_SBRS= \
"$(INTDIR)\symtab.sbr" \
"$(INTDIR)\task.sbr" \
"$(INTDIR)\taskpool.sbr" \
- "$(INTDIR)\timer.sbr"
+ "$(INTDIR)\timer.sbr" \
+ "$(INTDIR)\win32os.sbr" \
"$(OUTDIR)\libisc.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
@@ -492,6 +507,7 @@ LINK32_OBJS= \
"$(INTDIR)\resource.obj" \
"$(INTDIR)\socket.obj" \
"$(INTDIR)\stdio.obj" \
+ "$(INTDIR)\strerror.obj" \
"$(INTDIR)\stdtime.obj" \
"$(INTDIR)\syslog.obj" \
"$(INTDIR)\thread.obj" \
@@ -505,6 +521,7 @@ LINK32_OBJS= \
"$(INTDIR)\commandline.obj" \
"$(INTDIR)\error.obj" \
"$(INTDIR)\event.obj" \
+ "$(INTDIR)\hash.obj" \
"$(INTDIR)\heap.obj" \
"$(INTDIR)\hex.obj" \
"$(INTDIR)\hmacmd5.obj" \
@@ -533,7 +550,8 @@ LINK32_OBJS= \
"$(INTDIR)\symtab.obj" \
"$(INTDIR)\task.obj" \
"$(INTDIR)\taskpool.obj" \
- "$(INTDIR)\timer.obj"
+ "$(INTDIR)\timer.obj" \
+ "$(INTDIR)\win32os.obj"
"..\..\..\Build\Debug\libisc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
@@ -857,6 +875,22 @@ SOURCE=.\stdio.c
!ENDIF
+SOURCE=.\strerror.c
+
+!IF "$(CFG)" == "libisc - Win32 Release"
+
+
+"$(INTDIR)\strerror.obj" : $(SOURCE) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "libisc - Win32 Debug"
+
+
+"$(INTDIR)\strerror.obj" "$(INTDIR)\strerror.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+!ENDIF
+
SOURCE=.\stdtime.c
!IF "$(CFG)" == "libisc - Win32 Release"
@@ -1081,6 +1115,24 @@ SOURCE=..\event.c
!ENDIF
+SOURCE=..\hash.c
+
+!IF "$(CFG)" == "libisc - Win32 Release"
+
+
+"$(INTDIR)\hash.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "libisc - Win32 Debug"
+
+
+"$(INTDIR)\hash.obj" "$(INTDIR)\hash.sbr" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF
+
SOURCE=..\heap.c
!IF "$(CFG)" == "libisc - Win32 Release"
@@ -1603,6 +1655,24 @@ SOURCE=..\timer.c
!ENDIF
+SOURCE=.\win32os.c
+
+!IF "$(CFG)" == "libisc - Win32 Release"
+
+
+"$(INTDIR)\win32os.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "libisc - Win32 Debug"
+
+
+"$(INTDIR)\win32os.obj" "$(INTDIR)\win32os.sbr" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF
+
!ENDIF
diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c
index 119c4646..c0d681d6 100644
--- a/lib/isc/win32/net.c
+++ b/lib/isc/win32/net.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: net.c,v 1.3.8.2 2003/02/17 07:05:10 marka Exp $ */
+/* $Id: net.c,v 1.3.2.2 2003/03/06 04:38:24 marka Exp $ */
#include <config.h>
diff --git a/lib/isc/win32/netdb.h b/lib/isc/win32/netdb.h
index 7554c001..ecbb7387 100644
--- a/lib/isc/win32/netdb.h
+++ b/lib/isc/win32/netdb.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Internet Software Consortium.
+ * Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: netdb.h,v 1.2 2001/07/08 05:09:07 mayer Exp $ */
+/* $Id: netdb.h,v 1.2.2.2 2003/07/22 04:03:50 marka Exp $ */
#ifndef NETDB_H
#define NETDB_H 1
@@ -26,7 +26,7 @@
/*
* Define if <netdb.h> does not declare struct addrinfo.
*/
-
+#if _MSC_VER < 1300
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
@@ -37,7 +37,7 @@ struct addrinfo {
struct sockaddr *ai_addr; /* Binary address */
struct addrinfo *ai_next; /* Next structure in linked list */
};
-
+#endif
/*
* Undefine all #defines we are interested in as <netdb.h> may or may not have
diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c
index d9ed5f12..eecab87c 100644
--- a/lib/isc/win32/socket.c
+++ b/lib/isc/win32/socket.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 Internet Software Consortium.
+ * Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,8 +15,40 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.5.2.7 2002/07/31 03:10:58 mayer Exp $ */
+/* $Id: socket.c,v 1.5.2.13 2003/07/22 04:03:50 marka Exp $ */
+/* This code has been rewritten to take advantage of Windows Sockets
+ * I/O Completion Ports and Events. I/O Completion Ports is ONLY
+ * available on Windows NT, Windows 2000 and Windows XP series of
+ * the Windows Operating Systems. In CANNOT run on Windows 95, Windows 98
+ * or the follow-ons to those Systems.
+ *
+ * This code is by nature multithreaded and takes advantage of various
+ * features to pass on information through the completion port for
+ * when I/O is completed. All sends and receives are completed through
+ * the completion port. Due to an implementation bug in Windows 2000,
+ * Service Pack 2 must installed on the system for this code to run correctly.
+ * For details on this problem see Knowledge base article Q263823.
+ * The code checks for this. The number of Completion Port Worker threads
+ * used is the total number of CPU's + 1. This increases the likelihood that
+ * a Worker Thread is available for processing a completed request.
+ *
+ * All accepts and connects are accomplished through the WSAEventSelect()
+ * function and the event_wait loop. Events are added to and deleted from
+ * each event_wait thread via a common event_update stack owned by the socket
+ * manager. If the event_wait thread runs out of array space in the events
+ * array it will look for another event_wait thread to add the event. If it
+ * fails to find another one it will create a new thread to handle the
+ * outstanding event.
+ *
+ * A future enhancement is to use AcceptEx to take avantage of Overlapped
+ * I/O which allows for enhanced performance of TCP connections.
+ * This will also reduce the number of events that are waited on by the
+ * event_wait threads to just the connect sockets and reduce the number
+ * additional threads required.
+ *
+ * XXXPDM 5 August, 2002
+ */
#define MAKE_EXTERNAL 1
#include <config.h>
@@ -34,6 +66,7 @@
#include <unistd.h>
#include <io.h>
#include <fcntl.h>
+#include <process.h>
#include <isc/buffer.h>
#include <isc/bufferlist.h>
@@ -44,18 +77,31 @@
#include <isc/msgs.h>
#include <isc/mutex.h>
#include <isc/net.h>
+#include <isc/os.h>
#include <isc/platform.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/socket.h>
+#include <isc/strerror.h>
+#include <isc/syslog.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/util.h>
+#include <isc/win32os.h>
#include "errno2result.h"
-#define MAX_SELECT_SECONDS 0
-#define MAX_SELECT_MILLISECONDS 40
+/*
+ * Define this macro to control the behavior of connection
+ * resets on UDP sockets. See Microsoft KnowledgeBase Article Q263823
+ * for details.
+ * NOTE: This requires that Windows 2000 systems install Service Pack 2
+ * or later.
+ */
+#ifndef SIO_UDP_CONNRESET
+#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
+#endif
+
/*
* Some systems define the socket length argument as an int, some as size_t,
* some as socklen_t. This is here so it can be easily changed if needed.
@@ -73,6 +119,7 @@
* work around it here.
*/
#define SOFT_ERROR(e) ((e) == WSAEINTR || \
+ (e) == WSA_IO_PENDING || \
(e) == WSAEWOULDBLOCK || \
(e) == EWOULDBLOCK || \
(e) == EINTR || \
@@ -121,19 +168,6 @@ typedef isc_event_t intev_t;
* a setsockopt() like interface to request timestamps, and if the OS
* doesn't do it for us, call gettimeofday() on every UDP receive?
*/
-#ifdef SO_TIMESTAMP
-#ifndef USE_CMSG
-#define USE_CMSG 1
-#endif
-#endif
-
-/*
- * Check to see if we have even basic support for cracking messages from
- * the control data returned from/sent via recvmsg()/sendmsg().
- */
-#if defined(USE_CMSG) && (!defined(CMSG_LEN) || !defined(CMSG_SPACE))
-#undef USE_CMSG
-#endif
/*
* We really don't want to try and use these control messages. Win32
@@ -145,10 +179,7 @@ typedef isc_event_t intev_t;
* Message header for recvmsg and sendmsg calls.
* Used value-result for recvmsg, value only for sendmsg.
*/
-struct iovec {
- void *iov_base; /* starting address of buffer */
- size_t iov_len; /* size of buffer */
-};
+
struct msghdr {
void *msg_name; /* optional address */
@@ -159,7 +190,7 @@ struct msghdr {
u_int msg_controllen; /* ancillary data buffer len */
int msg_flags; /* flags on received message */
} msghdr;
-
+
/*
* The number of times a send operation is repeated if the result is EINTR.
*/
@@ -171,11 +202,20 @@ struct isc_socket {
isc_socketmgr_t *manager;
isc_mutex_t lock;
isc_sockettype_t type;
+ OVERLAPPED overlapped;
+ /* Pointers to scatter/gather buffers */
+ WSABUF iov[ISC_SOCKET_MAXSCATTERGATHER];
+ size_t totalBytes;
+ WSAEVENT hEvent; /* Event Handle */
+ long wait_type; /* Events to wait on */
+ WSAEVENT hAlert; /* Alert Event Handle */
+ DWORD evthread_id; /* Event Thread Id for socket */
+
/* Locked by socket lock. */
ISC_LINK(isc_socket_t) link;
unsigned int references;
- int fd;
+ SOCKET fd;
int pf;
ISC_LIST(isc_socketevent_t) send_list;
@@ -193,17 +233,80 @@ struct isc_socket {
isc_sockaddr_t address; /* remote address */
- unsigned int pending_recv : 1,
- pending_send : 1,
+ unsigned int pending_close : 1,
pending_accept : 1,
- listener : 1, /* listener socket */
+ iocp : 1, /* I/O Completion Port */
+ listener : 1, /* listener socket */
connected : 1,
connecting : 1, /* connect pending */
- bound : 1; /* bound to local addr */
+ bound : 1; /* bound to local addr */
-#ifdef ISC_NET_RECVOVERFLOW
- unsigned char overflow; /* used for MSG_TRUNC fake */
-#endif
+};
+
+/*
+ * I/O Completion ports Info structures
+ */
+
+static HANDLE hHeapHandle = NULL;
+static int iocp_total = 0;
+typedef struct IoCompletionInfo {
+ OVERLAPPED overlapped;
+ isc_socketevent_t *dev;
+ int request_type;
+ struct msghdr messagehdr;
+} IoCompletionInfo;
+
+/*
+ * Define a maximum number of I/O Completion Port worker threads
+ * to handle the load on the Completion Port. The actual number
+ * used is the number of CPU's + 1.
+ */
+#define MAX_IOCPTHREADS 20
+
+/*
+ * event_change structure to handle adds and deletes from the list of
+ * events in the Wait
+ */
+typedef struct event_change event_change_t;
+
+struct event_change {
+ isc_socket_t *sock;
+ WSAEVENT hEvent;
+ DWORD evthread_id;
+ SOCKET fd;
+ unsigned int action;
+ ISC_LINK(event_change_t) link;
+};
+
+/*
+ * Note: We are using an array here since *WaitForMultiple* wants an array
+ * WARNING: This value may not be greater than 64 since the
+ * WSAWaitForMultipleEvents function is limited to 64 events.
+ */
+
+#define MAX_EVENTS 64
+
+/*
+ * List of events being waited on and their associated sockets
+ */
+typedef struct sock_event_list {
+ int max_event;
+ int total_events;
+ isc_socket_t *aSockList[MAX_EVENTS];
+ WSAEVENT aEventList[MAX_EVENTS];
+} sock_event_list;
+
+/*
+ * Thread Event structure for managing the threads handling events
+ */
+typedef struct events_thread events_thread_t;
+
+struct events_thread {
+ isc_thread_t thread_handle; /* Thread's handle */
+ DWORD thread_id; /* Thread's id */
+ sock_event_list sockev_list;
+ isc_socketmgr_t *manager;
+ ISC_LINK(events_thread_t) link;
};
#define SOCKET_MANAGER_MAGIC ISC_MAGIC('I', 'O', 'm', 'g')
@@ -211,21 +314,21 @@ struct isc_socket {
struct isc_socketmgr {
/* Not locked. */
- unsigned int magic;
- isc_mem_t *mctx;
- isc_mutex_t lock;
+ unsigned int magic;
+ isc_mem_t *mctx;
+ isc_mutex_t lock;
/* Locked by manager lock. */
- ISC_LIST(isc_socket_t) socklist;
- fd_set read_fds;
- fd_set write_fds;
- fd_set except_fds;
- isc_socket_t *fds[FD_SETSIZE];
- int fdstate[FD_SETSIZE];
- int maxfd;
- int minfd;
- isc_thread_t watcher;
- isc_condition_t shutdown_ok;
- int pipe_fds[2];
+ ISC_LIST(event_change_t) event_updates;
+ ISC_LIST(isc_socket_t) socklist;
+ int event_written;
+ WSAEVENT prime_alert;
+ isc_boolean_t bShutdown;
+ ISC_LIST(events_thread_t) ev_threads;
+ isc_condition_t shutdown_ok;
+ HANDLE hIoCompletionPort;
+ int maxIOCPThreads;
+ HANDLE hIOCPThreads[MAX_IOCPTHREADS];
+ DWORD dwIOCPThreadIds[MAX_IOCPTHREADS];
};
#define CLOSED 0 /* this one must be zero */
@@ -236,68 +339,528 @@ struct isc_socketmgr {
* send() and recv() iovec counts
*/
#define MAXSCATTERGATHER_SEND (ISC_SOCKET_MAXSCATTERGATHER)
-#ifdef ISC_NET_RECVOVERFLOW
-# define MAXSCATTERGATHER_RECV (ISC_SOCKET_MAXSCATTERGATHER + 1)
-#else
-# define MAXSCATTERGATHER_RECV (ISC_SOCKET_MAXSCATTERGATHER)
-#endif
+#define MAXSCATTERGATHER_RECV (ISC_SOCKET_MAXSCATTERGATHER)
-static void send_recvdone_event(isc_socket_t *, isc_socketevent_t **);
-static void send_senddone_event(isc_socket_t *, isc_socketevent_t **);
+static isc_threadresult_t WINAPI event_wait(void *uap);
+static isc_threadresult_t WINAPI SocketIoThread(LPVOID ThreadContext);
static void free_socket(isc_socket_t **);
-static isc_result_t allocate_socket(isc_socketmgr_t *, isc_sockettype_t,
- isc_socket_t **);
-static void destroy(isc_socket_t **);
-static void internal_accept(isc_task_t *, isc_event_t *);
-static void internal_connect(isc_task_t *, isc_event_t *);
-static void internal_recv(isc_task_t *, isc_event_t *);
-static void internal_send(isc_task_t *, isc_event_t *);
-static void process_cmsg(isc_socket_t *, struct msghdr *, isc_socketevent_t *);
-static void build_msghdr_send(isc_socket_t *, isc_socketevent_t *,
- struct msghdr *, char *cmsg,
- WSABUF *, size_t *);
-static void build_msghdr_recv(isc_socket_t *, isc_socketevent_t *,
- struct msghdr *, char *cmsg,
- WSABUF *, size_t *);
-
-#define SELECT_POKE_SHUTDOWN (-1)
-#define SELECT_POKE_NOTHING (-2)
-#define SELECT_POKE_READ (-3)
-#define SELECT_POKE_ACCEPT (-3) /* Same as _READ */
-#define SELECT_POKE_WRITE (-4)
-#define SELECT_POKE_CONNECT (-5)
-#define SELECT_POKE_CLOSE (-6)
-
-long bpipe_written = 0;
+
+enum {
+ SOCKET_CANCEL,
+ SOCKET_SHUTDOWN,
+ SOCKET_RECV,
+ SOCKET_SEND,
+ SOCK_ACCEPT
+};
+
+enum {
+ EVENT_ADD,
+ EVENT_DELETE
+};
#define SOCK_DEAD(s) ((s)->references == 0)
+
+#if defined(ISC_SOCKET_DEBUG)
+/*
+ * This is used to dump the contents of the sock structure
+ * You should make sure that the sock is locked before
+ * dumping it. Since the code uses simple printf() statements
+ * it should only be used interactively.
+ */
+void
+sock_dump(isc_socket_t *sock) {
+ isc_socketevent_t *ldev;
+ isc_socket_newconnev_t *ndev;
+ isc_sockaddr_t addr;
+ char socktext[256];
+
+
+ isc_socket_getpeername(sock, &addr);
+ isc_sockaddr_format(&addr, socktext, sizeof(socktext));
+ printf("Remote Socket: %s\n", socktext);
+ isc_socket_getsockname(sock, &addr);
+ isc_sockaddr_format(&addr, socktext, sizeof(socktext));
+ printf("This Socket: %s\n", socktext);
+
+ printf("\n\t\tSock Dump\n");
+ printf("\t\tfd: %u\n", sock->fd);
+ printf("\t\treferences: %d\n", sock->references);
+ printf("\t\tpending_accept: %d\n", sock->pending_accept);
+ printf("\t\tpending_close: %d\n", sock->pending_close);
+ printf("\t\tconnecting: %d\n", sock->connecting);
+ printf("\t\tconnected: %d\n", sock->connected);
+ printf("\t\tbound: %d\n", sock->bound);
+ printf("\t\tiocp: %d\n", sock->iocp);
+ printf("\t\tsocket type: %d\n", sock->type);
+
+ printf("\n\t\tSock Recv List\n");
+ ldev = ISC_LIST_HEAD(sock->recv_list);
+ while (ldev != NULL) {
+ printf("\t\tdev: %p\n", ldev);
+ ldev = ISC_LIST_NEXT(ldev, ev_link);
+ }
+ printf("\n\t\tSock Send List\n");
+ ldev = ISC_LIST_HEAD(sock->send_list);
+ while (ldev != NULL) {
+ printf("\t\tdev: %p\n", ldev);
+ ldev = ISC_LIST_NEXT(ldev, ev_link);
+ }
+ printf("\n\t\tSock Accept List\n");
+ ndev = ISC_LIST_HEAD(sock->accept_list);
+ while (ndev != NULL) {
+ printf("\t\tdev: %p\n", ldev);
+ ndev = ISC_LIST_NEXT(ndev, ev_link);
+ }
+}
+#endif
+
+/* This function will add an entry to the I/O completion port
+ * that will signal the I/O thread to exit (gracefully)
+ */
+static void
+signal_iocompletionport_exit(isc_socketmgr_t *manager) {
+ int i;
+ int errval;
+ char strbuf[ISC_STRERRORSIZE];
+
+ REQUIRE(VALID_MANAGER(manager));
+ for (i = 0; i < manager->maxIOCPThreads; i++) {
+ if (!PostQueuedCompletionStatus(manager->hIoCompletionPort,
+ 0, 0, 0)) {
+ errval = GetLastError();
+ isc__strerror(errval, strbuf, sizeof(strbuf));
+ FATAL_ERROR(__FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_FAILED,
+ "Can't request service thread to exit: %s"),
+ strbuf);
+ }
+ }
+}
+
+/*
+ * Create the worker threads for the I/O Completion Port
+ */
+void
+iocompletionport_createthreads(int total_threads, isc_socketmgr_t *manager) {
+ int errval;
+ char strbuf[ISC_STRERRORSIZE];
+ int i;
+
+ INSIST(total_threads > 0);
+ REQUIRE(VALID_MANAGER(manager));
+ /*
+ * We need at least one
+ */
+ for (i = 0; i < total_threads; i++) {
+ manager->hIOCPThreads[i] = CreateThread( NULL, 0, SocketIoThread,
+ manager, 0,
+ &manager->dwIOCPThreadIds[i]);
+ if(manager->hIOCPThreads[i] == NULL) {
+ errval = GetLastError();
+ isc__strerror(errval, strbuf, sizeof(strbuf));
+ FATAL_ERROR(__FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_FAILED,
+ "Can't create IOCP thread: %s"),
+ strbuf);
+ }
+ }
+}
+
+/*
+ * Create/initialise the I/O completion port
+ */
+void
+iocompletionport_init(isc_socketmgr_t *manager) {
+ int errval;
+ char strbuf[ISC_STRERRORSIZE];
+
+ REQUIRE(VALID_MANAGER(manager));
+ /*
+ * Create a private heap to handle the socket overlapped structure
+ * The miniumum number of structures is 10, there is no maximum
+ */
+ hHeapHandle = HeapCreate(0, 10*sizeof(IoCompletionInfo), 0);
+ manager->maxIOCPThreads = min(isc_os_ncpus() + 1,
+ MAX_IOCPTHREADS);
+
+ /* Now Create the Completion Port */
+ manager->hIoCompletionPort = CreateIoCompletionPort(
+ INVALID_HANDLE_VALUE, NULL,
+ 0, manager->maxIOCPThreads);
+ if (manager->hIoCompletionPort == NULL) {
+ errval = GetLastError();
+ isc__strerror(errval, strbuf, sizeof(strbuf));
+ FATAL_ERROR(__FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_FAILED,
+ "CreateIoCompletionPort() failed "
+ "during initialization: %s"),
+ strbuf);
+ exit(1);
+ }
+
+ /*
+ * Worker threads for servicing the I/O
+ */
+ iocompletionport_createthreads(manager->maxIOCPThreads, manager);
+}
+
+
+void
+iocompletionport_exit(isc_socketmgr_t *manager) {
+
+ REQUIRE(VALID_MANAGER(manager));
+ if (manager->hIoCompletionPort != NULL) {
+ /* Get each of the service threads to exit
+ */
+ signal_iocompletionport_exit(manager);
+ }
+}
+
+/*
+ * Add sockets in here and pass the sock data in as part of the information needed
+ */
+void
+iocompletionport_update(isc_socket_t *sock) {
+ HANDLE hiocp;
+
+ REQUIRE(sock != NULL);
+ if(sock->iocp == 0) {
+ sock->iocp = 1;
+ hiocp = CreateIoCompletionPort((HANDLE) sock->fd,
+ sock->manager->hIoCompletionPort, (DWORD) sock,
+ sock->manager->maxIOCPThreads);
+ InterlockedIncrement(&iocp_total);
+
+ }
+}
+
+void
+socket_event_minit(sock_event_list *evlist) {
+ BOOL bReset;
+ int i;
+
+ REQUIRE(evlist != NULL);
+ /* Initialize the Event List */
+ evlist->max_event = 0;
+ evlist->total_events = 0;
+ for (i = 0; i < MAX_EVENTS; i++) {
+ evlist->aSockList[i] = NULL;
+ evlist->aEventList[i] = (WSAEVENT) 0;
+ }
+
+ evlist->aEventList[0] = WSACreateEvent();
+ (evlist->max_event)++;
+ bReset = WSAResetEvent(evlist->aEventList[0]);
+}
/*
- * Routine to handle error messages
+ * Event Thread Initialization
*/
+isc_result_t
+event_thread_create(events_thread_t **evthreadp, isc_socketmgr_t *manager) {
+ events_thread_t *evthread;
+
+ REQUIRE(VALID_MANAGER(manager));
+ REQUIRE(evthreadp != NULL && *evthreadp == NULL);
+
+ evthread = isc_mem_get(manager->mctx, sizeof(*evthread));
+ socket_event_minit(&evthread->sockev_list);
+ ISC_LINK_INIT(evthread, link);
+ evthread->manager = manager;
-#define ISC_STRERRORSIZE 128
+ ISC_LIST_APPEND(manager->ev_threads, evthread, link);
+ /*
+ * Start up the event wait thread.
+ */
+ if (isc_thread_create(event_wait, evthread, &evthread->thread_handle) !=
+ ISC_R_SUCCESS) {
+ isc_mem_put(manager->mctx, evthread, sizeof(*evthread));
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "isc_thread_create() %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
+ return (ISC_R_UNEXPECTED);
+ }
+ *evthreadp = evthread;
+ return (ISC_R_SUCCESS);
+}
+/*
+ * Locate a thread with space for additional events or create one if
+ * necessary. The manager is locked at this point so the information
+ * cannot be changed by another thread while we are searching.
+ */
void
-isc__strerror(int num, char *buf, size_t size) {
- char *msg;
- unsigned int unum = num;
+locate_available_thread(isc_socketmgr_t *manager) {
+ events_thread_t *evthread;
+ DWORD threadid = GetCurrentThreadId();
+
+ evthread = ISC_LIST_HEAD(manager->ev_threads);
+ while (evthread != NULL) {
+ /*
+ * We need to find a thread with space to add an event
+ * If we find it, alert it to process the event change
+ * list
+ */
+ if(threadid != evthread->thread_id &&
+ evthread->sockev_list.max_event < MAX_EVENTS) {
+ WSASetEvent(evthread->sockev_list.aEventList[0]);
+ return;
+ }
+ evthread = ISC_LIST_NEXT(evthread, link);
+ }
+ /*
+ * We need to create a new thread as other threads are full.
+ * If we succeed in creating the thread, alert it to
+ * process the event change list since it will have space.
+ * If we are unable to create one, the event will stay on the
+ * list and the next event_wait thread will try again to add
+ * the event. It will call here again if it has no space.
+ */
+ if (event_thread_create(&evthread, manager) == ISC_R_SUCCESS) {
+ WSASetEvent(evthread->sockev_list.aEventList[0]);
+ }
+
+}
+
+isc_boolean_t
+socket_eventlist_add(event_change_t *evchange, sock_event_list *evlist,
+ isc_socketmgr_t *manager) {
+ int max_event;
+ isc_socket_t *sock;
+ REQUIRE(evchange != NULL);
+
+ sock = evchange->sock;
+ REQUIRE(sock != NULL);
+ REQUIRE(sock->hEvent != NULL);
+ REQUIRE(evlist != NULL);
+
+ max_event = evlist->max_event;
+ if(max_event >= MAX_EVENTS) {
+ locate_available_thread(manager);
+ return (ISC_FALSE);
+ }
+
+ evlist->aSockList[max_event] = sock;
+ evlist->aEventList[max_event] = sock->hEvent;
+ evlist->max_event++;
+ evlist->total_events++;
+ sock->hAlert = evlist->aEventList[0];
+ sock->evthread_id = GetCurrentThreadId();
+ return (ISC_TRUE);
+}
+/*
+ * Note that the eventLock is locked before calling this function
+ * All Events and associated sockes are closed here
+ */
+isc_boolean_t
+socket_eventlist_delete(event_change_t *evchange, sock_event_list *evlist) {
+ int i;
+ WSAEVENT hEvent;
+ int iEvent = -1;
+
+ REQUIRE(evchange != NULL);
+ /* Make sure this is the right thread from which to delete the event */
+ if(evchange->evthread_id != GetCurrentThreadId())
+ return (ISC_FALSE);
+
+ REQUIRE(evlist != NULL);
+ REQUIRE(evchange->hEvent != NULL);
+ hEvent = evchange->hEvent;
+
+ /* Find the Event */
+ for (i = 1; i < evlist->max_event; i++) {
+ if (evlist->aEventList[i] == hEvent) {
+ iEvent = i;
+ break;
+ }
+ }
+ /* Actual event start at 1 */
+ if (iEvent < 1)
+ return (ISC_FALSE);
+
+ for(i = iEvent; i < (evlist->max_event - 1); i++) {
+ evlist->aEventList[i] = evlist->aEventList[i + 1];
+ evlist->aSockList[i] = evlist->aSockList[i + 1];
+ }
+ evlist->aEventList[evlist->max_event - 1] = 0;
+ evlist->aSockList[evlist->max_event - 1] = NULL;
- REQUIRE(buf != NULL);
+ /* Cleanup */
+ WSACloseEvent(hEvent);
+ if (evchange->fd >= 0)
+ closesocket(evchange->fd);
+ evlist->max_event--;
+ evlist->total_events--;
- msg = NTstrerror(num);
- if (msg != NULL)
- snprintf(buf, size, "%s", msg);
+ return (ISC_TRUE);
+}
+/*
+ * Get the event changes off of the list and apply the
+ * requested changes. The manager lock is taken out at
+ * the start of this function to prevent other event_wait
+ * threads processing the same information at the same
+ * time. The queue may not be empty on exit since other
+ * threads may be involved in processing the queue.
+ *
+ * The deletes are done first in order that there be space
+ * available for the events being added in the same thread
+ * in case the event list is almost full. This reduces the
+ * probability of having to create another thread which would
+ * increase overhead costs.
+ */
+isc_result_t
+process_eventlist(sock_event_list *evlist, isc_socketmgr_t *manager) {
+ event_change_t *evchange;
+ event_change_t *next;
+ isc_boolean_t del;
+
+ REQUIRE(evlist != NULL);
+
+ LOCK(&manager->lock);
+
+ /* First the deletes */
+ evchange = ISC_LIST_HEAD(manager->event_updates);
+ while (evchange != NULL) {
+ next = ISC_LIST_NEXT(evchange, link);
+ del = ISC_FALSE;
+ if(evchange->action == EVENT_DELETE) {
+ del = socket_eventlist_delete(evchange, evlist);
+
+ /* Delete only if this thread's socket list was updated */
+ if (del) {
+ ISC_LIST_DEQUEUE(manager->event_updates,
+ evchange, link);
+ HeapFree(hHeapHandle, 0, evchange);
+ manager->event_written--;
+ }
+ }
+ evchange = next;
+ }
+ /* Now the adds */
+ evchange = ISC_LIST_HEAD(manager->event_updates);
+ while (evchange != NULL) {
+ next = ISC_LIST_NEXT(evchange, link);
+ del = ISC_FALSE;
+ if(evchange->action == EVENT_ADD) {
+ del = socket_eventlist_add(evchange, evlist, manager);
+
+ /* Delete only if this thread's socket list was updated */
+ if (del) {
+ ISC_LIST_DEQUEUE(manager->event_updates,
+ evchange, link);
+ HeapFree(hHeapHandle, 0, evchange);
+ manager->event_written--;
+ }
+ }
+ evchange = next;
+ }
+ UNLOCK(&manager->lock);
+ return (ISC_R_SUCCESS);
+}
+/*
+ * Add the event list changes to the queue and notify the
+ * event loop
+ */
+static void
+notify_eventlist(isc_socket_t *sock, isc_socketmgr_t *manager,
+ unsigned int action) {
+
+ event_change_t *evchange;
+
+ REQUIRE(VALID_MANAGER(manager));
+ REQUIRE(sock != NULL);
+
+ evchange = HeapAlloc(hHeapHandle, HEAP_ZERO_MEMORY,
+ sizeof(event_change_t));
+ evchange->sock = sock;
+ evchange->action = action;
+ evchange->hEvent = sock->hEvent;
+ evchange->fd = sock->fd;
+ evchange->evthread_id = sock->evthread_id;
+
+ LOCK(&manager->lock);
+ ISC_LIST_APPEND(manager->event_updates, evchange, link);
+ sock->manager->event_written++;
+ UNLOCK(&manager->lock);
+
+ /* Alert the Wait List */
+ if (sock->hAlert != NULL)
+ WSASetEvent(sock->hAlert);
else
- snprintf(buf, size, "Unknown error: %u", unum);
+ WSASetEvent(manager->prime_alert);
}
+/*
+ * Note that the socket is already locked before calling this function
+ */
+isc_result_t
+socket_event_add(isc_socket_t *sock, long type) {
+ int stat;
+ WSAEVENT hEvent;
+ REQUIRE(sock != NULL);
+ hEvent = WSACreateEvent();
+ if (hEvent == WSA_INVALID_EVENT) {
+ stat = WSAGetLastError();
+ return (ISC_R_UNEXPECTED);
+ }
+ if (WSAEventSelect(sock->fd, hEvent, type) != 0) {
+ stat = WSAGetLastError();
+ WSACloseEvent(hEvent);
+ return (ISC_R_UNEXPECTED);
+ }
+ sock->hEvent = hEvent;
+
+ sock->wait_type = type;
+ notify_eventlist(sock, sock->manager, EVENT_ADD);
+ return (ISC_R_SUCCESS);
+}
/*
- * The following routines are here to handle Unix emulation until we
- * can rewrite the the routines in Winsock2 style.
+ * Note that the socket is not locked before calling this function
*/
+void
+socket_event_delete(isc_socket_t *sock) {
+ REQUIRE(sock != NULL);
+ REQUIRE(sock->hEvent != NULL);
+
+ if (sock->hEvent != NULL) {
+ sock->wait_type = 0;
+ sock->pending_close = 1;
+ notify_eventlist(sock, sock->manager, EVENT_DELETE);
+ sock->hEvent = NULL;
+ sock->hAlert = NULL;
+ sock->evthread_id = 0;
+ }
+
+}
+/*
+ * Routine to cleanup and then close the socket.
+ * Only close the socket here if it is NOT associated
+ * with an event, otherwise the WSAWaitForMultipleEvents
+ * may fail due to the fact that the the Wait should not
+ * be running while closing an event or a socket.
+ */
+void
+socket_close(isc_socket_t *sock) {
+
+ REQUIRE(sock != NULL);
+ sock->pending_close = 1;
+ if (sock->hEvent != NULL)
+ socket_event_delete(sock);
+ else {
+ closesocket(sock->fd);
+ }
+ if (sock->iocp) {
+ sock->iocp = 0;
+ InterlockedDecrement(&iocp_total);
+ }
+
+}
/*
* Initialize socket services
*/
@@ -312,106 +875,112 @@ BOOL InitSockets() {
err = WSAStartup(wVersionRequested, &wsaData);
if ( err != 0 ) {
/* Tell the user that we could not find a usable Winsock DLL */
- return (FALSE);
+ return(FALSE);
}
-
- return (TRUE);
+ return(TRUE);
}
int
-internal_pipe(int filedes[2]) {
- int status;
- unsigned int pipesize = 65535;
- int mode = _O_TEXT;
-
- status = _pipe(filedes, pipesize, mode);
- return (status);
- InterlockedExchange(&bpipe_written, 0);
-}
-
-int
-internal_sendmsg(int sock, const struct msghdr *msg, int flags, int *merror) {
+internal_sendmsg(isc_socket_t *sock, IoCompletionInfo *lpo,
+ struct msghdr *messagehdr, int flags, int *Error) {
+ int Result;
DWORD BytesSent;
DWORD Flags = flags;
-
- *merror = WSASendTo((SOCKET) sock,
- msg->msg_iov,
- msg->msg_iovlen,
- &BytesSent,
- Flags,
- msg->msg_name,
- msg->msg_namelen,
- NULL,
- NULL);
+ int total_sent;
+
+ *Error = 0;
+ Result = WSASendTo((SOCKET) sock->fd,
+ messagehdr->msg_iov,
+ messagehdr->msg_iovlen,
+ &BytesSent,
+ Flags,
+ messagehdr->msg_name,
+ messagehdr->msg_namelen,
+ (LPOVERLAPPED) lpo,
+ NULL);
+
+ total_sent = (int) BytesSent;
- if (*merror == SOCKET_ERROR) {
- BytesSent = -1;
- /* There is an error... */
- *merror = WSAGetLastError();
- if (*merror == WSA_IO_PENDING) {
- /* Overlapped send successfully initiated. */
- errno = EAGAIN;
- } else {
- /* An unexpected error occurred. */
- errno = *merror;
- }
- }
+ /* Check for errors.*/
+ if (Result == SOCKET_ERROR) {
- /* No error -- the I/O request was completed immediately... */
- return (BytesSent);
+ *Error = WSAGetLastError();
+
+ switch (*Error) {
+
+ case NO_ERROR :
+ case WSA_IO_INCOMPLETE :
+ case WSA_WAIT_IO_COMPLETION :
+ case WSA_IO_PENDING :
+ break ;
+
+ default :
+ return (-1);
+ break;
+ }
+ }
+ if(lpo != NULL)
+ return (0);
+ else
+ return (total_sent);
}
int
-internal_recvmsg(int sock, struct msghdr *msg, int flags, int *merror) {
- DWORD Flags = flags;
- DWORD NumBytes;
+internal_recvmsg(isc_socket_t *sock, IoCompletionInfo *lpo,
+ struct msghdr *messagehdr, int flags, int *Error) {
+ DWORD Flags = 0;
+ DWORD NumBytes = 0;
+ int total_bytes = 0;
int Result;
- Result = WSARecvFrom((SOCKET) sock,
- msg->msg_iov,
- msg->msg_iovlen,
- &NumBytes,
- &Flags,
- msg->msg_name,
- (int *)&(msg->msg_namelen),
- NULL,
- NULL);
+ *Error = 0;
+ Result = WSARecvFrom((SOCKET) sock->fd,
+ messagehdr->msg_iov,
+ messagehdr->msg_iovlen,
+ &NumBytes,
+ &Flags,
+ messagehdr->msg_name,
+ (int *)&(messagehdr->msg_namelen),
+ (LPOVERLAPPED) lpo,
+ NULL);
+ total_bytes = (int) NumBytes;
/* Check for errors. */
if (Result == SOCKET_ERROR) {
- *merror = WSAGetLastError();
- NumBytes = -1;
+
+ *Error = WSAGetLastError();
- switch (*merror) {
- case WSAEWOULDBLOCK:
- /*
- * No data received; return to wait for another
- * read event.
- */
- errno = EAGAIN;
- break;
+ switch (*Error) {
- default:
- /* Some other error... hit the panic button. */
- errno = *merror;
- break;
- }
+ case NO_ERROR :
+ case WSA_IO_INCOMPLETE :
+ case WSA_WAIT_IO_COMPLETION :
+ case WSA_IO_PENDING :
+ break ;
+
+ default :
+ return (-1);
+ break;
+ }
}
- msg->msg_flags = Flags; /* Return the flags received in header */
-
- return (NumBytes);
-}
+ /* Return the flags received in header */
+ messagehdr->msg_flags = Flags;
+ if(lpo != NULL)
+ return (-1);
+ else
+ return (total_bytes);
+
+}
static void
manager_log(isc_socketmgr_t *sockmgr,
isc_logcategory_t *category, isc_logmodule_t *module, int level,
- const char *fmt, ...)
-{
+ const char *fmt, ...) {
char msgbuf[2048];
va_list ap;
- if (! isc_log_wouldlog(isc_lctx, level))
+ if (!isc_log_wouldlog(isc_lctx, level))
return;
va_start(ap, fmt);
@@ -431,8 +1000,7 @@ static void
socket_log(isc_socket_t *sock, isc_sockaddr_t *address,
isc_logcategory_t *category, isc_logmodule_t *module, int level,
isc_msgcat_t *msgcat, int msgset, int message,
- const char *fmt, ...)
-{
+ const char *fmt, ...) {
char msgbuf[2048];
char peerbuf[256];
va_list ap;
@@ -449,134 +1017,27 @@ socket_log(isc_socket_t *sock, isc_sockaddr_t *address,
msgcat, msgset, message,
"socket %p: %s", sock, msgbuf);
} else {
- isc_sockaddr_format(address, peerbuf, sizeof(peerbuf));
+ isc_sockaddr_format(address, peerbuf, sizeof peerbuf);
isc_log_iwrite(isc_lctx, category, module, level,
msgcat, msgset, message,
"socket %p %s: %s", sock, peerbuf, msgbuf);
}
}
-static void
-wakeup_socket(isc_socketmgr_t *manager, int fd, int msg) {
- isc_socket_t *sock;
-
- /*
- * This is a wakeup on a socket. If the socket is not in the
- * process of being closed, start watching it for either reads
- * or writes.
- */
-
- INSIST(fd >= 0 && fd < FD_SETSIZE);
-
- if (manager->fdstate[fd] == CLOSE_PENDING) {
- manager->fdstate[fd] = CLOSED;
- FD_CLR(fd, &manager->read_fds);
- FD_CLR(fd, &manager->write_fds);
- FD_CLR(fd, &manager->except_fds);
- closesocket(fd);
- return;
- }
- if (manager->fdstate[fd] != MANAGED)
- return;
-
- sock = manager->fds[fd];
-
- /*
- * If there are no events, or there is an event but we
- * have already queued up the internal event on a task's
- * queue, clear the bit. Otherwise, set it.
- */
- if (msg == SELECT_POKE_READ)
- FD_SET(sock->fd, &manager->read_fds);
- if (msg == SELECT_POKE_WRITE)
- FD_SET(sock->fd, &manager->write_fds);
- if (msg == SELECT_POKE_CONNECT) { /* Need both here */
- FD_SET(sock->fd, &manager->write_fds);
- FD_SET(sock->fd, &manager->except_fds);
- }
-}
-
/*
- * Poke the select loop when there is something for us to do.
- * The write is required (by POSIX) to complete. That is, we
- * will not get partial writes.
- */
-static void
-select_poke(isc_socketmgr_t *mgr, int fd, int msg) {
- int cc;
- int buf[2];
- char strbuf[ISC_STRERRORSIZE];
-
- buf[0] = fd;
- buf[1] = msg;
-
- if (msg == SELECT_POKE_SHUTDOWN) {
- do {
- cc = _write(mgr->pipe_fds[1], buf, sizeof(buf));
- } while (cc < 0 && SOFT_ERROR(errno));
-
- if (cc < 0) {
- isc__strerror(errno, strbuf, sizeof(strbuf));
- FATAL_ERROR(__FILE__, __LINE__,
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
- ISC_MSG_WRITEFAILED,
- "write() failed "
- "during watcher poke: %s"),
- strbuf);
- }
-
- INSIST(cc == sizeof(buf));
-
- InterlockedIncrement(&bpipe_written);
- } else {
- wakeup_socket(mgr, fd, msg);
- }
-}
-
-/*
- * Read a message on the internal fd.
- */
-static void
-select_readmsg(isc_socketmgr_t *mgr, int *fd, int *msg) {
- int buf[2];
- int cc;
- char strbuf[ISC_STRERRORSIZE];
-
- cc = _read(mgr->pipe_fds[0], buf, sizeof(buf));
- if (cc < 0) {
- *msg = SELECT_POKE_NOTHING;
- if (SOFT_ERROR(errno))
- return;
-
- isc__strerror(errno, strbuf, sizeof(strbuf));
- FATAL_ERROR(__FILE__, __LINE__,
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
- ISC_MSG_READFAILED,
- "read() failed "
- "during watcher poke: %s"),
- strbuf);
-
- return;
- }
- INSIST(cc == sizeof(buf));
- *fd = buf[0];
- *msg = buf[1];
-
-}
-/*
- * Make a fd non-blocking.
+ * Make an fd SOCKET non-blocking.
*/
static isc_result_t
-make_nonblock(int fd) {
+make_nonblock(SOCKET fd) {
int ret;
unsigned long flags = 1;
char strbuf[ISC_STRERRORSIZE];
/* Set the socket to non-blocking */
- ret = ioctlsocket((SOCKET) fd, FIONBIO, &flags);
+ ret = ioctlsocket(fd, FIONBIO, &flags);
if (ret == -1) {
- isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf));
+ isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"ioctlsocket(%d, FIOBIO, %d): %s",
fd, flags, strbuf);
@@ -586,103 +1047,33 @@ make_nonblock(int fd) {
return (ISC_R_SUCCESS);
}
-
/*
- * Process control messages received on a socket.
+ * Windows 2000 systems incorrectly cause UDP sockets using WASRecvFrom
+ * to not work correctly, returning a WSACONNRESET error when a WSASendTo
+ * fails with an "ICMP port unreachable" response and preventing the
+ * socket from using the WSARecvFrom in subsequent operations.
+ * The function below fixes this, but requires that Windows 2000
+ * Service Pack 2 or later be installed on the system. NT 4.0
+ * systems are not affected by this and work correctly.
+ * See Microsoft Knowledge Base Article Q263823 for details of this.
*/
-static void
-process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
-#ifdef USE_CMSG
- struct cmsghdr *cmsgp;
-#ifdef ISC_PLATFORM_HAVEIPV6
- struct in6_pktinfo *pktinfop;
-#endif
-#ifdef SO_TIMESTAMP
- struct timeval *timevalp;
-#endif
-#endif
-
- /*
- * sock is used only when ISC_NET_BSD44MSGHDR and USE_CMSG are defined.
- * msg and dev are used only when ISC_NET_BSD44MSGHDR is defined.
- * They are all here, outside of the CPP tests, because it is
- * more consistent with the usual ISC coding style.
- */
- UNUSED(sock);
- UNUSED(msg);
- UNUSED(dev);
-
-#ifndef ISC_NET_BSD44MSGHDR
- return;
-
-#else /* defined ISC_NET_BSD44MSGHDR */
-
-#ifdef MSG_TRUNC
- if ((msg->msg_flags & MSG_TRUNC) == MSG_TRUNC)
- dev->attributes |= ISC_SOCKEVENTATTR_TRUNC;
-#endif
-
-#ifdef MSG_CTRUNC
- if ((msg->msg_flags & MSG_CTRUNC) == MSG_CTRUNC)
- dev->attributes |= ISC_SOCKEVENTATTR_CTRUNC;
-#endif
-
-#ifndef USE_CMSG
- return;
-#else
- if (msg->msg_controllen == 0 || msg->msg_control == NULL)
- return;
-
-#ifdef SO_TIMESTAMP
- timevalp = NULL;
-#endif
-#ifdef ISC_PLATFORM_HAVEIPV6
- pktinfop = NULL;
-#endif
-
- cmsgp = CMSG_FIRSTHDR(msg);
- while (cmsgp != NULL) {
- socket_log(sock, NULL, TRACE,
- isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PROCESSCMSG,
- "processing cmsg %p", cmsgp);
-
-#ifdef ISC_PLATFORM_HAVEIPV6
- if (cmsgp->cmsg_level == IPPROTO_IPV6
- && cmsgp->cmsg_type == IPV6_PKTINFO) {
-
- pktinfop = (struct in6_pktinfo *)CMSG_DATA(cmsgp);
- memcpy(&dev->pktinfo, pktinfop,
- sizeof(struct in6_pktinfo));
- dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO;
- socket_log(sock, NULL, TRACE,
- isc_msgcat, ISC_MSGSET_SOCKET,
- ISC_MSG_IFRECEIVED,
- "interface received on ifindex %u",
- dev->pktinfo.ipi6_ifindex);
- if (IN6_IS_ADDR_MULTICAST(&pktinfop->ipi6_addr))
- dev->attributes |= ISC_SOCKEVENTATTR_MULTICAST;
- goto next;
- }
-#endif
-
-#ifdef SO_TIMESTAMP
- if (cmsgp->cmsg_level == SOL_SOCKET
- && cmsgp->cmsg_type == SCM_TIMESTAMP) {
- timevalp = (struct timeval *)CMSG_DATA(cmsgp);
- dev->timestamp.seconds = timevalp->tv_sec;
- dev->timestamp.nanoseconds = timevalp->tv_usec * 1000;
- dev->attributes |= ISC_SOCKEVENTATTR_TIMESTAMP;
- goto next;
- }
-#endif
-
- next:
- cmsgp = CMSG_NXTHDR(msg, cmsgp);
- }
-#endif /* USE_CMSG */
-
-#endif /* ISC_NET_BSD44MSGHDR */
-
+isc_result_t
+connection_reset_fix(SOCKET fd) {
+ DWORD dwBytesReturned = 0;
+ BOOL bNewBehavior = FALSE;
+ DWORD status;
+
+ if(isc_win32os_majorversion() < 5)
+ return (ISC_R_SUCCESS); /* NT 4.0 has no problem */
+
+ /* disable bad behavior using IOCTL: SIO_UDP_CONNRESET */
+ status = WSAIoctl(fd, SIO_UDP_CONNRESET, &bNewBehavior,
+ sizeof(bNewBehavior), NULL, 0,
+ &dwBytesReturned, NULL, NULL);
+ if (status != SOCKET_ERROR)
+ return (ISC_R_SUCCESS);
+ else
+ return (ISC_R_UNEXPECTED);
}
/*
@@ -700,18 +1091,13 @@ process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
static void
build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
struct msghdr *msg, char *cmsg,
- WSABUF *iov, size_t *write_countp)
-{
+ WSABUF *iov, size_t *write_countp) {
unsigned int iovcount;
isc_buffer_t *buffer;
isc_region_t used;
size_t write_count;
size_t skip_count;
-#ifndef USE_CMSG
- UNUSED(cmsg);
-#endif
-
memset(msg, 0, sizeof (*msg));
if (sock->type == isc_sockettype_udp) {
@@ -758,7 +1144,7 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
if (used.length > 0) {
iov[iovcount].buf = (void *)(used.base
- + skip_count);
+ + skip_count);
iov[iovcount].len = used.length - skip_count;
write_count += (used.length - skip_count);
skip_count = 0;
@@ -773,34 +1159,6 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
msg->msg_iov = iov;
msg->msg_iovlen = iovcount;
-#ifdef ISC_NET_BSD44MSGHDR
- msg->msg_control = NULL;
- msg->msg_controllen = 0;
- msg->msg_flags = 0;
-#if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIPV6)
- if ((sock->type == isc_sockettype_udp)
- && ((dev->attributes & ISC_SOCKEVENTATTR_PKTINFO) != 0)) {
- struct cmsghdr *cmsgp;
- struct in6_pktinfo *pktinfop;
-
- socket_log(sock, NULL, TRACE,
- isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_SENDTODATA,
- "sendto pktinfo data, ifindex %u",
- dev->pktinfo.ipi6_ifindex);
-
- msg->msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
- msg->msg_control = (void *)cmsg;
-
- cmsgp = (struct cmsghdr *)cmsg;
- cmsgp->cmsg_level = IPPROTO_IPV6;
- cmsgp->cmsg_type = IPV6_PKTINFO;
- cmsgp->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
- pktinfop = (struct in6_pktinfo *)CMSG_DATA(cmsgp);
- memcpy(pktinfop, &dev->pktinfo, sizeof(struct in6_pktinfo));
- }
-#endif /* USE_CMSG && ISC_PLATFORM_HAVEIPV6 */
-#endif /* ISC_NET_BSD44MSGHDR */
-
if (write_countp != NULL)
*write_countp = write_count;
}
@@ -820,27 +1178,18 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
static void
build_msghdr_recv(isc_socket_t *sock, isc_socketevent_t *dev,
struct msghdr *msg, char *cmsg,
- WSABUF *iov, size_t *read_countp)
-{
+ WSABUF *iov, size_t *read_countp) {
unsigned int iovcount;
isc_buffer_t *buffer;
isc_region_t available;
size_t read_count;
-#ifndef USE_CMSG
- UNUSED(cmsg);
-#endif
-
memset(msg, 0, sizeof (struct msghdr));
if (sock->type == isc_sockettype_udp) {
memset(&dev->address, 0, sizeof(dev->address));
msg->msg_name = (void *)&dev->address.type.sa;
msg->msg_namelen = sizeof(dev->address.type);
-#ifdef ISC_NET_RECVOVERFLOW
- /* If needed, steal one iovec for overflow detection. */
- maxiov--;
-#endif
} else { /* TCP */
msg->msg_name = NULL;
msg->msg_namelen = 0;
@@ -859,10 +1208,10 @@ build_msghdr_recv(isc_socket_t *sock, isc_socketevent_t *dev,
iov[0].len = read_count;
iovcount = 1;
} else {
- /*
- * Multibuffer I/O.
- * Skip empty buffers.
- */
+ /*
+ * Multibuffer I/O.
+ * Skip empty buffers.
+ */
while (buffer != NULL) {
REQUIRE(ISC_BUFFER_VALID(buffer));
if (isc_buffer_availablelength(buffer) != 0)
@@ -891,37 +1240,17 @@ build_msghdr_recv(isc_socket_t *sock, isc_socketevent_t *dev,
* we know there is at least one iov left, since we stole it
* at the top of this function.
*/
-#ifdef ISC_NET_RECVOVERFLOW
- if (sock->type == isc_sockettype_udp) {
- iov[iovcount].iov_base = (void *)(&sock->overflow);
- iov[iovcount].iov_len = 1;
- iovcount++;
- }
-#endif
msg->msg_iov = iov;
msg->msg_iovlen = iovcount;
-#ifdef ISC_NET_BSD44MSGHDR
- msg->msg_control = NULL;
- msg->msg_controllen = 0;
- msg->msg_flags = 0;
-#if defined(USE_CMSG)
- if (sock->type == isc_sockettype_udp) {
- msg->msg_control = cmsg;
- msg->msg_controllen = CMSG_BUF_SIZE;
- }
-#endif /* USE_CMSG */
-#endif /* ISC_NET_BSD44MSGHDR */
-
if (read_countp != NULL)
*read_countp = read_count;
}
static void
set_dev_address(isc_sockaddr_t *address, isc_socket_t *sock,
- isc_socketevent_t *dev)
-{
+ isc_socketevent_t *dev) {
if (sock->type == isc_sockettype_udp) {
if (address != NULL)
dev->address = *address;
@@ -935,8 +1264,7 @@ set_dev_address(isc_sockaddr_t *address, isc_socket_t *sock,
static isc_socketevent_t *
allocate_socketevent(isc_socket_t *sock, isc_eventtype_t eventtype,
- isc_taskaction_t action, const void *arg)
-{
+ isc_taskaction_t action, const void *arg) {
isc_socketevent_t *ev;
ev = (isc_socketevent_t *)isc_event_allocate(sock->manager->mctx,
@@ -963,17 +1291,13 @@ static void
dump_msg(struct msghdr *msg, isc_socket_t *sock) {
unsigned int i;
- printf("MSGHDR %p, Socket #: %d\n", msg, sock->fd);
+ printf("MSGHDR %p, Socket #: %u\n", msg, sock->fd);
printf("\tname %p, namelen %d\n", msg->msg_name, msg->msg_namelen);
printf("\tiov %p, iovlen %d\n", msg->msg_iov, msg->msg_iovlen);
for (i = 0 ; i < (unsigned int)msg->msg_iovlen ; i++)
printf("\t\t%d\tbase %p, len %d\n", i,
msg->msg_iov[i].buf,
msg->msg_iov[i].len);
-#ifdef ISC_NET_BSD44MSGHDR
- printf("\tcontrol %p, controllen %d\n", msg->msg_control,
- msg->msg_controllen);
-#endif
}
#endif
@@ -983,41 +1307,10 @@ dump_msg(struct msghdr *msg, isc_socket_t *sock) {
#define DOIO_EOF 3 /* EOF, no event sent */
static int
-doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
- int cc;
- WSABUF iov[MAXSCATTERGATHER_RECV];
- size_t read_count;
+completeio_recv(isc_socket_t *sock, isc_socketevent_t *dev,
+ struct msghdr *messagehdr, int cc, int recv_errno) {
size_t actual_count;
- struct msghdr msghdr;
isc_buffer_t *buffer;
- int recv_errno = 0;
-#if USE_CMSG
- char cmsg[CMSG_BUF_SIZE];
-#else
- char *cmsg = NULL;
-#endif
- char strbuf[ISC_STRERRORSIZE];
-
- build_msghdr_recv(sock, dev, &msghdr, cmsg, iov, &read_count);
-
-#if defined(ISC_SOCKET_DEBUG)
- dump_msg(&msghdr,sock);
-#endif
-
- cc = internal_recvmsg(sock->fd, &msghdr, 0, &recv_errno);
-
- if (cc < 0) {
- if (SOFT_ERROR(recv_errno))
- return (DOIO_SOFT);
-
- if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) {
- isc__strerror(recv_errno, strbuf, sizeof(strbuf));
- socket_log(sock, NULL, IOEVENT,
- isc_msgcat, ISC_MSGSET_SOCKET,
- ISC_MSG_DOIORECV,
- "doio_recv: recvmsg(%d) %d bytes, err %d/%s",
- sock->fd, cc, recv_errno, strbuf);
- }
#define SOFT_OR_HARD(_system, _isc) \
if (recv_errno == _system) { \
@@ -1027,19 +1320,30 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
} \
return (DOIO_SOFT); \
}
+
#define ALWAYS_HARD(_system, _isc) \
if (recv_errno == _system) { \
dev->result = _isc; \
return (DOIO_HARD); \
}
+ if (recv_errno != 0) {
+
+ if (SOFT_ERROR(recv_errno))
+ return (DOIO_SOFT);
+
SOFT_OR_HARD(WSAECONNREFUSED, ISC_R_CONNREFUSED);
SOFT_OR_HARD(WSAENETUNREACH, ISC_R_NETUNREACH);
SOFT_OR_HARD(WSAEHOSTUNREACH, ISC_R_HOSTUNREACH);
SOFT_OR_HARD(WSAECONNRESET, ISC_R_CONNECTIONRESET);
SOFT_OR_HARD(WSAENETRESET, ISC_R_CONNECTIONRESET);
+ SOFT_OR_HARD(WSAECONNABORTED, ISC_R_CONNECTIONRESET);
SOFT_OR_HARD(WSAEDISCON, ISC_R_CONNECTIONRESET);
SOFT_OR_HARD(WSAENETDOWN, ISC_R_NETDOWN);
+ ALWAYS_HARD(ERROR_OPERATION_ABORTED, ISC_R_CONNECTIONRESET);
+ ALWAYS_HARD(ERROR_PORT_UNREACHABLE, ISC_R_HOSTUNREACH);
+ ALWAYS_HARD(ERROR_HOST_UNREACHABLE, ISC_R_HOSTUNREACH);
+ ALWAYS_HARD(ERROR_NETWORK_UNREACHABLE, ISC_R_NETUNREACH);
ALWAYS_HARD(WSAENOBUFS, ISC_R_NORESOURCES);
#undef SOFT_OR_HARD
@@ -1058,7 +1362,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
return (DOIO_EOF);
if (sock->type == isc_sockettype_udp) {
- dev->address.length = msghdr.msg_namelen;
+ dev->address.length = messagehdr->msg_namelen;
if (isc_sockaddr_getport(&dev->address) == 0) {
if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) {
socket_log(sock, &dev->address, IOEVENT,
@@ -1087,13 +1391,6 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
#endif
/*
- * If there are control messages attached, run through them and pull
- * out the interesting bits.
- */
- if (sock->type == isc_sockettype_udp)
- process_cmsg(sock, &msghdr, dev);
-
- /*
* update the buffers (if any) and the i/o count
*/
dev->n += cc;
@@ -1118,9 +1415,9 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
/*
* If we read less than we expected, update counters,
- * and let the upper layer poke the descriptor.
+ * and let the upper layer handle it.
*/
- if (((size_t)cc != read_count) && (dev->n < dev->minimum))
+ if (((size_t)cc != sock->totalBytes) && (dev->n < dev->minimum))
return (DOIO_SOFT);
/*
@@ -1129,7 +1426,63 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
dev->result = ISC_R_SUCCESS;
return (DOIO_SUCCESS);
}
+static int
+startio_recv(isc_socket_t *sock, isc_socketevent_t *dev, int *nbytes,
+ BOOL bwait, int *recv_errno) {
+ char *cmsg = NULL;
+ char strbuf[ISC_STRERRORSIZE];
+ IoCompletionInfo *lpo;
+ int status;
+ struct msghdr messagehdr;
+ struct msghdr *msghdr;
+
+ if (!bwait) {
+ lpo = (IoCompletionInfo *) HeapAlloc(hHeapHandle,
+ HEAP_ZERO_MEMORY, sizeof(IoCompletionInfo));
+ lpo->request_type = SOCKET_RECV;
+ lpo->dev = dev;
+ msghdr = &lpo->messagehdr;
+ } else { /* Wait for recv to complete */
+ lpo = NULL;
+ msghdr = &messagehdr;
+ }
+ sock->references++;
+ memset(msghdr, 0, sizeof(struct msghdr));
+
+ build_msghdr_recv(sock, dev, msghdr, cmsg, sock->iov,
+ &(sock->totalBytes));
+
+#if defined(ISC_SOCKET_DEBUG)
+ dump_msg(msghdr, sock);
+#endif
+
+ *nbytes = internal_recvmsg(sock, lpo, msghdr, 0, recv_errno);
+ if (*nbytes < 0) {
+ if (SOFT_ERROR(*recv_errno)) {
+ status = DOIO_SOFT;
+ goto done;
+ }
+
+ if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) {
+ isc__strerror(*recv_errno, strbuf, sizeof(strbuf));
+ socket_log(sock, NULL, IOEVENT,
+ isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_DOIORECV,
+ "startio_recv: recvmsg(%d) %d bytes, err %d/%s",
+ sock->fd, *nbytes, *recv_errno, strbuf);
+ }
+ status = completeio_recv(sock, dev, msghdr, *nbytes, *recv_errno);
+ if(status != DOIO_SOFT) {
+ sock->references--;
+ }
+ goto done;
+ }
+ dev->result = ISC_R_SUCCESS;
+ status = DOIO_SOFT;
+done:
+ return (status);
+}
/*
* Returns:
* DOIO_SUCCESS The operation succeeded. dev->result contains
@@ -1144,32 +1497,12 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
* No other return values are possible.
*/
static int
-doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
- int cc;
- WSABUF iov[MAXSCATTERGATHER_SEND];
- size_t write_count;
- struct msghdr msghdr;
+completeio_send(isc_socket_t *sock, isc_socketevent_t *dev, struct msghdr *messagehdr, int cc,
+ int send_errno) {
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
-#if USE_CMSG
- char cmsg[CMSG_BUF_SIZE];
-#else
- char *cmsg = NULL;
-#endif
- int attempts = 0;
- int send_errno = 0;
char strbuf[ISC_STRERRORSIZE];
- build_msghdr_send(sock, dev, &msghdr, cmsg, iov, &write_count);
-
-resend:
- cc = internal_sendmsg(sock->fd, &msghdr, 0, &send_errno);
-
- /*
- * Check for error or block condition.
- */
- if (cc < 0) {
- if (send_errno == WSAEINTR && ++attempts < NRETRIES)
- goto resend;
+ if(send_errno != 0) {
if (SOFT_ERROR(send_errno))
return (DOIO_SOFT);
@@ -1193,9 +1526,14 @@ resend:
SOFT_OR_HARD(WSAECONNREFUSED, ISC_R_CONNREFUSED);
SOFT_OR_HARD(WSAENOTCONN, ISC_R_CONNREFUSED);
SOFT_OR_HARD(WSAECONNRESET, ISC_R_CONNECTIONRESET);
+ SOFT_OR_HARD(WSAECONNABORTED, ISC_R_CONNECTIONRESET);
SOFT_OR_HARD(WSAENETRESET, ISC_R_CONNECTIONRESET);
SOFT_OR_HARD(WSAEDISCON, ISC_R_CONNECTIONRESET);
SOFT_OR_HARD(WSAENETDOWN, ISC_R_NETDOWN);
+ ALWAYS_HARD(ERROR_OPERATION_ABORTED, ISC_R_CONNECTIONRESET);
+ ALWAYS_HARD(ERROR_PORT_UNREACHABLE, ISC_R_HOSTUNREACH);
+ ALWAYS_HARD(ERROR_HOST_UNREACHABLE, ISC_R_HOSTUNREACH);
+ ALWAYS_HARD(ERROR_NETWORK_UNREACHABLE, ISC_R_NETUNREACH);
ALWAYS_HARD(WSAEADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
ALWAYS_HARD(WSAEHOSTUNREACH, ISC_R_HOSTUNREACH);
ALWAYS_HARD(WSAEHOSTDOWN, ISC_R_HOSTUNREACH);
@@ -1218,23 +1556,17 @@ resend:
*/
isc_sockaddr_format(&dev->address, addrbuf, sizeof(addrbuf));
isc__strerror(send_errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__, "internal_send: %s: %s",
+ UNEXPECTED_ERROR(__FILE__, __LINE__, "completeio_send: %s: %s",
addrbuf, strbuf);
dev->result = isc__errno2result(send_errno);
- return (DOIO_HARD);
+ return (DOIO_HARD);
}
- if (cc == 0)
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "internal_send: send() %s 0",
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_RETURNED, "returned"));
-
/*
* If we write less than we expected, update counters, poke.
*/
dev->n += cc;
- if ((size_t)cc != write_count)
+ if ((size_t)cc != sock->totalBytes)
return (DOIO_SOFT);
/*
@@ -1244,7 +1576,59 @@ resend:
dev->result = ISC_R_SUCCESS;
return (DOIO_SUCCESS);
}
+static int
+startio_send(isc_socket_t *sock, isc_socketevent_t *dev, int *nbytes,
+ BOOL bwait, int *send_errno) {
+ char *cmsg = NULL;
+ char strbuf[ISC_STRERRORSIZE];
+ IoCompletionInfo *lpo;
+ int status;
+ struct msghdr messagehdr;
+ struct msghdr *msghdr;
+
+ if (!bwait) {
+ lpo = (IoCompletionInfo *) HeapAlloc(hHeapHandle,
+ HEAP_ZERO_MEMORY, sizeof(IoCompletionInfo));
+ lpo->request_type = SOCKET_SEND;
+ lpo->dev = dev;
+ msghdr = &lpo->messagehdr;
+ } else { /* Wait for send to complete */
+ lpo = NULL;
+ msghdr = &messagehdr;
+ }
+ memset(msghdr, 0, sizeof(struct msghdr));
+ sock->references++;
+
+ build_msghdr_send(sock, dev, msghdr, cmsg, sock->iov,
+ &(sock->totalBytes));
+
+ *nbytes = internal_sendmsg(sock, lpo, msghdr, 0, send_errno);
+
+ if (*nbytes < 0) {
+ if (SOFT_ERROR(*send_errno)) {
+ status = DOIO_SOFT;
+ goto done;
+ }
+ if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) {
+ isc__strerror(*send_errno, strbuf, sizeof(strbuf));
+ socket_log(sock, NULL, IOEVENT,
+ isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_INTERNALSEND,
+ "startio_send: internal_sendmsg(%d) %d bytes, err %d/%s",
+ sock->fd, *nbytes, *send_errno, strbuf);
+ }
+ status = completeio_send(sock, dev, msghdr, *nbytes, *send_errno);
+ if(status != DOIO_SOFT) {
+ sock->references--;
+ }
+ goto done;
+ }
+ dev->result = ISC_R_SUCCESS;
+ status = DOIO_SOFT;
+done:
+ return (status);
+}
/*
* Kill.
*
@@ -1252,34 +1636,34 @@ resend:
* references exist.
*/
static void
-destroy(isc_socket_t **sockp) {
+destroy_socket(isc_socket_t **sockp) {
isc_socket_t *sock = *sockp;
isc_socketmgr_t *manager = sock->manager;
+ REQUIRE(sock != NULL);
+
socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET,
- ISC_MSG_DESTROYING, "destroying");
+ ISC_MSG_DESTROYING, "destroying socket %d", sock->fd);
INSIST(ISC_LIST_EMPTY(sock->accept_list));
INSIST(ISC_LIST_EMPTY(sock->recv_list));
INSIST(ISC_LIST_EMPTY(sock->send_list));
INSIST(sock->connect_ev == NULL);
- REQUIRE(sock->fd >= 0 && sock->fd < FD_SETSIZE);
LOCK(&manager->lock);
/*
- * No one has this socket open, so the watcher doesn't have to be
- * poked, and the socket doesn't have to be locked.
+ * No one has this socket open and the socket doesn't have to be
+ * locked. The socket_close function makes sure that if needed
+ * the event_wait loop removes any associated event from the list
+ * of events being waited on.
*/
- manager->fds[sock->fd] = NULL;
- manager->fdstate[sock->fd] = CLOSE_PENDING;
- select_poke(manager, sock->fd, SELECT_POKE_CLOSE);
+ socket_close(sock);
+
ISC_LIST_UNLINK(manager->socklist, sock, link);
-#ifdef ISC_PLATFORM_USETHREADS
if (ISC_LIST_EMPTY(manager->socklist))
SIGNAL(&manager->shutdown_ok);
-#endif /* ISC_PLATFORM_USETHREADS */
/*
* XXX should reset manager->maxfd here
@@ -1292,12 +1676,11 @@ destroy(isc_socket_t **sockp) {
static isc_result_t
allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
- isc_socket_t **socketp)
-{
+ isc_socket_t **socketp) {
isc_socket_t *sock;
isc_result_t ret;
- sock = isc_mem_get(manager->mctx, sizeof(*sock));
+ sock = isc_mem_get(manager->mctx, sizeof *sock);
if (sock == NULL)
return (ISC_R_NOMEMORY);
@@ -1309,7 +1692,7 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
sock->manager = manager;
sock->type = type;
- sock->fd = -1;
+ sock->fd = INVALID_SOCKET;
ISC_LINK_INIT(sock, link);
@@ -1320,13 +1703,17 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
ISC_LIST_INIT(sock->send_list);
ISC_LIST_INIT(sock->accept_list);
sock->connect_ev = NULL;
- sock->pending_recv = 0;
- sock->pending_send = 0;
sock->pending_accept = 0;
+ sock->pending_close = 0;
+ sock->iocp = 0;
sock->listener = 0;
sock->connected = 0;
sock->connecting = 0;
sock->bound = 0;
+ sock->hEvent = NULL;
+ sock->hAlert = NULL;
+ sock->evthread_id = 0;
+ sock->wait_type = 0;
/*
* initialize the lock
@@ -1360,13 +1747,12 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
return (ret);
}
-
/*
* This event requires that the various lists be empty, that the reference
* count be 1, and that the magic number is valid. The other socket bits,
* like the lock, must be initialized as well. The fd associated must be
- * marked as closed, by setting it to -1 on close, or this routine will
- * also close the socket.
+ * marked as closed, by setting it to INVALID_SOCKET on close, or this
+ * routine will also close the socket.
*/
static void
free_socket(isc_socket_t **socketp) {
@@ -1375,8 +1761,6 @@ free_socket(isc_socket_t **socketp) {
INSIST(sock->references == 0);
INSIST(VALID_SOCKET(sock));
INSIST(!sock->connecting);
- INSIST(!sock->pending_recv);
- INSIST(!sock->pending_send);
INSIST(!sock->pending_accept);
INSIST(ISC_LIST_EMPTY(sock->recv_list));
INSIST(ISC_LIST_EMPTY(sock->send_list));
@@ -1406,7 +1790,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
#if defined(USE_CMSG) || defined(SO_BSDCOMPAT)
int on = 1;
#endif
- int socket_errno = 0;
+ int socket_errno;
char strbuf[ISC_STRERRORSIZE];
REQUIRE(VALID_MANAGER(manager));
@@ -1420,24 +1804,18 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
switch (type) {
case isc_sockettype_udp:
sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP);
+ if (connection_reset_fix(sock->fd) != ISC_R_SUCCESS) {
+ closesocket(sock->fd);
+ free_socket(&sock);
+ return (ISC_R_UNEXPECTED);
+ }
break;
case isc_sockettype_tcp:
sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
break;
}
-
- if (sock->fd >= FD_SETSIZE) {
- (void)closesocket(sock->fd);
- isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL,
- ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
- isc_msgcat, ISC_MSGSET_SOCKET,
- ISC_MSG_TOOMANYFDS,
- "%s: too many open file descriptors", "socket");
- free_socket(&sock);
- return (ISC_R_NORESOURCES);
- }
- if (sock->fd < 0) {
+ if (sock->fd == INVALID_SOCKET) {
socket_errno = WSAGetLastError();
free_socket(&sock);
@@ -1469,41 +1847,10 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
return (ISC_R_UNEXPECTED);
}
-#ifdef SO_BSDCOMPAT
- if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
- (void *)&on, sizeof(on)) < 0) {
- socket_errno = WSAGetLastError();
- isc__strerror(socket_errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, SO_BSDCOMPAT) %s: %s",
- sock->fd,
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED, "failed"),
- strbuf);
- /* Press on... */
- }
-#endif
#if defined(USE_CMSG)
if (type == isc_sockettype_udp) {
-#if defined(SO_TIMESTAMP)
- if (setsockopt(sock->fd, SOL_SOCKET, SO_TIMESTAMP,
- (void *)&on, sizeof(on)) < 0
- && WSAGetLastError() != WSAENOPROTOOPT) {
- isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "setsockopt(%d, SO_TIMESTAMP) %s: %s",
- sock->fd,
- isc_msgcat_get(isc_msgcat,
- ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED,
- "failed"),
- strbuf);
- /* Press on... */
- }
-#endif /* SO_TIMESTAMP */
-
#if defined(ISC_PLATFORM_HAVEIPV6)
#ifdef IPV6_RECVPKTINFO
/* 2292bis */
@@ -1559,13 +1906,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
* there are no external references to it yet.
*/
- manager->fds[sock->fd] = sock;
- manager->fdstate[sock->fd] = MANAGED;
ISC_LIST_APPEND(manager->socklist, sock, link);
- if (manager->maxfd < sock->fd)
- manager->maxfd = sock->fd;
- manager->minfd = min(manager->minfd, sock->fd);
-
UNLOCK(&manager->lock);
socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET,
@@ -1610,119 +1951,12 @@ isc_socket_detach(isc_socket_t **socketp) {
UNLOCK(&sock->lock);
if (kill_socket)
- destroy(&sock);
+ destroy_socket(&sock);
*socketp = NULL;
}
/*
- * I/O is possible on a given socket. Schedule an event to this task that
- * will call an internal function to do the I/O. This will charge the
- * task with the I/O operation and let our select loop handler get back
- * to doing something real as fast as possible.
- *
- * The socket and manager must be locked before calling this function.
- */
-static void
-dispatch_recv(isc_socket_t *sock) {
- intev_t *iev;
- isc_socketevent_t *ev;
-
- INSIST(!sock->pending_recv);
-
- ev = ISC_LIST_HEAD(sock->recv_list);
- if (ev == NULL)
- return;
-
- sock->pending_recv = 1;
- iev = &sock->readable_ev;
-
- socket_log(sock, NULL, EVENT, NULL, 0, 0,
- "dispatch_recv: event %p -> task %p", ev, ev->ev_sender);
-
- sock->references++;
- iev->ev_sender = sock;
- iev->ev_action = internal_recv;
- iev->ev_arg = sock;
-
- isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
-}
-
-static void
-dispatch_send(isc_socket_t *sock) {
- intev_t *iev;
- isc_socketevent_t *ev;
-
- INSIST(!sock->pending_send);
-
- ev = ISC_LIST_HEAD(sock->send_list);
- if (ev == NULL)
- return;
-
- sock->pending_send = 1;
- iev = &sock->writable_ev;
-
- socket_log(sock, NULL, EVENT, NULL, 0, 0,
- "dispatch_send: event %p -> task %p", ev, ev->ev_sender);
-
- sock->references++;
- iev->ev_sender = sock;
- iev->ev_action = internal_send;
- iev->ev_arg = sock;
-
- isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
-}
-
-/*
- * Dispatch an internal accept event.
- */
-static void
-dispatch_accept(isc_socket_t *sock) {
- intev_t *iev;
- isc_socket_newconnev_t *ev;
-
- INSIST(!sock->pending_accept);
-
- /*
- * Are there any done events left, or were they all canceled
- * before the manager got the socket lock?
- */
- ev = ISC_LIST_HEAD(sock->accept_list);
- if (ev == NULL)
- return;
-
- sock->pending_accept = 1;
- iev = &sock->readable_ev;
-
- sock->references++; /* keep socket around for this internal event */
- iev->ev_sender = sock;
- iev->ev_action = internal_accept;
- iev->ev_arg = sock;
-
- isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
-}
-
-static void
-dispatch_connect(isc_socket_t *sock) {
- intev_t *iev;
- isc_socket_connev_t *ev;
-
- iev = &sock->writable_ev;
-
- ev = sock->connect_ev;
- INSIST(ev != NULL); /* XXX */
-
- INSIST(sock->connecting);
-
- sock->references++; /* keep socket around for this internal event */
- iev->ev_sender = sock;
- iev->ev_action = internal_connect;
- iev->ev_arg = sock;
-
- isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
-}
-
-/*
* Dequeue an item off the given socket's read queue, set the result code
* in the done event to the one provided, and send it to the task it was
* destined for.
@@ -1740,8 +1974,9 @@ send_recvdone_event(isc_socket_t *sock, isc_socketevent_t **dev) {
(*dev)->ev_sender = sock;
- if (ISC_LINK_LINKED(*dev, ev_link))
+ if (ISC_LINK_LINKED(*dev, ev_link)) {
ISC_LIST_DEQUEUE(sock->recv_list, *dev, ev_link);
+ }
if (((*dev)->attributes & ISC_SOCKEVENTATTR_ATTACHED)
== ISC_SOCKEVENTATTR_ATTACHED)
@@ -1764,8 +1999,9 @@ send_senddone_event(isc_socket_t *sock, isc_socketevent_t **dev) {
task = (*dev)->ev_sender;
(*dev)->ev_sender = sock;
- if (ISC_LINK_LINKED(*dev, ev_link))
+ if (ISC_LINK_LINKED(*dev, ev_link)) {
ISC_LIST_DEQUEUE(sock->send_list, *dev, ev_link);
+ }
if (((*dev)->attributes & ISC_SOCKEVENTATTR_ATTACHED)
== ISC_SOCKEVENTATTR_ATTACHED)
@@ -1786,20 +2022,15 @@ send_senddone_event(isc_socket_t *sock, isc_socketevent_t **dev) {
* so just unlock and return.
*/
static void
-internal_accept(isc_task_t *me, isc_event_t *ev) {
- isc_socket_t *sock;
+internal_accept(isc_socket_t *sock, int accept_errno) {
isc_socketmgr_t *manager;
isc_socket_newconnev_t *dev;
isc_task_t *task;
ISC_SOCKADDR_LEN_T addrlen;
- int fd;
+ SOCKET fd;
isc_result_t result = ISC_R_SUCCESS;
- int accept_errno = 0;
char strbuf[ISC_STRERRORSIZE];
- UNUSED(me);
-
- sock = ev->ev_sender;
INSIST(VALID_SOCKET(sock));
LOCK(&sock->lock);
@@ -1811,6 +2042,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
INSIST(VALID_MANAGER(manager));
INSIST(sock->listener);
+ INSIST(sock->hEvent != NULL);
INSIST(sock->pending_accept == 1);
sock->pending_accept = 0;
@@ -1818,7 +2050,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
sock->references--; /* the internal event is done with this socket */
if (sock->references == 0) {
UNLOCK(&sock->lock);
- destroy(&sock);
+ destroy_socket(&sock);
return;
}
@@ -1834,14 +2066,14 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
/*
* Try to accept the new connection. If the accept fails with
- * EAGAIN or EINTR, simply poke the watcher to watch this socket
- * again.
+ * EAGAIN or EINTR, the event wait will be notified again since
+ * the event will be reset on return to caller.
*/
- addrlen = sizeof(dev->newsocket->address.type);
+ addrlen = sizeof dev->newsocket->address.type;
memset(&dev->newsocket->address.type.sa, 0, addrlen);
fd = accept(sock->fd, &dev->newsocket->address.type.sa,
(void *)&addrlen);
- if (fd < 0) {
+ if (fd == INVALID_SOCKET) {
accept_errno = WSAGetLastError();
if (SOFT_ERROR(accept_errno) || accept_errno == WSAECONNRESET) {
goto soft_error;
@@ -1854,7 +2086,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
ISC_MSG_FAILED,
"failed"),
strbuf);
- fd = -1;
+ fd = INVALID_SOCKET;
result = ISC_R_UNEXPECTED;
}
} else {
@@ -1878,19 +2110,10 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
sock->pf);
(void)closesocket(fd);
goto soft_error;
- } else if (fd >= FD_SETSIZE) {
- isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL,
- ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
- isc_msgcat, ISC_MSGSET_SOCKET,
- ISC_MSG_TOOMANYFDS,
- "%s: too many open file descriptors",
- "accept");
- (void)closesocket(fd);
- goto soft_error;
}
}
- if (fd != -1) {
+ if (fd != INVALID_SOCKET) {
dev->newsocket->address.length = addrlen;
dev->newsocket->pf = sock->pf;
}
@@ -1900,24 +2123,18 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
*/
ISC_LIST_UNLINK(sock->accept_list, dev, ev_link);
- /*
- * Poke watcher if there are more pending accepts.
- */
- if (!ISC_LIST_EMPTY(sock->accept_list))
- select_poke(sock->manager, sock->fd, SELECT_POKE_ACCEPT);
-
UNLOCK(&sock->lock);
- if (fd != -1 && (make_nonblock(fd) != ISC_R_SUCCESS)) {
+ if (fd != INVALID_SOCKET && (make_nonblock(fd) != ISC_R_SUCCESS)) {
closesocket(fd);
- fd = -1;
+ fd = INVALID_SOCKET;
result = ISC_R_UNEXPECTED;
}
/*
- * -1 means the new socket didn't happen.
+ * INVALID_SOCKET means the new socket didn't happen.
*/
- if (fd != -1) {
+ if (fd != INVALID_SOCKET) {
LOCK(&manager->lock);
ISC_LIST_APPEND(manager->socklist, dev->newsocket, link);
@@ -1930,18 +2147,12 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
*/
dev->address = dev->newsocket->address;
- manager->fds[fd] = dev->newsocket;
- manager->fdstate[fd] = MANAGED;
- if (manager->maxfd < fd)
- manager->maxfd = fd;
- manager->minfd = min(manager->minfd, sock->fd);
-
socket_log(sock, &dev->newsocket->address, CREATION,
isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_ACCEPTEDCXN,
"accepted connection, new socket %p",
dev->newsocket);
- UNLOCK(&manager->lock);
+ UNLOCK(&manager->lock);
} else {
dev->newsocket->references--;
free_socket(&dev->newsocket);
@@ -1958,46 +2169,151 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
return;
soft_error:
- select_poke(sock->manager, sock->fd, SELECT_POKE_ACCEPT);
UNLOCK(&sock->lock);
return;
}
+/*
+ * Called when a socket with a pending connect() finishes.
+ */
static void
-internal_recv(isc_task_t *me, isc_event_t *ev) {
- isc_socketevent_t *dev;
- isc_socket_t *sock;
+internal_connect(isc_socket_t *sock, int connect_errno) {
+ isc_socket_connev_t *dev;
+ isc_task_t *task;
+ int cc;
+ ISC_SOCKADDR_LEN_T optlen;
+ char strbuf[ISC_STRERRORSIZE];
- INSIST(ev->ev_type == ISC_SOCKEVENT_INTR);
+ INSIST(VALID_SOCKET(sock));
+
+ LOCK(&sock->lock);
+ WSAResetEvent(sock->hEvent);
+
+ /*
+ * When the internal event was sent the reference count was bumped
+ * to keep the socket around for us. Decrement the count here.
+ */
+ INSIST(sock->references > 0);
+ sock->references--;
+ if (sock->references == 0) {
+ UNLOCK(&sock->lock);
+ destroy_socket(&sock);
+ return;
+ }
+
+ /*
+ * Has this event been canceled?
+ */
+ dev = sock->connect_ev;
+ if (dev == NULL) {
+ INSIST(!sock->connecting);
+ UNLOCK(&sock->lock);
+ return;
+ }
+
+ INSIST(sock->connecting);
+ sock->connecting = 0;
+
+ /*
+ * Get any possible error status here.
+ */
+ optlen = sizeof(cc);
+ if (getsockopt(sock->fd, SOL_SOCKET, SO_ERROR,
+ (void *)&cc, (void *)&optlen) < 0)
+ connect_errno = WSAGetLastError();
+ else
+ connect_errno = 0;
+
+ if (connect_errno != 0) {
+ /*
+ * If the error is EAGAIN, just try again on this
+ * fd and pretend nothing strange happened.
+ */
+ if (SOFT_ERROR(connect_errno) || connect_errno == WSAEINPROGRESS) {
+ sock->connecting = 1;
+ UNLOCK(&sock->lock);
+
+ return;
+ }
+
+ /*
+ * Translate other errors into ISC_R_* flavors.
+ */
+ switch (connect_errno) {
+#define ERROR_MATCH(a, b) case a: dev->result = b; break;
+ ERROR_MATCH(WSAEACCES, ISC_R_NOPERM);
+ ERROR_MATCH(WSAEADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
+ ERROR_MATCH(WSAEAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
+ ERROR_MATCH(WSAECONNREFUSED, ISC_R_CONNREFUSED);
+ ERROR_MATCH(WSAEHOSTUNREACH, ISC_R_HOSTUNREACH);
+ ERROR_MATCH(WSAEHOSTDOWN, ISC_R_HOSTUNREACH);
+ ERROR_MATCH(WSAENETUNREACH, ISC_R_NETUNREACH);
+ ERROR_MATCH(WSAENOBUFS, ISC_R_NORESOURCES);
+ ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
+ ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
+ ERROR_MATCH(WSAETIMEDOUT, ISC_R_TIMEDOUT);
+#undef ERROR_MATCH
+ default:
+ dev->result = ISC_R_UNEXPECTED;
+ isc__strerror(connect_errno, strbuf, sizeof(strbuf));
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "internal_connect: connect() %s",
+ strbuf);
+ }
+ } else {
+ dev->result = ISC_R_SUCCESS;
+ sock->connected = 1;
+ sock->bound = 1;
+ }
+
+ sock->connect_ev = NULL;
+
+ UNLOCK(&sock->lock);
+
+ task = dev->ev_sender;
+ dev->ev_sender = sock;
+ isc_task_sendanddetach(&task, (isc_event_t **)&dev);
+}
+
+static void
+internal_recv(isc_socket_t *sock, isc_socketevent_t *dev, struct msghdr *messagehdr, int nbytes, int recv_errno) {
+ isc_socketevent_t *ldev;
+ int io_state;
+ int cc;
- sock = ev->ev_sender;
INSIST(VALID_SOCKET(sock));
LOCK(&sock->lock);
socket_log(sock, NULL, IOEVENT,
isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALRECV,
- "internal_recv: task %p got event %p", me, ev);
-
- INSIST(sock->pending_recv == 1);
- sock->pending_recv = 0;
+ "internal_recv: task got socket event %p", dev);
INSIST(sock->references > 0);
sock->references--; /* the internal event is done with this socket */
if (sock->references == 0) {
UNLOCK(&sock->lock);
- destroy(&sock);
+ destroy_socket(&sock);
return;
}
+ /* If the event is no longer in the list we can just return */
+ ldev = ISC_LIST_HEAD(sock->recv_list);
+ while (ldev != NULL && ldev != dev) {
+ ldev = ISC_LIST_NEXT(ldev, ev_link);
+ }
+ if (ldev == NULL)
+ goto done;
+
/*
* Try to do as much I/O as possible on this socket. There are no
* limits here, currently.
*/
- dev = ISC_LIST_HEAD(sock->recv_list);
- while (dev != NULL) {
- switch (doio_recv(sock, dev)) {
+ switch (completeio_recv(sock, dev, messagehdr, nbytes, recv_errno)) {
case DOIO_SOFT:
- goto poke;
+ cc = 0;
+ recv_errno = 0;
+ io_state = startio_recv(sock, dev, &cc, FALSE, &recv_errno);
+ goto done;
case DOIO_EOF:
/*
@@ -2005,322 +2321,304 @@ internal_recv(isc_task_t *me, isc_event_t *ev) {
* Run through the event queue and dispatch all
* the events with an EOF result code.
*/
- do {
- dev->result = ISC_R_EOF;
- send_recvdone_event(sock, &dev);
- dev = ISC_LIST_HEAD(sock->recv_list);
- } while (dev != NULL);
- goto poke;
+ dev->result = ISC_R_EOF;
+ send_recvdone_event(sock, &dev);
+ goto done;
case DOIO_SUCCESS:
case DOIO_HARD:
send_recvdone_event(sock, &dev);
break;
}
-
- dev = ISC_LIST_HEAD(sock->recv_list);
- }
-
- poke:
- if (!ISC_LIST_EMPTY(sock->recv_list))
- select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
-
+ done:
UNLOCK(&sock->lock);
}
static void
-internal_send(isc_task_t *me, isc_event_t *ev) {
- isc_socketevent_t *dev;
- isc_socket_t *sock;
-
- INSIST(ev->ev_type == ISC_SOCKEVENT_INTW);
+internal_send(isc_socket_t *sock, isc_socketevent_t *dev, struct msghdr *messagehdr, int nbytes, int send_errno) {
+ isc_socketevent_t *ldev;
+ int io_state;
+ int cc;
/*
* Find out what socket this is and lock it.
*/
- sock = (isc_socket_t *)ev->ev_sender;
INSIST(VALID_SOCKET(sock));
LOCK(&sock->lock);
socket_log(sock, NULL, IOEVENT,
isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALSEND,
- "internal_send: task %p got event %p", me, ev);
-
- INSIST(sock->pending_send == 1);
- sock->pending_send = 0;
+ "internal_send: task got socket event %p", dev);
INSIST(sock->references > 0);
sock->references--; /* the internal event is done with this socket */
if (sock->references == 0) {
UNLOCK(&sock->lock);
- destroy(&sock);
+ destroy_socket(&sock);
return;
}
+ /* If the event is no longer in the list we can just return */
+ ldev = ISC_LIST_HEAD(sock->send_list);
+ while (ldev != NULL && ldev != dev) {
+ ldev = ISC_LIST_NEXT(ldev, ev_link);
+ }
+ if (ldev == NULL)
+ goto done;
/*
* Try to do as much I/O as possible on this socket. There are no
* limits here, currently.
*/
- dev = ISC_LIST_HEAD(sock->send_list);
- while (dev != NULL) {
- switch (doio_send(sock, dev)) {
- case DOIO_SOFT:
- goto poke;
-
- case DOIO_HARD:
- case DOIO_SUCCESS:
- send_senddone_event(sock, &dev);
- break;
- }
+ switch (completeio_send(sock, dev, messagehdr, nbytes, send_errno)) {
+ case DOIO_SOFT:
+ cc = 0;
+ send_errno = 0;
+ io_state = startio_send(sock, dev, &cc, FALSE, &send_errno);
+ goto done;
- dev = ISC_LIST_HEAD(sock->send_list);
+ case DOIO_HARD:
+ case DOIO_SUCCESS:
+ send_senddone_event(sock, &dev);
+ break;
}
- poke:
- if (!ISC_LIST_EMPTY(sock->send_list))
- select_poke(sock->manager, sock->fd, SELECT_POKE_WRITE);
+ done:
UNLOCK(&sock->lock);
}
-static void
-process_fds(isc_socketmgr_t *manager, int maxfd, int minfd,
- fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
-{
- int i;
- isc_socket_t *sock;
- isc_boolean_t unlock_sock;
- BOOL conn_check = FALSE;
+/*
+ * This is the I/O Completion Port Worker Function. It loops forever
+ * waiting for I/O to complete and then forwards them for further
+ * processing. There are a number of these in separate threads.
+ */
+static isc_threadresult_t WINAPI
+SocketIoThread(LPVOID ThreadContext) {
+ isc_socketmgr_t *manager = ThreadContext;
+ BOOL bSuccess = FALSE;
+ DWORD nbytes;
+ DWORD tbytes;
+ DWORD tflags;
+ IoCompletionInfo *lpo = NULL;
+ isc_socket_t *sock = NULL;
+ int request;
+ isc_socketevent_t *dev = NULL;
+ struct msghdr *messagehdr = NULL;
+ int errval;
+ char strbuf[ISC_STRERRORSIZE];
+ int errstatus;
- REQUIRE(maxfd <= FD_SETSIZE);
+ REQUIRE(VALID_MANAGER(manager));
- /*
- * Process read/writes on other fds here. Avoid locking
- * and unlocking twice if both reads and writes are possible.
+ /* Set the thread priority high enough so I/O will
+ * preempt normal recv packet processing, but not
+ * higher than the timer sync thread.
*/
- for (i = minfd ; i <= maxfd ; i++) {
- if (manager->fdstate[i] == CLOSE_PENDING) {
- manager->fdstate[i] = CLOSED;
- FD_CLR(i, &manager->read_fds);
- FD_CLR(i, &manager->write_fds);
- FD_CLR(i, &manager->except_fds);
-
- closesocket(i);
+ if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL)) {
+ errval = GetLastError();
+ isc__strerror(errval, strbuf, sizeof(strbuf));
+ FATAL_ERROR(__FILE__, __LINE__,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
+ ISC_MSG_FAILED,
+ "Can't set thread priority: %s"),
+ strbuf);
+ }
- continue;
- }
- sock = manager->fds[i];
- unlock_sock = ISC_FALSE;
- if (FD_ISSET(i, readfds)) {
- if (sock == NULL) {
- FD_CLR(i, &manager->read_fds);
- goto check_write;
- }
- unlock_sock = ISC_TRUE;
- LOCK(&sock->lock);
- if (!SOCK_DEAD(sock)) {
- if (sock->listener)
- dispatch_accept(sock);
- else
- dispatch_recv(sock);
- }
- FD_CLR(i, &manager->read_fds);
- }
- check_write:
- if (FD_ISSET(i, writefds)) {
- if (sock == NULL) {
- FD_CLR(i, &manager->write_fds);
- continue;
- }
- if (!unlock_sock) {
- unlock_sock = ISC_TRUE;
- LOCK(&sock->lock);
- }
- if (!SOCK_DEAD(sock)) {
- if (sock->connecting) {
- dispatch_connect(sock);
- conn_check = TRUE;
- }
- else
- dispatch_send(sock);
- }
- FD_CLR(i, &manager->write_fds);
- FD_CLR(i, &manager->except_fds);
+ /*
+ * Loop forever waiting on I/O Completions and then processing them
+ */
+ while(TRUE) {
+ bSuccess = GetQueuedCompletionStatus (
+ manager->hIoCompletionPort,
+ &nbytes,
+ (LPDWORD) &sock,
+ (LPOVERLAPPED *)&lpo,
+ INFINITE
+ );
+ if(lpo == NULL ) {
+ /*
+ * Received request to exit
+ */
+ break;
}
- if (FD_ISSET(i, exceptfds)) {
- if (sock == NULL) {
- FD_CLR(i, &manager->except_fds);
- continue;
- }
- if (!unlock_sock) {
- unlock_sock = ISC_TRUE;
- LOCK(&sock->lock);
- }
- if (!SOCK_DEAD(sock)) {
- if (sock->connecting) {
- dispatch_connect(sock);
- conn_check = TRUE;
- }
- }
- FD_CLR(i, &manager->write_fds);
- FD_CLR(i, &manager->except_fds);
+ errstatus = 0;
+ if(!bSuccess) {
+ /*
+ * I/O Failure
+ * Find out why
+ */
+ WSAGetOverlappedResult(sock->fd, (LPWSAOVERLAPPED) &lpo,
+ &tbytes, FALSE, &tflags);
+ dev = lpo->dev;
}
- if (unlock_sock)
- UNLOCK(&sock->lock);
+ request = lpo->request_type;
+ dev = lpo->dev;
+ messagehdr = &lpo->messagehdr;
+
+ switch (request) {
+ case SOCKET_CANCEL:
+ break;
+ case SOCKET_RECV:
+ internal_recv(sock, dev, messagehdr, nbytes, errstatus);
+ break;
+ case SOCKET_SEND:
+ internal_send(sock, dev, messagehdr, nbytes, errstatus);
+ break;
+ default:
+ break; /* Unknown: Just ignore it */
+ }
+ if (lpo != NULL)
+ HeapFree(hHeapHandle, 0, lpo);
}
+ /*
+ * Exit Completion Port Thread
+ */
+ manager_log(manager, TRACE,
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_EXITING, "SocketIoThread exiting"));
+ return ((isc_threadresult_t)0);
}
-
-#ifdef ISC_PLATFORM_USETHREADS
/*
- * This is the thread that will loop forever, always in a select or poll
- * call.
+ * This is the thread that will loop forever, waiting for an event to
+ * happen.
*
- * When select returns something to do, track down what thread gets to do
- * this I/O and post the event to it.
+ * When the wait returns something to do, find the signaled event
+ * and issue the request for the given socket
*/
static isc_threadresult_t WINAPI
-watcher(void *uap) {
- isc_socketmgr_t *manager = uap;
- isc_boolean_t done;
- int ctlfd;
+event_wait(void *uap) {
+ events_thread_t *evthread = uap;
+ isc_socketmgr_t *manager = evthread->manager;
int cc;
- fd_set readfds;
- fd_set writefds;
- fd_set exceptfds;
- int msg, fd;
- int maxfd;
- int minfd;
- int watcher_errno = 0;
+ int event_errno;
char strbuf[ISC_STRERRORSIZE];
+ isc_socket_t *wsock;
+ int iEvent;
+ int max_event;
+ sock_event_list *evlist;
+ WSANETWORKEVENTS NetworkEvents;
+ int err;
- /* Timeout on select in case it's necesasary */
- struct timeval tv;
- tv.tv_sec = MAX_SELECT_SECONDS;
- tv.tv_usec = MAX_SELECT_MILLISECONDS*1000;
+ REQUIRE(evthread != NULL);
+ REQUIRE(VALID_MANAGER(manager));
- /*
- * Get the control fd here. This will never change.
- */
- LOCK(&manager->lock);
- ctlfd = manager->pipe_fds[0];
+ /* We need to know the Id of the thread */
+ evthread->thread_id = GetCurrentThreadId();
- done = ISC_FALSE;
- while (!done) {
+ evlist = &(evthread->sockev_list);
+
+ /* See if there's anything waiting to add to the event list */
+ if (manager->event_written > 0)
+ process_eventlist(evlist, manager);
+
+ while (!manager->bShutdown) {
do {
- readfds = manager->read_fds;
- writefds = manager->write_fds;
- exceptfds = manager->except_fds;
- maxfd = manager->maxfd; /* Pipe not included */
- minfd = manager->minfd;
- watcher_errno = 0;
-
- UNLOCK(&manager->lock);
-
- if(maxfd > 0) {
- cc = select(maxfd, &readfds, &writefds,
- &exceptfds, &tv);
- if (cc < 0 && bpipe_written <= 0) {
- watcher_errno = WSAGetLastError();
- if (!SOFT_ERROR(watcher_errno) &&
- watcher_errno != WSAEINVAL) {
- isc__strerror(watcher_errno,
- strbuf, sizeof(strbuf));
- FATAL_ERROR(__FILE__, __LINE__,
- "select() %s: %s",
- isc_msgcat_get(isc_msgcat,
- ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED,
- "failed"),
- strbuf);
- }
- }
- } else {
- /*
- * Nothing to select on yet, so sleep
- * and check again for work
- */
- Sleep(MAX_SELECT_SECONDS*1000
- + MAX_SELECT_MILLISECONDS);
+ max_event = evlist->max_event;
+ event_errno = 0;
+
+ WSAResetEvent(evlist->aEventList[0]);
+ cc = WSAWaitForMultipleEvents(max_event,
+ evlist->aEventList, FALSE, WSA_INFINITE,
+ FALSE);
+ if (cc == WSA_WAIT_FAILED) {
+ event_errno = WSAGetLastError();
+ if (!SOFT_ERROR(event_errno)) {
+ isc__strerror(event_errno, strbuf,
+ sizeof(strbuf));
+ FATAL_ERROR(__FILE__, __LINE__,
+ "WSAWaitForMultipleEvents() %s: %s",
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
+ strbuf);
+ }
}
- LOCK(&manager->lock);
- } while (cc < 0 && bpipe_written <= 0);
+ } while (cc < 0 && !manager->bShutdown
+ && manager->event_written == 0);
+
+
+ if (manager->bShutdown)
+ break;
+ iEvent = cc - WSA_WAIT_EVENT_0;
/*
- * Process reads on internal, control fd.
+ * Add or delete events as requested
*/
- while (bpipe_written > 0) {
- select_readmsg(manager, &fd, &msg);
- InterlockedDecrement(&bpipe_written);
+ if (manager->event_written > 0)
+ process_eventlist(evlist, manager);
+ /*
+ * Stopped to add and delete events on the list
+ */
+ if(iEvent == 0)
+ continue;
- manager_log(manager, IOEVENT,
- isc_msgcat_get(isc_msgcat,
- ISC_MSGSET_SOCKET,
- ISC_MSG_WATCHERMSG,
- "watcher got message %d"),
- msg);
-
- /*
- * Nothing to read?
- */
- if (msg == SELECT_POKE_NOTHING)
- break;
+ wsock = evlist->aSockList[iEvent];
+ if (wsock == NULL)
+ continue;
- /*
- * Handle shutdown message. We really should
- * jump out of this loop right away, but
- * it doesn't matter if we have to do a little
- * more work first.
- */
- if (msg == SELECT_POKE_SHUTDOWN) {
- done = ISC_TRUE;
+ if (WSAEnumNetworkEvents( wsock->fd, 0,
+ &NetworkEvents) == SOCKET_ERROR) {
+ err = WSAGetLastError();
+ isc__strerror(err, strbuf, sizeof(strbuf));
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "event_wait: WSAEnumNetworkEvents() %s",
+ strbuf);
+ }
- break;
- }
+ if(NetworkEvents.lNetworkEvents == 0 ) {
+ WSAResetEvent(wsock->hEvent);
+ continue;
+ }
+
+ if(NetworkEvents.lNetworkEvents & FD_CLOSE) {
+ WSAResetEvent(wsock->hEvent);
+ continue;
+ }
+
+ if (wsock->references > 0 && wsock->pending_close == 0) {
+ if (wsock->listener == 1 &&
+ wsock->pending_accept == 0) {
+ wsock->pending_accept = 1;
+ wsock->references++;
+ internal_accept(wsock, event_errno);
+ }
+ else {
+ wsock->references++;
+ internal_connect(wsock, event_errno);
+ }
}
- process_fds(manager, maxfd, minfd, &readfds, &writefds, &exceptfds);
+ if (wsock->hEvent != NULL)
+ WSAResetEvent(wsock->hEvent);
}
manager_log(manager, TRACE,
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_EXITING, "watcher exiting"));
+ ISC_MSG_EXITING, "event_wait exiting"));
- UNLOCK(&manager->lock);
return ((isc_threadresult_t)0);
}
-#endif /* ISC_PLATFORM_USETHREADS */
-
/*
* Create a new socket manager.
*/
isc_result_t
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
isc_socketmgr_t *manager;
-#ifdef ISC_PLATFORM_USETHREADS
- char strbuf[ISC_STRERRORSIZE];
-#endif
+ events_thread_t *evthread = NULL;
REQUIRE(managerp != NULL && *managerp == NULL);
-#ifndef ISC_PLATFORM_USETHREADS
- if (socketmgr != NULL) {
- socketmgr->refs++;
- *managerp = socketmgr;
- return (ISC_R_SUCCESS);
- }
-#endif /* ISC_PLATFORM_USETHREADS */
-
manager = isc_mem_get(mctx, sizeof(*manager));
if (manager == NULL)
return (ISC_R_NOMEMORY);
manager->magic = SOCKET_MANAGER_MAGIC;
manager->mctx = NULL;
- memset(manager->fds, 0, sizeof(manager->fds));
ISC_LIST_INIT(manager->socklist);
if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) {
isc_mem_put(mctx, manager, sizeof(*manager));
@@ -2332,7 +2630,7 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
}
if (isc_condition_init(&manager->shutdown_ok) != ISC_R_SUCCESS) {
DESTROYLOCK(&manager->lock);
- isc_mem_put(mctx, manager, sizeof(*manager));
+ isc_mem_put(mctx, manager, sizeof (*manager));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_condition_init() %s",
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
@@ -2340,50 +2638,30 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) {
return (ISC_R_UNEXPECTED);
}
- /*
- * Create the special fds that will be used to wake up the
- * select/poll loop when something internal needs to be done.
- */
- if (internal_pipe(manager->pipe_fds) != 0) {
- DESTROYLOCK(&manager->lock);
- isc_mem_put(mctx, manager, sizeof(*manager));
- isc__strerror(errno, strbuf, sizeof(strbuf));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "pipe() %s: %s",
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED, "failed"),
- strbuf);
-
- return (ISC_R_UNEXPECTED);
- }
+ isc_mem_attach(mctx, &manager->mctx);
+ iocompletionport_init(manager); /* Create the Completion Ports */
/*
- * Set up initial state for the select loop
+ * Event Wait Thread Initialization
*/
- FD_ZERO(&manager->read_fds);
- FD_ZERO(&manager->write_fds);
- FD_ZERO(&manager->except_fds);
- manager->maxfd = 0;
- manager->minfd = FD_SETSIZE;
- memset(manager->fdstate, 0, sizeof(manager->fdstate));
+ ISC_LIST_INIT(manager->ev_threads);
/*
- * Start up the select/poll thread.
+ * Start up the initial event wait thread.
*/
- if (isc_thread_create(watcher, manager, &manager->watcher) !=
- ISC_R_SUCCESS) {
+ if (event_thread_create(&evthread, manager) != ISC_R_SUCCESS) {
DESTROYLOCK(&manager->lock);
isc_mem_put(mctx, manager, sizeof(*manager));
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_thread_create() %s",
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
- ISC_MSG_FAILED, "failed"));
- _close(manager->pipe_fds[0]);
- _close(manager->pipe_fds[1]);
return (ISC_R_UNEXPECTED);
}
- isc_mem_attach(mctx, &manager->mctx);
+
+ manager->prime_alert = evthread->sockev_list.aEventList[0];
+ manager->event_written = 0;
+ manager->bShutdown = ISC_FALSE;
+
+ /* Initialize the event update list */
+ ISC_LIST_INIT(manager->event_updates);
*managerp = manager;
@@ -2395,6 +2673,7 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
isc_socketmgr_t *manager;
int i;
isc_mem_t *mctx;
+ events_thread_t *evthread;
/*
* Destroy a socket manager.
@@ -2404,17 +2683,8 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
manager = *managerp;
REQUIRE(VALID_MANAGER(manager));
-#ifndef ISC_PLATFORM_USETHREADS
- if (manager->refs > 1) {
- manager->refs--;
- *managerp = NULL;
- return;
- }
-#endif /* ISC_PLATFORM_USETHREADS */
-
LOCK(&manager->lock);
-#ifdef ISC_PLATFORM_USETHREADS
/*
* Wait for all sockets to be destroyed.
*/
@@ -2425,56 +2695,59 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
"sockets exist"));
WAIT(&manager->shutdown_ok, &manager->lock);
}
-#else /* ISC_PLATFORM_USETHREADS */
- /*
- * Hope all sockets have been destroyed.
- */
- if (!ISC_LIST_EMPTY(manager->socklist)) {
- manager_log(manager, CREATION,
- isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET,
- ISC_MSG_SOCKETSREMAIN,
- "sockets exist"));
- INSIST(0);
- }
-#endif /* ISC_PLATFORM_USETHREADS */
UNLOCK(&manager->lock);
/*
- * Here, poke our select/poll thread. Do this by closing the write
- * half of the pipe, which will send EOF to the read half.
- * This is currently a no-op in the non-threaded case.
+ * Here, we need to had some wait code for the completion port
+ * thread.
*/
- select_poke(manager, 0, SELECT_POKE_SHUTDOWN);
+ signal_iocompletionport_exit(manager);
+ manager->bShutdown = ISC_TRUE;
-#ifdef ISC_PLATFORM_USETHREADS
/*
- * Wait for thread to exit.
+ * Wait for threads to exit.
*/
- if (isc_thread_join(manager->watcher, NULL) != ISC_R_SUCCESS)
- UNEXPECTED_ERROR(__FILE__, __LINE__,
- "isc_thread_join() %s",
+
+ /*
+ * Shut down the event wait threads
+ */
+ evthread = ISC_LIST_HEAD(manager->ev_threads);
+ while (evthread != NULL) {
+ WSASetEvent(evthread->sockev_list.aEventList[0]);
+ if (isc_thread_join(evthread->thread_handle, NULL) != ISC_R_SUCCESS)
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "isc_thread_join() for event_wait %s",
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
ISC_MSG_FAILED, "failed"));
-#endif /* ISC_PLATFORM_USETHREADS */
+ ISC_LIST_DEQUEUE(manager->ev_threads, evthread, link);
+ isc_mem_put(manager->mctx, evthread, sizeof(*evthread));
+ evthread = ISC_LIST_HEAD(manager->ev_threads);
+ }
/*
+ * Now the I/O Completion Port Worker Threads
+ */
+ for (i = 0; i < manager->maxIOCPThreads; i++) {
+ if (isc_thread_join((isc_thread_t) manager->hIOCPThreads[i], NULL)
+ != ISC_R_SUCCESS)
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "isc_thread_join() for Completion Port %s",
+ isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED, "failed"));
+ }
+ /*
* Clean up.
*/
-#ifdef ISC_PLATFORM_USETHREADS
- _close(manager->pipe_fds[0]);
- _close(manager->pipe_fds[1]);
- (void)isc_condition_destroy(&manager->shutdown_ok);
-#endif /* ISC_PLATFORM_USETHREADS */
- for (i = 0 ; i < FD_SETSIZE ; i++)
- if (manager->fdstate[i] == CLOSE_PENDING)
- closesocket(i);
+ CloseHandle(manager->hIoCompletionPort);
+
+ (void)isc_condition_destroy(&manager->shutdown_ok);
DESTROYLOCK(&manager->lock);
manager->magic = 0;
mctx= manager->mctx;
- isc_mem_put(mctx, manager, sizeof(*manager));
+ isc_mem_put(mctx, manager, sizeof *manager);
isc_mem_detach(&mctx);
@@ -2483,26 +2756,18 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) {
static isc_result_t
socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
- unsigned int flags)
-{
+ unsigned int flags) {
int io_state;
- isc_boolean_t have_lock = ISC_FALSE;
+ int cc = 0;
isc_task_t *ntask = NULL;
isc_result_t result = ISC_R_SUCCESS;
+ int recv_errno = 0;
dev->ev_sender = task;
- if (sock->type == isc_sockettype_udp) {
- io_state = doio_recv(sock, dev);
- } else {
- LOCK(&sock->lock);
- have_lock = ISC_TRUE;
-
- if (ISC_LIST_EMPTY(sock->recv_list))
- io_state = doio_recv(sock, dev);
- else
- io_state = DOIO_SOFT;
- }
+ LOCK(&sock->lock);
+ iocompletionport_update(sock);
+ io_state = startio_recv(sock, dev, &cc, FALSE, &recv_errno);
switch (io_state) {
case DOIO_SOFT:
@@ -2515,17 +2780,9 @@ socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
isc_task_attach(task, &ntask);
dev->attributes |= ISC_SOCKEVENTATTR_ATTACHED;
- if (!have_lock) {
- LOCK(&sock->lock);
- have_lock = ISC_TRUE;
- }
-
/*
- * Enqueue the request. If the socket was previously not being
- * watched, poke the watcher to start paying attention to it.
+ * Enqueue the request.
*/
- if (ISC_LIST_EMPTY(sock->recv_list))
- select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
ISC_LIST_ENQUEUE(sock->recv_list, dev, ev_link);
socket_log(sock, NULL, EVENT, NULL, 0, 0,
@@ -2546,9 +2803,7 @@ socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
send_recvdone_event(sock, &dev);
break;
}
-
- if (have_lock)
- UNLOCK(&sock->lock);
+ UNLOCK(&sock->lock);
return (result);
}
@@ -2663,6 +2918,8 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
unsigned int flags)
{
int io_state;
+ int send_errno = 0;
+ int cc = 0;
isc_boolean_t have_lock = ISC_FALSE;
isc_task_t *ntask = NULL;
isc_result_t result = ISC_R_SUCCESS;
@@ -2685,17 +2942,10 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
dev->pktinfo.ipi6_ifindex = 0;
}
- if (sock->type == isc_sockettype_udp)
- io_state = doio_send(sock, dev);
- else {
- LOCK(&sock->lock);
- have_lock = ISC_TRUE;
-
- if (ISC_LIST_EMPTY(sock->send_list))
- io_state = doio_send(sock, dev);
- else
- io_state = DOIO_SOFT;
- }
+ LOCK(&sock->lock);
+ have_lock = ISC_TRUE;
+ iocompletionport_update(sock);
+ io_state = startio_send(sock, dev, &cc, FALSE, &send_errno);
switch (io_state) {
case DOIO_SOFT:
@@ -2703,7 +2953,6 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
* We couldn't send all or part of the request right now, so
* queue it unless ISC_SOCKFLAG_NORETRY is set.
*/
- if ((flags & ISC_SOCKFLAG_NORETRY) == 0) {
isc_task_attach(task, &ntask);
dev->attributes |= ISC_SOCKEVENTATTR_ATTACHED;
@@ -2713,12 +2962,8 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
}
/*
- * Enqueue the request. If the socket was previously not being
- * watched, poke the watcher to start paying attention to it.
+ * Enqueue the request.
*/
- if (ISC_LIST_EMPTY(sock->send_list))
- select_poke(sock->manager, sock->fd,
- SELECT_POKE_WRITE);
ISC_LIST_ENQUEUE(sock->send_list, dev, ev_link);
socket_log(sock, NULL, EVENT, NULL, 0, 0,
@@ -2728,12 +2973,8 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
if ((flags & ISC_SOCKFLAG_IMMEDIATE) != 0)
result = ISC_R_INPROGRESS;
break;
- }
- case DOIO_HARD:
case DOIO_SUCCESS:
- if ((flags & ISC_SOCKFLAG_IMMEDIATE) == 0)
- send_senddone_event(sock, &dev);
break;
}
@@ -2776,7 +3017,6 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
if (dev == NULL) {
return (ISC_R_NOMEMORY);
}
-
dev->region = *region;
return (socket_send(sock, dev, task, address, pktinfo, 0));
@@ -2852,7 +3092,7 @@ isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region,
isc_result_t
isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
- int bind_errno = 0;
+ int bind_errno;
char strbuf[ISC_STRERRORSIZE];
int on = 1;
@@ -2865,7 +3105,7 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
return (ISC_R_FAMILYMISMATCH);
}
if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
- sizeof(on)) < 0) {
+ sizeof on) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"setsockopt(%d) %s", sock->fd,
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
@@ -2900,6 +3140,15 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
return (ISC_R_SUCCESS);
}
+isc_result_t
+isc_socket_filter(isc_socket_t *sock, const char *filter) {
+ UNUSED(sock);
+ UNUSED(filter);
+
+ REQUIRE(VALID_SOCKET(sock));
+ return (ISC_R_NOTIMPLEMENTED);
+}
+
/*
* Set up to listen on a given socket. We do this by creating an internal
* event that will be dispatched when the socket has read activity. The
@@ -2913,6 +3162,7 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
isc_result_t
isc_socket_listen(isc_socket_t *sock, unsigned int backlog) {
char strbuf[ISC_STRERRORSIZE];
+ isc_result_t retstat;
REQUIRE(VALID_SOCKET(sock));
@@ -2936,6 +3186,20 @@ isc_socket_listen(isc_socket_t *sock, unsigned int backlog) {
sock->listener = 1;
+ /* Add the socket to the list of events to accept */
+ retstat = socket_event_add(sock, FD_ACCEPT | FD_CLOSE);
+ if (retstat != ISC_R_SUCCESS) {
+ UNLOCK(&sock->lock);
+ if (retstat != ISC_R_NOSPACE) {
+ isc__strerror(WSAGetLastError(), strbuf,
+ sizeof(strbuf));
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "isc_socket_listen: socket_event_add: %s", strbuf);
+ }
+ return (retstat);
+ }
+
+
UNLOCK(&sock->lock);
return (ISC_R_SUCCESS);
}
@@ -2952,7 +3216,6 @@ isc_socket_accept(isc_socket_t *sock,
isc_task_t *ntask = NULL;
isc_socket_t *nsock;
isc_result_t ret;
- isc_boolean_t do_poke = ISC_FALSE;
REQUIRE(VALID_SOCKET(sock));
manager = sock->manager;
@@ -2993,18 +3256,10 @@ isc_socket_accept(isc_socket_t *sock,
dev->newsocket = nsock;
/*
- * Poke watcher here. We still have the socket locked, so there
- * is no race condition. We will keep the lock for such a short
- * bit of time waking it up now or later won't matter all that much.
+ * Enqueue the event
*/
- if (ISC_LIST_EMPTY(sock->accept_list))
- do_poke = ISC_TRUE;
-
ISC_LIST_ENQUEUE(sock->accept_list, dev, ev_link);
- if (do_poke)
- select_poke(manager, sock->fd, SELECT_POKE_ACCEPT);
-
UNLOCK(&sock->lock);
return (ISC_R_SUCCESS);
}
@@ -3017,6 +3272,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
isc_task_t *ntask = NULL;
isc_socketmgr_t *manager;
int cc;
+ int retstat;
int errval;
char strbuf[ISC_STRERRORSIZE];
@@ -3069,7 +3325,6 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
ERROR_MATCH(WSAENOBUFS, ISC_R_NORESOURCES);
ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
- ERROR_MATCH(WSAECONNRESET, ISC_R_CONNECTIONRESET);
#undef ERROR_MATCH
}
@@ -3115,125 +3370,24 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
dev->ev_sender = ntask;
/*
- * Poke watcher here. We still have the socket locked, so there
- * is no race condition. We will keep the lock for such a short
- * bit of time waking it up now or later won't matter all that much.
+ * Enqueue the request.
*/
- if (sock->connect_ev == NULL)
- select_poke(manager, sock->fd, SELECT_POKE_CONNECT);
-
sock->connect_ev = dev;
-
- UNLOCK(&sock->lock);
- return (ISC_R_SUCCESS);
-}
-
-/*
- * Called when a socket with a pending connect() finishes.
- */
-static void
-internal_connect(isc_task_t *me, isc_event_t *ev) {
- isc_socket_t *sock;
- isc_socket_connev_t *dev;
- isc_task_t *task;
- int cc;
- ISC_SOCKADDR_LEN_T optlen;
- int connect_errno = 0;
- char strbuf[ISC_STRERRORSIZE];
-
- UNUSED(me);
- INSIST(ev->ev_type == ISC_SOCKEVENT_INTW);
-
- sock = ev->ev_sender;
- INSIST(VALID_SOCKET(sock));
-
- LOCK(&sock->lock);
-
- /*
- * When the internal event was sent the reference count was bumped
- * to keep the socket around for us. Decrement the count here.
- */
- INSIST(sock->references > 0);
- sock->references--;
- if (sock->references == 0) {
- UNLOCK(&sock->lock);
- destroy(&sock);
- return;
- }
-
- /*
- * Has this event been canceled?
- */
- dev = sock->connect_ev;
- if (dev == NULL) {
- INSIST(!sock->connecting);
+ /* Add the socket to the list of events to connect */
+ retstat = socket_event_add(sock, FD_CONNECT | FD_CLOSE);
+ if (retstat != ISC_R_SUCCESS) {
UNLOCK(&sock->lock);
- return;
- }
-
- INSIST(sock->connecting);
- sock->connecting = 0;
-
- /*
- * Get any possible error status here.
- */
- optlen = sizeof(cc);
- if (getsockopt(sock->fd, SOL_SOCKET, SO_ERROR,
- (void *)&cc, (void *)&optlen) < 0)
- connect_errno = WSAGetLastError();
-
- if (connect_errno != 0) {
- /*
- * If the error is WSAEAGAIN, just re-select on this
- * fd and pretend nothing strange happened.
- */
- if (SOFT_ERROR(connect_errno) || connect_errno == WSAEINPROGRESS) {
- sock->connecting = 1;
- select_poke(sock->manager, sock->fd,
- SELECT_POKE_CONNECT);
- UNLOCK(&sock->lock);
-
- return;
- }
-
- /*
- * Translate other errors into ISC_R_* flavors.
- */
- switch (connect_errno) {
-#define ERROR_MATCH(a, b) case a: dev->result = b; break;
- ERROR_MATCH(WSAEACCES, ISC_R_NOPERM);
- ERROR_MATCH(WSAEADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
- ERROR_MATCH(WSAEAFNOSUPPORT, ISC_R_ADDRNOTAVAIL);
- ERROR_MATCH(WSAECONNREFUSED, ISC_R_CONNREFUSED);
- ERROR_MATCH(WSAEHOSTUNREACH, ISC_R_HOSTUNREACH);
- ERROR_MATCH(WSAEHOSTDOWN, ISC_R_HOSTUNREACH);
- ERROR_MATCH(WSAENETUNREACH, ISC_R_NETUNREACH);
- ERROR_MATCH(WSAENOBUFS, ISC_R_NORESOURCES);
- ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH);
- ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED);
- ERROR_MATCH(WSAETIMEDOUT, ISC_R_TIMEDOUT);
- ERROR_MATCH(WSAECONNRESET, ISC_R_CONNECTIONRESET);
-#undef ERROR_MATCH
- default:
- dev->result = ISC_R_UNEXPECTED;
- isc__strerror(connect_errno, strbuf, sizeof(strbuf));
+ if (retstat != ISC_R_NOSPACE) {
+ isc__strerror(WSAGetLastError(), strbuf,
+ sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
- "internal_connect: connect() %s",
- strbuf);
+ "isc_socket_connect: socket_event_add: %s", strbuf);
}
- } else {
- dev->result = ISC_R_SUCCESS;
- sock->connected = 1;
- sock->bound = 1;
+ return (retstat);
}
- sock->connect_ev = NULL;
-
UNLOCK(&sock->lock);
-
- task = dev->ev_sender;
- dev->ev_sender = sock;
- isc_task_sendanddetach(&task, (isc_event_t **)&dev);
+ return (ISC_R_SUCCESS);
}
isc_result_t
@@ -3275,7 +3429,7 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) {
ret = ISC_R_SUCCESS;
- len = sizeof(addressp->type);
+ len = sizeof addressp->type;
if (getsockname(sock->fd, &addressp->type.sa, (void *)&len) < 0) {
isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__, "getsockname: %s",
@@ -3330,7 +3484,6 @@ isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
while (dev != NULL) {
current_task = dev->ev_sender;
next = ISC_LIST_NEXT(dev, ev_link);
-
if ((task == NULL) || (task == current_task)) {
dev->result = ISC_R_CANCELED;
send_recvdone_event(sock, &dev);
@@ -3350,7 +3503,6 @@ isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
while (dev != NULL) {
current_task = dev->ev_sender;
next = ISC_LIST_NEXT(dev, ev_link);
-
if ((task == NULL) || (task == current_task)) {
dev->result = ISC_R_CANCELED;
send_senddone_event(sock, &dev);
@@ -3366,6 +3518,8 @@ isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) {
isc_task_t *current_task;
dev = ISC_LIST_HEAD(sock->accept_list);
+ socket_event_delete(sock);
+
while (dev != NULL) {
current_task = dev->ev_sender;
next = ISC_LIST_NEXT(dev, ev_link);
@@ -3432,3 +3586,22 @@ isc_socket_isbound(isc_socket_t *sock) {
return (val);
}
+
+void
+isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) {
+#if defined(IPV6_V6ONLY)
+ int onoff = yes ? 1 : 0;
+#else
+ UNUSED(yes);
+ UNUSED(sock);
+#endif
+
+ REQUIRE(VALID_SOCKET(sock));
+
+#ifdef IPV6_V6ONLY
+ if (sock->pf == AF_INET6) {
+ (void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_V6ONLY,
+ (void *)&onoff, sizeof(onoff));
+ }
+#endif
+}
diff --git a/lib/isc/win32/strerror.c b/lib/isc/win32/strerror.c
new file mode 100644
index 00000000..ceb45c8b
--- /dev/null
+++ b/lib/isc/win32/strerror.c
@@ -0,0 +1,459 @@
+/*
+ * Copyright (C) 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: strerror.c,v 1.5.186.2 2003/07/22 04:03:51 marka Exp $ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <winsock2.h>
+
+#include <isc/mutex.h>
+#include <isc/once.h>
+#include <isc/print.h>
+#include <isc/strerror.h>
+#include <isc/util.h>
+
+/*
+ * Forward declarations
+ */
+
+char *
+FormatError(int error);
+
+char *
+GetWSAErrorMessage(int errval);
+
+char *
+NTstrerror(int err, BOOL *bfreebuf);
+
+/*
+ * We need to do this this way for profiled locks.
+ */
+
+static isc_mutex_t isc_strerror_lock;
+static void init_lock(void) {
+ RUNTIME_CHECK(isc_mutex_init(&isc_strerror_lock) == ISC_R_SUCCESS);
+}
+
+/*
+ * This routine needs to free up any buffer allocated by FormatMessage
+ * if that routine gets used.
+ */
+
+void
+isc__strerror(int num, char *buf, size_t size) {
+ char *msg;
+ BOOL freebuf;
+ unsigned int unum = num;
+ static isc_once_t once = ISC_ONCE_INIT;
+
+ REQUIRE(buf != NULL);
+
+ RUNTIME_CHECK(isc_once_do(&once, init_lock) == ISC_R_SUCCESS);
+
+ LOCK(&isc_strerror_lock);
+ freebuf = FALSE;
+ msg = NTstrerror(num, &freebuf);
+ if (msg != NULL)
+ snprintf(buf, size, "%s", msg);
+ else
+ snprintf(buf, size, "Unknown error: %u", unum);
+ if(freebuf && msg != NULL) {
+ LocalFree(msg);
+ }
+ UNLOCK(&isc_strerror_lock);
+}
+
+/*
+ * Note this will cause a memory leak unless the memory allocated here
+ * is freed by calling LocalFree. isc__strerror does this before unlocking.
+ * This only gets called if there is a system type of error and will likely
+ * be an unusual event.
+ */
+char *
+FormatError(int error) {
+ LPVOID lpMsgBuf = NULL;
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ error,
+ /* Default language */
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf,
+ 0,
+ NULL);
+
+ return (lpMsgBuf);
+}
+
+/*
+ * This routine checks the error value and calls the WSA Windows Sockets
+ * Error message function GetWSAErrorMessage below if it's within that range
+ * since those messages are not available in the system error messages.
+ */
+char *
+NTstrerror(int err, BOOL *bfreebuf) {
+ char *retmsg = NULL;
+
+ /* Copy the error value first in case of other errors */
+ DWORD errval = err;
+
+ *bfreebuf = FALSE;
+
+ /* Get the Winsock2 error messages */
+ if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) {
+ retmsg = GetWSAErrorMessage(errval);
+ if (retmsg != NULL)
+ return (retmsg);
+ }
+ /*
+ * If it's not one of the standard Unix error codes,
+ * try a system error message
+ */
+ if (errval > (DWORD) _sys_nerr) {
+ *bfreebuf = TRUE;
+ return (FormatError(errval));
+ } else {
+ return (strerror(errval));
+ }
+}
+
+/*
+ * This is a replacement for perror
+ */
+void __cdecl
+NTperror(char *errmsg) {
+ /* Copy the error value first in case of other errors */
+ int errval = errno;
+ BOOL bfreebuf = FALSE;
+ char *msg;
+
+ msg = NTstrerror(errval, &bfreebuf);
+ fprintf(stderr, "%s: %s\n", errmsg, msg);
+ if(bfreebuf == TRUE) {
+ LocalFree(msg);
+ }
+
+}
+
+/*
+ * Return the error string related to Winsock2 errors.
+ * This function is necessary since FormatMessage knows nothing about them
+ * and there is no function to get them.
+ */
+char *
+GetWSAErrorMessage(int errval) {
+ char *msg;
+
+ switch (errval) {
+
+ case WSAEINTR:
+ msg = "Interrupted system call";
+ break;
+
+ case WSAEBADF:
+ msg = "Bad file number";
+ break;
+
+ case WSAEACCES:
+ msg = "Permission denied";
+ break;
+
+ case WSAEFAULT:
+ msg = "Bad address";
+ break;
+
+ case WSAEINVAL:
+ msg = "Invalid argument";
+ break;
+
+ case WSAEMFILE:
+ msg = "Too many open sockets";
+ break;
+
+ case WSAEWOULDBLOCK:
+ msg = "Operation would block";
+ break;
+
+ case WSAEINPROGRESS:
+ msg = "Operation now in progress";
+ break;
+
+ case WSAEALREADY:
+ msg = "Operation already in progress";
+ break;
+
+ case WSAENOTSOCK:
+ msg = "Socket operation on non-socket";
+ break;
+
+ case WSAEDESTADDRREQ:
+ msg = "Destination address required";
+ break;
+
+ case WSAEMSGSIZE:
+ msg = "Message too long";
+ break;
+
+ case WSAEPROTOTYPE:
+ msg = "Protocol wrong type for socket";
+ break;
+
+ case WSAENOPROTOOPT:
+ msg = "Bad protocol option";
+ break;
+
+ case WSAEPROTONOSUPPORT:
+ msg = "Protocol not supported";
+ break;
+
+ case WSAESOCKTNOSUPPORT:
+ msg = "Socket type not supported";
+ break;
+
+ case WSAEOPNOTSUPP:
+ msg = "Operation not supported on socket";
+ break;
+
+ case WSAEPFNOSUPPORT:
+ msg = "Protocol family not supported";
+ break;
+
+ case WSAEAFNOSUPPORT:
+ msg = "Address family not supported";
+ break;
+
+ case WSAEADDRINUSE:
+ msg = "Address already in use";
+ break;
+
+ case WSAEADDRNOTAVAIL:
+ msg = "Can't assign requested address";
+ break;
+
+ case WSAENETDOWN:
+ msg = "Network is down";
+ break;
+
+ case WSAENETUNREACH:
+ msg = "Network is unreachable";
+ break;
+
+ case WSAENETRESET:
+ msg = "Net connection reset";
+ break;
+
+ case WSAECONNABORTED:
+ msg = "Software caused connection abort";
+ break;
+
+ case WSAECONNRESET:
+ msg = "Connection reset by peer";
+ break;
+
+ case WSAENOBUFS:
+ msg = "No buffer space available";
+ break;
+
+ case WSAEISCONN:
+ msg = "Socket is already connected";
+ break;
+
+ case WSAENOTCONN:
+ msg = "Socket is not connected";
+ break;
+
+ case WSAESHUTDOWN:
+ msg = "Can't send after socket shutdown";
+ break;
+
+ case WSAETOOMANYREFS:
+ msg = "Too many references: can't splice";
+ break;
+
+ case WSAETIMEDOUT:
+ msg = "Connection timed out";
+ break;
+
+ case WSAECONNREFUSED:
+ msg = "Connection refused";
+ break;
+
+ case WSAELOOP:
+ msg = "Too many levels of symbolic links";
+ break;
+
+ case WSAENAMETOOLONG:
+ msg = "File name too long";
+ break;
+
+ case WSAEHOSTDOWN:
+ msg = "Host is down";
+ break;
+
+ case WSAEHOSTUNREACH:
+ msg = "No route to host";
+ break;
+
+ case WSAENOTEMPTY:
+ msg = "Directory not empty";
+ break;
+
+ case WSAEPROCLIM:
+ msg = "Too many processes";
+ break;
+
+ case WSAEUSERS:
+ msg = "Too many users";
+ break;
+
+ case WSAEDQUOT:
+ msg = "Disc quota exceeded";
+ break;
+
+ case WSAESTALE:
+ msg = "Stale NFS file handle";
+ break;
+
+ case WSAEREMOTE:
+ msg = "Too many levels of remote in path";
+ break;
+
+ case WSASYSNOTREADY:
+ msg = "Network system is unavailable";
+ break;
+
+ case WSAVERNOTSUPPORTED:
+ msg = "Winsock version out of range";
+ break;
+
+ case WSANOTINITIALISED:
+ msg = "WSAStartup not yet called";
+ break;
+
+ case WSAEDISCON:
+ msg = "Graceful shutdown in progress";
+ break;
+/*
+ case WSAHOST_NOT_FOUND:
+ msg = "Host not found";
+ break;
+
+ case WSANO_DATA:
+ msg = "No host data of that type was found";
+ break;
+*/
+ default:
+ msg = NULL;
+ break;
+ }
+ return (msg);
+}
+
+/*
+ * These error messages are more informative about CryptAPI Errors than the
+ * standard error messages
+ */
+
+char *
+GetCryptErrorMessage(int errval) {
+ char *msg;
+
+ switch (errval) {
+
+ case NTE_BAD_FLAGS:
+ msg = "The dwFlags parameter has an illegal value.";
+ break;
+ case NTE_BAD_KEYSET:
+ msg = "The Registry entry for the key container "
+ "could not be opened and may not exist.";
+ break;
+ case NTE_BAD_KEYSET_PARAM:
+ msg = "The pszContainer or pszProvider parameter "
+ "is set to an illegal value.";
+ break;
+ case NTE_BAD_PROV_TYPE:
+ msg = "The value of the dwProvType parameter is out "
+ "of range. All provider types must be from "
+ "1 to 999, inclusive.";
+ break;
+ case NTE_BAD_SIGNATURE:
+ msg = "The provider DLL signature did not verify "
+ "correctly. Either the DLL or the digital "
+ "signature has been tampered with.";
+ break;
+ case NTE_EXISTS:
+ msg = "The dwFlags parameter is CRYPT_NEWKEYSET, but the key"
+ " container already exists.";
+ break;
+ case NTE_KEYSET_ENTRY_BAD:
+ msg = "The Registry entry for the pszContainer key container "
+ "was found (in the HKEY_CURRENT_USER window), but is "
+ "corrupt. See the section System Administration for "
+ " etails about CryptoAPI's Registry usage.";
+ break;
+ case NTE_KEYSET_NOT_DEF:
+ msg = "No Registry entry exists in the HKEY_CURRENT_USER "
+ "window for the key container specified by "
+ "pszContainer.";
+ break;
+ case NTE_NO_MEMORY:
+ msg = "The CSP ran out of memory during the operation.";
+ break;
+ case NTE_PROV_DLL_NOT_FOUND:
+ msg = "The provider DLL file does not exist or is not on the "
+ "current path.";
+ break;
+ case NTE_PROV_TYPE_ENTRY_BAD:
+ msg = "The Registry entry for the provider type specified by "
+ "dwProvType is corrupt. This error may relate to "
+ "either the user default CSP list or the machine "
+ "default CSP list. See the section System "
+ "Administration for details about CryptoAPI's "
+ "Registry usage.";
+ break;
+ case NTE_PROV_TYPE_NO_MATCH:
+ msg = "The provider type specified by dwProvType does not "
+ "match the provider type found in the Registry. Note "
+ "that this error can only occur when pszProvider "
+ "specifies an actual CSP name.";
+ break;
+ case NTE_PROV_TYPE_NOT_DEF:
+ msg = "No Registry entry exists for the provider type "
+ "specified by dwProvType.";
+ break;
+ case NTE_PROVIDER_DLL_FAIL:
+ msg = "The provider DLL file could not be loaded, and "
+ "may not exist. If it exists, then the file is "
+ "not a valid DLL.";
+ break;
+ case NTE_SIGNATURE_FILE_BAD:
+ msg = "An error occurred while loading the DLL file image, "
+ "prior to verifying its signature.";
+ break;
+
+ default:
+ msg = NULL;
+ break;
+ }
+ return msg;
+}
+
diff --git a/lib/isc/win32/win32os.c b/lib/isc/win32/win32os.c
new file mode 100644
index 00000000..45b3c6ca
--- /dev/null
+++ b/lib/isc/win32/win32os.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: win32os.c,v 1.2.176.2 2003/07/22 04:03:51 marka Exp $ */
+
+#include <windows.h>
+
+#include <isc/win32os.h>
+
+static BOOL bInit = FALSE;
+static OSVERSIONINFOEX osVer;
+
+static void
+initialize_action(void) {
+ BOOL bSuccess;
+
+ if (bInit)
+ return;
+ /*
+ * NOTE: VC++ 6.0 gets this function declaration wrong
+ * so we compensate by casting the argument
+ */
+ osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ bSuccess = GetVersionEx((OSVERSIONINFO *) &osVer);
+
+ /*
+ * Versions of NT before NT4.0 SP6 did not return the
+ * extra info that the EX structure provides and returns
+ * a failure so we need to retry with the old structure.
+ */
+ if(!bSuccess) {
+ osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ bSuccess = GetVersionEx((OSVERSIONINFO *) &osVer);
+ }
+ bInit = TRUE;
+}
+
+unsigned int
+isc_win32os_majorversion(void) {
+ initialize_action();
+ return ((unsigned int)osVer.dwMajorVersion);
+}
+
+unsigned int
+isc_win32os_minorversion(void) {
+ initialize_action();
+ return ((unsigned int)osVer.dwMinorVersion);
+}
+
+unsigned int
+isc_win32os_servicepackmajor(void) {
+ initialize_action();
+ return ((unsigned int)osVer.wServicePackMajor);
+}
+
+unsigned int
+isc_win32os_servicepackminor(void) {
+ initialize_action();
+ return ((unsigned int)osVer.wServicePackMinor);
+}
+
+int
+isc_win32os_versioncheck(unsigned int major, unsigned int minor,
+ unsigned int spmajor, unsigned int spminor) {
+
+ initialize_action();
+
+ if (major < isc_win32os_majorversion())
+ return (1);
+ if (major > isc_win32os_majorversion())
+ return (-1);
+ if (minor < isc_win32os_minorversion())
+ return (1);
+ if (minor > isc_win32os_minorversion())
+ return (-1);
+ if (spmajor < isc_win32os_servicepackmajor())
+ return (1);
+ if (spmajor > isc_win32os_servicepackmajor())
+ return (-1);
+ if (spminor < isc_win32os_servicepackminor())
+ return (1);
+ if (spminor > isc_win32os_servicepackminor())
+ return (-1);
+
+ /* Exact */
+ return (0);
+} \ No newline at end of file
diff --git a/lib/isccc/api b/lib/isccc/api
index 06977fcb..13178156 100644
--- a/lib/isccc/api
+++ b/lib/isccc/api
@@ -1,3 +1,3 @@
-LIBINTERFACE = 0
-LIBREVISION = 1
-LIBAGE = 0
+LIBINTERFACE = 1
+LIBREVISION = 0
+LIBAGE = 1
diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c
index 9ac82ad7..6750e913 100644
--- a/lib/isccc/cc.c
+++ b/lib/isccc/cc.c
@@ -16,7 +16,7 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: cc.c,v 1.4.2.2 2002/03/26 00:55:13 marka Exp $ */
+/* $Id: cc.c,v 1.4.2.3 2003/07/23 06:57:55 marka Exp $ */
#include <config.h>
@@ -105,7 +105,7 @@ value_towire(isccc_sexpr_t *elt, isccc_region_t *target)
* the placeholder length too. Adjust and
* emit.
*/
- INSIST(len >= 4);
+ INSIST(len >= 4U);
len -= 4;
PUT32(len, lenp);
} else if (isccc_sexpr_listp(elt)) {
@@ -128,7 +128,7 @@ value_towire(isccc_sexpr_t *elt, isccc_region_t *target)
* 'len' is 4 bytes too big, since it counts
* the placeholder length. Adjust and emit.
*/
- INSIST(len >= 4);
+ INSIST(len >= 4U);
len -= 4;
PUT32(len, lenp);
}
@@ -152,7 +152,7 @@ table_towire(isccc_sexpr_t *alist, isccc_region_t *target)
ks = isccc_sexpr_tostring(k);
v = ISCCC_SEXPR_CDR(kv);
len = strlen(ks);
- INSIST(len <= 255);
+ INSIST(len <= 255U);
/*
* Emit the key name.
*/
diff --git a/lib/isccc/include/isccc/result.h b/lib/isccc/include/isccc/result.h
index 1cd3a8d2..daf5223a 100644
--- a/lib/isccc/include/isccc/result.h
+++ b/lib/isccc/include/isccc/result.h
@@ -1,6 +1,6 @@
/*
- * Portions Copyright (C) 2001 Internet Software Consortium.
- * Portions Copyright (C) 2001 Nominum, Inc.
+ * Portions Copyright (C) 2001, 2003 Internet Software Consortium.
+ * Portions Copyright (C) 2001, 2003 Nominum, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -16,7 +16,7 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.h,v 1.3 2001/03/28 23:11:41 bwelling Exp $ */
+/* $Id: result.h,v 1.3.2.2 2003/07/22 04:03:53 marka Exp $ */
#ifndef ISCCC_RESULT_H
#define ISCCC_RESULT_H 1
@@ -30,8 +30,11 @@
#define ISCCC_R_UNKNOWNVERSION (ISC_RESULTCLASS_ISCCC + 0)
#define ISCCC_R_SYNTAX (ISC_RESULTCLASS_ISCCC + 1)
#define ISCCC_R_BADAUTH (ISC_RESULTCLASS_ISCCC + 2)
+#define ISCCC_R_EXPIRED (ISC_RESULTCLASS_ISCCC + 3)
+#define ISCCC_R_CLOCKSKEW (ISC_RESULTCLASS_ISCCC + 4)
+#define ISCCC_R_DUPLICATE (ISC_RESULTCLASS_ISCCC + 5)
-#define ISCCC_R_NRESULTS 3 /* Number of results */
+#define ISCCC_R_NRESULTS 6 /* Number of results */
ISC_LANG_BEGINDECLS
diff --git a/lib/isccc/result.c b/lib/isccc/result.c
index 529e0fe2..764d04d1 100644
--- a/lib/isccc/result.c
+++ b/lib/isccc/result.c
@@ -1,6 +1,6 @@
/*
- * Portions Copyright (C) 2001 Internet Software Consortium.
- * Portions Copyright (C) 2001 Nominum, Inc.
+ * Portions Copyright (C) 2001, 2003 Internet Software Consortium.
+ * Portions Copyright (C) 2001, 2003 Nominum, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -16,7 +16,7 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: result.c,v 1.3 2001/03/28 23:11:40 bwelling Exp $ */
+/* $Id: result.c,v 1.3.2.2 2003/07/22 04:03:52 marka Exp $ */
#include <config.h>
@@ -30,6 +30,9 @@ static const char *text[ISCCC_R_NRESULTS] = {
"unknown version", /* 1 */
"syntax error", /* 2 */
"bad auth", /* 3 */
+ "expired", /* 4 */
+ "clock skew", /* 5 */
+ "duplicate" /* 6 */
};
#define ISCCC_RESULT_RESULTSET 2
diff --git a/lib/isccc/win32/libisccc.def b/lib/isccc/win32/libisccc.def
index 5d32a528..f8fdf87b 100644
--- a/lib/isccc/win32/libisccc.def
+++ b/lib/isccc/win32/libisccc.def
@@ -1,66 +1,66 @@
-LIBRARY libisccc
-
-; Exported Functions
-EXPORTS
-
-isccc_alist_create
-isccc_alist_alistp
-isccc_alist_emptyp
-isccc_alist_first
-isccc_alist_assq
-isccc_alist_delete
-isccc_alist_define
-isccc_alist_definestring
-isccc_alist_definebinary
-isccc_alist_lookup
-isccc_alist_lookupstring
-isccc_alist_lookupbinary
-isccc_alist_prettyprint
-isccc_base64_encode
-isccc_base64_decode
-isccc_cc_towire
-isccc_cc_fromwire
-isccc_cc_createmessage
-isccc_cc_createack
-isccc_cc_isack
-isccc_cc_isreply
-isccc_cc_createresponse
-isccc_cc_definestring
-isccc_cc_defineuint32
-isccc_cc_lookupstring
-isccc_cc_lookupuint32
-isccc_cc_createsymtab
-isccc_cc_cleansymtab
-isccc_cc_checkdup
-isccc_ccmsg_init
-isccc_ccmsg_setmaxsize
-isccc_ccmsg_readmessage
-isccc_ccmsg_cancelread
-isccc_ccmsg_invalidate
-isccc_lib_initmsgcat
-isccc_result_totext
-isccc_result_register
-isccc_sexpr_cons
-isccc_sexpr_tconst
-isccc_sexpr_fromstring
-isccc_sexpr_frombinary
-isccc_sexpr_free
-isccc_sexpr_print
-isccc_sexpr_car
-isccc_sexpr_cdr
-isccc_sexpr_setcar
-isccc_sexpr_setcdr
-isccc_sexpr_addtolist
-isccc_sexpr_listp
-isccc_sexpr_emptyp
-isccc_sexpr_stringp
-isccc_sexpr_binaryp
-isccc_sexpr_tostring
-isccc_sexpr_tobinary
-isccc_symtab_destroy
-isccc_symtab_create
-isccc_symtab_destroy
-isccc_symtab_lookup
-isccc_symtab_define
-isccc_symtab_undefine
-isccc_symtab_foreach
+LIBRARY libisccc
+
+; Exported Functions
+EXPORTS
+
+isccc_alist_create
+isccc_alist_alistp
+isccc_alist_emptyp
+isccc_alist_first
+isccc_alist_assq
+isccc_alist_delete
+isccc_alist_define
+isccc_alist_definestring
+isccc_alist_definebinary
+isccc_alist_lookup
+isccc_alist_lookupstring
+isccc_alist_lookupbinary
+isccc_alist_prettyprint
+isccc_base64_encode
+isccc_base64_decode
+isccc_cc_towire
+isccc_cc_fromwire
+isccc_cc_createmessage
+isccc_cc_createack
+isccc_cc_isack
+isccc_cc_isreply
+isccc_cc_createresponse
+isccc_cc_definestring
+isccc_cc_defineuint32
+isccc_cc_lookupstring
+isccc_cc_lookupuint32
+isccc_cc_createsymtab
+isccc_cc_cleansymtab
+isccc_cc_checkdup
+isccc_ccmsg_init
+isccc_ccmsg_setmaxsize
+isccc_ccmsg_readmessage
+isccc_ccmsg_cancelread
+isccc_ccmsg_invalidate
+isccc_lib_initmsgcat
+isccc_result_totext
+isccc_result_register
+isccc_sexpr_cons
+isccc_sexpr_tconst
+isccc_sexpr_fromstring
+isccc_sexpr_frombinary
+isccc_sexpr_free
+isccc_sexpr_print
+isccc_sexpr_car
+isccc_sexpr_cdr
+isccc_sexpr_setcar
+isccc_sexpr_setcdr
+isccc_sexpr_addtolist
+isccc_sexpr_listp
+isccc_sexpr_emptyp
+isccc_sexpr_stringp
+isccc_sexpr_binaryp
+isccc_sexpr_tostring
+isccc_sexpr_tobinary
+isccc_symtab_destroy
+isccc_symtab_create
+isccc_symtab_destroy
+isccc_symtab_lookup
+isccc_symtab_define
+isccc_symtab_undefine
+isccc_symtab_foreach
diff --git a/lib/isccc/win32/libisccc.dsp b/lib/isccc/win32/libisccc.dsp
index 33c7ba8a..0b9eb49b 100644
--- a/lib/isccc/win32/libisccc.dsp
+++ b/lib/isccc/win32/libisccc.dsp
@@ -1,197 +1,197 @@
-# Microsoft Developer Studio Project File - Name="libisccc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libisccc - Win32 Release
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libisccc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libisccc.mak" CFG="libisccc - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libisccc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libisccc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libisccc - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libisccc_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../" /I "include" /I "../include" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../../../lib/isc/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBISCCC_EXPORTS" /YX /FD /c
-# SUBTRACT CPP /X
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/Release/libisc.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libisccc.dll"
-
-!ELSEIF "$(CFG)" == "libisccc - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libisccc_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../../../lib/isc/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "_DEBUG" /D "WIN32" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBISCCC_EXPORTS" /FR /YX /FD /GZ /c
-# SUBTRACT CPP /X
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/debug/libisc.lib /nologo /dll /debug /machine:I386 /out:"../../../Build/Debug/libisccc.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "libisccc - Win32 Release"
-# Name "libisccc - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\alist.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\cc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ccmsg.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\DLLMain.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\result.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sexpr.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\symtab.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\version.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\include\isccc\alist.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\cc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\ccmsg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\events.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\lib.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\result.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\sexpr.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\symtab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\symtype.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccc\util.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\libisccc.def
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="libisccc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libisccc - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libisccc.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libisccc.mak" CFG="libisccc - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libisccc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libisccc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libisccc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libisccc_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../" /I "include" /I "../include" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../../../lib/isc/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBISCCC_EXPORTS" /YX /FD /c
+# SUBTRACT CPP /X
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/Release/libisc.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libisccc.dll"
+
+!ELSEIF "$(CFG)" == "libisccc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libisccc_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../../../lib/isc/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "_DEBUG" /D "WIN32" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBISCCC_EXPORTS" /FR /YX /FD /GZ /c
+# SUBTRACT CPP /X
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/debug/libisc.lib /nologo /dll /debug /machine:I386 /out:"../../../Build/Debug/libisccc.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "libisccc - Win32 Release"
+# Name "libisccc - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\alist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\cc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ccmsg.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\DLLMain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\result.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sexpr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\symtab.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\version.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\include\isccc\alist.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\base64.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\cc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\ccmsg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\events.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\lib.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\result.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\sexpr.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\symtab.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\symtype.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\types.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccc\util.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\libisccc.def
+# End Source File
+# End Target
+# End Project
diff --git a/lib/isccc/win32/libisccc.dsw b/lib/isccc/win32/libisccc.dsw
index 3bcecf04..28eaa74f 100644
--- a/lib/isccc/win32/libisccc.dsw
+++ b/lib/isccc/win32/libisccc.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "libisccc"=.\libisccc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libisccc"=.\libisccc.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/lib/isccfg/api b/lib/isccfg/api
index dbaaf58c..b4cd78b7 100644
--- a/lib/isccfg/api
+++ b/lib/isccfg/api
@@ -1,3 +1,3 @@
LIBINTERFACE = 0
-LIBREVISION = 4
+LIBREVISION = 5
LIBAGE = 0
diff --git a/lib/isccfg/check.c b/lib/isccfg/check.c
index b762c73b..179c17d1 100644
--- a/lib/isccfg/check.c
+++ b/lib/isccfg/check.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001, 2002 Internet Software Consortium.
+ * Copyright (C) 2001-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: check.c,v 1.14.2.16 2002/04/23 02:00:03 marka Exp $ */
+/* $Id: check.c,v 1.14.2.18 2003/07/22 04:03:53 marka Exp $ */
#include <config.h>
@@ -243,11 +243,18 @@ check_zoneconf(cfg_obj_t *zconfig, isc_symtab_t *symtab, isc_log_t *logctx,
cfg_map_get(zoptions, options[i].name, &obj) ==
ISC_R_SUCCESS)
{
- cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
- "option '%s' is not allowed in '%s' "
- "zone '%s'",
- options[i].name, typestr, zname);
- result = ISC_R_FAILURE;
+ if (strcmp(options[i].name, "allow-update") != 0 ||
+ ztype != SLAVEZONE) {
+ cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
+ "option '%s' is not allowed "
+ "in '%s' zone '%s'",
+ options[i].name, typestr, zname);
+ result = ISC_R_FAILURE;
+ } else
+ cfg_obj_log(obj, logctx, ISC_LOG_WARNING,
+ "option '%s' is not allowed "
+ "in '%s' zone '%s'",
+ options[i].name, typestr, zname);
}
}
diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c
index dc879231..c9dd28b9 100644
--- a/lib/isccfg/parser.c
+++ b/lib/isccfg/parser.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: parser.c,v 1.70.2.14.4.2 2003/02/17 07:05:10 marka Exp $ */
+/* $Id: parser.c,v 1.70.2.20 2003/07/23 06:57:55 marka Exp $ */
#include <config.h>
@@ -1200,7 +1200,8 @@ create_tuple(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
return (ISC_R_SUCCESS);
cleanup:
- CLEANUP_OBJ(obj);
+ if (obj != NULL)
+ isc_mem_put(pctx->mctx, obj, sizeof(*obj));
return (result);
}
@@ -1665,6 +1666,10 @@ parse_sizeval(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
UNUSED(type);
CHECK(cfg_gettoken(pctx, 0));
+ if (pctx->token.type != isc_tokentype_string) {
+ result = ISC_R_UNEXPECTEDTOKEN;
+ goto cleanup;
+ }
CHECK(parse_unitstring(pctx->token.value.as_pointer, &val));
CHECK(create_cfgobj(pctx, &cfg_type_uint64, &obj));
@@ -1774,7 +1779,7 @@ create_string(cfg_parser_t *pctx, const char *contents, const cfg_type_t *type,
obj->value.string.length = len;
obj->value.string.base = isc_mem_get(pctx->mctx, len + 1);
if (obj->value.string.base == 0) {
- CLEANUP_OBJ(obj);
+ isc_mem_put(pctx->mctx, obj, sizeof(*obj));
return (ISC_R_NOMEMORY);
}
memcpy(obj->value.string.base, contents, len);
@@ -2107,24 +2112,26 @@ parse_list(cfg_parser_t *pctx, const cfg_type_t *listtype, cfg_obj_t **ret)
cfg_obj_t *listobj = NULL;
const cfg_type_t *listof = listtype->of;
isc_result_t result;
+ cfg_listelt_t *elt = NULL;
CHECK(create_list(pctx, listtype, &listobj));
for (;;) {
- cfg_listelt_t *elt = NULL;
-
CHECK(cfg_peektoken(pctx, 0));
if (pctx->token.type == isc_tokentype_special &&
- pctx->token.value.as_char == '}')
+ pctx->token.value.as_char == /*{*/ '}')
break;
CHECK(parse_list_elt(pctx, listof, &elt));
CHECK(parse_semicolon(pctx));
ISC_LIST_APPEND(listobj->value.list, elt, link);
+ elt = NULL;
}
*ret = listobj;
return (ISC_R_SUCCESS);
cleanup:
+ if (elt != NULL)
+ free_list_elt(pctx, elt);
CLEANUP_OBJ(listobj);
return (result);
}
@@ -2427,7 +2434,6 @@ parse_symtab_elt(cfg_parser_t *pctx, const char *name,
CHECK(isc_symtab_define(symtab, name,
1, symval,
isc_symexists_reject));
- obj = NULL;
return (ISC_R_SUCCESS);
cleanup:
@@ -2766,7 +2772,7 @@ token_addr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na) {
}
}
if ((flags & V4PREFIXOK) != 0 &&
- strlen(s) <= 15) {
+ strlen(s) <= 15U) {
char buf[64];
int i;
@@ -2825,7 +2831,7 @@ get_port(cfg_parser_t *pctx, unsigned int flags, in_port_t *port) {
"expected port number or '*'");
return (ISC_R_UNEXPECTEDTOKEN);
}
- if (pctx->token.value.as_ulong >= 65536) {
+ if (pctx->token.value.as_ulong >= 65536U) {
parser_error(pctx, LOG_NEAR,
"port number out of range");
return (ISC_R_UNEXPECTEDTOKEN);
@@ -3756,7 +3762,8 @@ create_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
return (ISC_R_SUCCESS);
cleanup:
- CLEANUP_OBJ(obj);
+ if (obj != NULL)
+ isc_mem_put(pctx->mctx, obj, sizeof(*obj));
return (result);
}
diff --git a/lib/isccfg/win32/libisccfg.def b/lib/isccfg/win32/libisccfg.def
index 1dd1b82e..4070f895 100644
--- a/lib/isccfg/win32/libisccfg.def
+++ b/lib/isccfg/win32/libisccfg.def
@@ -1,44 +1,44 @@
-LIBRARY libisccfg
-
-; Exported Functions
-EXPORTS
-
-cfg_parser_create
-cfg_parser_setcallback
-cfg_parse_file
-cfg_parse_buffer
-cfg_parser_destroy
-cfg_obj_isvoid
-cfg_obj_ismap
-cfg_map_get
-cfg_map_getname
-cfg_obj_istuple
-cfg_tuple_get
-cfg_obj_isuint32
-cfg_obj_asuint32
-cfg_obj_isuint64
-cfg_obj_asuint64
-cfg_obj_isstring
-cfg_obj_asstring
-cfg_obj_isboolean
-cfg_obj_asboolean
-cfg_obj_issockaddr
-cfg_obj_assockaddr
-cfg_obj_isnetprefix
-cfg_obj_asnetprefix
-cfg_obj_islist
-cfg_list_first
-cfg_list_next
-cfg_listelt_value
-cfg_obj_istype
-cfg_obj_destroy
-cfg_obj_log
-cfg_check_namedconf
-cfg_check_key
-cfg_log_init
-
-
-
-; Exported Data
-
-;cfg_type_rndcconf
+LIBRARY libisccfg
+
+; Exported Functions
+EXPORTS
+
+cfg_parser_create
+cfg_parser_setcallback
+cfg_parse_file
+cfg_parse_buffer
+cfg_parser_destroy
+cfg_obj_isvoid
+cfg_obj_ismap
+cfg_map_get
+cfg_map_getname
+cfg_obj_istuple
+cfg_tuple_get
+cfg_obj_isuint32
+cfg_obj_asuint32
+cfg_obj_isuint64
+cfg_obj_asuint64
+cfg_obj_isstring
+cfg_obj_asstring
+cfg_obj_isboolean
+cfg_obj_asboolean
+cfg_obj_issockaddr
+cfg_obj_assockaddr
+cfg_obj_isnetprefix
+cfg_obj_asnetprefix
+cfg_obj_islist
+cfg_list_first
+cfg_list_next
+cfg_listelt_value
+cfg_obj_istype
+cfg_obj_destroy
+cfg_obj_log
+cfg_check_namedconf
+cfg_check_key
+cfg_log_init
+
+
+
+; Exported Data
+
+;cfg_type_rndcconf
diff --git a/lib/isccfg/win32/libisccfg.dsp b/lib/isccfg/win32/libisccfg.dsp
index ec2df68e..8333be17 100644
--- a/lib/isccfg/win32/libisccfg.dsp
+++ b/lib/isccfg/win32/libisccfg.dsp
@@ -1,141 +1,141 @@
-# Microsoft Developer Studio Project File - Name="libisccfg" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libisccfg - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libisccfg.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libisccfg.mak" CFG="libisccfg - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libisccfg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libisccfg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libisccfg - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libisccfg_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../" /I "include" /I "../include" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/isc/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBISCCFG_EXPORTS" /YX /FD /c
-# SUBTRACT CPP /X
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/Release/libisc.lib ../../dns/win32/Release/libdns.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libisccfg.dll"
-
-!ELSEIF "$(CFG)" == "libisccfg - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libisccfg_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/isc/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISCCFG_EXPORTS" /FR /YX /FD /GZ /c
-# SUBTRACT CPP /X
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/debug/libisc.lib ../../dns/win32/debug/libdns.lib /nologo /dll /debug /machine:I386 /out:"../../../Build/Debug/libisccfg.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "libisccfg - Win32 Release"
-# Name "libisccfg - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\check.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\DLLMain.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\log.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\parser.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\version.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\include\isccfg\cfg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccfg\check.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\isccfg\log.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\libisccfg.def
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="libisccfg" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libisccfg - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libisccfg.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libisccfg.mak" CFG="libisccfg - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libisccfg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libisccfg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libisccfg - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libisccfg_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../" /I "include" /I "../include" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/isc/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBISCCFG_EXPORTS" /YX /FD /c
+# SUBTRACT CPP /X
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/Release/libisc.lib ../../dns/win32/Release/libdns.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libisccfg.dll"
+
+!ELSEIF "$(CFG)" == "libisccfg - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libisccfg_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/isc/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISCCFG_EXPORTS" /FR /YX /FD /GZ /c
+# SUBTRACT CPP /X
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib ../../isc/win32/debug/libisc.lib ../../dns/win32/debug/libdns.lib /nologo /dll /debug /machine:I386 /out:"../../../Build/Debug/libisccfg.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "libisccfg - Win32 Release"
+# Name "libisccfg - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\check.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\DLLMain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\log.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\parser.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\version.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\include\isccfg\cfg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccfg\check.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\isccfg\log.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\libisccfg.def
+# End Source File
+# End Target
+# End Project
diff --git a/lib/isccfg/win32/libisccfg.dsw b/lib/isccfg/win32/libisccfg.dsw
index ccc8711e..2851ea80 100644
--- a/lib/isccfg/win32/libisccfg.dsw
+++ b/lib/isccfg/win32/libisccfg.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "libisccfg"=".\libisccfg.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libisccfg"=".\libisccfg.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/lib/lwres/context.c b/lib/lwres/context.c
index 646f348d..96e1ff6a 100644
--- a/lib/lwres/context.c
+++ b/lib/lwres/context.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: context.c,v 1.41 2001/07/19 16:59:32 gson Exp $ */
+/* $Id: context.c,v 1.41.2.1 2003/07/23 06:57:56 marka Exp $ */
#include <config.h>
@@ -152,14 +152,14 @@ lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial) {
void
lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len) {
REQUIRE(mem != NULL);
- REQUIRE(len != 0);
+ REQUIRE(len != 0U);
CTXFREE(mem, len);
}
void *
lwres_context_allocmem(lwres_context_t *ctx, size_t len) {
- REQUIRE(len != 0);
+ REQUIRE(len != 0U);
return (CTXMALLOC(len));
}
@@ -349,7 +349,7 @@ lwres_context_sendrecv(lwres_context_t *ctx,
* Type of tv_sec is long, so make sure the unsigned long timeout
* does not overflow it.
*/
- if (ctx->timeout <= LONG_MAX)
+ if (ctx->timeout <= (unsigned int)LONG_MAX)
timeout.tv_sec = (long)ctx->timeout;
else
timeout.tv_sec = LONG_MAX;
diff --git a/lib/lwres/getipnode.c b/lib/lwres/getipnode.c
index f4def6a8..3b2b780b 100644
--- a/lib/lwres/getipnode.c
+++ b/lib/lwres/getipnode.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: getipnode.c,v 1.30.2.3 2002/08/08 21:29:07 marka Exp $ */
+/* $Id: getipnode.c,v 1.30.2.4 2003/07/23 06:57:56 marka Exp $ */
#include <config.h>
@@ -242,13 +242,13 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
switch (af) {
case AF_INET:
- if (len != INADDRSZ) {
+ if (len != (unsigned int)INADDRSZ) {
*error_num = NO_RECOVERY;
return (NULL);
}
break;
case AF_INET6:
- if (len != IN6ADDRSZ) {
+ if (len != (unsigned int)IN6ADDRSZ) {
*error_num = NO_RECOVERY;
return (NULL);
}
diff --git a/lib/lwres/getnameinfo.c b/lib/lwres/getnameinfo.c
index 42daf8d8..51fd8008 100644
--- a/lib/lwres/getnameinfo.c
+++ b/lib/lwres/getnameinfo.c
@@ -1,5 +1,5 @@
/*
- * Portions Copyright (C) 1999-2001 Internet Software Consortium.
+ * Portions Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: getnameinfo.c,v 1.30 2001/07/10 18:25:43 gson Exp $ */
+/* $Id: getnameinfo.c,v 1.30.2.3 2003/07/23 06:57:56 marka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -29,11 +29,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by WIDE Project and
- * its contributors.
- * 4. Neither the name of the project nor the names of its contributors
+ * 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -166,7 +162,7 @@ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
}
proto = (flags & NI_DGRAM) ? "udp" : "tcp";
- if (serv == NULL || servlen == 0) {
+ if (serv == NULL || servlen == 0U) {
/*
* Caller does not want service.
*/
@@ -201,7 +197,7 @@ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
}
#endif
- if (host == NULL || hostlen == 0) {
+ if (host == NULL || hostlen == 0U) {
/*
* What should we do?
*/
diff --git a/lib/lwres/getrrset.c b/lib/lwres/getrrset.c
index 73c1a301..208c4a0f 100644
--- a/lib/lwres/getrrset.c
+++ b/lib/lwres/getrrset.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: getrrset.c,v 1.11.2.2 2002/08/05 06:57:16 marka Exp $ */
+/* $Id: getrrset.c,v 1.11.2.3 2003/07/23 06:57:56 marka Exp $ */
#include <config.h>
@@ -48,7 +48,7 @@ lwresult_to_result(lwres_result_t lwresult) {
static void *
sane_malloc(size_t size) {
- if (size == 0)
+ if (size == 0U)
size = 1;
return (malloc(size));
}
diff --git a/lib/lwres/lwconfig.c b/lib/lwres/lwconfig.c
index d6ff3de4..48635fb2 100644
--- a/lib/lwres/lwconfig.c
+++ b/lib/lwres/lwconfig.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwconfig.c,v 1.33 2001/07/10 18:25:45 gson Exp $ */
+/* $Id: lwconfig.c,v 1.33.2.1 2003/07/23 06:57:57 marka Exp $ */
/***
*** Module for parsing resolv.conf files.
@@ -156,7 +156,7 @@ getword(FILE *fp, char *buffer, size_t size) {
char *p = buffer;
REQUIRE(buffer != NULL);
- REQUIRE(size > 0);
+ REQUIRE(size > 0U);
*p = '\0';
@@ -194,7 +194,7 @@ lwres_strdup(lwres_context_t *ctx, const char *str) {
char *p;
REQUIRE(str != NULL);
- REQUIRE(strlen(str) > 0);
+ REQUIRE(strlen(str) > 0U);
p = CTXMALLOC(strlen(str) + 1);
if (p != NULL)
@@ -284,7 +284,7 @@ lwres_conf_parsenameserver(lwres_context_t *ctx, FILE *fp) {
return (LWRES_R_SUCCESS);
res = getword(fp, word, sizeof(word));
- if (strlen(word) == 0)
+ if (strlen(word) == 0U)
return (LWRES_R_FAILURE); /* Nothing on line. */
else if (res == ' ' || res == '\t')
res = eatwhite(fp);
@@ -312,7 +312,7 @@ lwres_conf_parselwserver(lwres_context_t *ctx, FILE *fp) {
return (LWRES_R_SUCCESS);
res = getword(fp, word, sizeof(word));
- if (strlen(word) == 0)
+ if (strlen(word) == 0U)
return (LWRES_R_FAILURE); /* Nothing on line. */
else if (res == ' ' || res == '\t')
res = eatwhite(fp);
@@ -337,7 +337,7 @@ lwres_conf_parsedomain(lwres_context_t *ctx, FILE *fp) {
confdata = &ctx->confdata;
res = getword(fp, word, sizeof(word));
- if (strlen(word) == 0)
+ if (strlen(word) == 0U)
return (LWRES_R_FAILURE); /* Nothing else on line. */
else if (res == ' ' || res == '\t')
res = eatwhite(fp);
@@ -399,11 +399,11 @@ lwres_conf_parsesearch(lwres_context_t *ctx, FILE *fp) {
confdata->searchnxt = 0;
delim = getword(fp, word, sizeof(word));
- if (strlen(word) == 0)
+ if (strlen(word) == 0U)
return (LWRES_R_FAILURE); /* Nothing else on line. */
idx = 0;
- while (strlen(word) > 0) {
+ while (strlen(word) > 0U) {
if (confdata->searchnxt == LWRES_CONFMAXSEARCH)
goto ignore; /* Too many domains. */
@@ -460,10 +460,10 @@ lwres_conf_parsesortlist(lwres_context_t *ctx, FILE *fp) {
confdata = &ctx->confdata;
delim = getword(fp, word, sizeof(word));
- if (strlen(word) == 0)
+ if (strlen(word) == 0U)
return (LWRES_R_FAILURE); /* Empty line after keyword. */
- while (strlen(word) > 0) {
+ while (strlen(word) > 0U) {
if (confdata->sortlistnxt == LWRES_CONFMAXSORTLIST)
return (LWRES_R_FAILURE); /* Too many values. */
@@ -516,10 +516,10 @@ lwres_conf_parseoption(lwres_context_t *ctx, FILE *fp) {
confdata = &ctx->confdata;
delim = getword(fp, word, sizeof(word));
- if (strlen(word) == 0)
+ if (strlen(word) == 0U)
return (LWRES_R_FAILURE); /* Empty line after keyword. */
- while (strlen(word) > 0) {
+ while (strlen(word) > 0U) {
if (strcmp("debug", word) == 0) {
confdata->resdebug = 1;
} else if (strcmp("no_tld_query", word) == 0) {
@@ -554,7 +554,7 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
confdata = &ctx->confdata;
REQUIRE(filename != NULL);
- REQUIRE(strlen(filename) > 0);
+ REQUIRE(strlen(filename) > 0U);
REQUIRE(confdata != NULL);
errno = 0;
@@ -569,7 +569,7 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
break;
}
- if (strlen(word) == 0)
+ if (strlen(word) == 0U)
rval = LWRES_R_SUCCESS;
else if (strcmp(word, "nameserver") == 0)
rval = lwres_conf_parsenameserver(ctx, fp);
diff --git a/lib/lwres/lwinetaton.c b/lib/lwres/lwinetaton.c
index b95bbe07..97907d83 100644
--- a/lib/lwres/lwinetaton.c
+++ b/lib/lwres/lwinetaton.c
@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
-static char rcsid[] = "$Id: lwinetaton.c,v 1.10 2001/01/09 21:59:25 bwelling Exp $";
+static char rcsid[] = "$Id: lwinetaton.c,v 1.10.2.1 2003/07/23 06:57:57 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
@@ -152,7 +152,7 @@ lwres_net_aton(const char *cp, struct in_addr *addr) {
* a.b.c (with c treated as 16 bits)
* a.b (with b treated as 24 bits)
*/
- if (pp >= parts + 3 || val > 0xff)
+ if (pp >= parts + 3 || val > 0xffU)
return (0);
*pp++ = (lwres_uint8_t)val;
c = *++cp;
@@ -179,19 +179,19 @@ lwres_net_aton(const char *cp, struct in_addr *addr) {
break;
case 2: /* a.b -- 8.24 bits */
- if (val > 0xffffff)
+ if (val > 0xffffffU)
return (0);
val |= parts[0] << 24;
break;
case 3: /* a.b.c -- 8.8.16 bits */
- if (val > 0xffff)
+ if (val > 0xffffU)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16);
break;
case 4: /* a.b.c.d -- 8.8.8.8 bits */
- if (val > 0xff)
+ if (val > 0xffU)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
break;
diff --git a/lib/lwres/man/lwres_context.3 b/lib/lwres/man/lwres_context.3
index 50183309..85e60a07 100644
--- a/lib/lwres/man/lwres_context.3
+++ b/lib/lwres/man/lwres_context.3
@@ -65,7 +65,7 @@ It holds a socket and other data needed for communicating
with a resolver daemon.
The new
\fBlwres_context_t\fR
-is returned throught
+is returned through
\fIcontextp\fR,
a pointer to a
\fBlwres_context_t\fR
diff --git a/lib/lwres/man/lwres_context.docbook b/lib/lwres/man/lwres_context.docbook
index 85ebd46e..32a72bb4 100644
--- a/lib/lwres/man/lwres_context.docbook
+++ b/lib/lwres/man/lwres_context.docbook
@@ -1,6 +1,6 @@
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
<!--
- - Copyright (C) 2001 Internet Software Consortium.
+ - Copyright (C) 2001, 2003 Internet Software Consortium.
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->
-<!-- $Id: lwres_context.docbook,v 1.3 2001/06/18 22:56:16 gson Exp $ -->
+<!-- $Id: lwres_context.docbook,v 1.3.2.2 2003/07/22 04:03:54 marka Exp $ -->
<refentry>
<refentryinfo>
@@ -109,7 +109,7 @@ It holds a socket and other data needed for communicating
with a resolver daemon.
The new
<type>lwres_context_t</type>
-is returned throught
+is returned through
<parameter>contextp</parameter>,
a pointer to a
diff --git a/lib/lwres/man/lwres_context.html b/lib/lwres/man/lwres_context.html
index 90a969fd..a3aeb400 100644
--- a/lib/lwres/man/lwres_context.html
+++ b/lib/lwres/man/lwres_context.html
@@ -144,7 +144,7 @@ The new
CLASS="TYPE"
>lwres_context_t</SPAN
>
-is returned throught
+is returned through
<TT
CLASS="PARAMETER"
><I
diff --git a/lib/lwres/man/lwres_getipnode.docbook b/lib/lwres/man/lwres_getipnode.docbook
index 73a69698..220ad9bb 100644
--- a/lib/lwres/man/lwres_getipnode.docbook
+++ b/lib/lwres/man/lwres_getipnode.docbook
@@ -16,7 +16,7 @@
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->
-<!-- $Id: lwres_getipnode.docbook,v 1.4.118.2 2003/02/17 07:05:11 marka Exp $ -->
+<!-- $Id: lwres_getipnode.docbook,v 1.4.2.2 2003/03/06 04:38:26 marka Exp $ -->
<refentry>
diff --git a/lib/lwres/win32/liblwres.def b/lib/lwres/win32/liblwres.def
index e3638fcb..54bc85bb 100644
--- a/lib/lwres/win32/liblwres.def
+++ b/lib/lwres/win32/liblwres.def
@@ -1,78 +1,78 @@
-LIBRARY liblwres
-
-; Exported Functions
-EXPORTS
-
-lwres_context_create
-lwres_context_destroy
-lwres_context_nextserial
-lwres_context_initserial
-lwres_context_freemem
-lwres_context_allocmem
-lwres_context_getsocket
-lwres_context_send
-lwres_context_recv
-lwres_context_sendrecv
-lwres_buffer_init
-lwres_buffer_invalidate
-lwres_buffer_add
-lwres_buffer_subtract
-lwres_buffer_clear
-lwres_buffer_first
-lwres_buffer_forward
-lwres_buffer_back
-lwres_buffer_getuint8
-lwres_buffer_putuint8
-lwres_buffer_getuint16
-lwres_buffer_putuint16
-lwres_buffer_getuint32
-lwres_buffer_putuint32
-lwres_buffer_putmem
-lwres_buffer_getmem
-lwres_lwpacket_renderheader
-lwres_lwpacket_parseheader
-lwres_gabnrequest_render
-lwres_gabnresponse_render
-lwres_gabnrequest_parse
-lwres_gabnresponse_parse
-lwres_gabnrequest_free
-lwres_gabnresponse_free
-lwres_gnbarequest_render
-lwres_gnbaresponse_render
-lwres_gnbarequest_parse
-lwres_gnbaresponse_parse
-lwres_gnbarequest_free
-lwres_gnbaresponse_free
-lwres_grbnrequest_render
-lwres_grbnresponse_render
-lwres_grbnrequest_parse
-lwres_grbnresponse_parse
-lwres_grbnrequest_free
-lwres_grbnresponse_free
-lwres_nooprequest_render
-lwres_noopresponse_render
-lwres_nooprequest_parse
-lwres_noopresponse_parse
-lwres_nooprequest_free
-lwres_noopresponse_free
-lwres_conf_parse
-lwres_conf_print
-lwres_conf_init
-lwres_conf_clear
-lwres_conf_get
-lwres_data_parse
-lwres_string_parse
-lwres_addr_parse
-lwres_net_ntop
-lwres_net_pton
-lwres_net_aton
-lwres_gethostbyname
-lwres_freeaddrinfo
-lwres_gai_strerror
-lwres_getaddrinfo
-
-; Exported Data
-
-EXPORTS
-
-;lwres_h_errno DATA
+LIBRARY liblwres
+
+; Exported Functions
+EXPORTS
+
+lwres_context_create
+lwres_context_destroy
+lwres_context_nextserial
+lwres_context_initserial
+lwres_context_freemem
+lwres_context_allocmem
+lwres_context_getsocket
+lwres_context_send
+lwres_context_recv
+lwres_context_sendrecv
+lwres_buffer_init
+lwres_buffer_invalidate
+lwres_buffer_add
+lwres_buffer_subtract
+lwres_buffer_clear
+lwres_buffer_first
+lwres_buffer_forward
+lwres_buffer_back
+lwres_buffer_getuint8
+lwres_buffer_putuint8
+lwres_buffer_getuint16
+lwres_buffer_putuint16
+lwres_buffer_getuint32
+lwres_buffer_putuint32
+lwres_buffer_putmem
+lwres_buffer_getmem
+lwres_lwpacket_renderheader
+lwres_lwpacket_parseheader
+lwres_gabnrequest_render
+lwres_gabnresponse_render
+lwres_gabnrequest_parse
+lwres_gabnresponse_parse
+lwres_gabnrequest_free
+lwres_gabnresponse_free
+lwres_gnbarequest_render
+lwres_gnbaresponse_render
+lwres_gnbarequest_parse
+lwres_gnbaresponse_parse
+lwres_gnbarequest_free
+lwres_gnbaresponse_free
+lwres_grbnrequest_render
+lwres_grbnresponse_render
+lwres_grbnrequest_parse
+lwres_grbnresponse_parse
+lwres_grbnrequest_free
+lwres_grbnresponse_free
+lwres_nooprequest_render
+lwres_noopresponse_render
+lwres_nooprequest_parse
+lwres_noopresponse_parse
+lwres_nooprequest_free
+lwres_noopresponse_free
+lwres_conf_parse
+lwres_conf_print
+lwres_conf_init
+lwres_conf_clear
+lwres_conf_get
+lwres_data_parse
+lwres_string_parse
+lwres_addr_parse
+lwres_net_ntop
+lwres_net_pton
+lwres_net_aton
+lwres_gethostbyname
+lwres_freeaddrinfo
+lwres_gai_strerror
+lwres_getaddrinfo
+
+; Exported Data
+
+EXPORTS
+
+;lwres_h_errno DATA
diff --git a/lib/lwres/win32/liblwres.dsp b/lib/lwres/win32/liblwres.dsp
index 1eba97fb..fe151c9b 100644
--- a/lib/lwres/win32/liblwres.dsp
+++ b/lib/lwres/win32/liblwres.dsp
@@ -1,241 +1,241 @@
-# Microsoft Developer Studio Project File - Name="liblwres" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=liblwres - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "liblwres.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "liblwres.mak" CFG="liblwres - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "liblwres - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "liblwres - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "liblwres - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "liblwres_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../lib/lwres/win32/include/lwres" /I "include" /I "../include" /I "../../../" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../../../lib/isc/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBLWRES_EXPORTS" /YX /FD /c
-# SUBTRACT CPP /X
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/liblwres.dll"
-
-!ELSEIF "$(CFG)" == "liblwres - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "liblwres_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../lib/lwres/win32/include/lwres" /I "include" /I "../include" /I "../../../" /I "../../../lib/isc/win32" /I "../../../lib/isc/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBLWRES_EXPORTS" /FR /YX /FD /GZ /c
-# SUBTRACT CPP /X
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"../../../Build/Debug/liblwres.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "liblwres - Win32 Release"
-# Name "liblwres - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\context.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\DLLMain.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\gai_strerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\getaddrinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\gethost.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\getipnode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\getnameinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\getrrset.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\herror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwbuffer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwconfig.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwinetaton.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwinetntop.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwinetpton.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwpacket.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwres_gabn.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwres_gnba.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwres_grbn.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwres_noop.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lwresutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\version.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\include\lwres\context.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\lwres\int.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\lwres\ipv6.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\lwres\lang.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\lwres\list.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\lwres\lwbuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\lwres\lwpacket.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\lwres\lwres.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\lwres\net.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\lwres\netdb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\lwres\platform.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\include\lwres\result.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\liblwres.def
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="liblwres" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=liblwres - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "liblwres.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "liblwres.mak" CFG="liblwres - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "liblwres - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "liblwres - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "liblwres - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "liblwres_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../lib/lwres/win32/include/lwres" /I "include" /I "../include" /I "../../../" /I "../../../lib/isc/win32" /I "../../../lib/isc/win32/include" /I "../../../lib/dns/win32/include" /I "../../../lib/dns/include" /I "../../../lib/isc/include" /I "../..../lib/dns/sec/openssl/include" /I "../../../lib/dns/sec/dst/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBLWRES_EXPORTS" /YX /FD /c
+# SUBTRACT CPP /X
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/liblwres.dll"
+
+!ELSEIF "$(CFG)" == "liblwres - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "liblwres_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../lib/lwres/win32/include/lwres" /I "include" /I "../include" /I "../../../" /I "../../../lib/isc/win32" /I "../../../lib/isc/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "USE_MD5" /D "OPENSSL" /D "DST_USE_PRIVATE_OPENSSL" /D "LIBLWRES_EXPORTS" /FR /YX /FD /GZ /c
+# SUBTRACT CPP /X
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"../../../Build/Debug/liblwres.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "liblwres - Win32 Release"
+# Name "liblwres - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\context.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\DLLMain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\gai_strerror.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\getaddrinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\gethost.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\getipnode.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\getnameinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\getrrset.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\herror.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwbuffer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwconfig.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwinetaton.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwinetntop.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwinetpton.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwpacket.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwres_gabn.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwres_gnba.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwres_grbn.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwres_noop.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lwresutil.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\version.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\include\lwres\context.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\lwres\int.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\lwres\ipv6.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\lwres\lang.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\lwres\list.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\lwres\lwbuffer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\lwres\lwpacket.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\lwres\lwres.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\lwres\net.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\lwres\netdb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\lwres\platform.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\include\lwres\result.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\liblwres.def
+# End Source File
+# End Target
+# End Project
diff --git a/lib/lwres/win32/liblwres.dsw b/lib/lwres/win32/liblwres.dsw
index fa317209..06267b54 100644
--- a/lib/lwres/win32/liblwres.dsw
+++ b/lib/lwres/win32/liblwres.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "liblwres"=".\liblwres.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "liblwres"=".\liblwres.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/lib/tests/t_api.c b/lib/tests/t_api.c
index 6f40aa6c..cb5f4826 100644
--- a/lib/tests/t_api.c
+++ b/lib/tests/t_api.c
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_api.c,v 1.48 2001/07/11 18:51:22 bwelling Exp $ */
+/* $Id: t_api.c,v 1.48.2.1 2003/07/23 06:57:57 marka Exp $ */
#include <config.h>
@@ -534,7 +534,7 @@ t_fgetbs(FILE *fp) {
}
}
*p = '\0';
- return(((c == EOF) && (n == 0)) ? NULL : buf);
+ return(((c == EOF) && (n == 0U)) ? NULL : buf);
} else {
fprintf(stderr, "malloc failed %d", errno);
return(NULL);
@@ -569,7 +569,7 @@ t_getdate(char *buf, size_t buflen) {
t = time(NULL);
p = localtime(&t);
n = strftime(buf, buflen - 1, "%A %d %B %H:%M:%S %Y\n", p);
- return(n != 0 ? buf : NULL);
+ return(n != 0U ? buf : NULL);
}
/*
diff --git a/lib/win32/bindevt/bindevt.dsp b/lib/win32/bindevt/bindevt.dsp
index 4c9dc6b6..6aafb193 100644
--- a/lib/win32/bindevt/bindevt.dsp
+++ b/lib/win32/bindevt/bindevt.dsp
@@ -1,132 +1,132 @@
-# Microsoft Developer Studio Project File - Name="bindevt" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=bindevt - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "bindevt.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "bindevt.mak" CFG="bindevt - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "bindevt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "bindevt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "bindevt - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BINDEVT_EXPORTS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\include" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BINDEVT_EXPORTS" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /machine:I386 /out:"..\..\..\Build\Release\bindevt.dll"
-
-!ELSEIF "$(CFG)" == "bindevt - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BINDEVT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BINDEVT_EXPORTS" /FR /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /debug /machine:I386 /out:"..\..\..\Build\Debug\bindevt.dll"
-
-!ENDIF
-
-# Begin Target
-
-# Name "bindevt - Win32 Release"
-# Name "bindevt - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\bindevt.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bindevt.mc
-
-!IF "$(CFG)" == "bindevt - Win32 Release"
-
-# Begin Custom Build
-TargetName=bindevt
-InputPath=.\bindevt.mc
-InputName=bindevt
-
-"$(TargetName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- mc $(InputName).mc
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "bindevt - Win32 Debug"
-
-# Begin Custom Build
-TargetName=bindevt
-InputPath=.\bindevt.mc
-InputName=bindevt
-
-"$(TargetName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- mc $(InputName).mc
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\bindevt.rc
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="bindevt" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=bindevt - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "bindevt.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "bindevt.mak" CFG="bindevt - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "bindevt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "bindevt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "bindevt - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BINDEVT_EXPORTS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\include" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BINDEVT_EXPORTS" /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /machine:I386 /out:"..\..\..\Build\Release\bindevt.dll"
+
+!ELSEIF "$(CFG)" == "bindevt - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BINDEVT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BINDEVT_EXPORTS" /FR /FD /GZ /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /debug /machine:I386 /out:"..\..\..\Build\Debug\bindevt.dll"
+
+!ENDIF
+
+# Begin Target
+
+# Name "bindevt - Win32 Release"
+# Name "bindevt - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\bindevt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\bindevt.mc
+
+!IF "$(CFG)" == "bindevt - Win32 Release"
+
+# Begin Custom Build
+TargetName=bindevt
+InputPath=.\bindevt.mc
+InputName=bindevt
+
+"$(TargetName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ mc $(InputName).mc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "bindevt - Win32 Debug"
+
+# Begin Custom Build
+TargetName=bindevt
+InputPath=.\bindevt.mc
+InputName=bindevt
+
+"$(TargetName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ mc $(InputName).mc
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\bindevt.rc
+# End Source File
+# End Target
+# End Project
diff --git a/lib/win32/bindevt/bindevt.dsw b/lib/win32/bindevt/bindevt.dsw
index c9e02a01..7421804f 100644
--- a/lib/win32/bindevt/bindevt.dsw
+++ b/lib/win32/bindevt/bindevt.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "bindevt"=.\bindevt.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "bindevt"=.\bindevt.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+