d56ed2
diff -up bind-9.9.4-P2/bin/Makefile.in.sdb bind-9.9.4-P2/bin/Makefile.in
d56ed2
--- bind-9.9.4-P2/bin/Makefile.in.sdb	2013-12-20 01:28:28.000000000 +0100
d56ed2
+++ bind-9.9.4-P2/bin/Makefile.in	2014-07-22 10:29:23.940233449 +0200
bc5dde
@@ -19,8 +19,8 @@ srcdir =	@srcdir@
bc5dde
 VPATH =		@srcdir@
bc5dde
 top_srcdir =	@top_srcdir@
bc5dde
 
d56ed2
-SUBDIRS =	named named-pkcs11 rndc dig dnssec dnssec-pkcs11 tools tests nsupdate \
bc5dde
-		check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@
d56ed2
+SUBDIRS =	named named-pkcs11 named-sdb rndc dig dnssec dnssec-pkcs11 tools tests nsupdate \
bc5dde
+		check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@ sdb_tools
bc5dde
 TARGETS =
bc5dde
 
bc5dde
 @BIND9_MAKE_RULES@
d56ed2
diff -up bind-9.9.4-P2/bin/named/Makefile.in.sdb bind-9.9.4-P2/bin/named/Makefile.in
d56ed2
--- bind-9.9.4-P2/bin/named/Makefile.in.sdb	2014-07-22 10:29:23.873233351 +0200
d56ed2
+++ bind-9.9.4-P2/bin/named/Makefile.in	2014-07-22 10:30:43.247348398 +0200
d56ed2
@@ -52,7 +52,7 @@ CINCLUDES =	-I${srcdir}/include -I${srcd
bc5dde
 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
bc5dde
 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
bc5dde
 
d56ed2
-CDEFINES =      @CONTRIB_DLZ@ @CRYPTO@
d56ed2
+CDEFINES =      @CRYPTO@
bc5dde
 
bc5dde
 CWARNINGS =
bc5dde
 
d56ed2
@@ -79,11 +79,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
 
d56ed2
@@ -96,8 +96,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
 
d56ed2
@@ -110,8 +109,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
 
d56ed2
@@ -187,7 +185,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
d56ed2
diff -up bind-9.9.4-P2/bin/named-sdb/main.c.sdb bind-9.9.4-P2/bin/named-sdb/main.c
d56ed2
--- bind-9.9.4-P2/bin/named-sdb/main.c.sdb	2014-07-22 10:29:23.919233417 +0200
d56ed2
+++ bind-9.9.4-P2/bin/named-sdb/main.c	2014-07-22 10:29:23.940233449 +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
 /*
d56ed2
@@ -814,6 +817,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);
d56ed2
@@ -926,6 +933,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
 
d56ed2
@@ -957,6 +1015,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();
d56ed2
diff -up bind-9.9.4-P2/bin/named-sdb/Makefile.in.sdb bind-9.9.4-P2/bin/named-sdb/Makefile.in
d56ed2
--- bind-9.9.4-P2/bin/named-sdb/Makefile.in.sdb	2014-07-22 10:29:23.917233415 +0200
d56ed2
+++ bind-9.9.4-P2/bin/named-sdb/Makefile.in	2014-07-22 10:29:23.941233449 +0200
d56ed2
@@ -34,10 +34,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
 
d56ed2
@@ -87,7 +87,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@ \
d56ed2
@@ -146,7 +146,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}
d56ed2
@@ -177,15 +177,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
 
d56ed2
diff -up bind-9.9.4-P2/configure.in.sdb bind-9.9.4-P2/configure.in
d56ed2
--- bind-9.9.4-P2/configure.in.sdb	2014-07-22 10:29:23.909233403 +0200
d56ed2
+++ bind-9.9.4-P2/configure.in	2014-07-22 10:29:23.942233450 +0200
d56ed2
@@ -3900,12 +3900,15 @@ AC_CONFIG_FILES([
d56ed2
 	bin/named-pkcs11/Makefile
d56ed2
 	bin/named-pkcs11/unix/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