bc5dde
diff -up bind-9.9.3rc1/bin/Makefile.in.sdb bind-9.9.3rc1/bin/Makefile.in
bc5dde
--- bind-9.9.3rc1/bin/Makefile.in.sdb	2013-04-05 00:21:21.000000000 +0200
bc5dde
+++ bind-9.9.3rc1/bin/Makefile.in	2013-04-16 15:21:22.286944331 +0200
bc5dde
@@ -19,8 +19,8 @@ srcdir =	@srcdir@
bc5dde
 VPATH =		@srcdir@
bc5dde
 top_srcdir =	@top_srcdir@
bc5dde
 
bc5dde
-SUBDIRS =	named rndc dig dnssec tools tests nsupdate \
bc5dde
-		check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@
bc5dde
+SUBDIRS =	named named-sdb rndc dig dnssec tools tests nsupdate \
bc5dde
+		check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@ sdb_tools
bc5dde
 TARGETS =
bc5dde
 
bc5dde
 @BIND9_MAKE_RULES@
bc5dde
diff -up bind-9.9.3rc1/bin/named/Makefile.in.sdb bind-9.9.3rc1/bin/named/Makefile.in
bc5dde
--- bind-9.9.3rc1/bin/named/Makefile.in.sdb	2013-04-16 15:21:22.102944727 +0200
bc5dde
+++ bind-9.9.3rc1/bin/named/Makefile.in	2013-04-16 15:21:22.286944331 +0200
bc5dde
@@ -49,7 +49,7 @@ CINCLUDES =	-I${srcdir}/include -I${srcd
bc5dde
 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
bc5dde
 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
bc5dde
 
bc5dde
-CDEFINES =      @CONTRIB_DLZ@ @USE_PKCS11@ @USE_OPENSSL@
bc5dde
+CDEFINES =      @USE_PKCS11@ @USE_OPENSSL@
bc5dde
 
bc5dde
 CWARNINGS =
bc5dde
 
bc5dde
@@ -73,11 +73,11 @@ DEPLIBS =	${LWRESDEPLIBS} ${DNSDEPLIBS}
bc5dde
 
bc5dde
 LIBS =		${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
bc5dde
 		${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \
bc5dde
-		${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
bc5dde
+		@LIBS@
bc5dde
 
bc5dde
 NOSYMLIBS =	${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
bc5dde
 		${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \
bc5dde
-		${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
bc5dde
+		@LIBS@
bc5dde
 
bc5dde
 SUBDIRS =	unix
bc5dde
 
bc5dde
@@ -90,8 +90,7 @@ OBJS =		builtin.@O@ client.@O@ config.@O
bc5dde
 		tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
bc5dde
 		zoneconf.@O@ \
bc5dde
 		lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
bc5dde
-		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
bc5dde
-		${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
bc5dde
+		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@
bc5dde
 
bc5dde
 UOBJS =		unix/os.@O@ unix/dlz_dlopen_driver.@O@
bc5dde
 
bc5dde
@@ -104,8 +103,7 @@ SRCS =		builtin.c client.c config.c cont
bc5dde
 		tkeyconf.c tsigconf.c update.c xfrout.c \
bc5dde
 		zoneconf.c \
bc5dde
 		lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
bc5dde
-		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
bc5dde
-		${DLZDRIVER_SRCS} ${DBDRIVER_SRCS}
bc5dde
+		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c
bc5dde
 
bc5dde
 MANPAGES =	named.8 lwresd.8 named.conf.5
bc5dde
 
bc5dde
@@ -180,7 +178,5 @@ install:: named@EXEEXT@ lwresd@EXEEXT@ i
bc5dde
 	${INSTALL_DATA} ${srcdir}/lwresd.8 ${DESTDIR}${mandir}/man8
bc5dde
 	${INSTALL_DATA} ${srcdir}/named.conf.5 ${DESTDIR}${mandir}/man5
bc5dde
 
bc5dde
-@DLZ_DRIVER_RULES@
bc5dde
-
bc5dde
 named-symtbl.@O@: named-symtbl.c
bc5dde
 	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c named-symtbl.c
bc5dde
diff -up bind-9.9.3rc1/bin/named-sdb/main.c.sdb bind-9.9.3rc1/bin/named-sdb/main.c
bc5dde
--- bind-9.9.3rc1/bin/named-sdb/main.c.sdb	2013-04-16 15:21:22.249944411 +0200
bc5dde
+++ bind-9.9.3rc1/bin/named-sdb/main.c	2013-04-16 15:21:22.287944329 +0200
bc5dde
@@ -83,6 +83,9 @@
bc5dde
  * Include header files for database drivers here.
bc5dde
  */
bc5dde
 /* #include "xxdb.h" */
bc5dde
+#include "ldapdb.h"
bc5dde
+#include "pgsqldb.h"
bc5dde
+#include "dirdb.h"
bc5dde
 
bc5dde
 #ifdef CONTRIB_DLZ
bc5dde
 /*
bc5dde
@@ -808,6 +811,10 @@ setup(void) {
bc5dde
 		ns_main_earlyfatal("isc_app_start() failed: %s",
bc5dde
 				   isc_result_totext(result));
bc5dde
 
bc5dde
+	ldapdb_clear();
bc5dde
+	pgsqldb_clear();
bc5dde
+	dirdb_clear();
bc5dde
+
bc5dde
 	isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
 		      ISC_LOG_NOTICE, "starting %s %s%s", ns_g_product,
bc5dde
 		      ns_g_version, saved_command_line);
bc5dde
@@ -920,6 +927,57 @@ setup(void) {
bc5dde
 				   isc_result_totext(result));
bc5dde
 #endif
bc5dde
 
bc5dde
+        result = ldapdb_init();
bc5dde
+        if (result != ISC_R_SUCCESS)
bc5dde
+        {
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_ERROR, 
bc5dde
+                          "SDB ldap module initialisation failed: %s.",
bc5dde
+                          isc_result_totext(result)
bc5dde
+                );
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_ERROR, 
bc5dde
+                          "SDB ldap zone database will be unavailable."
bc5dde
+                );
bc5dde
+        }else
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_NOTICE, "SDB ldap zone database module loaded."
bc5dde
+                         );
bc5dde
+
bc5dde
+        result = pgsqldb_init();
bc5dde
+        if (result != ISC_R_SUCCESS)
bc5dde
+        {
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_ERROR, 
bc5dde
+                          "SDB pgsql module initialisation failed: %s.",
bc5dde
+                          isc_result_totext(result)
bc5dde
+                );
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_ERROR, 
bc5dde
+                          "SDB pgsql zone database will be unavailable."
bc5dde
+                );
bc5dde
+        }else
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_NOTICE, "SDB postgreSQL DB zone database module loaded."
bc5dde
+                         );
bc5dde
+
bc5dde
+        result = dirdb_init();
bc5dde
+        if (result != ISC_R_SUCCESS)
bc5dde
+        {
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_ERROR, 
bc5dde
+                          "SDB directory DB module initialisation failed: %s.",
bc5dde
+                          isc_result_totext(result)
bc5dde
+                );
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_ERROR, 
bc5dde
+                          "SDB directory DB zone database will be unavailable."
bc5dde
+                );
bc5dde
+        }else
bc5dde
+            isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
+                          ISC_LOG_NOTICE, "SDB directory DB zone database module loaded."
bc5dde
+                         );
bc5dde
+
bc5dde
 	ns_server_create(ns_g_mctx, &ns_g_server);
bc5dde
 }
bc5dde
 
bc5dde
@@ -951,6 +1009,10 @@ cleanup(void) {
bc5dde
 
bc5dde
 	dns_name_destroy();
bc5dde
 
bc5dde
+        ldapdb_clear();
bc5dde
+        pgsqldb_clear();
bc5dde
+        dirdb_clear();
bc5dde
+
bc5dde
 	isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
bc5dde
 		      ISC_LOG_NOTICE, "exiting");
bc5dde
 	ns_log_shutdown();
bc5dde
diff -up bind-9.9.3rc1/bin/named-sdb/Makefile.in.sdb bind-9.9.3rc1/bin/named-sdb/Makefile.in
bc5dde
--- bind-9.9.3rc1/bin/named-sdb/Makefile.in.sdb	2013-04-16 15:21:22.243944424 +0200
bc5dde
+++ bind-9.9.3rc1/bin/named-sdb/Makefile.in	2013-04-16 15:21:22.287944329 +0200
bc5dde
@@ -32,10 +32,10 @@ top_srcdir =	@top_srcdir@
bc5dde
 #
bc5dde
 # Add database drivers here.
bc5dde
 #
bc5dde
-DBDRIVER_OBJS =
bc5dde
-DBDRIVER_SRCS =
bc5dde
+DBDRIVER_OBJS =	ldapdb.@O@ pgsqldb.@O@ dirdb.@O@
bc5dde
+DBDRIVER_SRCS =	ldapdb.c pgsqldb.c dirdb.c
bc5dde
 DBDRIVER_INCLUDES =
bc5dde
-DBDRIVER_LIBS =
bc5dde
+DBDRIVER_LIBS =	-lldap -llber -lpq
bc5dde
 
bc5dde
 DLZ_DRIVER_DIR =	${top_srcdir}/contrib/dlz/drivers
bc5dde
 
bc5dde
@@ -81,7 +81,7 @@ NOSYMLIBS =	${LWRESLIBS} ${DNSLIBS} ${BI
bc5dde
 
bc5dde
 SUBDIRS =	unix
bc5dde
 
bc5dde
-TARGETS =	named@EXEEXT@ lwresd@EXEEXT@
bc5dde
+TARGETS =	named-sdb@EXEEXT@
bc5dde
 
bc5dde
 OBJS =		builtin.@O@ client.@O@ config.@O@ control.@O@ \
bc5dde
 		controlconf.@O@ interfacemgr.@O@ \
bc5dde
@@ -139,7 +139,7 @@ config.@O@: config.c bind.keys.h
bc5dde
 		-DNS_SYSCONFDIR=\"${sysconfdir}\" \
bc5dde
 		-c ${srcdir}/config.c
bc5dde
 
bc5dde
-named@EXEEXT@: ${OBJS} ${UOBJS} ${DEPLIBS}
bc5dde
+named-sdb@EXEEXT@: ${OBJS} ${UOBJS} ${DEPLIBS}
bc5dde
 	export MAKE_SYMTABLE="yes"; \
bc5dde
 	export BASEOBJS="${OBJS} ${UOBJS}"; \
bc5dde
 	${FINALBUILDCMD}
bc5dde
@@ -170,15 +170,9 @@ statschannel.@O@: bind9.xsl.h bind9.ver3
bc5dde
 
bc5dde
 installdirs:
bc5dde
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
bc5dde
-	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man5
bc5dde
-	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
bc5dde
 
bc5dde
-install:: named@EXEEXT@ lwresd@EXEEXT@ installdirs
bc5dde
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named@EXEEXT@ ${DESTDIR}${sbindir}
bc5dde
-	(cd ${DESTDIR}${sbindir}; rm -f lwresd@EXEEXT@; @LN@ named@EXEEXT@ lwresd@EXEEXT@)
bc5dde
-	${INSTALL_DATA} ${srcdir}/named.8 ${DESTDIR}${mandir}/man8
bc5dde
-	${INSTALL_DATA} ${srcdir}/lwresd.8 ${DESTDIR}${mandir}/man8
bc5dde
-	${INSTALL_DATA} ${srcdir}/named.conf.5 ${DESTDIR}${mandir}/man5
bc5dde
+install:: named-sdb@EXEEXT@ installdirs
bc5dde
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-sdb@EXEEXT@ ${DESTDIR}${sbindir}
bc5dde
 
bc5dde
 @DLZ_DRIVER_RULES@
bc5dde
 
bc5dde
diff -up bind-9.9.3rc1/configure.in.sdb bind-9.9.3rc1/configure.in
bc5dde
--- bind-9.9.3rc1/configure.in.sdb	2013-04-16 15:21:22.208944499 +0200
bc5dde
+++ bind-9.9.3rc1/configure.in	2013-04-16 15:21:19.395950103 +0200
bc5dde
@@ -3651,12 +3651,15 @@ AC_CONFIG_FILES([
bc5dde
 	bin/dnssec/Makefile
bc5dde
 	bin/named/Makefile
bc5dde
 	bin/named/unix/Makefile
bc5dde
+	bin/named-sdb/Makefile
bc5dde
+	bin/named-sdb/unix/Makefile
bc5dde
 	bin/nsupdate/Makefile
bc5dde
 	bin/pkcs11/Makefile
bc5dde
 	bin/python/Makefile
bc5dde
 	bin/python/dnssec-checkds.py
bc5dde
 	bin/python/dnssec-coverage.py
bc5dde
 	bin/rndc/Makefile
bc5dde
+	bin/sdb_tools/Makefile
bc5dde
 	bin/tests/Makefile
bc5dde
 	bin/tests/atomic/Makefile
bc5dde
 	bin/tests/db/Makefile