Blame SOURCES/bind-dyndb-ldap-tkrizek-0003-Revert-BIND-9.11-Remove-if-blocks-for-older-BIND-ver.patch

29882e
From b0b52c55e7ee12287eb4360b0fc1dd5751ee105e Mon Sep 17 00:00:00 2001
29882e
From: Tomas Krizek <tkrizek@redhat.com>
29882e
Date: Fri, 17 Feb 2017 14:35:13 +0100
29882e
Subject: [PATCH 3/3] Revert "BIND 9.11: Remove #if blocks for older BIND
29882e
 versions."
29882e
29882e
This reverts commit 2649ef1da1cbfc1203337665c4e589e1fe75f04b.
29882e
---
29882e
 src/Makefile.am   |   1 +
29882e
 src/compat.h      |  44 +++++++++++++++++++++++
29882e
 src/fwd.c         |  60 +++++++++++++++++++++++++++++--
29882e
 src/ldap_driver.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++---
29882e
 4 files changed, 202 insertions(+), 6 deletions(-)
29882e
 create mode 100644 src/compat.h
29882e
29882e
diff --git a/src/Makefile.am b/src/Makefile.am
29882e
index e1e3968682a675573fbebcefefdee53bf6499f5b..fe96c4c82d3fe5ee4763dd1834c074e08365cdcc 100644
29882e
--- a/src/Makefile.am
29882e
+++ b/src/Makefile.am
29882e
@@ -4,6 +4,7 @@ bindplugindir=$(libdir)/bind
29882e
 HDRS =				\
29882e
 	acl.h			\
29882e
 	bindcfg.h		\
29882e
+	compat.h		\
29882e
 	empty_zones.h		\
29882e
 	fs.h			\
29882e
 	fwd.h			\
