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