Adam Tkac 300cfc
diff -up bind-9.5.0b2/bin/named-sdb/main.c.sdb bind-9.5.0b2/bin/named/main-sdb.c
Adam Tkac 300cfc
--- bind-9.5.0b2/bin/named-sdb/main.c.sdb	2008-02-11 17:32:43.000000000 +0100
Adam Tkac 300cfc
+++ bind-9.5.0b2/bin/named-sdb/main.c	2008-02-11 17:32:43.000000000 +0100
Adam Tkac 15c5cd
@@ -72,6 +72,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 15c5cd
 /*
Adam Tkac 15c5cd
  * Include DLZ drivers if appropriate.
Adam Tkac 15c5cd
@@ -641,6 +644,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 15c5cd
 		      ISC_LOG_NOTICE, "starting BIND %s%s", ns_g_version,
Adam Tkac 15c5cd
 		      saved_command_line);
Adam Tkac 15c5cd
@@ -702,6 +709,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 15c5cd
@@ -727,6 +785,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 300cfc
diff -up bind-9.5.0b2/configure.in.sdb bind-9.5.0b2/configure.in
Adam Tkac 300cfc
--- bind-9.5.0b2/configure.in.sdb	2008-02-14 14:14:55.000000000 +0100
Adam Tkac 300cfc
+++ bind-9.5.0b2/configure.in	2008-02-14 14:15:34.000000000 +0100
Adam Tkac 300cfc
@@ -2761,6 +2761,8 @@ AC_CONFIG_FILES([
Adam Tkac 300cfc
 	bin/check/Makefile
Adam Tkac 300cfc
 	bin/named/Makefile
Adam Tkac 300cfc
 	bin/named/unix/Makefile
Adam Tkac 300cfc
+	bin/named-sdb/Makefile
Adam Tkac 300cfc
+	bin/named-sdb/unix/Makefile
Adam Tkac 300cfc
 	bin/rndc/Makefile
Adam Tkac 300cfc
 	bin/rndc/unix/Makefile
Adam Tkac 300cfc
 	bin/dig/Makefile
Adam Tkac 300cfc
@@ -2782,6 +2784,7 @@ AC_CONFIG_FILES([
Adam Tkac 300cfc
 	bin/tests/system/tkey/Makefile
Adam Tkac 300cfc
 	bin/tests/headerdep_test.sh
Adam Tkac 300cfc
 	bin/dnssec/Makefile
Adam Tkac 300cfc
+	bin/sdb_tools/Makefile
Adam Tkac 300cfc
 	doc/Makefile
Adam Tkac 300cfc
 	doc/arm/Makefile
Adam Tkac 300cfc
 	doc/misc/Makefile
Adam Tkac 300cfc
diff -up bind-9.5.0b2/bin/named-sdb/Makefile.in.sdb bind-9.5.0b2/bin/named-sdb/Makefile.in
Adam Tkac 300cfc
--- bind-9.5.0b2/bin/named-sdb/Makefile.in.sdb	2008-02-14 14:16:10.000000000 +0100
Adam Tkac 300cfc
+++ bind-9.5.0b2/bin/named-sdb/Makefile.in	2008-02-14 14:18:45.000000000 +0100
Adam Tkac 300cfc
@@ -26,10 +26,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 300cfc
@@ -70,7 +70,7 @@ LIBS =		${LWRESLIBS} ${DNSLIBS} ${BIND9L
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 300cfc
@@ -118,7 +118,7 @@ config.@O@: config.c
Adam Tkac 300cfc
 		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
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 300cfc
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
Adam Tkac 300cfc
 	${OBJS} ${UOBJS} ${LIBS}
Adam Tkac 300cfc
 
Adam Tkac 300cfc
@@ -142,14 +142,8 @@ server.o: bind9.xsl.h
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 300cfc
diff -up bind-9.5.0b2/bin/Makefile.in.sdb bind-9.5.0b2/bin/Makefile.in
Adam Tkac 300cfc
--- bind-9.5.0b2/bin/Makefile.in.sdb	2008-02-14 14:15:42.000000000 +0100
Adam Tkac 300cfc
+++ bind-9.5.0b2/bin/Makefile.in	2008-02-14 14:15:55.000000000 +0100
Adam Tkac 300cfc
@@ -19,7 +19,7 @@ srcdir =	@srcdir@
Adam Tkac 300cfc
 VPATH =		@srcdir@
Adam Tkac 300cfc
 top_srcdir =	@top_srcdir@
Adam Tkac 300cfc
 
Adam Tkac 300cfc
-SUBDIRS =	named rndc dig dnssec tests nsupdate check
Adam Tkac 300cfc
+SUBDIRS =	named named-sdb rndc dig dnssec tests nsupdate check sdb_tools
Adam Tkac 300cfc
 TARGETS =
Adam Tkac 300cfc
 
Adam Tkac 300cfc
 @BIND9_MAKE_RULES@
Adam Tkac 300cfc
diff -up bind-9.5.0b2/bin/named/Makefile.in.sdb bind-9.5.0b2/bin/named/Makefile.in
Adam Tkac 300cfc
--- bind-9.5.0b2/bin/named/Makefile.in.sdb	2008-02-14 14:19:39.000000000 +0100
Adam Tkac 300cfc
+++ bind-9.5.0b2/bin/named/Makefile.in	2008-02-14 14:20:18.000000000 +0100
Adam Tkac 300cfc
@@ -43,7 +43,7 @@ CINCLUDES =	-I${srcdir}/include -I${srcd
Adam Tkac 300cfc
 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
Adam Tkac 300cfc
 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES}
Adam Tkac 300cfc
 
Adam Tkac 300cfc
-CDEFINES =      @USE_DLZ@
Adam Tkac 300cfc
+CDEFINES =
Adam Tkac 300cfc
 
Adam Tkac 300cfc
 CWARNINGS =
Adam Tkac 300cfc
 
Adam Tkac 300cfc
@@ -66,7 +66,7 @@ DEPLIBS =	${LWRESDEPLIBS} ${DNSDEPLIBS} 
Adam Tkac 300cfc
 
Adam Tkac 300cfc
 LIBS =		${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
Adam Tkac 300cfc
 		${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \
Adam Tkac 300cfc
-		${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
Adam Tkac 300cfc
+		@LIBS@
Adam Tkac 300cfc
 
Adam Tkac 300cfc
 SUBDIRS =	unix
Adam Tkac 300cfc
 
Adam Tkac 300cfc
@@ -79,8 +79,7 @@ OBJS =		builtin.@O@ client.@O@ config.@O
Adam Tkac 300cfc
 		tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
Adam Tkac 300cfc
 		zoneconf.@O@ \
Adam Tkac 300cfc
 		lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
Adam Tkac 300cfc
-		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
Adam Tkac 300cfc
-		${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
Adam Tkac 300cfc
+		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@
Adam Tkac 300cfc
 
Adam Tkac 300cfc
 UOBJS =		unix/os.@O@
Adam Tkac 300cfc
 
Adam Tkac 300cfc
@@ -91,8 +90,7 @@ SRCS =		builtin.c client.c config.c cont
Adam Tkac 300cfc
 		tkeyconf.c tsigconf.c update.c xfrout.c \
Adam Tkac 300cfc
 		zoneconf.c \
Adam Tkac 300cfc
 		lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
Adam Tkac 300cfc
-		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
Adam Tkac 300cfc
-		${DLZDRIVER_SRCS} ${DBDRIVER_SRCS}
Adam Tkac 300cfc
+		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c
Adam Tkac 300cfc
 
Adam Tkac 300cfc
 MANPAGES =	named.8 lwresd.8 named.conf.5
Adam Tkac 300cfc
 
Adam Tkac 300cfc
@@ -151,5 +149,3 @@ install:: named@EXEEXT@ lwresd@EXEEXT@ i
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
-
Adam Tkac 300cfc
-@DLZ_DRIVER_RULES@