diff --git a/.cvsignore b/.cvsignore
index dafbbd3..e2911f6 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,3 +1,3 @@
-bind-9.3.4.tar.gz
-bind-chroot.tar.gz
+bind-9.4.0.tar.gz
 libbind-man.tar.gz
+bind-chroot.tar.gz
diff --git a/bind-9.3.1-dbus_archdep_libdir.patch b/bind-9.3.1-dbus_archdep_libdir.patch
index e6f1ce2..8dc3646 100644
--- a/bind-9.3.1-dbus_archdep_libdir.patch
+++ b/bind-9.3.1-dbus_archdep_libdir.patch
@@ -1,26 +1,26 @@
---- bind-9.3.1/bin/named_sdb/Makefile.in.dbus_archdep_libdir	2005-08-16 21:23:28.000000000 -0400
-+++ bind-9.3.1/bin/named_sdb/Makefile.in	2005-08-16 23:00:49.000000000 -0400
-@@ -35,8 +35,9 @@
- 		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
+--- bind-9.4.0/bin/named/Makefile.in.dbus_archdep_libdir	2007-03-06 14:18:14.000000000 +0100
++++ bind-9.4.0/bin/named/Makefile.in	2007-03-06 14:20:39.000000000 +0100
+@@ -43,8 +43,9 @@
  		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
- 		${DBDRIVER_INCLUDES}
+ 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES}
+ 
 +DBUS_ARCHDEP_LIBDIR ?= lib
  DBUS_INCLUDES = \
--	-I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
-+	-I/usr/${DBUS_ARCHDEP_LIBDIR}/dbus-1.0/include -I/usr/include/dbus-1.0
- CDEFINES =
- CWARNINGS =
+-        -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
++        -I/usr/${DBUS_ARCHDEP_LIBDIR}/dbus-1.0/include -I/usr/include/dbus-1.0
+ 
+ CDEFINES =      @USE_DLZ@
  
---- bind-9.3.1/bin/named/Makefile.in.dbus_archdep_libdir	2005-08-16 21:23:28.000000000 -0400
-+++ bind-9.3.1/bin/named/Makefile.in	2005-08-16 23:00:58.000000000 -0400
-@@ -35,8 +35,9 @@
- 		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
+--- bind-9.4.0/bin/named_sdb/Makefile.in.dbus_archdep_libdir	2007-03-06 14:18:14.000000000 +0100
++++ bind-9.4.0/bin/named_sdb/Makefile.in	2007-03-06 14:21:09.000000000 +0100
+@@ -43,8 +43,9 @@
  		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
- 		${DBDRIVER_INCLUDES}
+ 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES}
+ 
 +DBUS_ARCHDEP_LIBDIR ?= lib
  DBUS_INCLUDES = \
--	-I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
-+	-I/usr/${DBUS_ARCHDEP_LIBDIR}/dbus-1.0/include -I/usr/include/dbus-1.0
- CDEFINES =
- CWARNINGS =
+-        -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
++        -I/usr/${DBUS_ARCHDEP_LIBDIR}/dbus-1.0/include -I/usr/include/dbus-1.0
+ 
+ CDEFINES =      @USE_DLZ@
  
diff --git a/bind-9.3.1-sdb_dbus.patch b/bind-9.3.1-sdb_dbus.patch
index 8e790d1..4829fa7 100644
--- a/bind-9.3.1-sdb_dbus.patch
+++ b/bind-9.3.1-sdb_dbus.patch
@@ -1,16 +1,16 @@
---- bind-9.3.1/bin/named_sdb/Makefile.in.sdb_dbus	2005-08-16 21:18:06.000000000 -0400
-+++ bind-9.3.1/bin/named_sdb/Makefile.in	2005-08-16 21:18:06.000000000 -0400
-@@ -35,7 +35,8 @@
- 		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
+--- bind-9.4.0/bin/named_sdb/Makefile.in.sdb_dbus	2007-03-06 14:12:30.000000000 +0100
++++ bind-9.4.0/bin/named_sdb/Makefile.in	2007-03-06 14:16:45.000000000 +0100
+@@ -43,6 +43,9 @@
  		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
- 		${DBDRIVER_INCLUDES}
--
+ 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES}
+ 
 +DBUS_INCLUDES = \
-+	-I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
- CDEFINES =
- CWARNINGS =
++        -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
++
+ CDEFINES =      @USE_DLZ@
  
-@@ -52,6 +53,7 @@
+ CWARNINGS =
+@@ -60,6 +63,7 @@
  ISCDEPLIBS =	../../lib/isc/libisc.@A@
  LWRESDEPLIBS =	../../lib/lwres/liblwres.@A@
  BIND9DEPLIBS =	../../lib/bind9/libbind9.@A@
@@ -18,25 +18,23 @@
  
  DEPLIBS =	${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
  		${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}
-@@ -70,7 +72,8 @@
- 		tkeyconf.o tsigconf.o update.o xfrout.o \
+@@ -80,6 +84,7 @@
  		zoneconf.o \
  		lwaddr.o lwresd.o lwdclient.o lwderror.o lwdgabn.o \
--		lwdgnba.o lwdgrbn.o lwdnoop.o lwsearch.o \
-+		lwdgnba.o lwdgrbn.o lwdnoop.o lwsearch.o  \
+ 		lwdgnba.o lwdgrbn.o lwdnoop.o lwsearch.o \
 +		dbus_service.o dbus_mgr.o \
- 		$(DBDRIVER_OBJS)
+ 		${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
  
  UOBJS =		unix/os.o
-@@ -83,6 +86,7 @@
+@@ -92,6 +97,7 @@
  		zoneconf.c \
  		lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
  		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
-+	        dbus_service.c dbus_mgr.c \
- 		$(DBDRIVER_SRCS)
++		dbus_service.c dbus_mgr.c \
+ 		${DLZDRIVER_SRCS} ${DBDRIVER_SRCS}
  
  MANPAGES =	named.8 lwresd.8 named.conf.5
-@@ -114,9 +118,14 @@
+@@ -120,9 +126,14 @@
  		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
  		-c ${srcdir}/config.c
  
@@ -52,19 +50,19 @@
  
  doc man:: ${MANOBJS}
  
---- bind-9.3.1/bin/named_sdb/main.c.sdb_dbus	2005-08-16 21:18:06.000000000 -0400
-+++ bind-9.3.1/bin/named_sdb/main.c	2005-08-16 21:21:40.000000000 -0400
-@@ -243,7 +243,8 @@
+--- bind-9.4.0/bin/named_sdb/main.c.sdb_dbus	2007-03-06 14:12:30.000000000 +0100
++++ bind-9.4.0/bin/named_sdb/main.c	2007-03-06 14:17:51.000000000 +0100
+@@ -251,7 +251,8 @@
  		"usage: named [-4|-6] [-c conffile] [-d debuglevel] "
  		"[-f|-g] [-n number_of_cpus]\n"
  		"             [-p port] [-s] [-t chrootdir] [-u username]\n"
--		"             [-m {usage|trace|record}]\n");
-+		"             [-m {usage|trace|record}]\n"
-+	        "             [-D ]\n");
+-		"             [-m {usage|trace|record|size|mctx}]\n");
++		"             [-m {usage|trace|record|size|mctx}]\n"
++		"	      [-D ]\n");
  }
  
  static void
