[Pkg-freeipa-devel] [Git][freeipa-team/bind-dyndb-ldap][upstream] 6 commits: Skip isc_bind9 check on BIND 9.16.17+

Timo Aaltonen (@tjaalton) gitlab at salsa.debian.org
Wed Jun 22 19:26:09 BST 2022



Timo Aaltonen pushed to branch upstream at FreeIPA packaging / bind-dyndb-ldap


Commits:
d7d3032d by Petr Menšík at 2021-06-17T17:57:52+02:00
Skip isc_bind9 check on BIND 9.16.17+

Reference variable refvar from dns_dyndbctx_t were removed. Removed was
also flag requesting different namespace. Skip that check on last stable
version, it should eval to false on all versions anyway.

- - - - -
056d2e2b by Petr Menšík at 2022-01-30T21:10:13+01:00
Initial support for BIND 9.18 support

Some changes needed to build with the most recent BIND9 release. It does
not yet provide complete support for new release.

Detects version of libdns just from libdns.so symlink. It requires
--libdir= explicitly set for this part to work.

- - - - -
7206aba2 by Petr Menšík at 2022-02-22T17:09:36+01:00
Add basic support of dns_ssuruletype_t

dns_ssutable_addrule changed input types. Add very basic support for the
new type, without support for parsing actual rule string including max
count.

- - - - -
d28f8ef1 by Petr Menšík at 2022-02-22T17:52:07+01:00
Support for 9.18 and 9.17 support

Make dns_name_copynf alias to support both older and more recent
release. Initialize few other variables to pass new compiler warnings.
Remove few changed functions in database interface.

- - - - -
fa16da22 by Petr Menšík at 2022-02-24T01:51:39+01:00
Move common dns_name_copynf compatibility macros to header

The same dns_name_copynf is required in multiple places. Because I have
already modified util.h to require dyndb-config.h, it can contain also
these compatibility defines in single place.

Signed-off-by: Petr Menšík <pemensik at redhat.com>

- - - - -
f71746a0 by Alexander Bokovoy at 2022-06-21T10:02:27+03:00
Release 11.10

Support BIND 9.17+

Signed-off-by: Alexander Bokovoy <abokovoy at redhat.com>

- - - - -


12 changed files:

- configure.ac
- contrib/bind-dyndb-ldap.spec
- src/acl.c
- src/empty_zones.c
- src/ldap_convert.c
- src/ldap_driver.c
- src/ldap_helper.c
- src/mldap.c
- src/str.h
- src/syncptr.c
- src/syncrepl.c
- src/util.h


Changes:

=====================================
configure.ac
=====================================
@@ -1,5 +1,5 @@
 AC_PREREQ([2.59])
-AC_INIT([bind-dyndb-ldap], [11.9], [freeipa-devel at redhat.com])
+AC_INIT([bind-dyndb-ldap], [11.10], [freeipa-devel at redhat.com])
 
 AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
 