29882e
diff --git a/src/compat.h b/src/compat.h
29882e
new file mode 100644
29882e
index 0000000000000000000000000000000000000000..00e3da58bc270e3e21f8780af1056caae5151c87
29882e
--- /dev/null
29882e
+++ b/src/compat.h
29882e
@@ -0,0 +1,44 @@
29882e
+/*
29882e
+ * Copyright (C) 2009  bind-dyndb-ldap authors; see COPYING for license
29882e
+ */
29882e
+
29882e
+#ifdef HAVE_CONFIG_H
29882e
+#include <config.h>
29882e
+#else
29882e
+#error "Can't compile without config.h"
29882e
+#endif
29882e
+
29882e
+/*
29882e
+ * dns_rdatalist_fromrdataset() did not exist in older versions of libdns.
29882e
+ * Add a substitude function here.
29882e
+ */
29882e
+#if LIBDNS_VERSION_MAJOR < 40
29882e
+static inline isc_result_t
29882e
+dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset,
29882e
+			   dns_rdatalist_t **rdatalist)
29882e
+{
29882e
+	REQUIRE(rdatalist != NULL && rdataset != NULL);
29882e
+
29882e
+	*rdatalist = rdataset->private1;
29882e
+
29882e
+	return ISC_R_SUCCESS;
29882e
+}
29882e
+#endif /* LIBDNS_VERSION_MAJOR < 40 */
29882e
+
29882e
+/*
29882e
+ * In older libdns versions, isc_refcount_init() was defined as a macro.
29882e
+ * However, in newer versions, it is a function returning isc_result_t type.
29882e
+ * This piece of code should take care of that problem.
29882e
+ */
29882e
+#if LIBDNS_VERSION_MAJOR < 30
29882e
+#include <isc/refcount.h>
29882e
+
29882e
+static inline isc_result_t
29882e
+isc_refcount_init_func(isc_refcount_t *ref, unsigned int n)
29882e
+{
29882e
+	isc_refcount_init(ref, n);
29882e
+	return ISC_R_SUCCESS;
29882e
+}
29882e
+#undef isc_refcount_init
29882e
+#define isc_refcount_init isc_refcount_init_func
29882e
+#endif /* LIBDNS_VERSION_MAJOR < 30 */
29882e
diff --git a/src/fwd.c b/src/fwd.c
29882e
index 840f0e8f232969b2b726fa4a338a10c010654279..1f6a9e5d922d6a14dec88e04d41ad911f2dfd389 100644
29882e
--- a/src/fwd.c
29882e
+++ b/src/fwd.c
29882e
@@ -69,7 +69,11 @@ fwd_list_len(dns_forwarders_t *fwdrs) {
29882e
 
29882e
 	REQUIRE(fwdrs != NULL);
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	for (isc_sockaddr_t *fwdr = ISC_LIST_HEAD(fwdrs->addrs);
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 	for (dns_forwarder_t *fwdr = ISC_LIST_HEAD(fwdrs->fwdrs);
29882e
+#endif
29882e
 	     fwdr != NULL;
29882e
 	     fwdr = ISC_LIST_NEXT(fwdr, link)) {
29882e
 		len++;
29882e
@@ -165,7 +169,11 @@ fwd_print_list_buff(isc_mem_t *mctx, dns_forwarders_t *fwdrs,
29882e
 	const cfg_obj_t *faddresses;
29882e
 	const cfg_listelt_t *fwdr_cfg; /* config representation */
29882e
 	/* internal representation */
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	isc_sockaddr_t *fwdr_int;
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 	dns_forwarder_t *fwdr_int;
29882e
+#endif
29882e
 
29882e
 	isc_buffer_initnull(&tmp_buf);
29882e
 	tmp_buf.mctx = mctx;
29882e
@@ -189,12 +197,20 @@ fwd_print_list_buff(isc_mem_t *mctx, dns_forwarders_t *fwdrs,
29882e
 	 * data from the internal one to cfg data structures.*/
29882e
 	faddresses = cfg_tuple_get(forwarders_cfg, "addresses");
29882e
 	for (fwdr_int = ISC_LIST_HEAD(
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+			fwdrs->addrs
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 			fwdrs->fwdrs
29882e
+#endif
29882e
 			), fwdr_cfg = cfg_list_first(faddresses);
29882e
 	     INSIST((fwdr_int == NULL) == (fwdr_cfg == NULL)), fwdr_int != NULL;
29882e
 	     fwdr_int = ISC_LIST_NEXT(fwdr_int, link), fwdr_cfg = cfg_list_next(fwdr_cfg)) {
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+		fwdr_cfg->obj->value.sockaddr = *fwdr_int;
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 		fwdr_cfg->obj->value.sockaddrdscp.sockaddr = fwdr_int->addr;
29882e
 		fwdr_cfg->obj->value.sockaddrdscp.dscp = fwdr_int->dscp;
29882e
+#endif
29882e
 	}
29882e
 	cfg_print(faddresses, buffer_append_str, &tmp_buf);
29882e
 
29882e
@@ -243,7 +259,12 @@ cleanup:
29882e
 
29882e
 static isc_result_t
29882e
 fwd_parse_str(const char *fwdrs_str, isc_mem_t *mctx,
29882e
-	      dns_forwarderlist_t *fwdrs)
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	isc_sockaddrlist_t *fwdrs
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
+	dns_forwarderlist_t *fwdrs
29882e
+#endif
29882e
+	)
29882e
 {
29882e
 	isc_result_t result = ISC_R_SUCCESS;
29882e
 	cfg_parser_t *parser = NULL;
29882e
@@ -253,7 +274,11 @@ fwd_parse_str(const char *fwdrs_str, isc_mem_t *mctx,
29882e
 	const cfg_listelt_t *listel;
29882e
 	const cfg_obj_t *fwdr_cfg;
29882e
 	isc_sockaddr_t addr;
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	isc_sockaddr_t *fwdr;
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 	dns_forwarder_t *fwdr;
29882e
+#endif
29882e
 
29882e
 	in_port_t port = 53;
29882e
 
29882e
@@ -276,8 +301,12 @@ fwd_parse_str(const char *fwdrs_str, isc_mem_t *mctx,
29882e
 		if (isc_sockaddr_getport(&addr) == 0)
29882e
 			isc_sockaddr_setport(&addr, port);
29882e
 		CHECKED_MEM_GET_PTR(mctx, fwdr);
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+		*fwdr = addr;
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 		fwdr->addr = addr;
29882e
 		fwdr->dscp = cfg_obj_getdscp(fwdr_cfg);
29882e
+#endif
29882e
 		ISC_LINK_INIT(fwdr, link);
29882e
 		ISC_LIST_APPEND(*fwdrs, fwdr, link);
29882e
 	}
29882e
@@ -291,8 +320,18 @@ cleanup:
29882e
 }
29882e
 
29882e
 static void
29882e
-fwdr_list_free(isc_mem_t *mctx, dns_forwarderlist_t *fwdrs) {
29882e
+fwdr_list_free(isc_mem_t *mctx,
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	isc_sockaddrlist_t *fwdrs
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
+	dns_forwarderlist_t *fwdrs
29882e
+#endif
29882e
+	) {
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	isc_sockaddr_t *fwdr;
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 	dns_forwarder_t *fwdr;
29882e
+#endif
29882e
 	while (!ISC_LIST_EMPTY(*fwdrs)) {
29882e
 		fwdr = ISC_LIST_HEAD(*fwdrs);
29882e
 		ISC_LIST_UNLINK(*fwdrs, fwdr, link);
29882e
@@ -318,7 +357,11 @@ fwd_setting_isexplicit(isc_mem_t *mctx, const settings_set_t *set,
29882e
 	isc_result_t result;
29882e
 	setting_t *setting = NULL;
29882e
 	dns_fwdpolicy_t	fwdpolicy;
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	isc_sockaddrlist_t fwdrs;
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 	dns_forwarderlist_t fwdrs;
29882e
+#endif
29882e
 
29882e
 	REQUIRE(isexplicit != NULL);
29882e
 	ISC_LIST_INIT(fwdrs);
29882e
@@ -397,7 +440,11 @@ fwd_parse_ldap(ldap_entry_t *entry, settings_set_t *set) {
29882e
 	ldap_valuelist_t values;
29882e
 	ldap_value_t *value;
29882e
 	isc_buffer_t *tmp_buf = NULL; /* hack: only the base buffer is allocated */
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	isc_sockaddrlist_t fwdrs;
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 	dns_forwarderlist_t fwdrs;
29882e
+#endif
29882e
 	const char *setting_str = NULL;
29882e
 
29882e
 	/**
29882e
@@ -500,7 +547,11 @@ fwd_configure_zone(const settings_set_t *set, ldap_instance_t *inst,
29882e
 	isc_mem_t *mctx = NULL;
29882e
 	dns_view_t *view = NULL;
29882e
 	isc_result_t lock_state = ISC_R_IGNORE;
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+	isc_sockaddrlist_t fwdrs;
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 	dns_forwarderlist_t fwdrs;
29882e
+#endif
29882e
 	isc_boolean_t is_global_config;
29882e
 	dns_fixedname_t foundname;
29882e
 	const char *msg_use_global_fwds;
29882e
@@ -579,8 +630,13 @@ fwd_configure_zone(const settings_set_t *set, ldap_instance_t *inst,
29882e
 	run_exclusive_enter(inst, &lock_state);
29882e
 	CHECK(fwd_delete_table(view, name, msg_obj_type, set->name));
29882e
 	if (isconfigured == ISC_TRUE) {
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+		CHECK(dns_fwdtable_add(view->fwdtable, name, &fwdrs,
29882e
+				       fwdpolicy));
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 		CHECK(dns_fwdtable_addfwd(view->fwdtable, name, &fwdrs,
29882e
 					  fwdpolicy));
29882e
+#endif
29882e
 	}
29882e
 	dns_view_flushcache(view);
29882e
 	run_exclusive_exit(inst, lock_state);
29882e
diff --git a/src/ldap_driver.c b/src/ldap_driver.c
29882e
index ed31d50321072a8100e20bbd0cf7da2e3741b0d4..4e842cb0f122c49080128a81892f9737d29a299e 100644
29882e
--- a/src/ldap_driver.c
29882e
+++ b/src/ldap_driver.c
29882e
@@ -34,6 +34,7 @@
29882e
 #include <string.h> /* For memcpy */
29882e
 
29882e
 #include "bindcfg.h"
29882e
+#include "compat.h"
29882e
 #include "ldap_driver.h"
29882e
 #include "ldap_helper.h"
29882e
 #include "ldap_convert.h"
29882e
@@ -184,9 +185,18 @@ detach(dns_db_t **dbp)
29882e
 
29882e
 /* !!! This could be required for optimizations (like on-disk cache). */
29882e
 static isc_result_t
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+beginload(dns_db_t *db, dns_addrdatasetfunc_t *addp, dns_dbload_t **dbloadp)
29882e
+{
29882e
+
29882e
+	UNUSED(db);
29882e
+	UNUSED(addp);
29882e
+	UNUSED(dbloadp);
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
29882e
 	UNUSED(db);
29882e
 	UNUSED(callbacks);
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 
29882e
 	fatal_error("ldapdb: method beginload() should never be called");
29882e
 
29882e
@@ -201,9 +211,17 @@ beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
29882e
 
29882e
 /* !!! This could be required for optimizations (like on-disk cache). */
29882e
 static isc_result_t
29882e
+#if LIBDNS_VERSION_MAJOR < 140
29882e
+endload(dns_db_t *db, dns_dbload_t **dbloadp)
29882e
+{
29882e
+
29882e
+	UNUSED(db);
29882e
+	UNUSED(dbloadp);
29882e
+#else /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 endload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
29882e
 	UNUSED(db);
29882e
 	UNUSED(callbacks);
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 
29882e
 	fatal_error("ldapdb: method endload() should never be called");
29882e
 
29882e
@@ -211,6 +229,7 @@ endload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
29882e
 	return ISC_R_SUCCESS;
29882e
 }
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 140
29882e
 static isc_result_t
29882e
 serialize(dns_db_t *db, dns_dbversion_t *version, FILE *file)
29882e
 {
29882e
@@ -220,17 +239,23 @@ serialize(dns_db_t *db, dns_dbversion_t *version, FILE *file)
29882e
 
29882e
 	return dns_db_serialize(ldapdb->rbtdb, version, file);
29882e
 }
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 
29882e
 /* !!! This could be required for optimizations (like on-disk cache). */
29882e
 static isc_result_t
29882e
-dump(dns_db_t *db, dns_dbversion_t *version, const char *filename,
29882e
-     dns_masterformat_t masterformat)
29882e
+dump(dns_db_t *db, dns_dbversion_t *version, const char *filename
29882e
+#if LIBDNS_VERSION_MAJOR >= 31
29882e
+     , dns_masterformat_t masterformat
29882e
+#endif
29882e
+     )
29882e
 {
29882e
 
29882e
 	UNUSED(db);
29882e
 	UNUSED(version);
29882e
 	UNUSED(filename);
29882e
+#if LIBDNS_VERSION_MAJOR >= 31
29882e
 	UNUSED(masterformat);
29882e
+#endif
29882e
 
29882e
 	fatal_error("ldapdb: method dump() should never be called");
29882e
 
29882e
@@ -401,14 +426,22 @@ printnode(dns_db_t *db, dns_dbnode_t *node, FILE *out)
29882e
 }
29882e
 
29882e
 static isc_result_t
29882e
-createiterator(dns_db_t *db,  unsigned int options,
29882e
+createiterator(dns_db_t *db,
29882e
+#if LIBDNS_VERSION_MAJOR >= 50
29882e
+	       unsigned int options,
29882e
+#else
29882e
+	       isc_boolean_t relative_names,
29882e
+#endif
29882e
 	       dns_dbiterator_t **iteratorp)
29882e
 {
29882e
 	ldapdb_t *ldapdb = (ldapdb_t *) db;
29882e
 
29882e
 	REQUIRE(VALID_LDAPDB(ldapdb));
29882e
-
29882e
+#if LIBDNS_VERSION_MAJOR >= 50
29882e
 	return dns_db_createiterator(ldapdb->rbtdb, options, iteratorp);
29882e
+#else
29882e
+	return dns_db_createiterator(ldapdb->rbtdb, relative_names, iteratorp);
29882e
+#endif
29882e
 }
29882e
 
29882e
 static isc_result_t
29882e
@@ -646,6 +679,7 @@ settask(dns_db_t *db, isc_task_t *task)
29882e
 	dns_db_settask(ldapdb->rbtdb, task);
29882e
 }
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 31
29882e
 static isc_result_t
29882e
 getoriginnode(dns_db_t *db, dns_dbnode_t **nodep)
29882e
 {
29882e
@@ -655,7 +689,9 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep)
29882e
 
29882e
 	return dns_db_getoriginnode(ldapdb->rbtdb, nodep);
29882e
 }
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 31 */
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 45
29882e
 static void
29882e
 transfernode(dns_db_t *db, dns_dbnode_t **sourcep, dns_dbnode_t **targetp)
29882e
 {
29882e
@@ -666,7 +702,9 @@ transfernode(dns_db_t *db, dns_dbnode_t **sourcep, dns_dbnode_t **targetp)
29882e
 	dns_db_transfernode(ldapdb->rbtdb, sourcep, targetp);
29882e
 
29882e
 }
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 45 */
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 50
29882e
 static isc_result_t
29882e
 getnsec3parameters(dns_db_t *db, dns_dbversion_t *version,
29882e
 			  dns_hash_t *hash, isc_uint8_t *flags,
29882e
@@ -733,7 +771,9 @@ isdnssec(dns_db_t *db)
29882e
 
29882e
 	return dns_db_isdnssec(ldapdb->rbtdb);
29882e
 }
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 50 */
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 45
29882e
 static dns_stats_t *
29882e
 getrrsetstats(dns_db_t *db) {
29882e
 	ldapdb_t *ldapdb = (ldapdb_t *) db;
29882e
@@ -743,7 +783,35 @@ getrrsetstats(dns_db_t *db) {
29882e
 	return dns_db_getrrsetstats(ldapdb->rbtdb);
29882e
 
29882e
 }
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 45 */
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 82 && LIBDNS_VERSION_MAJOR < 140
29882e
+static isc_result_t
29882e
+rpz_enabled(dns_db_t *db, dns_rpz_st_t *st)
29882e
+{
29882e
+	ldapdb_t *ldapdb = (ldapdb_t *) db;
29882e
+
29882e
+	REQUIRE(VALID_LDAPDB(ldapdb));
29882e
+
29882e
+	return dns_db_rpz_enabled(ldapdb->rbtdb, st);
29882e
+}
29882e
+
29882e
+static void
29882e
+rpz_findips(dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
29882e
+		   dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version,
29882e
+		   dns_rdataset_t *ardataset, dns_rpz_st_t *st,
29882e
+		   dns_name_t *query_qname)
29882e
+{
29882e
+	ldapdb_t *ldapdb = (ldapdb_t *) db;
29882e
+
29882e
+	REQUIRE(VALID_LDAPDB(ldapdb));
29882e
+
29882e
+	dns_db_rpz_findips(rpz, rpz_type, zone, ldapdb->rbtdb, version,
29882e
+			   ardataset, st, query_qname);
29882e
+}
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 82 && LIBDNS_VERSION_MAJOR < 140 */
29882e
+
29882e
+#if LIBDNS_VERSION_MAJOR >= 140
29882e
 void
29882e
 rpz_attach(dns_db_t *db, dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num)
29882e
 {
29882e
@@ -763,7 +831,9 @@ rpz_ready(dns_db_t *db)
29882e
 
29882e
 	return dns_db_rpz_ready(ldapdb->rbtdb);
29882e
 }
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 90
29882e
 static isc_result_t
29882e
 findnodeext(dns_db_t *db, dns_name_t *name,
29882e
 		   isc_boolean_t create, dns_clientinfomethods_t *methods,
29882e
@@ -792,7 +862,9 @@ findext(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
29882e
 			      nodep, foundname, methods, clientinfo, rdataset,
29882e
 			      sigrdataset);
29882e
 }
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 90 */
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 140
29882e
 isc_result_t
29882e
 setcachestats(dns_db_t *db, isc_stats_t *stats)
29882e
 {
29882e
@@ -803,7 +875,11 @@ setcachestats(dns_db_t *db, isc_stats_t *stats)
29882e
 	return dns_db_setcachestats(ldapdb->rbtdb, stats);
29882e
 }
29882e
 
29882e
+#if LIBDNS_VERSION_MAJOR >= 164
29882e
 size_t
29882e
+#else
29882e
+unsigned int
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 164 */
29882e
 hashsize(dns_db_t *db)
29882e
 {
29882e
 	ldapdb_t *ldapdb = (ldapdb_t *) db;
29882e
@@ -812,13 +888,16 @@ hashsize(dns_db_t *db)
29882e
 
29882e
 	return dns_db_hashsize(ldapdb->rbtdb);
29882e
 }
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 
29882e
 static dns_dbmethods_t ldapdb_methods = {
29882e
 	attach,
29882e
 	detach,
29882e
 	beginload,
29882e
 	endload,
29882e
+#if LIBDNS_VERSION_MAJOR >= 140
29882e
 	serialize, /* see dns_db_serialize(), implementation is not mandatory */
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 	dump,
29882e
 	currentversion,
29882e
 	newversion,
29882e
@@ -842,21 +921,37 @@ static dns_dbmethods_t ldapdb_methods = {
29882e
 	ispersistent,
29882e
 	overmem,
29882e
 	settask,
29882e
+#if LIBDNS_VERSION_MAJOR >= 31
29882e
 	getoriginnode,
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 31 */
29882e
+#if LIBDNS_VERSION_MAJOR >= 45
29882e
 	transfernode,
29882e
+#if LIBDNS_VERSION_MAJOR >= 50
29882e
 	getnsec3parameters,
29882e
 	findnsec3node,
29882e
 	setsigningtime,
29882e
 	getsigningtime,
29882e
 	resigned,
29882e
 	isdnssec,
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 50 */
29882e
 	getrrsetstats,
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 45 */
29882e
+#if LIBDNS_VERSION_MAJOR >= 82 && LIBDNS_VERSION_MAJOR < 140
29882e
+	rpz_enabled,
29882e
+	rpz_findips,
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 82 && LIBDNS_VERSION_MAJOR < 140 */
29882e
+#if LIBDNS_VERSION_MAJOR >= 140
29882e
 	rpz_attach,
29882e
 	rpz_ready,
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
+#if LIBDNS_VERSION_MAJOR >= 90
29882e
 	findnodeext,
29882e
 	findext,
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 90 */
29882e
+#if LIBDNS_VERSION_MAJOR >= 140
29882e
 	setcachestats,
29882e
 	hashsize
29882e
+#endif /* LIBDNS_VERSION_MAJOR >= 140 */
29882e
 };
29882e
 
29882e
 isc_result_t ATTR_NONNULLS
29882e
-- 
29882e
2.9.3
29882e