-@@ -349,7 +350,7 @@
+@@ -359,7 +360,7 @@
  
  	isc_commandline_errprint = ISC_FALSE;
  	while ((ch = isc_commandline_parse(argc, argv,
@@ -73,7 +71,7 @@
  		switch (ch) {
  		case '4':
  			if (disable4)
-@@ -438,6 +439,9 @@
+@@ -448,6 +449,9 @@
  		case 'v':
  			printf("BIND %s\n", ns_g_version);
  			exit(0);
diff --git a/bind-9.3.1rc1-sdb.patch b/bind-9.3.1rc1-sdb.patch
index 7f0c41d..1ea2579 100644
--- a/bind-9.3.1rc1-sdb.patch
+++ b/bind-9.3.1rc1-sdb.patch
@@ -1,6 +1,6 @@
---- bind-9.3.1rc1/configure.in.sdb	2005-02-16 22:25:08.000000000 -0500
-+++ bind-9.3.1rc1/configure.in	2005-02-16 22:25:08.000000000 -0500
-@@ -2194,6 +2194,8 @@
+--- bind-9.4.0/configure.in.sdb	2007-03-06 12:59:32.000000000 +0100
++++ bind-9.4.0/configure.in	2007-03-06 12:59:32.000000000 +0100
+@@ -2457,6 +2457,8 @@
  	bin/check/Makefile
  	bin/named/Makefile
  	bin/named/unix/Makefile
@@ -9,17 +9,28 @@
  	bin/rndc/Makefile
  	bin/rndc/unix/Makefile
  	bin/dig/Makefile
-@@ -2215,6 +2217,7 @@
+@@ -2478,6 +2480,7 @@
  	bin/tests/system/tkey/Makefile
  	bin/tests/headerdep_test.sh
  	bin/dnssec/Makefile
 +	bin/sdb_tools/Makefile
  	doc/Makefile
  	doc/arm/Makefile
- 	doc/arm/nominum-docbook-html.dsl
---- bind-9.3.1rc1/bin/named_sdb/main.c.sdb	2004-10-24 20:42:54.000000000 -0400
-+++ bind-9.3.1rc1/bin/named_sdb/main.c	2005-02-16 22:25:08.000000000 -0500
-@@ -71,6 +71,9 @@
+ 	doc/misc/Makefile
+--- bind-9.4.0/bin/Makefile.in.sdb	2004-03-05 05:57:10.000000000 +0100
++++ bind-9.4.0/bin/Makefile.in	2007-03-06 12:59:32.000000000 +0100
+@@ -19,7 +19,7 @@
+ VPATH =		@srcdir@
+ top_srcdir =	@top_srcdir@
+ 
+-SUBDIRS =	named rndc dig dnssec tests nsupdate check
++SUBDIRS =	named named_sdb rndc dig dnssec tests nsupdate check sdb_tools
+ TARGETS =
+ 
+ @BIND9_MAKE_RULES@
+--- bind-9.4.0/bin/named_sdb/main.c.sdb	2006-11-10 19:51:14.000000000 +0100
++++ bind-9.4.0/bin/named_sdb/main.c	2007-03-06 13:43:31.000000000 +0100
+@@ -72,6 +72,9 @@
   * Include header files for database drivers here.
   */
  /* #include "xxdb.h" */
@@ -27,80 +38,90 @@
 +#include "pgsqldb.h"
 +#include "dirdb.h"
  
- static isc_boolean_t	want_stats = ISC_FALSE;
- static char		program_name[ISC_DIR_NAMEMAX] = "named";
-@@ -656,7 +659,57 @@
- 	 * Add calls to register sdb drivers here.
- 	 */
- 	/* xxdb_init(); */
--
-+	result = ldapdb_init();
-+	if (result != ISC_R_SUCCESS)
-+	{
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_ERROR, 
-+			  "SDB ldap module initialisation failed: %s.",
-+			  isc_result_totext(result)
-+		);
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_ERROR, 
-+			  "SDB ldap zone database will be unavailable."
-+		);
-+	}else
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_NOTICE, "SDB ldap zone database module loaded."
-+		         );
-+	
-+	result = pgsqldb_init();
-+	if (result != ISC_R_SUCCESS)
-+	{
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_ERROR, 
-+			  "SDB pgsql module initialisation failed: %s.",
-+			  isc_result_totext(result)
-+		);
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_ERROR, 
-+			  "SDB pgsql zone database will be unavailable."
-+		);
-+	}else
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_NOTICE, "SDB postgreSQL DB zone database module loaded."
-+		         );
-+		
-+	result = dirdb_init();
-+	if (result != ISC_R_SUCCESS)
-+	{
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_ERROR, 
-+			  "SDB directory DB module initialisation failed: %s.",
-+			  isc_result_totext(result)
-+		);
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_ERROR, 
-+			  "SDB directory DB zone database will be unavailable."
-+		);
-+	}else
-+	    isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
-+			  ISC_LOG_NOTICE, "SDB directory DB zone database module loaded."
-+		         );
-+	       
- 	ns_server_create(ns_g_mctx, &ns_g_server);
- }
- 
-@@ -673,6 +726,10 @@
- 	 */
- 	/* xxdb_clear(); */
+ /*
+  * Include DLZ drivers if appropriate.
+@@ -639,6 +642,10 @@
+ 		ns_main_earlyfatal("isc_app_start() failed: %s",
+ 				   isc_result_totext(result));
  
 +	ldapdb_clear();
 +	pgsqldb_clear();
 +	dirdb_clear();
 +
  	isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
+ 		      ISC_LOG_NOTICE, "starting BIND %s%s", ns_g_version,
+ 		      saved_command_line);
+@@ -692,6 +699,57 @@
+ 				   isc_result_totext(result));
+ #endif
+ 
++        result = ldapdb_init();
++        if (result != ISC_R_SUCCESS)
++        {
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_ERROR, 
++                          "SDB ldap module initialisation failed: %s.",
++                          isc_result_totext(result)
++                );
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_ERROR, 
++                          "SDB ldap zone database will be unavailable."
++                );
++        }else
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_NOTICE, "SDB ldap zone database module loaded."
++                         );
++
++        result = pgsqldb_init();
++        if (result != ISC_R_SUCCESS)
++        {
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_ERROR, 
++                          "SDB pgsql module initialisation failed: %s.",
++                          isc_result_totext(result)
++                );
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_ERROR, 
++                          "SDB pgsql zone database will be unavailable."
++                );
++        }else
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_NOTICE, "SDB postgreSQL DB zone database module loaded."
++                         );
++
++        result = dirdb_init();
++        if (result != ISC_R_SUCCESS)
++        {
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_ERROR, 
++                          "SDB directory DB module initialisation failed: %s.",
++                          isc_result_totext(result)
++                );
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_ERROR, 
++                          "SDB directory DB zone database will be unavailable."
++                );
++        }else
++            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
++                          ISC_LOG_NOTICE, "SDB directory DB zone database module loaded."
++                         );
++
+ 	ns_server_create(ns_g_mctx, &ns_g_server);
+ }
+ 
+@@ -717,6 +775,10 @@
+ 
+ 	dns_name_destroy();
+ 
++        ldapdb_clear();
++        pgsqldb_clear();
++        dirdb_clear();
++
+ 	isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
  		      ISC_LOG_NOTICE, "exiting");
  	ns_log_shutdown();
---- bind-9.3.1rc1/bin/named_sdb/Makefile.in.sdb	2005-02-16 22:25:08.000000000 -0500
-+++ bind-9.3.1rc1/bin/named_sdb/Makefile.in	2005-02-16 22:25:08.000000000 -0500
+--- bind-9.4.0/bin/named_sdb/Makefile.in.sdb	2007-03-06 12:59:32.000000000 +0100
++++ bind-9.4.0/bin/named_sdb/Makefile.in	2007-03-06 12:59:32.000000000 +0100
 @@ -26,10 +26,10 @@
  #
  # Add database drivers here.
@@ -113,18 +134,18 @@
 -DBDRIVER_LIBS =
 +DBDRIVER_LIBS =      -lldap -llber  -lpq
  
- CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include \
- 		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
-@@ -61,7 +61,7 @@
+ DLZ_DRIVER_DIR =	${top_srcdir}/contrib/dlz/drivers
+ 
+@@ -70,7 +70,7 @@
  
  SUBDIRS =	unix
  
 -TARGETS =	named@EXEEXT@ lwresd@EXEEXT@
 +TARGETS =	named_sdb@EXEEXT@
  
- OBJS =		aclconf.o builtin.o client.o config.o control.o \
+ OBJS =		builtin.o client.o config.o control.o \
  		controlconf.o interfacemgr.o \
-@@ -114,14 +114,10 @@
+@@ -120,14 +120,10 @@
  		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
  		-c ${srcdir}/config.c
  
@@ -140,7 +161,7 @@
  doc man:: ${MANOBJS}
  
  docclean manclean maintainer-clean::
-@@ -132,13 +128,8 @@
+@@ -138,14 +134,9 @@
  
  installdirs:
  	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
@@ -157,14 +178,4 @@
 +	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named_sdb@EXEEXT@ ${DESTDIR}${sbindir}
 +
  
---- bind-9.3.1rc1/bin/Makefile.in.sdb	2004-03-06 05:21:10.000000000 -0500
-+++ bind-9.3.1rc1/bin/Makefile.in	2005-02-16 22:25:08.000000000 -0500
-@@ -19,7 +19,7 @@
- VPATH =		@srcdir@
- top_srcdir =	@top_srcdir@
- 
--SUBDIRS =	named rndc dig dnssec tests nsupdate check
-+SUBDIRS =	named named_sdb rndc dig dnssec tests nsupdate check sdb_tools
- TARGETS =
- 
- @BIND9_MAKE_RULES@
+ @DLZ_DRIVER_RULES@
diff --git a/bind-9.3.2b1-PIE.patch b/bind-9.3.2b1-PIE.patch
index 9962349..cd85e67 100644
--- a/bind-9.3.2b1-PIE.patch
+++ b/bind-9.3.2b1-PIE.patch
@@ -1,6 +1,6 @@
---- bind-9.3.2b1/make/rules.in.PIE	2005-05-12 17:36:17.000000000 -0400
-+++ bind-9.3.2b1/make/rules.in	2005-10-06 20:04:36.000000000 -0400
-@@ -118,6 +118,9 @@
+--- bind-9.4.0/make/rules.in.PIE	2007-01-30 00:57:21.000000000 +0100
++++ bind-9.4.0/make/rules.in	2007-03-06 12:53:37.000000000 +0100
+@@ -124,6 +124,9 @@
  .c.@O@:
  	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c $<
  
@@ -10,108 +10,55 @@
  SHELL = @SHELL@
  LIBTOOL = @LIBTOOL@
  LIBTOOL_MODE_COMPILE = ${LIBTOOL} @LIBTOOL_MODE_COMPILE@
---- bind-9.3.2b1/bin/dnssec/Makefile.in.PIE	2005-05-01 20:25:54.000000000 -0400
-+++ bind-9.3.2b1/bin/dnssec/Makefile.in	2005-10-06 20:04:36.000000000 -0400
-@@ -41,7 +41,7 @@
- # Alphabetically
- TARGETS =	dnssec-keygen@EXEEXT@ dnssec-signzone@EXEEXT@
- 
--OBJS =		dnssectool.@O@
-+OBJS =		dnssectool.o
- 
- SRCS =		dnssec-keygen.c dnssec-signzone.c dnssectool.c
- 
-@@ -51,19 +51,25 @@
+--- bind-9.4.0/bin/rndc/Makefile.in.PIE	2007-01-19 01:55:49.000000000 +0100
++++ bind-9.4.0/bin/rndc/Makefile.in	2007-03-06 12:53:37.000000000 +0100
+@@ -59,28 +59,34 @@
  
  MANOBJS =	${MANPAGES} ${HTMLPAGES}
  
-+EXT_CFLAGS = -fPIE
-+
- @BIND9_MAKE_RULES@
- 
--dnssec-keygen@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS}
-+LDFLAGS   += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack
-+
-+.SUFFIXES: .c .o
-+
-+dnssec-keygen@EXEEXT@: dnssec-keygen.o ${OBJS} ${DEPLIBS}
- 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
--	dnssec-keygen.@O@ ${OBJS} ${LIBS}
-+	dnssec-keygen.o ${OBJS} ${LIBS}
- 
--dnssec-signzone.@O@: dnssec-signzone.c
--	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
-+dnssec-signzone.o: dnssec-signzone.c
-+	${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
- 		-c ${srcdir}/dnssec-signzone.c
- 
--dnssec-signzone@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
-+dnssec-signzone@EXEEXT@: dnssec-signzone.o ${OBJS} ${DEPLIBS}
- 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
--	dnssec-signzone.@O@ ${OBJS} ${LIBS}
-+	dnssec-signzone.o ${OBJS} ${LIBS}
- 
- doc man:: ${MANOBJS}
- 
---- bind-9.3.2b1/bin/named/Makefile.in.PIE	2004-09-06 17:47:25.000000000 -0400
-+++ bind-9.3.2b1/bin/named/Makefile.in	2005-10-06 20:04:36.000000000 -0400
-@@ -63,17 +63,17 @@
- 
- TARGETS =	named@EXEEXT@ lwresd@EXEEXT@
- 
--OBJS =		aclconf.@O@ builtin.@O@ client.@O@ config.@O@ control.@O@ \
--		controlconf.@O@ interfacemgr.@O@ \
--		listenlist.@O@ log.@O@ logconf.@O@ main.@O@ notify.@O@ \
--		query.@O@ server.@O@ sortlist.@O@ \
--		tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
--		zoneconf.@O@ \
--		lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
--		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
-+OBJS =		aclconf.o builtin.o client.o config.o control.o \
-+		controlconf.o interfacemgr.o \
-+		listenlist.o log.o logconf.o main.o notify.o \
-+		query.o server.o sortlist.o \
-+		tkeyconf.o tsigconf.o update.o xfrout.o \
-+		zoneconf.o \
-+		lwaddr.o lwresd.o lwdclient.o lwderror.o lwdgabn.o \
-+		lwdgnba.o lwdgrbn.o lwdnoop.o lwsearch.o \
- 		$(DBDRIVER_OBJS)
- 
 -UOBJS =		unix/os.@O@
 +UOBJS =		unix/os.o
- 
- SRCS =		aclconf.c builtin.c client.c config.c control.c \
- 		controlconf.c interfacemgr.c \
-@@ -91,16 +91,22 @@
- 
- MANOBJS =	${MANPAGES} ${HTMLPAGES}
- 
-+EXT_CFLAGS = -fPIE
 +
++EXT_CFLAGS = -fPIE
+ 
  @BIND9_MAKE_RULES@
  
--main.@O@: main.c
+-rndc.@O@: rndc.c
 -	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
 +LDFLAGS   += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack
 +
 +.SUFFIXES: .c .o
 +
-+main.o: main.c
++rndc.o: rndc.c
 +	${CC} ${ALL_CFLAGS} \
  		-DVERSION=\"${VERSION}\" \
- 		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
- 		-DNS_SYSCONFDIR=\"${sysconfdir}\" -c ${srcdir}/main.c
+ 		-DRNDC_CONFFILE=\"${sysconfdir}/rndc.conf\" \
+ 		-DRNDC_KEYFILE=\"${sysconfdir}/rndc.key\" \
+ 		-c ${srcdir}/rndc.c
  
--config.@O@: config.c
+-rndc-confgen.@O@: rndc-confgen.c
 -	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
-+config.o: config.c
++rndc-confgen.o: rndc-confgen.c
 +	${CC} ${ALL_CFLAGS} \
- 		-DVERSION=\"${VERSION}\" \
- 		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
- 		-c ${srcdir}/config.c
---- bind-9.3.2b1/bin/named/unix/Makefile.in.PIE	2004-03-08 04:04:15.000000000 -0500
-+++ bind-9.3.2b1/bin/named/unix/Makefile.in	2005-10-06 20:04:36.000000000 -0400
-@@ -27,10 +27,14 @@
+ 		-DRNDC_KEYFILE=\"${sysconfdir}/rndc.key\" \
+ 		-c ${srcdir}/rndc-confgen.c
+ 
+-rndc@EXEEXT@: rndc.@O@ util.@O@ ${RNDCDEPLIBS}
+-	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rndc.@O@ util.@O@ \
++rndc@EXEEXT@: rndc.o util.o ${RNDCDEPLIBS}
++	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rndc.o util.o \
+ 		${RNDCLIBS}
+ 
+-rndc-confgen@EXEEXT@: rndc-confgen.@O@ util.@O@ ${UOBJS} ${CONFDEPLIBS} 
+-	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rndc-confgen.@O@ util.@O@ \
++rndc-confgen@EXEEXT@: rndc-confgen.o util.o ${UOBJS} ${CONFDEPLIBS} 
++	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rndc-confgen.o util.o \
+ 		${UOBJS} ${CONFLIBS}
+ 
+ doc man:: ${MANOBJS}
+--- bind-9.4.0/bin/rndc/unix/Makefile.in.PIE	2004-03-05 05:58:29.000000000 +0100
++++ bind-9.4.0/bin/rndc/unix/Makefile.in	2007-03-06 12:53:37.000000000 +0100
+@@ -27,10 +27,16 @@
  CDEFINES =
  CWARNINGS =
  
@@ -126,10 +73,11 @@
 +
  @BIND9_MAKE_RULES@
 +
++LDFLAGS   += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack
++
 +.SUFFIXES: .c .o
-\ No newline at end of file
---- bind-9.3.2b1/bin/check/Makefile.in.PIE	2004-07-20 03:01:48.000000000 -0400
-+++ bind-9.3.2b1/bin/check/Makefile.in	2005-10-06 20:04:36.000000000 -0400
+--- bind-9.4.0/bin/check/Makefile.in.PIE	2006-06-09 02:54:08.000000000 +0200
++++ bind-9.4.0/bin/check/Makefile.in	2007-03-06 12:57:46.000000000 +0100
 @@ -55,27 +55,33 @@
  
  MANOBJS =	${MANPAGES} ${HTMLPAGES}
@@ -167,23 +115,66 @@
 -named-checkzone@EXEEXT@: named-checkzone.@O@ check-tool.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
 +named-checkzone@EXEEXT@: named-checkzone.o check-tool.o ${ISCDEPLIBS} ${DNSDEPLIBS}
  	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
--	named-checkzone.@O@ check-tool.@O@ ${DNSLIBS} ${ISCLIBS} ${LIBS}
-+	named-checkzone.o check-tool.o ${DNSLIBS} ${ISCLIBS} ${LIBS}
+-	named-checkzone.@O@ check-tool.@O@ ${ISCCFGLIBS} ${DNSLIBS} \
++	named-checkzone.o check-tool.o ${ISCCFGLIBS} ${DNSLIBS} \
+ 	${ISCLIBS} ${LIBS}
  
  doc man:: ${MANOBJS}
+--- bind-9.4.0/bin/dnssec/Makefile.in.PIE	2005-05-02 02:26:11.000000000 +0200
++++ bind-9.4.0/bin/dnssec/Makefile.in	2007-03-06 12:53:37.000000000 +0100
+@@ -41,7 +41,7 @@
+ # Alphabetically
+ TARGETS =	dnssec-keygen@EXEEXT@ dnssec-signzone@EXEEXT@
  
---- bind-9.3.2b1/bin/nsupdate/Makefile.in.PIE	2004-07-20 03:01:49.000000000 -0400
-+++ bind-9.3.2b1/bin/nsupdate/Makefile.in	2005-10-06 20:04:36.000000000 -0400
-@@ -49,7 +49,7 @@
+-OBJS =		dnssectool.@O@
++OBJS =		dnssectool.o
  
- TARGETS =	nsupdate@EXEEXT@
+ SRCS =		dnssec-keygen.c dnssec-signzone.c dnssectool.c
  
--OBJS =		nsupdate.@O@
-+OBJS =		nsupdate.o
+@@ -51,19 +51,25 @@
+ 
+ MANOBJS =	${MANPAGES} ${HTMLPAGES}
+ 
++EXT_CFLAGS = -fPIE
++
+ @BIND9_MAKE_RULES@
+ 
+-dnssec-keygen@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS}
++LDFLAGS   += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack
++
++.SUFFIXES: .c .o
++
++dnssec-keygen@EXEEXT@: dnssec-keygen.o ${OBJS} ${DEPLIBS}
+ 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+-	dnssec-keygen.@O@ ${OBJS} ${LIBS}
++	dnssec-keygen.o ${OBJS} ${LIBS}
+ 
+-dnssec-signzone.@O@: dnssec-signzone.c
+-	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
++dnssec-signzone.o: dnssec-signzone.c
++	${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
+ 		-c ${srcdir}/dnssec-signzone.c
+ 
+-dnssec-signzone@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
++dnssec-signzone@EXEEXT@: dnssec-signzone.o ${OBJS} ${DEPLIBS}
+ 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+-	dnssec-signzone.@O@ ${OBJS} ${LIBS}
++	dnssec-signzone.o ${OBJS} ${LIBS}
+ 
+ doc man:: ${MANOBJS}
+ 
+--- bind-9.4.0/bin/dig/Makefile.in.PIE	2005-09-09 16:11:04.000000000 +0200
++++ bind-9.4.0/bin/dig/Makefile.in	2007-03-06 12:53:37.000000000 +0100
+@@ -51,7 +51,7 @@
+ 
+ TARGETS =	dig@EXEEXT@ host@EXEEXT@ nslookup@EXEEXT@
+ 
+-OBJS =		dig.@O@ dighost.@O@ host.@O@ nslookup.@O@
++OBJS =		dig.o dighost.o host.o nslookup.o
  
  UOBJS =
  
-@@ -61,10 +61,16 @@
+@@ -63,19 +63,25 @@
  
  MANOBJS =	${MANPAGES} ${HTMLPAGES}
  
@@ -191,66 +182,89 @@
 +
  @BIND9_MAKE_RULES@
  
--nsupdate@EXEEXT@: nsupdate.@O@ ${UOBJS} ${DEPLIBS}
--	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ nsupdate.@O@ ${UOBJS} ${LIBS}
+-dig@EXEEXT@: dig.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
 +LDFLAGS   += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack
 +
 +.SUFFIXES: .c .o
 +
-+nsupdate@EXEEXT@: nsupdate.o ${UOBJS} ${DEPLIBS}
-+	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ nsupdate.o ${UOBJS} ${LIBS}
++dig@EXEEXT@: dig.o dighost.o ${UOBJS} ${DEPLIBS}
+ 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+-	dig.@O@ dighost.@O@ ${UOBJS} ${LIBS}
++	dig.o dighost.o ${UOBJS} ${LIBS}
+ 
+-host@EXEEXT@: host.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
++host@EXEEXT@: host.o dighost.o ${UOBJS} ${DEPLIBS}
+ 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+-	host.@O@ dighost.@O@ ${UOBJS} ${LIBS}
++	host.o dighost.o ${UOBJS} ${LIBS}
+ 
+-nslookup@EXEEXT@: nslookup.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
++nslookup@EXEEXT@: nslookup.o dighost.o ${UOBJS} ${DEPLIBS}
+ 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+-	nslookup.@O@ dighost.@O@ ${UOBJS} ${LIBS}
++	nslookup.o dighost.o ${UOBJS} ${LIBS}
  
  doc man:: ${MANOBJS}
  
---- bind-9.3.2b1/bin/rndc/Makefile.in.PIE	2004-07-20 03:01:50.000000000 -0400
-+++ bind-9.3.2b1/bin/rndc/Makefile.in	2005-10-06 20:05:10.000000000 -0400
-@@ -57,28 +57,34 @@
+--- bind-9.4.0/bin/named/Makefile.in.PIE	2005-09-05 02:18:10.000000000 +0200
++++ bind-9.4.0/bin/named/Makefile.in	2007-03-06 12:59:02.000000000 +0100
+@@ -72,17 +72,17 @@
  
- MANOBJS =	${MANPAGES} ${HTMLPAGES}
+ TARGETS =	named@EXEEXT@ lwresd@EXEEXT@
+ 
+-OBJS =		builtin.@O@ client.@O@ config.@O@ control.@O@ \
+-		controlconf.@O@ interfacemgr.@O@ \
+-		listenlist.@O@ log.@O@ logconf.@O@ main.@O@ notify.@O@ \
+-		query.@O@ server.@O@ sortlist.@O@ \
+-		tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
+-		zoneconf.@O@ \
+-		lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
+-		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
++OBJS =		builtin.o client.o config.o control.o \
++		controlconf.o interfacemgr.o \
++		listenlist.o log.o logconf.o main.o notify.o \
++		query.o server.o sortlist.o \
++		tkeyconf.o tsigconf.o update.o xfrout.o \
++		zoneconf.o \
++		lwaddr.o lwresd.o lwdclient.o lwderror.o lwdgabn.o \
++		lwdgnba.o lwdgrbn.o lwdnoop.o lwsearch.o \
+ 		${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
  
 -UOBJS =		unix/os.@O@
 +UOBJS =		unix/os.o
-+
-+EXT_CFLAGS = -fPIE
  
+ SRCS =		builtin.c client.c config.c control.c \
+ 		controlconf.c interfacemgr.c \
+@@ -100,16 +100,22 @@
+ 
+ MANOBJS =	${MANPAGES} ${HTMLPAGES}
+ 
++EXT_CFLAGS = -fPIE
++
  @BIND9_MAKE_RULES@
  
--rndc.@O@: rndc.c
+-main.@O@: main.c
 -	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
 +LDFLAGS   += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack
 +
 +.SUFFIXES: .c .o
 +
-+rndc.o: rndc.c
++main.o: main.c
 +	${CC} ${ALL_CFLAGS} \
  		-DVERSION=\"${VERSION}\" \
- 		-DRNDC_CONFFILE=\"${sysconfdir}/rndc.conf\" \
- 		-DRNDC_KEYFILE=\"${sysconfdir}/rndc.key\" \
- 		-c ${srcdir}/rndc.c
+ 		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
+ 		-DNS_SYSCONFDIR=\"${sysconfdir}\" -c ${srcdir}/main.c
  
--rndc-confgen.@O@: rndc-confgen.c
+-config.@O@: config.c
 -	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
-+rndc-confgen.o: rndc-confgen.c
++config.o: config.c
 +	${CC} ${ALL_CFLAGS} \
- 		-DRNDC_KEYFILE=\"${sysconfdir}/rndc.key\" \
- 		-c ${srcdir}/rndc-confgen.c
- 
--rndc@EXEEXT@: rndc.@O@ util.@O@ ${RNDCDEPLIBS}
--	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rndc.@O@ util.@O@ \
-+rndc@EXEEXT@: rndc.o util.o ${RNDCDEPLIBS}
-+	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rndc.o util.o \
- 		${RNDCLIBS}
- 
--rndc-confgen@EXEEXT@: rndc-confgen.@O@ util.@O@ ${UOBJS} ${CONFDEPLIBS} 
--	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rndc-confgen.@O@ util.@O@ \
-+rndc-confgen@EXEEXT@: rndc-confgen.o util.o ${UOBJS} ${CONFDEPLIBS} 
-+	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rndc-confgen.o util.o \
- 		${UOBJS} ${CONFLIBS}
- 
- doc man:: ${MANOBJS}
---- bind-9.3.2b1/bin/rndc/unix/Makefile.in.PIE	2004-03-07 23:04:24.000000000 -0500
-+++ bind-9.3.2b1/bin/rndc/unix/Makefile.in	2005-10-06 20:04:36.000000000 -0400
-@@ -27,10 +27,16 @@
+ 		-DVERSION=\"${VERSION}\" \
+ 		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
+ 		-c ${srcdir}/config.c
+--- bind-9.4.0/bin/named/unix/Makefile.in.PIE	2004-03-05 05:58:01.000000000 +0100
++++ bind-9.4.0/bin/named/unix/Makefile.in	2007-03-06 12:53:37.000000000 +0100
+@@ -27,10 +27,14 @@
  CDEFINES =
  CWARNINGS =
  
@@ -265,21 +279,20 @@
 +
  @BIND9_MAKE_RULES@
 +
-+LDFLAGS   += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack
-+
 +.SUFFIXES: .c .o
---- bind-9.3.2b1/bin/dig/Makefile.in.PIE	2004-08-18 19:25:57.000000000 -0400
-+++ bind-9.3.2b1/bin/dig/Makefile.in	2005-10-06 20:04:36.000000000 -0400
-@@ -51,7 +51,7 @@
+\ Chybí znak konce řádku na konci souboru
+--- bind-9.4.0/bin/nsupdate/Makefile.in.PIE	2004-07-20 09:03:20.000000000 +0200
++++ bind-9.4.0/bin/nsupdate/Makefile.in	2007-03-06 12:53:37.000000000 +0100
+@@ -49,7 +49,7 @@
  
- TARGETS =	dig@EXEEXT@ host@EXEEXT@ nslookup@EXEEXT@
+ TARGETS =	nsupdate@EXEEXT@
  
--OBJS =		dig.@O@ dighost.@O@ host.@O@ nslookup.@O@
-+OBJS =		dig.o dighost.o host.o nslookup.o
+-OBJS =		nsupdate.@O@
++OBJS =		nsupdate.o
  
  UOBJS =
  
-@@ -63,19 +63,25 @@
+@@ -61,10 +61,16 @@
  
  MANOBJS =	${MANPAGES} ${HTMLPAGES}
  
@@ -287,27 +300,14 @@
 +
  @BIND9_MAKE_RULES@
  
--dig@EXEEXT@: dig.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
+-nsupdate@EXEEXT@: nsupdate.@O@ ${UOBJS} ${DEPLIBS}
+-	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ nsupdate.@O@ ${UOBJS} ${LIBS}
 +LDFLAGS   += -pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack
 +
 +.SUFFIXES: .c .o
 +
-+dig@EXEEXT@: dig.o dighost.o ${UOBJS} ${DEPLIBS}
- 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
--	dig.@O@ dighost.@O@ ${UOBJS} ${LIBS}
-+	dig.o dighost.o ${UOBJS} ${LIBS}
- 
--host@EXEEXT@: host.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
-+host@EXEEXT@: host.o dighost.o ${UOBJS} ${DEPLIBS}
- 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
--	host.@O@ dighost.@O@ ${UOBJS} ${LIBS}
-+	host.o dighost.o ${UOBJS} ${LIBS}
- 
--nslookup@EXEEXT@: nslookup.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
-+nslookup@EXEEXT@: nslookup.o dighost.o ${UOBJS} ${DEPLIBS}
- 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
--	nslookup.@O@ dighost.@O@ ${UOBJS} ${LIBS}
-+	nslookup.o dighost.o ${UOBJS} ${LIBS}
++nsupdate@EXEEXT@: nsupdate.o ${UOBJS} ${DEPLIBS}
++	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ nsupdate.o ${UOBJS} ${LIBS}
  
  doc man:: ${MANOBJS}
  
diff --git a/bind-9.3.3-edns.patch b/bind-9.3.3-edns.patch
index fa9004b..0a22b84 100644
--- a/bind-9.3.3-edns.patch
+++ b/bind-9.3.3-edns.patch
@@ -1,68 +1,78 @@
---- bind-9.3.3rc2/doc/misc/options.edns	2005-05-13 04:43:27.000000000 +0200
-+++ bind-9.3.3rc2/doc/misc/options	2006-11-02 13:00:25.000000000 +0100
-@@ -83,6 +83,7 @@
-         edns-udp-size <integer>;
-         root-delegation-only [ exclude { <quoted_string>; ... } ];
-         disable-algorithms <string> { <string>; ... };
-+        edns-enable <boolean>;
-         dnssec-enable <boolean>;
-         dnssec-lookaside <string> trust-anchor <string>;
-         dnssec-must-be-secure <string> <boolean>;
-@@ -263,6 +264,7 @@
-         edns-udp-size <integer>;
-         root-delegation-only [ exclude { <quoted_string>; ... } ];
-         disable-algorithms <string> { <string>; ... };
-+        edns-enable <boolean>;
-         dnssec-enable <boolean>;
-         dnssec-lookaside <string> trust-anchor <string>;
-         dnssec-must-be-secure <string> <boolean>;
---- bind-9.3.3rc2/lib/dns/view.c.edns	2004-03-10 03:55:58.000000000 +0100
-+++ bind-9.3.3rc2/lib/dns/view.c	2006-11-02 12:47:07.000000000 +0100
-@@ -156,6 +156,7 @@
+--- bind-9.4.0/lib/dns/view.c.edns	2006-03-10 00:38:21.000000000 +0100
++++ bind-9.4.0/lib/dns/view.c	2007-03-06 14:55:44.000000000 +0100
+@@ -160,6 +160,7 @@
  	view->additionalfromcache = ISC_TRUE;
  	view->additionalfromauth = ISC_TRUE;
  	view->enablednssec = ISC_TRUE;
 +	view->enableedns = ISC_TRUE;
+ 	view->enablevalidation = ISC_TRUE;
+ 	view->acceptexpired = ISC_FALSE;
  	view->minimalresponses = ISC_FALSE;
- 	view->transfer_format = dns_one_answer;
- 	view->queryacl = NULL;
---- bind-9.3.3rc2/lib/dns/include/dns/view.h.edns	2004-03-10 03:55:58.000000000 +0100
-+++ bind-9.3.3rc2/lib/dns/include/dns/view.h	2006-11-02 12:47:07.000000000 +0100
-@@ -109,6 +109,7 @@
+--- bind-9.4.0/lib/dns/include/dns/view.h.edns	2006-03-10 00:38:21.000000000 +0100
++++ bind-9.4.0/lib/dns/include/dns/view.h	2007-03-06 14:56:19.000000000 +0100
+@@ -112,6 +112,7 @@
  	isc_boolean_t			additionalfromauth;
  	isc_boolean_t			minimalresponses;
  	isc_boolean_t			enablednssec;
 +	isc_boolean_t			enableedns;
+ 	isc_boolean_t			enablevalidation;
+ 	isc_boolean_t			acceptexpired;
  	dns_transfer_format_t		transfer_format;
- 	dns_acl_t *			queryacl;
- 	dns_acl_t *			recursionacl;
---- bind-9.3.3rc2/lib/isccfg/namedconf.c.edns	2006-03-02 01:37:20.000000000 +0100
-+++ bind-9.3.3rc2/lib/isccfg/namedconf.c	2006-11-02 12:47:07.000000000 +0100
-@@ -726,6 +726,7 @@
+--- bind-9.4.0/lib/isccfg/namedconf.c.edns	2006-05-03 03:46:40.000000000 +0200
++++ bind-9.4.0/lib/isccfg/namedconf.c	2007-03-06 14:43:48.000000000 +0100
+@@ -767,6 +767,7 @@
  	{ "root-delegation-only",  &cfg_type_optional_exclude, 0 },
  	{ "disable-algorithms", &cfg_type_disablealgorithm,
  	  CFG_CLAUSEFLAG_MULTI },
 +	{ "edns-enable", &cfg_type_boolean, 0 },
  	{ "dnssec-enable", &cfg_type_boolean, 0 },
+ 	{ "dnssec-validation", &cfg_type_boolean, 0 },
  	{ "dnssec-lookaside", &cfg_type_lookaside, CFG_CLAUSEFLAG_MULTI },
- 	{ "dnssec-must-be-secure",  &cfg_type_mustbesecure,
---- bind-9.3.3rc2/bin/named/server.c.edns	2006-11-02 12:47:07.000000000 +0100
-+++ bind-9.3.3rc2/bin/named/server.c	2006-11-02 12:47:07.000000000 +0100
-@@ -1181,6 +1181,11 @@
- 	result = ns_config_get(maps, "provide-ixfr", &obj);
- 	INSIST(result == ISC_R_SUCCESS);
- 	view->provideixfr = cfg_obj_asboolean(obj);
+--- bind-9.4.0/doc/misc/options.edns	2006-05-03 04:26:59.000000000 +0200
++++ bind-9.4.0/doc/misc/options	2007-03-06 14:43:48.000000000 +0100
+@@ -85,6 +85,7 @@
+         max-udp-size <integer>;
+         root-delegation-only [ exclude { <quoted_string>; ... } ];
+         disable-algorithms <string> { <string>; ... };
++        edns-enable <boolean>;
+         dnssec-enable <boolean>;
+         dnssec-validation <boolean>;
+         dnssec-lookaside <string> trust-anchor <string>;
+@@ -313,6 +314,7 @@
+         max-udp-size <integer>;
+         root-delegation-only [ exclude { <quoted_string>; ... } ];
+         disable-algorithms <string> { <string>; ... };
++        edns-enable <boolean>;
+         dnssec-enable <boolean>;
+         dnssec-validation <boolean>;
+         dnssec-lookaside <string> trust-anchor <string>;
+--- bind-9.4.0/bin/named/config.c.edns	2006-05-03 03:46:40.000000000 +0200
++++ bind-9.4.0/bin/named/config.c	2007-03-06 15:02:07.000000000 +0100
+@@ -135,6 +135,7 @@
+ 	acache-enable no;\n\
+ 	acache-cleaning-interval 60;\n\
+ 	max-acache-size 0;\n\
++	edns-enable yes;\n\
+ 	dnssec-enable yes;\n\
+ 	dnssec-validation no; /* Make yes for 9.5. */ \n\
+ 	dnssec-accept-expired no;\n\
+--- bind-9.4.0/bin/named/server.c.edns	2007-03-06 14:43:48.000000000 +0100
++++ bind-9.4.0/bin/named/server.c	2007-03-06 15:01:24.000000000 +0100
+@@ -1492,6 +1492,11 @@
+ 	dns_resolver_setclientsperquery(view->resolver,
+ 					cfg_obj_asuint32(obj),
+ 					max_clients_per_query);
 +
 +        obj = NULL;
 +        (void)ns_config_get(maps, "edns-enable", &obj);