@@ -53,6 +53,18 @@ AC_TRY_COMPILE([
 [CFLAGS="$SAVED_CFLAGS"
  AC_MSG_RESULT([no])])
 
+# Check if build chain supports -std=gnu11
+AC_MSG_CHECKING([for -std=gnu11 compiler flag])
+SAVED_CFLAGS="$CFLAGS"
+CFLAGS="-std=gnu11 -Werror"
+AC_TRY_COMPILE([
+	extern int fdef(void);
+],[],
+[AC_MSG_RESULT([yes])
+ CFLAGS="$SAVED_CFLAGS -std=gnu11"],
+[CFLAGS="$SAVED_CFLAGS"
+ AC_MSG_RESULT([no])])
+
 # Get CFLAGS from isc-config.sh
 AC_ARG_VAR([BIND9_CFLAGS],
            [C compiler flags for bind9, overriding isc-config.sh])
@@ -98,6 +110,7 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
 #include <dns/version.h>
 ],[ printf("%d\n", dns_libinterface) ])], [
     LIBDNS_VERSION_MAJOR=`./conftest$ac_exeext`
+    AC_MSG_RESULT([$LIBDNS_VERSION_MAJOR])
     AC_DEFINE_UNQUOTED([LIBDNS_VERSION_MAJOR], [$LIBDNS_VERSION_MAJOR],
     [Define libdns version])], [
     AC_RUN_IFELSE([AC_LANG_PROGRAM([[
@@ -111,9 +124,24 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
 	return !(scanned == 3 && major == 9);
     ]])], [
     LIBDNS_VERSION_MAJOR=`./conftest$ac_exeext`
+    AC_MSG_RESULT([$LIBDNS_VERSION_MAJOR])
     AC_DEFINE_UNQUOTED([LIBDNS_VERSION_MAJOR], [$LIBDNS_VERSION_MAJOR],
     [Define libdns version])],
-    [AC_MSG_ERROR([Can't obtain libdns version.])])
+    [
+	LIBDNS_PATH="${libdir}/libdns.so"
+	if test -L "$LIBDNS_PATH" ; then
+		LIBDNS_VERSION_MAJOR=$(ls -l "$LIBDNS_PATH" | sed -e 's/^.*->\s*libdns-9\.\([[0-9]]\+\)\.\([[0-9]]\+\).*\.so/\1 \2/' -e t -e d | xargs printf "%02d%02d")
+	else
+		AC_MSG_ERROR([Can't obtain libdns version1.])
+	fi
+	if test -z "$LIBDNS_VERSION_MAJOR" || test "$LIBDNS_VERSION_MAJOR" -lt 1200; then
+		AC_MSG_ERROR([Can't obtain libdns version ($LIBDNS_VERSION_MAJOR).])
+	else
+		AC_DEFINE_UNQUOTED([LIBDNS_VERSION_MAJOR], [$LIBDNS_VERSION_MAJOR],
+    			[Define libdns version])
+		AC_MSG_RESULT([$LIBDNS_VERSION_MAJOR])
+	fi
+    ])
 ], [AC_MSG_ERROR([Cross compiling is not supported.])]
 )
 
@@ -137,6 +165,10 @@ AC_CHECK_LIB([dns], [dns_db_setservestalettl],
   [AC_DEFINE([HAVE_DNS_SERVESTALE], 1, [Define if dns library provides dns_db_setservestalettl])]
 )
 
+AC_CHECK_LIB([dns], [dns_result_totext],
+  [AC_DEFINE([HAVE_DNS_RESULT_TOTEXT], 1, [Define if dns library provides dns_result_totext])]
+)
+
 dnl Older autoconf (2.59, for example) doesn't define docdir
 [[ ! -n "$docdir" ]] && docdir='${datadir}/doc/${PACKAGE_TARNAME}'
 AC_SUBST([docdir])


=====================================
contrib/bind-dyndb-ldap.spec
=====================================
@@ -3,7 +3,7 @@
 %define bind_version 32:9.11.17-1
 
 Name:           bind-dyndb-ldap
-Version:        11.9
+Version:        11.10
 Release:        0%{?dist}
 Summary:        LDAP back-end plug-in for BIND
 
@@ -116,6 +116,10 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Tue Jun 21 2022 Alexander Bokovoy <abokovoy at redhat.com>
+- Release 11.10
+- Support BIND 9.17+
+
 * Tue May 25 2021 Alexander Bokovoy <abokovoy at redhat.com>
 - Release 11.9
 - Support 9.16.16+


=====================================
src/acl.c
=====================================
@@ -66,6 +66,10 @@ const enum_txt_assoc_t acl_type_txts[] = {
 		}							\
 	} while (0)
 
+#if LIBDNS_VERSION_MAJOR < 1700
+typedef dns_rdatatype_t dns_ssuruletype_t;
+#endif
+
 static isc_result_t ATTR_NONNULLS ATTR_CHECKRESULT
 get_mode(const cfg_obj_t *obj, bool *value)
 {
@@ -184,14 +188,14 @@ count_list_elements(const cfg_obj_t *list)
 }
 
 static isc_result_t ATTR_NONNULLS ATTR_CHECKRESULT
-get_types(isc_mem_t *mctx, const cfg_obj_t *obj, dns_rdatatype_t **typesp,
+get_types(isc_mem_t *mctx, const cfg_obj_t *obj, dns_ssuruletype_t **typesp,
 	  unsigned int *np)
 {
 	isc_result_t result = ISC_R_SUCCESS;
 	unsigned int i;
 	unsigned int n = 0;
 	const cfg_listelt_t *el;
-	dns_rdatatype_t *types = NULL;
+	dns_ssuruletype_t *types = NULL;
 
 	REQUIRE(obj != NULL);
 	REQUIRE(typesp != NULL && *typesp == NULL);
@@ -201,7 +205,7 @@ get_types(isc_mem_t *mctx, const cfg_obj_t *obj, dns_rdatatype_t **typesp,
 
 	n = count_list_elements(obj);
 	if (n > 0) {
-		types = isc_mem_get(mctx, n * sizeof(dns_rdatatype_t));
+		types = isc_mem_get(mctx, n * sizeof(dns_ssuruletype_t));
 	}
 	i = 0;
 	for (el = cfg_list_first(obj); el != NULL; el = cfg_list_next(el)) {
@@ -216,7 +220,12 @@ get_types(isc_mem_t *mctx, const cfg_obj_t *obj, dns_rdatatype_t **typesp,
 		DE_CONST(str, r.base);
 		r.length = strlen(str);
 
+#if LIBDNS_VERSION_MAJOR < 1700
 		result = dns_rdatatype_fromtext(&types[i++], &r);
+#else
+		types[i].max = 0;
+		result = dns_rdatatype_fromtext(&types[i++].type, &r);
+#endif
 		if (result != ISC_R_SUCCESS) {
 			log_error("'%s' is not a valid type", str);
 			goto cleanup;
@@ -229,7 +238,7 @@ get_types(isc_mem_t *mctx, const cfg_obj_t *obj, dns_rdatatype_t **typesp,
 	return result;
 
 cleanup:
-	SAFE_MEM_PUT(mctx, types, n * sizeof(dns_rdatatype_t));
+	SAFE_MEM_PUT(mctx, types, n * sizeof(dns_ssuruletype_t));
 
 	return result;
 }
@@ -281,14 +290,18 @@ acl_configure_zone_ssutable(const char *policy_str, dns_zone_t *zone)
 		goto cleanup;
 	}
 
+#if LIBDNS_VERSION_MAJOR >= 1700
+	dns_ssutable_create(mctx, &table);
+#else
 	CHECK(dns_ssutable_create(mctx, &table));
+#endif
 
 	for (el = cfg_list_first(policy); el != NULL; el = cfg_list_next(el)) {
 		const cfg_obj_t *stmt;
 		bool grant;
 		unsigned int match_type;
 		dns_fixedname_t fname, fident;
-		dns_rdatatype_t *types;
+		dns_ssuruletype_t *types;
 		unsigned int n;
 
 		types = NULL;
@@ -303,9 +316,14 @@ acl_configure_zone_ssutable(const char *policy_str, dns_zone_t *zone)
 		result = get_fixed_name(stmt, "name", &fname);
 		if (result == ISC_R_NOTFOUND &&
 		    match_type == dns_ssumatchtype_subdomain) {
+#if LIBDNS_VERSION_MAJOR >= 1700
+			dns_name_copy(dns_zone_getorigin(zone),
+				      dns_fixedname_initname(&fname));
+#else
 			CHECK(dns_name_copy(dns_zone_getorigin(zone),
 					    dns_fixedname_initname(&fname),
 					    &fname.buffer));
+#endif
 		}
 		else if (result != ISC_R_SUCCESS)
 			goto cleanup;
@@ -324,13 +342,22 @@ acl_configure_zone_ssutable(const char *policy_str, dns_zone_t *zone)
 			CLEANUP_WITH(DNS_R_BADNAME);
 		}
 
+#if LIBDNS_VERSION_MAJOR >= 1700
+		result = ISC_R_SUCCESS;
+		dns_ssutable_addrule(table, grant,
+				     dns_fixedname_name(&fident),
+				     match_type,
+				     dns_fixedname_name(&fname),
+				     n, types);
+#else
 		result = dns_ssutable_addrule(table, grant,
 					      dns_fixedname_name(&fident),
 					      match_type,
 					      dns_fixedname_name(&fname),
 					      n, types);
+#endif
 
-		SAFE_MEM_PUT(mctx, types, n * sizeof(dns_rdatatype_t));
+		SAFE_MEM_PUT(mctx, types, n * sizeof(dns_ssuruletype_t));
 		if (result != ISC_R_SUCCESS)
 			goto cleanup;
 


=====================================
src/empty_zones.c
=====================================
@@ -13,10 +13,6 @@
 #include "util.h"
 #include "zone_register.h"
 
-#if LIBDNS_VERSION_MAJOR < 1600
-#define dns_name_copynf(src, dst) dns_name_copy((src), (dst), NULL)
-#endif
-
 /**
  * These zones should not leak onto the Internet.
  * The list matches BIND commit 8f20f6c9d7ce5a0f0af6ee4c5361832d97b1c5d4


=====================================
src/ldap_convert.c
=====================================
@@ -27,10 +27,6 @@
 #include "util.h"
 #include "zone_register.h"
 
-#if LIBDNS_VERSION_MAJOR < 1600
-#define dns_name_copynf(src, dst) dns_name_copy((src), (dst), NULL)
-#endif
-
 /**
  * Convert LDAP DN to absolute DNS names.
  *


=====================================
src/ldap_driver.c
=====================================
@@ -11,11 +11,13 @@
 #include <isc/buffer.h>
 #include <isc/commandline.h>
 #include <isc/hash.h>
-#include <isc/lib.h>
 #include <isc/mem.h>
 #include <isc/once.h>
 #include <isc/refcount.h>
 #include <isc/util.h>
+#if LIBDNS_VERSION_MAJOR < 1617
+#include <isc/lib.h>
+#endif
 
 #include <dns/db.h>
 #include <dns/diff.h>
@@ -238,6 +240,7 @@ endload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
 	return ISC_R_SUCCESS;
 }
 
+#if LIBDNS_VERSION_MAJOR < 1719
 static isc_result_t
 serialize(dns_db_t *db, dns_dbversion_t *version, FILE *file)
 {
@@ -247,6 +250,7 @@ serialize(dns_db_t *db, dns_dbversion_t *version, FILE *file)
 
 	return dns_db_serialize(ldapdb->rbtdb, version, file);
 }
+#endif
 
 /* !!! This could be required for optimizations (like on-disk cache). */
 static isc_result_t
@@ -635,6 +639,7 @@ issecure(dns_db_t *db)
 	return dns_db_issecure(ldapdb->rbtdb);
 }
 
+#if LIBDNS_VERSION_MAJOR < 1721
 static unsigned int
 nodecount(dns_db_t *db)
 {
@@ -644,6 +649,17 @@ nodecount(dns_db_t *db)
 
 	return dns_db_nodecount(ldapdb->rbtdb);
 }
+#else
+static unsigned int
+nodecount(dns_db_t *db, dns_dbtree_t tree)
+{
+	ldapdb_t *ldapdb = (ldapdb_t *) db;
+
+	REQUIRE(VALID_LDAPDB(ldapdb));
+
+	return dns_db_nodecount(ldapdb->rbtdb, tree);
+}
+#endif
 
 /**
  * Return TRUE, because database does not need to be loaded from disk
@@ -896,7 +912,7 @@ getservestalettl(dns_db_t *db, dns_ttl_t *ttl) {
 }
 #endif
 
-#if LIBDNS_VERSION_MAJOR >= 1606
+#if LIBDNS_VERSION_MAJOR >= 1606 && LIBDNS_VERSION_MAJOR < 1720
 /* Used for cache size adjustments, called by dns_cache_setcachesize.
  * Just proxy to rbtdb implementation. */
 static isc_result_t
@@ -914,7 +930,9 @@ static dns_dbmethods_t ldapdb_methods = {
 	detach,
 	beginload,
 	endload,
+#if LIBDNS_VERSION_MAJOR < 1719
 	serialize, /* see dns_db_serialize(), implementation is not mandatory */
+#endif
 	dump,
 	currentversion,
 	newversion,
@@ -966,7 +984,7 @@ static dns_dbmethods_t ldapdb_methods = {
 #if LIBDNS_VERSION_MAJOR >= 1600
 	NULL, /* setgluecachestats */
 #endif
-#if LIBDNS_VERSION_MAJOR >= 1606
+#if LIBDNS_VERSION_MAJOR >= 1606 && LIBDNS_VERSION_MAJOR < 1720
 	adjusthashsize, /* adjusthashsize */
 #endif
 };
@@ -1156,6 +1174,7 @@ dyndb_init(isc_mem_t *mctx, const char *name, const char *parameters,
 	RUNTIME_CHECK(isc_once_do(&library_init_once, library_init)
 		      == ISC_R_SUCCESS);
 
+#if LIBDNS_VERSION_MAJOR < 1617
 	/*
 	 * Depending on how dlopen() was called, we may not have
 	 * access to named's global namespace, in which case we need
@@ -1168,6 +1187,7 @@ dyndb_init(isc_mem_t *mctx, const char *name, const char *parameters,
 		isc_hash_set_initializer(dctx->hashinit);
 		log_debug(5, "registering library from dynamic ldap driver, %p != %p.", dctx->refvar, &isc_bind9);
 	}
+#endif
 
 	log_debug(2, "registering dynamic ldap driver for %s.", name);
 


=====================================
src/ldap_helper.c
=====================================
@@ -5,6 +5,7 @@
 #include "dyndb-config.h"
 #define HAVE_TLS 1
 #define HAVE_THREAD_LOCAL 1
+#include <threads.h>
 
 #include <dns/dyndb.h>
 #include <dns/diff.h>
@@ -3760,7 +3761,7 @@ static void ATTR_NONNULLS
 update_zone(isc_task_t *task, isc_event_t *event)
 {
 	ldap_syncreplevent_t *pevent = (ldap_syncreplevent_t *)event;
-	isc_result_t result ;
+	isc_result_t result = ISC_R_SUCCESS;
 	ldap_instance_t *inst = pevent->inst;
 	isc_mem_t *mctx;
 	dns_name_t prevname;


=====================================
src/mldap.c
=====================================
@@ -30,7 +30,6 @@
 #include "dyndb-config.h"
 
 #if LIBDNS_VERSION_MAJOR < 1600
-#define dns_name_copynf(src, dst) dns_name_copy((src), (dst), NULL)
 #define REFCOUNT_CAST(n) ((typeof(((isc_refcount_t *)0)->refs)) (n))
 
 /* Static assert is not provided yet, copy from 9.16 */
@@ -495,7 +494,7 @@ mldap_iter_deadnodes_next(mldapdb_t *mldap, metadb_iter_t **iterp,
 	isc_result_t result;
 	dns_dbnode_t *rbt_node = NULL;
 	metadb_iter_t *iter = NULL;
-	uint32_t node_generation;
+	uint32_t node_generation = 0;
 	uint32_t cur_generation;
 	metadb_node_t metadb_node;
 	DECLARE_BUFFERED_NAME(name);


=====================================
src/str.h
=====================================
@@ -17,7 +17,7 @@
 #define _STR_MEM_FLARG_PASS	, file, line
 #else
 #define _STR_MEM_FILELINE
-#define _STR_MEM_FLAG
+#define _STR_MEM_FLARG
 #define _STR_MEM_FLARG_PASS
 #endif
 


=====================================
src/syncptr.c
=====================================
@@ -32,10 +32,6 @@
 #define SYNCPTR_FMTPRE  SYNCPTR_PREF "(%s) for '%s A/AAAA %s' "
 #define SYNCPTR_FMTPOST ldap_modop_str(mod_op), a_name_str, ip_str
 
-#if LIBDNS_VERSION_MAJOR < 1600
-#define dns_name_copynf(src, dst) dns_name_copy((src), (dst), NULL)
-#endif
-
 /*
  * Event for asynchronous PTR record synchronization.
  */


=====================================
src/syncrepl.c
=====================================
@@ -129,7 +129,7 @@ void
 finish(isc_task_t *task, isc_event_t *event) {
 	isc_result_t result = ISC_R_SUCCESS;
 	sync_barrierev_t *bev = NULL;
-	sync_state_t new_state;
+	sync_state_t new_state = sync_configinit;
 
 	REQUIRE(event != NULL);
 	UNUSED(task);
@@ -496,8 +496,8 @@ isc_result_t
 sync_barrier_wait(sync_ctx_t *sctx, ldap_instance_t *inst) {
 	isc_event_t *ev = NULL;
 	sync_barrierev_t *bev = NULL;
-	sync_state_t barrier_state;
-	sync_state_t final_state;
+	sync_state_t barrier_state = sync_configinit;
+	sync_state_t final_state = sync_configinit;
 	task_element_t *taskel = NULL;
 	task_element_t *next_taskel = NULL;
 


=====================================
src/util.h
=====================================
@@ -15,9 +15,20 @@
 #include <dns/result.h>
 
 #include "log.h"
+#include "dyndb-config.h"
 
 extern bool verbose_checks; /* from settings.c */
 
+#ifndef HAVE_DNS_RESULT_TOTEXT
+#define dns_result_totext isc_result_totext
+#endif
+
+#if LIBDNS_VERSION_MAJOR < 1600
+#define dns_name_copynf(src, dst) dns_name_copy((src), (dst), NULL)
+#elif LIBDNS_VERSION_MAJOR >= 1714
+#define dns_name_copynf(src, dst) dns_name_copy((src), (dst))
+#endif
+
 #define CLEANUP_WITH(result_code)				\
 	do {							\
 		result = (result_code);				\



View it on GitLab: https://salsa.debian.org/freeipa-team/bind-dyndb-ldap/-/compare/63df41c8bc73154000c960fe4e402a5775c2fe45...f71746a059d31afd09867901cc79a9d75d07d331

-- 
View it on GitLab: https://salsa.debian.org/freeipa-team/bind-dyndb-ldap/-/compare/63df41c8bc73154000c960fe4e402a5775c2fe45...f71746a059d31afd09867901cc79a9d75d07d331
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-freeipa-devel/attachments/20220622/0ac8c6ad/attachment-0001.htm>


More information about the Pkg-freeipa-devel mailing list