-+        if (obj != NULL)
-+		view->enableedns = cfg_obj_asboolean(obj);
++        if(obj != NULL)
++               view->enableedns = cfg_obj_asboolean(obj);
  			
  	obj = NULL;
  	result = ns_config_get(maps, "dnssec-enable", &obj);
---- bind-9.3.3rc2/bin/named/query.c.edns	2006-08-31 05:57:11.000000000 +0200
-+++ bind-9.3.3rc2/bin/named/query.c	2006-11-02 12:47:07.000000000 +0100
-@@ -3558,6 +3558,12 @@
+--- bind-9.4.0/bin/named/query.c.edns	2007-01-08 03:41:59.000000000 +0100
++++ bind-9.4.0/bin/named/query.c	2007-03-06 14:43:48.000000000 +0100
+@@ -4578,6 +4578,12 @@
  	if (client->view->enablednssec)
  		message->flags |= DNS_MESSAGEFLAG_AD;
  
@@ -75,13 +85,3 @@
  	qclient = NULL;
  	ns_client_attach(client, &qclient);
  	query_find(qclient, NULL, qtype);
---- bind-9.3.3rc2/bin/named/config.c.edns	2006-02-28 07:32:53.000000000 +0100
-+++ bind-9.3.3rc2/bin/named/config.c	2006-11-02 12:47:07.000000000 +0100
-@@ -125,6 +125,7 @@
- 	check-names master fail;\n\
- 	check-names slave warn;\n\
- 	check-names response ignore;\n\
-+	edns-enable yes;\n\
- 	dnssec-enable no; /* Make yes for 9.4. */ \n\
- "
- 
diff --git a/bind-9.3.3rc2-dbus.patch b/bind-9.3.3rc2-dbus.patch
index 0855f04..7eda95c 100644
--- a/bind-9.3.3rc2-dbus.patch
+++ b/bind-9.3.3rc2-dbus.patch
@@ -1,208 +1,84 @@
---- bind-9.3.2b2/lib/dns/rbt.c.dbus	2005-06-17 21:03:24.000000000 -0400
-+++ bind-9.3.2b2/lib/dns/rbt.c	2005-11-15 12:45:05.000000000 -0500
-@@ -2172,6 +2172,47 @@
- 	dns_rbt_printtree(rbt->root, NULL, 0);
- }
+--- bind-9.4.0/lib/isc/include/isc/socket.h.dbus	2006-06-07 02:29:45.000000000 +0200
++++ bind-9.4.0/lib/isc/include/isc/socket.h	2007-03-06 13:58:11.000000000 +0100
+@@ -135,6 +135,10 @@
+ #define ISC_SOCKEVENT_NEWCONN	(ISC_EVENTCLASS_SOCKET + 3)
+ #define ISC_SOCKEVENT_CONNECT	(ISC_EVENTCLASS_SOCKET + 4)
  
-+static void
-+dns_rbt_traverse_tree(dns_rbtnode_t *root,  dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 ) {
-+/*
-+ * This is used ONLY to traverse the forward table by dbus_mgr at the moment.
-+ * Since the forward table is not likely to be large, this can be recursive.
-+ */
-+	dns_name_t name;
-+	dns_offsets_t offsets;
-+	char buf[DNS_NAME_MAXWIRE];
-+	isc_buffer_t buffer;
-+
-+	if (root != NULL) {
-+
-+		if (DOWN(root)) 
-+			dns_rbt_traverse_tree(DOWN(root), cb, cb_arg1, cb_arg2);
-+
-+		if( LEFT(root) != NULL )
-+		        dns_rbt_traverse_tree(LEFT(root), cb, cb_arg1, cb_arg2);
-+
-+		if( RIGHT(root) != NULL )
-+		        dns_rbt_traverse_tree(RIGHT(root), cb, cb_arg1, cb_arg2);
-+
-+		if( DATA(root) == 0L )
-+		    return;
-+
-+		dns_name_init(&name, offsets);
-+		isc_buffer_init(&buffer, buf, DNS_NAME_MAXWIRE);
-+		dns_name_setbuffer( &name, &buffer);
-+		dns_rbt_fullnamefromnode(root, &name);
-+		
-+		(*cb)(&name, DATA(root), cb_arg1, cb_arg2);		
-+	} 
-+}
-+
-+void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2  )
-+{
-+        REQUIRE(VALID_RBT(rbt));
-+
-+	dns_rbt_traverse_tree( rbt->root, cb, cb_arg1, cb_arg2 );       
-+}
++#define ISC_SOCKEVENT_READ_READY  (ISC_EVENTCLASS_SOCKET + 5)
++#define ISC_SOCKEVENT_WRITE_READY (ISC_EVENTCLASS_SOCKET + 6)
++#define ISC_SOCKEVENT_SELECTED    (ISC_EVENTCLASS_SOCKET + 7)
 +
  /*
-  * Chain Functions
+  * Internal events.
   */
---- bind-9.3.2b2/lib/dns/forward.c.dbus	2005-03-16 22:58:30.000000000 -0500
-+++ bind-9.3.2b2/lib/dns/forward.c	2005-11-15 12:45:05.000000000 -0500
-@@ -200,3 +200,89 @@
- 	}
- 	isc_mem_put(fwdtable->mctx, forwarders, sizeof(dns_forwarders_t));
- }
-+
-+/***
-+ *** new D-BUS Dynamic Forwarding Zones functions:
-+ ***/
-+isc_result_t
-+dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name )
-+{
-+	isc_result_t result;
-+
-+	REQUIRE(VALID_FWDTABLE(fwdtable));
-+
-+	RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
-+
-+	result = dns_rbt_deletename(fwdtable->table, name, ISC_FALSE);
-+
-+	RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write);		    
-+
-+	return (result);
-+}
-+
-+isc_result_t
-+dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable, 
-+			  dns_name_t *name, 
-+			  dns_name_t *foundname,
-+			  dns_forwarders_t **forwardersp)
-+{
-+	isc_result_t result;
-+
-+	REQUIRE(VALID_FWDTABLE(fwdtable));
-+	
-+	RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
-+
-+	result = dns_rbt_findname(fwdtable->table, name, 0, foundname,
-+				  (void **)forwardersp);
-+	
-+	if(result == DNS_R_PARTIALMATCH)
-+	    result = ISC_R_SUCCESS;
-+
-+	RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
-+
-+	return (result);
-+}
-+
-+isc_result_t
-+dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
-+		  dns_forwarders_t **forwardersp)
-+{
-+	isc_result_t result;
-+
-+	REQUIRE(VALID_FWDTABLE(fwdtable));
-+
-+	REQUIRE(forwardersp != 0L);
-+
-+	RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
-+
-+	result = dns_rbt_findname(fwdtable->table, name, 0, NULL,
-+				  (void **)forwardersp);
-+	
-+	if( result != ISC_R_SUCCESS )
-+	    *forwardersp = 0L;
-+
-+	RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
-+
-+	return (result);
-+}
-+
-+static 
-+void dns_fwdtable_traverse
-+(   
-+    dns_name_t *name,
-+    void *node_data,
-+    void *cbp,
-+    void *cb_arg
-+)
-+{
-+    dns_fwdtable_callback_t  cb = (dns_fwdtable_callback_t) cbp;
-+    
-+    (*cb)( name, node_data, cb_arg);
-+}
-+
-+void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void *cb_arg )
-+{
-+    REQUIRE(VALID_FWDTABLE(fwdtable));
-+
-+    dns_rbt_traverse( fwdtable->table, dns_fwdtable_traverse, cb, cb_arg );
-+}
---- bind-9.3.2b2/lib/dns/include/dns/forward.h.dbus	2005-03-16 22:58:31.000000000 -0500
-+++ bind-9.3.2b2/lib/dns/include/dns/forward.h	2005-11-15 12:45:05.000000000 -0500
-@@ -98,6 +98,37 @@
-  * 	all memory associated with the forwarding table is freed.
+@@ -144,7 +148,8 @@
+ typedef enum {
+ 	isc_sockettype_udp = 1,
+ 	isc_sockettype_tcp = 2,
+-	isc_sockettype_unix = 3
++	isc_sockettype_unix = 3,
++	isc_sockettype_fd = 8
+ } isc_sockettype_t;
+ 
+ /*@{*/
+@@ -747,6 +752,54 @@
+  * \li	#ISC_R_FAILURE
   */
  
-+
-+/* These are ONLY used by dbus_mgr :
++isc_socketevent_t*
++isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when the isc_sockettype_fd sock 
++ * was select()-ed for read. If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
 + */
-+
-+isc_result_t
-+dns_fwdtable_delete( dns_fwdtable_t *fwdtable, dns_name_t *name );
-+/* 
-+ * Removes an entry from the forwarding table.
++ 
++isc_socketevent_t*
++isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when the isc_sockettype_fd sock 
++ * was select()-ed for write. If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
 + */
 +
-+isc_result_t
-+dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
-+		  dns_forwarders_t **forwardersp);
-+/*
-+ * Finds an exact match for "name" in the forwarding table.  
++isc_socketevent_t*
++isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when ALL isc_sockettype_fd sockets 
++ * have been select()-ed . If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
 + */
 +
-+isc_result_t
-+dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_name_t *foundname,
-+		  dns_forwarders_t **forwardersp);
-+/*
-+ * Finds the closest match for "*name" in the forwarding table, returning  
-+ * the actual name matching in *name if different to *name passed in. 
++isc_socketevent_t*
++isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when the isc_sockettype_fd sock 
++ * was select()-ed for read. If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
 + */
-+
-+typedef void (*dns_fwdtable_callback_t)( dns_name_t *, dns_forwarders_t *, void *);
-+void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void * );
-+/* Invoke cb for each member of fwdtable 
++ 
++isc_socketevent_t*
++isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when the isc_sockettype_fd sock 
++ * was select()-ed for write. If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
 + */
 +
-+
- ISC_LANG_ENDDECLS
- 
- #endif /* DNS_FORWARD_H */
---- bind-9.3.2b2/lib/dns/include/dns/rbt.h.dbus	2004-10-11 01:55:51.000000000 -0400
-+++ bind-9.3.2b2/lib/dns/include/dns/rbt.h	2005-11-15 12:45:05.000000000 -0500
-@@ -833,6 +833,17 @@
-  *	<something_else>	Any error result from dns_name_concatenate.
-  */
- 
-+
-+typedef void (*dns_rbt_traverse_callback_t)(  dns_name_t *name,
-+					      void *node_data,
-+					      void *cb_arg1,
-+					      void *cb_arg2);
-+
-+void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 );
-+/* tree traversal function (only used by D-BUS dynamic forwarding dbus_mgr at
-+ * the moment)
++isc_socketevent_t*
++isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev );
++/* register the "dev" event to be sent when ALL isc_sockettype_fd sockets 
++ * have been select()-ed . If there is already an event registered, it
++ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
++ * registered event.
 + */
 +
  ISC_LANG_ENDDECLS
  
- #endif /* DNS_RBT_H */
---- bind-9.3.2b2/lib/isc/unix/socket.c.dbus	2005-11-15 12:43:36.000000000 -0500
-+++ bind-9.3.2b2/lib/isc/unix/socket.c	2005-11-15 12:45:05.000000000 -0500
-@@ -148,6 +148,11 @@
+ #endif /* ISC_SOCKET_H */
+--- bind-9.4.0/lib/isc/unix/socket.c.dbus	2007-03-06 13:45:26.000000000 +0100
++++ bind-9.4.0/lib/isc/unix/socket.c	2007-03-06 13:45:26.000000000 +0100
+@@ -159,6 +159,11 @@
  	ISC_LIST(isc_socketevent_t)		recv_list;
  	ISC_LIST(isc_socket_newconnev_t)	accept_list;
  	isc_socket_connev_t		       *connect_ev;
@@ -214,7 +90,7 @@
  
  	/*
  	 * Internal events.  Posted when a descriptor is readable or
-@@ -304,7 +309,7 @@
+@@ -315,7 +320,7 @@
  
  static void
  wakeup_socket(isc_socketmgr_t *manager, int fd, int msg) {
@@ -223,7 +99,7 @@
  
  	/*
  	 * This is a wakeup on a socket.  If the socket is not in the
-@@ -1266,6 +1271,9 @@
+@@ -1311,6 +1316,9 @@
  	sock->connected = 0;
  	sock->connecting = 0;
  	sock->bound = 0;
@@ -233,9 +109,9 @@
  
  	/*
  	 * initialize the lock
-@@ -1378,13 +1386,16 @@
- 	case isc_sockettype_tcp:
- 		sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
+@@ -1426,13 +1434,16 @@
+ 	case isc_sockettype_unix:
+ 		sock->fd = socket(pf, SOCK_STREAM, 0);
  		break;
 +
 +	case isc_sockettype_fd:
@@ -251,7 +127,7 @@
  		int new, tmp;
  		new = fcntl(sock->fd, F_DUPFD, 20);
  		tmp = errno;
-@@ -1438,7 +1449,7 @@
+@@ -1486,7 +1497,7 @@
  		}
  	}
  
@@ -260,7 +136,7 @@
  		(void)close(sock->fd);
  		free_socket(&sock);
  		return (ISC_R_UNEXPECTED);
-@@ -1706,6 +1717,38 @@
+@@ -1777,6 +1788,38 @@
  	isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
  }
  
@@ -299,7 +175,7 @@
  /*
   * 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
-@@ -2113,6 +2156,7 @@
+@@ -2184,6 +2227,7 @@
  	int i;
  	isc_socket_t *sock;
  	isc_boolean_t unlock_sock;
@@ -307,7 +183,7 @@
  
  	REQUIRE(maxfd <= (int)FD_SETSIZE);
  
-@@ -2146,11 +2190,15 @@
+@@ -2217,11 +2261,15 @@
  			unlock_sock = ISC_TRUE;
  			LOCK(&sock->lock);
  			if (!SOCK_DEAD(sock)) {
@@ -324,7 +200,7 @@
  			FD_CLR(i, &manager->read_fds);
  		}
  	check_write:
-@@ -2164,16 +2212,24 @@
+@@ -2235,16 +2283,24 @@
  				LOCK(&sock->lock);
  			}
  			if (!SOCK_DEAD(sock)) {
@@ -349,7 +225,7 @@
  }
  
  #ifdef ISC_PLATFORM_USETHREADS
-@@ -2192,7 +2248,7 @@
+@@ -2263,7 +2319,7 @@
  	int cc;
  	fd_set readfds;
  	fd_set writefds;
@@ -358,7 +234,7 @@
  	int maxfd;
  	char strbuf[ISC_STRERRORSIZE];
  
-@@ -3523,3 +3579,55 @@
+@@ -3784,3 +3840,55 @@
  	return (ISC_R_SUCCESS);
  }
  #endif /* ISC_PLATFORM_USETHREADS */
@@ -414,63 +290,242 @@
 +    }
 +    return dev;
 +}
---- bind-9.3.2b2/lib/isc/include/isc/socket.h.dbus	2004-03-08 04:04:53.000000000 -0500
-+++ bind-9.3.2b2/lib/isc/include/isc/socket.h	2005-11-15 12:45:05.000000000 -0500
-@@ -136,6 +136,10 @@
- #define ISC_SOCKEVENT_NEWCONN	(ISC_EVENTCLASS_SOCKET + 3)
- #define ISC_SOCKEVENT_CONNECT	(ISC_EVENTCLASS_SOCKET + 4)
- 
-+#define ISC_SOCKEVENT_READ_READY  (ISC_EVENTCLASS_SOCKET + 5)
-+#define ISC_SOCKEVENT_WRITE_READY (ISC_EVENTCLASS_SOCKET + 6)
-+#define ISC_SOCKEVENT_SELECTED    (ISC_EVENTCLASS_SOCKET + 7)
+--- bind-9.4.0/lib/dns/forward.c.dbus	2005-07-12 03:22:20.000000000 +0200
++++ bind-9.4.0/lib/dns/forward.c	2007-03-06 13:45:26.000000000 +0100
+@@ -197,3 +197,89 @@
+ 	}
+ 	isc_mem_put(fwdtable->mctx, forwarders, sizeof(dns_forwarders_t));
+ }
 +
- /*
-  * Internal events.
-  */
-@@ -144,7 +148,8 @@
- 
- typedef enum {
- 	isc_sockettype_udp = 1,
--	isc_sockettype_tcp = 2
-+	isc_sockettype_tcp = 2,
-+	isc_sockettype_fd  = 8
- } isc_sockettype_t;
- 
- /*
-@@ -699,6 +704,30 @@
-  *	'sock' is a valid socket.
-  */
- 
-+isc_socketevent_t*
-+isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev );
-+/* register the "dev" event to be sent when the isc_sockettype_fd sock 
-+ * was select()-ed for read. If there is already an event registered, it
-+ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
-+ * registered event.
-+ */
-+ 
-+isc_socketevent_t*
-+isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev );
-+/* register the "dev" event to be sent when the isc_sockettype_fd sock 
-+ * was select()-ed for write. If there is already an event registered, it
-+ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
-+ * registered event.
-+ */
++/***
++ *** new D-BUS Dynamic Forwarding Zones functions:
++ ***/
++isc_result_t
++dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name )
++{
++	isc_result_t result;
 +
-+isc_socketevent_t*
-+isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev );
-+/* register the "dev" event to be sent when ALL isc_sockettype_fd sockets 
-+ * have been select()-ed . If there is already an event registered, it
-+ * is returned, otherwise 0 is returned. If dev is 0, removes any existing
-+ * registered event.
++	REQUIRE(VALID_FWDTABLE(fwdtable));
++
++	RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
++
++	result = dns_rbt_deletename(fwdtable->table, name, ISC_FALSE);
++
++	RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write);		    
++
++	return (result);
++}
++
++isc_result_t
++dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable, 
++			  dns_name_t *name, 
++			  dns_name_t *foundname,
++			  dns_forwarders_t **forwardersp)
++{
++	isc_result_t result;
++
++	REQUIRE(VALID_FWDTABLE(fwdtable));
++	
++	RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++	result = dns_rbt_findname(fwdtable->table, name, 0, foundname,
++				  (void **)forwardersp);
++	
++	if(result == DNS_R_PARTIALMATCH)
++	    result = ISC_R_SUCCESS;
++
++	RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++	return (result);
++}
++
++isc_result_t
++dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
++		  dns_forwarders_t **forwardersp)
++{
++	isc_result_t result;
++
++	REQUIRE(VALID_FWDTABLE(fwdtable));
++
++	REQUIRE(forwardersp != 0L);
++
++	RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++	result = dns_rbt_findname(fwdtable->table, name, 0, NULL,
++				  (void **)forwardersp);
++	
++	if( result != ISC_R_SUCCESS )
++	    *forwardersp = 0L;
++
++	RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
++
++	return (result);
++}
++
++static 
++void dns_fwdtable_traverse
++(   
++    dns_name_t *name,
++    void *node_data,
++    void *cbp,
++    void *cb_arg
++)
++{
++    dns_fwdtable_callback_t  cb = (dns_fwdtable_callback_t) cbp;
++    
++    (*cb)( name, node_data, cb_arg);
++}
++
++void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void *cb_arg )
++{
++    REQUIRE(VALID_FWDTABLE(fwdtable));
++
++    dns_rbt_traverse( fwdtable->table, dns_fwdtable_traverse, cb, cb_arg );
++}
+--- bind-9.4.0/lib/dns/rbt.c.dbus	2005-10-13 03:26:06.000000000 +0200
++++ bind-9.4.0/lib/dns/rbt.c	2007-03-06 13:45:26.000000000 +0100
+@@ -2175,6 +2175,47 @@
+ 	dns_rbt_printtree(rbt->root, NULL, 0);
+ }
+ 
++static void
++dns_rbt_traverse_tree(dns_rbtnode_t *root,  dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 ) {
++/*
++ * This is used ONLY to traverse the forward table by dbus_mgr at the moment.
++ * Since the forward table is not likely to be large, this can be recursive.
++ */
++	dns_name_t name;
++	dns_offsets_t offsets;
++	char buf[DNS_NAME_MAXWIRE];
++	isc_buffer_t buffer;
++
++	if (root != NULL) {
++
++		if (DOWN(root)) 
++			dns_rbt_traverse_tree(DOWN(root), cb, cb_arg1, cb_arg2);
++
++		if( LEFT(root) != NULL )
++		        dns_rbt_traverse_tree(LEFT(root), cb, cb_arg1, cb_arg2);
++
++		if( RIGHT(root) != NULL )
++		        dns_rbt_traverse_tree(RIGHT(root), cb, cb_arg1, cb_arg2);
++
++		if( DATA(root) == 0L )
++		    return;
++
++		dns_name_init(&name, offsets);
++		isc_buffer_init(&buffer, buf, DNS_NAME_MAXWIRE);
++		dns_name_setbuffer( &name, &buffer);
++		dns_rbt_fullnamefromnode(root, &name);
++		
++		(*cb)(&name, DATA(root), cb_arg1, cb_arg2);		
++	} 
++}
++
++void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2  )
++{
++        REQUIRE(VALID_RBT(rbt));
++
++	dns_rbt_traverse_tree( rbt->root, cb, cb_arg1, cb_arg2 );       
++}
++
+ /*
+  * Chain Functions
+  */
+--- bind-9.4.0/lib/dns/include/dns/rbt.h.dbus	2005-10-13 03:26:07.000000000 +0200
++++ bind-9.4.0/lib/dns/include/dns/rbt.h	2007-03-06 13:45:26.000000000 +0100
+@@ -911,6 +911,17 @@
+ 	} while (0) 
+ #endif /* DNS_RBT_USEISCREFCOUNT */
+ 
++
++typedef void (*dns_rbt_traverse_callback_t)(  dns_name_t *name,
++					      void *node_data,
++					      void *cb_arg1,
++					      void *cb_arg2);
++
++void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 );
++/* tree traversal function (only used by D-BUS dynamic forwarding dbus_mgr at
++ * the moment)
 + */
 +
  ISC_LANG_ENDDECLS
  
- #endif /* ISC_SOCKET_H */
---- bind-9.3.2b2/bin/named/log.c.dbus	2005-05-24 19:58:17.000000000 -0400
-+++ bind-9.3.2b2/bin/named/log.c	2005-11-15 12:45:05.000000000 -0500
-@@ -41,6 +41,7 @@
+ #endif /* DNS_RBT_H */
+--- bind-9.4.0/lib/dns/include/dns/forward.h.dbus	2005-04-27 07:01:33.000000000 +0200
++++ bind-9.4.0/lib/dns/include/dns/forward.h	2007-03-06 13:45:26.000000000 +0100
+@@ -113,6 +113,37 @@
+  * \li	all memory associated with the forwarding table is freed.
+  */
+ 
++
++/* These are ONLY used by dbus_mgr :
++ */
++
++isc_result_t
++dns_fwdtable_delete( dns_fwdtable_t *fwdtable, dns_name_t *name );
++/* 
++ * Removes an entry from the forwarding table.
++ */
++
++isc_result_t
++dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
++		  dns_forwarders_t **forwardersp);
++/*
++ * Finds an exact match for "name" in the forwarding table.  
++ */
++
++isc_result_t
++dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_name_t *foundname,
++		  dns_forwarders_t **forwardersp);
++/*
++ * Finds the closest match for "*name" in the forwarding table, returning  
++ * the actual name matching in *name if different to *name passed in. 
++ */
++
++typedef void (*dns_fwdtable_callback_t)( dns_name_t *, dns_forwarders_t *, void *);
++void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void * );
++/* Invoke cb for each member of fwdtable 
++ */
++
++
+ ISC_LANG_ENDDECLS
+ 
+ #endif /* DNS_FORWARD_H */
+--- bind-9.4.0/bin/named/main.c.dbus	2006-11-10 19:51:14.000000000 +0100
++++ bind-9.4.0/bin/named/main.c	2007-03-06 14:11:18.000000000 +0100
+@@ -248,7 +248,8 @@
+ 		"usage: named [-4|-6] [-c conffile] [-d debuglevel] "
+ 		"[-f|-g] [-n number_of_cpus]\n"
+ 		"             [-p port] [-s] [-t chrootdir] [-u username]\n"
+-		"             [-m {usage|trace|record|size|mctx}]\n");
++		"             [-m {usage|trace|record|size|mctx}]\n"
++		"	      [-D ]\n");
+ }
+ 
+ static void
+@@ -356,7 +357,7 @@
+ 
+ 	isc_commandline_errprint = ISC_FALSE;
+ 	while ((ch = isc_commandline_parse(argc, argv,
+-			           "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:")) != -1) {
++			           "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:D")) != -1) {
+ 		switch (ch) {
+ 		case '4':
+ 			if (disable4)
+@@ -445,6 +446,9 @@
+ 		case 'v':
+ 			printf("BIND %s\n", ns_g_version);
+ 			exit(0);
++		case 'D':
++		        ns_g_dbus = 1;
++			break;
+ 		case '?':
+ 			usage();
+ 			ns_main_earlyfatal("unknown option '-%c'",
+--- bind-9.4.0/bin/named/log.c.dbus	2006-06-09 02:54:08.000000000 +0200
++++ bind-9.4.0/bin/named/log.c	2007-03-06 13:45:26.000000000 +0100
+@@ -44,6 +44,7 @@
  	{ "queries",	 		0 },
  	{ "unmatched",	 		0 },
  	{ "update-security",		0 },
@@ -478,7 +533,7 @@
  	{ NULL, 			0 }
  };
  
-@@ -60,6 +61,7 @@
+@@ -63,6 +64,7 @@
  	{ "notify",	 		0 },
  	{ "control",	 		0 },
  	{ "lwresd",	 		0 },
@@ -486,19 +541,126 @@
  	{ NULL, 			0 }
  };
  
---- bind-9.3.2b2/bin/named/Makefile.in.dbus	2005-11-15 12:43:36.000000000 -0500
-+++ bind-9.3.2b2/bin/named/Makefile.in	2005-11-15 12:45:05.000000000 -0500
-@@ -35,7 +35,8 @@
- 		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
- 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
- 		${DBDRIVER_INCLUDES}
+--- bind-9.4.0/bin/named/include/named/server.h.dbus	2006-03-10 00:46:20.000000000 +0100
++++ bind-9.4.0/bin/named/include/named/server.h	2007-03-06 14:12:02.000000000 +0100
+@@ -97,6 +97,8 @@
+ 	ns_dispatchlist_t	dispatches;
+ 
+ 	dns_acache_t		*acache;
++
++	ns_dbus_mgr_t *         dbus_mgr;
+ };
+ 
+ #define NS_SERVER_MAGIC			ISC_MAGIC('S','V','E','R')
+--- bind-9.4.0/bin/named/include/named/types.h.dbus	2005-04-29 02:15:38.000000000 +0200
++++ bind-9.4.0/bin/named/include/named/types.h	2007-03-06 13:45:26.000000000 +0100
+@@ -40,4 +40,6 @@
+ typedef struct ns_dispatch		ns_dispatch_t;
+ typedef ISC_LIST(ns_dispatch_t)		ns_dispatchlist_t;
+ 
++typedef struct ns_dbus_mgr              ns_dbus_mgr_t ;
++
+ #endif /* NAMED_TYPES_H */
+--- bind-9.4.0/bin/named/include/named/globals.h.dbus	2007-03-06 13:45:26.000000000 +0100
++++ bind-9.4.0/bin/named/include/named/globals.h	2007-03-06 13:45:26.000000000 +0100
+@@ -114,6 +114,8 @@
+ 
+ EXTERN int			ns_g_listen		INIT(3);
+ 
++EXTERN int                      ns_g_dbus               INIT(0);
++
+ #undef EXTERN
+ #undef INIT
+ 
+--- bind-9.4.0/bin/named/include/named/log.h.dbus	2005-04-29 02:15:35.000000000 +0200
++++ bind-9.4.0/bin/named/include/named/log.h	2007-03-06 13:45:26.000000000 +0100
+@@ -36,6 +36,7 @@
+ #define NS_LOGCATEGORY_QUERIES		(&ns_g_categories[4])
+ #define NS_LOGCATEGORY_UNMATCHED	(&ns_g_categories[5])
+ #define NS_LOGCATEGORY_UPDATE_SECURITY	(&ns_g_categories[6])
++#define NS_LOGCATEGORY_DBUS      	(&ns_g_categories[7])
+ 
+ /*
+  * Backwards compatibility.
+@@ -53,6 +54,7 @@
+ #define NS_LOGMODULE_NOTIFY		(&ns_g_modules[8])
+ #define NS_LOGMODULE_CONTROL		(&ns_g_modules[9])
+ #define NS_LOGMODULE_LWRESD		(&ns_g_modules[10])
++#define NS_LOGMODULE_DBUS		(&ns_g_modules[11])
+ 
+ isc_result_t
+ ns_log_init(isc_boolean_t safe);
+--- bind-9.4.0/bin/named/server.c.dbus	2006-12-07 06:24:19.000000000 +0100
++++ bind-9.4.0/bin/named/server.c	2007-03-06 13:45:26.000000000 +0100
+@@ -167,6 +167,8 @@
+ 	ISC_LINK(struct zonelistentry)	link;
+ };
+ 
++#include <named/dbus_mgr.h>
++
+ /*
+  * These zones should not leak onto the Internet.
+  */
+@@ -1985,12 +1987,12 @@
+ 	if (result != ISC_R_SUCCESS) {
+ 		char namebuf[DNS_NAME_FORMATSIZE];
+ 		dns_name_format(origin, namebuf, sizeof(namebuf));
+-		cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_WARNING,
+-			    "could not set up forwarding for domain '%s': %s",
++		cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_NOTICE,
++			    "setting up forwarding failed for domain '%s': %s",
+ 			    namebuf, isc_result_totext(result));
+ 		goto cleanup;
+ 	}
 -
++		
+ 	result = ISC_R_SUCCESS;
+ 
+  cleanup:
+@@ -3418,6 +3420,20 @@
+ 
+ 	CHECKFATAL(load_zones(server, ISC_FALSE), "loading zones");
+ 
++	server->dbus_mgr = 0L;
++	if( ns_g_dbus )	
++	    if( dbus_mgr_create
++	        (  ns_g_mctx, ns_g_taskmgr, ns_g_socketmgr, ns_g_timermgr,
++		   &server->dbus_mgr
++		) != ISC_R_SUCCESS
++	      )
++	    {
++		isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
++			      NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
++			      "dbus_mgr initialization failed. D-BUS service is disabled."
++		             );
++	    }
++
+ 	ns_os_started();
+ 	isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
+ 		      ISC_LOG_NOTICE, "running");
+@@ -3481,6 +3497,9 @@
+ 
+ 	dns_db_detach(&server->in_roothints);
+ 
++	if( server->dbus_mgr != 0L )
++	    dbus_mgr_shutdown(server->dbus_mgr);
++
+ 	isc_task_endexclusive(server->task);
+ 
+ 	isc_task_detach(&server->task);
+--- bind-9.4.0/bin/named/Makefile.in.dbus	2007-03-06 13:45:26.000000000 +0100
++++ bind-9.4.0/bin/named/Makefile.in	2007-03-06 14:08:10.000000000 +0100
+@@ -43,6 +43,9 @@
+ 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
+ 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES}
+ 
 +DBUS_INCLUDES = \
-+	-I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
- CDEFINES =
- CWARNINGS =
++        -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
++
+ CDEFINES =      @USE_DLZ@
  
-@@ -52,6 +53,7 @@
+ CWARNINGS =
+@@ -60,6 +63,7 @@
  ISCDEPLIBS =	../../lib/isc/libisc.@A@
  LWRESDEPLIBS =	../../lib/lwres/liblwres.@A@
  BIND9DEPLIBS =	../../lib/bind9/libbind9.@A@
@@ -506,25 +668,23 @@
  
  DEPLIBS =	${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
  		${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}
-@@ -70,7 +72,8 @@
- 		tkeyconf.o tsigconf.o update.o xfrout.o \
+@@ -80,6 +84,7 @@
  		zoneconf.o \
  		lwaddr.o lwresd.o lwdclient.o lwderror.o lwdgabn.o \
--		lwdgnba.o lwdgrbn.o lwdnoop.o lwsearch.o \
-+		lwdgnba.o lwdgrbn.o lwdnoop.o lwsearch.o  \
+ 		lwdgnba.o lwdgrbn.o lwdnoop.o lwsearch.o \
 +		dbus_service.o dbus_mgr.o \
- 		$(DBDRIVER_OBJS)
+ 		${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
  
  UOBJS =		unix/os.o
-@@ -83,6 +86,7 @@
+@@ -92,6 +97,7 @@
  		zoneconf.c \
  		lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
  		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
-+	        dbus_service.c dbus_mgr.c \
- 		$(DBDRIVER_SRCS)
++		dbus_service.c dbus_mgr.c \
+ 		${DLZDRIVER_SRCS} ${DBDRIVER_SRCS}
  
  MANPAGES =	named.8 lwresd.8 named.conf.5
-@@ -111,9 +115,14 @@
+@@ -120,9 +126,14 @@
  		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
  		-c ${srcdir}/config.c
  
@@ -540,9 +700,9 @@
  
  lwresd@EXEEXT@: named@EXEEXT@
  	rm -f lwresd@EXEEXT@
---- bind-9.3.2b2/bin/named/named.8.dbus	2005-10-12 22:33:46.000000000 -0400
-+++ bind-9.3.2b2/bin/named/named.8	2005-11-15 12:48:31.000000000 -0500
-@@ -30,7 +30,7 @@
+--- bind-9.4.0/bin/named/named.8.dbus	2007-01-30 01:23:44.000000000 +0100
++++ bind-9.4.0/bin/named/named.8	2007-03-06 13:45:26.000000000 +0100
+@@ -33,7 +33,7 @@
  named \- Internet domain name server
  .SH "SYNOPSIS"
  .HP 6
@@ -551,10 +711,10 @@
  .SH "DESCRIPTION"
  .PP
  \fBnamed\fR
-@@ -143,6 +143,13 @@
- .B "Warning:"
+@@ -172,6 +172,13 @@
  This option must not be used. It is only of interest to BIND 9 developers and may be removed or changed in a future release.
  .RE
+ .RE
 +.sp
 +.TP
 +\fB\-D\fR
@@ -565,7 +725,7 @@
  .SH "SIGNALS"
  .PP
  In routine operation, signals should not be used to control the nameserver;
-@@ -162,6 +169,73 @@
+@@ -195,6 +202,73 @@
  \fBnamed\fR
  configuration file is too complex to describe in detail here. A complete description is provided in the
  BIND 9 Administrator Reference Manual.
@@ -637,145 +797,5 @@
 +by selecting the Help menu.
 +.PP
  .SH "FILES"
- .TP
+ .PP
  \fI/etc/named.conf\fR
---- bind-9.3.2b2/bin/named/main.c.dbus	2005-04-28 21:04:47.000000000 -0400
-+++ bind-9.3.2b2/bin/named/main.c	2005-11-15 12:45:05.000000000 -0500
-@@ -239,7 +239,8 @@
- 		"usage: named [-4|-6] [-c conffile] [-d debuglevel] "
- 		"[-f|-g] [-n number_of_cpus]\n"
- 		"             [-p port] [-s] [-t chrootdir] [-u username]\n"
--		"             [-m {usage|trace|record}]\n");
-+		"             [-m {usage|trace|record}]\n"
-+	        "             [-D ]\n");
- }
- 
- static void
-@@ -345,7 +346,7 @@
- 
- 	isc_commandline_errprint = ISC_FALSE;
- 	while ((ch = isc_commandline_parse(argc, argv,
--			           "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:")) != -1) {
-+			           "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:D")) != -1) {
- 		switch (ch) {
- 		case '4':
- 			if (disable4)
-@@ -434,6 +435,9 @@
- 		case 'v':
- 			printf("BIND %s\n", ns_g_version);
- 			exit(0);
-+		case 'D':
-+		        ns_g_dbus = 1;
-+			break;
- 		case '?':
- 			usage();
- 			ns_main_earlyfatal("unknown option '-%c'",
---- bind-9.3.2b2/bin/named/server.c.dbus	2005-07-26 22:53:15.000000000 -0400
-+++ bind-9.3.2b2/bin/named/server.c	2005-11-15 12:45:05.000000000 -0500
-@@ -86,6 +86,8 @@
- #include <stdlib.h>
- #endif
- 
-+#include <named/dbus_mgr.h>
-+
- /*
-  * Check an operation for failure.  Assumes that the function
-  * using it has a 'result' variable and a 'cleanup' label.
-@@ -1496,12 +1498,12 @@
- 	if (result != ISC_R_SUCCESS) {
- 		char namebuf[DNS_NAME_FORMATSIZE];
- 		dns_name_format(origin, namebuf, sizeof(namebuf));
--		cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_WARNING,
--			    "could not set up forwarding for domain '%s': %s",
-+		cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_NOTICE,
-+			    "setting up forwarding failed for domain '%s': %s",
- 			    namebuf, isc_result_totext(result));
- 		goto cleanup;
- 	}
--
-+		
- 	result = ISC_R_SUCCESS;
- 
-  cleanup:
-@@ -2873,6 +2875,20 @@
- 
- 	CHECKFATAL(load_zones(server, ISC_FALSE), "loading zones");
- 
-+	server->dbus_mgr = 0L;
-+	if( ns_g_dbus )	
-+	    if( dbus_mgr_create
-+	        (  ns_g_mctx, ns_g_taskmgr, ns_g_socketmgr, ns_g_timermgr,
-+		   &server->dbus_mgr
-+		) != ISC_R_SUCCESS
-+	      )
-+	    {
-+		isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
-+			      NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
-+			      "dbus_mgr initialization failed. D-BUS service is disabled."
-+		             );
-+	    }
-+
- 	ns_os_started();
- 	isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
- 		      ISC_LOG_NOTICE, "running");
-@@ -2935,6 +2951,9 @@
- 
- 	dns_db_detach(&server->in_roothints);
- 
-+	if( server->dbus_mgr != 0L )
-+	    dbus_mgr_shutdown(server->dbus_mgr);
-+
- 	isc_task_endexclusive(server->task);
- 
- 	isc_task_detach(&server->task);
---- bind-9.3.2b2/bin/named/include/named/globals.h.dbus	2005-11-15 12:43:36.000000000 -0500
-+++ bind-9.3.2b2/bin/named/include/named/globals.h	2005-11-15 12:45:05.000000000 -0500
-@@ -112,6 +112,8 @@
- 
- EXTERN int			ns_g_listen		INIT(3);
- 
-+EXTERN int                      ns_g_dbus               INIT(0);
-+
- #undef EXTERN
- #undef INIT
- 
---- bind-9.3.2b2/bin/named/include/named/server.h.dbus	2004-03-07 23:04:21.000000000 -0500
-+++ bind-9.3.2b2/bin/named/include/named/server.h	2005-11-15 12:45:05.000000000 -0500
-@@ -91,7 +91,8 @@
- 	ns_controls_t *		controls;	/* Control channels */
- 	unsigned int		dispatchgen;
- 	ns_dispatchlist_t	dispatches;
--						
-+
-+        ns_dbus_mgr_t *         dbus_mgr;
- };
- 
- #define NS_SERVER_MAGIC			ISC_MAGIC('S','V','E','R')
---- bind-9.3.2b2/bin/named/include/named/log.h.dbus	2004-03-07 23:04:21.000000000 -0500
-+++ bind-9.3.2b2/bin/named/include/named/log.h	2005-11-15 12:45:05.000000000 -0500
-@@ -34,6 +34,7 @@
- #define NS_LOGCATEGORY_QUERIES		(&ns_g_categories[4])
- #define NS_LOGCATEGORY_UNMATCHED	(&ns_g_categories[5])
- #define NS_LOGCATEGORY_UPDATE_SECURITY	(&ns_g_categories[6])
-+#define NS_LOGCATEGORY_DBUS      	(&ns_g_categories[7])
- 
- /*
-  * Backwards compatibility.
-@@ -51,6 +52,7 @@
- #define NS_LOGMODULE_NOTIFY		(&ns_g_modules[8])
- #define NS_LOGMODULE_CONTROL		(&ns_g_modules[9])
- #define NS_LOGMODULE_LWRESD		(&ns_g_modules[10])
-+#define NS_LOGMODULE_DBUS		(&ns_g_modules[11])
- 
- isc_result_t
- ns_log_init(isc_boolean_t safe);
---- bind-9.3.2b2/bin/named/include/named/types.h.dbus	2004-03-06 05:21:26.000000000 -0500
-+++ bind-9.3.2b2/bin/named/include/named/types.h	2005-11-15 12:45:05.000000000 -0500
-@@ -38,4 +38,6 @@
- typedef struct ns_dispatch		ns_dispatch_t;
- typedef ISC_LIST(ns_dispatch_t)		ns_dispatchlist_t;
- 
-+typedef struct ns_dbus_mgr              ns_dbus_mgr_t ;
-+
- #endif /* NAMED_TYPES_H */
-
diff --git a/bind-9.3.3rc2-rndckey.patch b/bind-9.3.3rc2-rndckey.patch
index 4439aa0..42f0e26 100644
--- a/bind-9.3.3rc2-rndckey.patch
+++ b/bind-9.3.3rc2-rndckey.patch
@@ -1,17 +1,28 @@
---- bind-9.3.3rc2/bin/rndc/rndc-confgen.c.key	2004-09-28 09:14:57.000000000 +0200
-+++ bind-9.3.3rc2/bin/rndc/rndc-confgen.c	2006-09-15 08:56:25.000000000 +0200
-@@ -46,7 +46,7 @@
+--- bind-9.4.0/bin/rndc/rndc-confgen.8.key	2007-01-30 01:23:44.000000000 +0100
++++ bind-9.4.0/bin/rndc/rndc-confgen.8	2007-03-06 12:42:15.000000000 +0100
+@@ -125,7 +125,7 @@
+ \-k \fIkeyname\fR
+ .RS 4
+ Specifies the key name of the rndc authentication key. This must be a valid domain name. The default is
+-\fBrndc\-key\fR.
++\fBrndckey\fR.
+ .RE
+ .PP
+ \-p \fIport\fR
+--- bind-9.4.0/bin/rndc/rndc-confgen.c.key	2005-04-29 02:15:40.000000000 +0200
++++ bind-9.4.0/bin/rndc/rndc-confgen.c	2007-03-06 12:41:33.000000000 +0100
+@@ -57,7 +57,7 @@
  #include "util.h"
  
- #define DEFAULT_KEYLENGTH	128		/* Bits. */
+ #define DEFAULT_KEYLENGTH	128		/*% Bits. */
 -#define DEFAULT_KEYNAME		"rndc-key"
 +#define DEFAULT_KEYNAME		"rndckey"
  #define DEFAULT_SERVER		"127.0.0.1"
  #define DEFAULT_PORT		953
  
---- bind-9.3.3rc2/bin/rndc/rndc.conf.key	2004-03-06 11:21:32.000000000 +0100
-+++ bind-9.3.3rc2/bin/rndc/rndc.conf	2006-09-15 08:56:25.000000000 +0200
-@@ -23,14 +23,11 @@
+--- bind-9.4.0/bin/rndc/rndc.conf.key	2004-06-18 06:39:39.000000000 +0200
++++ bind-9.4.0/bin/rndc/rndc.conf	2007-03-06 12:44:06.000000000 +0100
+@@ -23,11 +23,11 @@
  
  options {
          default-server  localhost;
@@ -24,30 +35,24 @@
 +        key     "rndckey";
  };
  
+ key "cc64b3d1db63fc88d7cb5d2f9f57d258" {
+@@ -41,7 +41,4 @@
+         addresses { 10.53.0.1; };
+ };
+ 
 -key "key" {
 -        algorithm       hmac-md5;
 -        secret "c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
 -};
 +include "/etc/rndc.key";
---- bind-9.3.3rc2/bin/rndc/rndc-confgen.8.key	2006-09-15 09:00:01.000000000 +0200
-+++ bind-9.3.3rc2/bin/rndc/rndc-confgen.8	2006-09-15 08:56:25.000000000 +0200
-@@ -116,7 +116,7 @@
- .TP 3n
- \-k \fIkeyname\fR
- Specifies the key name of the rndc authentication key. This must be a valid domain name. The default is
--\fBrndc\-key\fR.
-+\fBrndckey\fR.
- .TP 3n
- \-p \fIport\fR
- Specifies the command channel port where
---- bind-9.3.3rc2/bin/rndc/rndc-confgen.docbook.key	2005-05-13 03:22:34.000000000 +0200
-+++ bind-9.3.3rc2/bin/rndc/rndc-confgen.docbook	2006-09-15 08:56:25.000000000 +0200
-@@ -160,7 +160,7 @@
- 	  <para>
- 	       Specifies the key name of the rndc authentication key.
- 	       This must be a valid domain name.
--	       The default is <constant>rndc-key</constant>.
-+	       The default is <constant>rndckey</constant>.
- 	  </para>
- 	</listitem>
+--- bind-9.4.0/bin/rndc/rndc-confgen.docbook.key	2007-01-30 00:57:20.000000000 +0100
++++ bind-9.4.0/bin/rndc/rndc-confgen.docbook	2007-03-06 12:44:45.000000000 +0100
+@@ -163,7 +163,7 @@
+           <para>
+             Specifies the key name of the rndc authentication key.
+             This must be a valid domain name.
+-            The default is <constant>rndc-key</constant>.
++            The default is <constant>rndckey</constant>.
+           </para>
+         </listitem>
        </varlistentry>
diff --git a/bind-bsdcompat.patch b/bind-bsdcompat.patch
index a0316c5..01ae22b 100644
--- a/bind-bsdcompat.patch
+++ b/bind-bsdcompat.patch
@@ -1,11 +1,11 @@
---- bind-9.2.2/lib/isc/unix/socket.c.bsdcompat	2003-02-18 02:28:41.000000000 -0500
-+++ bind-9.2.2/lib/isc/unix/socket.c	2003-07-19 15:40:49.784907968 -0400
-@@ -1365,7 +1365,7 @@ isc_socket_create(isc_socketmgr_t *manag
+--- bind-9.4.0/lib/isc/unix/socket.c.bsdcompat	2006-06-06 02:56:09.000000000 +0200
++++ bind-9.4.0/lib/isc/unix/socket.c	2007-03-06 12:53:12.000000000 +0100
+@@ -1492,7 +1492,7 @@
  		return (ISC_R_UNEXPECTED);
  	}
  
 -#ifdef SO_BSDCOMPAT
 +#if 0
- 	if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
- 		       (void *)&on, sizeof on) < 0) {
- 		isc__strerror(errno, strbuf, sizeof(strbuf));
+ 	if (type != isc_sockettype_unix &&
+ 	    setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
+ 		       (void *)&on, sizeof(on)) < 0) {
diff --git a/bind-chroot-admin.in b/bind-chroot-admin.in
index 1140383..c3f8f87 100644
--- a/bind-chroot-admin.in
+++ b/bind-chroot-admin.in
@@ -96,9 +96,9 @@ function check_dirs()
     [ ! -e "${BIND_CHROOT_PREFIX}/etc/localtime" ] &&  [ -e /etc/localtime ] && /bin/cp -fp /etc/localtime "${BIND_CHROOT_PREFIX}/etc/localtime";
     /bin/chown --preserve-root root:named "${BIND_CHROOT_PREFIX}"/dev/{random,null,zero};
     /bin/chmod --preserve-root 660 "${BIND_CHROOT_PREFIX}"/dev/{random,null,zero};
-    if selinux_enabled && [ -x /usr/bin/chcon ]; then       
+    if selinux_enabled && [ -x /sbin/restorecon ]; then       
        for dev in random zero null; do
-	   /usr/bin/chcon --reference=/dev/$dev ${BIND_CHROOT_PREFIX}/dev/$dev;
+	   /sbin/restorecon ${BIND_CHROOT_PREFIX}/dev/$dev;
        done
     fi;
 }
@@ -260,16 +260,16 @@ function sync_files()
 	if selinux_enabled && [ -x /sbin/restorecon ]; then
 	   /sbin/restorecon -R ${BIND_CHROOT_PREFIX}/etc ${BIND_CHROOT_PREFIX}/var/named ${BIND_CHROOT_PREFIX}/var/run/named >/dev/null 2>&1;
 	   if [ -e ${BIND_CHROOT_PREFIX}/etc/localtime ] && [ -e /etc/localtime ] ; then 
-	      /usr/bin/chcon --reference=/etc/localtime ${BIND_CHROOT_PREFIX}/etc/localtime >/dev/null 2>&1;
+	      /usr/bin/ ${BIND_CHROOT_PREFIX}/etc/localtime >/dev/null 2>&1;
 	   fi;		
-	   /usr/bin/chcon -h --reference=/etc/named.conf /etc/named.*    >/dev/null 2>&1;
-	   /usr/bin/chcon -h --reference=/etc/rndc.key   /etc/rndc.key   >/dev/null 2>&1;
-	   /usr/bin/chcon -h --reference=/etc/rndc.conf  /etc/rndc.conf  >/dev/null 2>&1;
-	   /usr/bin/chcon -h --reference=/var/named     /var/named{/,/*} >/dev/null 2>&1;
-	   /usr/bin/chcon -h --reference=${BIND_CHROOT_PREFIX}/var/named/slaves /var/named/{slaves,data}{/,/*} >/dev/null 2>&1;
+	   /sbin/restorecon /etc/named.*    >/dev/null 2>&1;
+	   /sbin/restorecon /etc/rndc.key   >/dev/null 2>&1;
+	   /sbin/restorecon /etc/rndc.conf  >/dev/null 2>&1;
+	   /sbin/restorecon /var/named{/,/*} >/dev/null 2>&1;
+	   /sbin/restorecon /var/named/{slaves,data}{/,/*} >/dev/null 2>&1;
 	   /sbin/restorecon /var/named/named.ca ${BIND_CHROOT_PREFIX}/var/named/named.ca  >/dev/null 2>&1;
 	   /sbin/restorecon ${BIND_CHROOT_PREFIX} >/dev/null 2>&1;
-	   /usr/bin/chcon -h --reference=${BIND_CHROOT_PREFIX}/var/named/named.ca /var/named/named.ca >/dev/null 2>&1;
+	   /sbin/restorecon /var/named/named.ca >/dev/null 2>&1;
 	fi;
 	/sbin/service named condrestart
 	rm -f $changed;
diff --git a/bind.spec b/bind.spec
index a815ffc..ebf90e3 100644
--- a/bind.spec
+++ b/bind.spec
@@ -16,14 +16,14 @@
 Summary: 	The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server.
 Name: 		bind
 License: 	BSD-like
-Version: 	9.3.4
-Release: 	7%{?dist}
+Version: 	9.4.0
+Release: 	8%{?dist}
 Epoch:   	31
 Url: 		http://www.isc.org/products/BIND/
 Buildroot: 	%{_tmppath}/%{name}-root
 Group: 		System Environment/Daemons
 #
-Source: 	ftp://ftp.isc.org/isc/bind9/%{version}/bind-%{version}%{?prever}.tar.gz
+Source: 	ftp://ftp.isc.org/isc/bind9/%{version}/bind-%{version}.tar.gz
 Source1: 	named.sysconfig
 Source2: 	named.init
 Source3: 	named.logrotate
@@ -68,8 +68,8 @@ Patch14: 	libbind-9.3.1rc1-fix_h_errno.patch
 Patch15: 	bind-9.3.3rc2-dbus.patch
 Patch16: 	bind-9.3.2-redhat_doc.patch
 Patch17: 	bind-9.3.2b1-fix_sdb_ldap.patch
-Patch19: 	bind-9.3.1-next_server_on_referral.patch
-Patch20: 	bind-9.3.2b2-no_servfail_stops.patch
+#Patch19: 	bind-9.3.1-next_server_on_referral.patch
+#Patch20: 	bind-9.3.2b2-no_servfail_stops.patch
 Patch22: 	bind-9.3.1-sdb_dbus.patch
 Patch23: 	bind-9.3.1-dbus_archdep_libdir.patch
 Patch32:	bind-9.3.2-prctl_set_dumpable.patch
@@ -257,8 +257,8 @@ cp -fp contrib/sdb/pgsql/zonetodb.c bin/sdb_tools
 %if %{SDB}
 %patch17 -p1 -b .fix_sdb_ldap
 %endif
-%patch19 -p1 -b .next_server_on_referral
-%patch20 -p1 -b .no_servfail_stops
+#%patch19 -p1 -b .next_server_on_referral
+#%patch20 -p1 -b .no_servfail_stops
 %if %{WITH_DBUS}
 #
 # this must follow all dbus patches:
@@ -481,6 +481,7 @@ chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/lib*so.*
 %{_sbindir}/named-bootconf
 %{_sbindir}/rndc*
 %{_sbindir}/bind-chroot-admin
+%{_sbindir}/named-compilezone
 %defattr(0644,root,root,0755)
 %{_mandir}/man5/named.conf.5*
 %{_mandir}/man5/rndc.conf.5*
@@ -490,6 +491,7 @@ chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/lib*so.*
 %{_mandir}/man8/dnssec*.8*
 %{_mandir}/man8/named-checkconf.8*
 %{_mandir}/man8/named-checkzone.8*
+%{_mandir}/man8/named-compilezone.8*
 %{_mandir}/man8/rndc-confgen.8*
 %doc CHANGES COPYRIGHT README
 %doc doc/arm doc/misc
@@ -744,6 +746,10 @@ rm -rf ${RPM_BUILD_ROOT}
 :;
 
 %changelog
+* Tue Mar 06 2007 Adam Tkac <atkac@redhat.com> 31:9.3.4-8.fc7
+- updated to 9.4.0
+- bind-chroot-admin now sets EAs correctly (#213926)
+
 * Thu Feb 15 2007 Adam Tkac <atkac@redhat.com> 31:9.3.4-7.fc7
 - minor cleanup in bind-chroot-admin script
 
diff --git a/sources b/sources
index 0a33df5..857534b 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
-df5417e7e7cf017fa28b65d0a3d6e999  bind-9.3.4.tar.gz
-3567c35a24cb83a8a69443a399bbb6c8  bind-chroot.tar.gz
+e85347f03f0d841b596422d5252a0869  bind-9.4.0.tar.gz
 13fef79f99fcefebb51d84b08805de51  libbind-man.tar.gz
+3567c35a24cb83a8a69443a399bbb6c8  bind-chroot.tar.gz