From f2f508eb4767db5d64a95d0de390d765f40eaaa8 Mon Sep 17 00:00:00 2001 From: xinghe Date: Tue, 5 Mar 2024 07:06:36 +0000 Subject: [PATCH] fix build error --- ...t-bind-dyndb-ldap-11.10-bind-9.18.13.patch | 56 +++ ...t-bind-dyndb-ldap-11.10-bind-9.18.19.patch | 405 ++++++++++++++++++ ...-bind-dyndb-ldap-11.10-dns_name_init.patch | 38 ++ bind-dyndb-ldap.spec | 14 +- 4 files changed, 511 insertions(+), 2 deletions(-) create mode 100644 backport-bind-dyndb-ldap-11.10-bind-9.18.13.patch create mode 100644 backport-bind-dyndb-ldap-11.10-bind-9.18.19.patch create mode 100644 backport-bind-dyndb-ldap-11.10-dns_name_init.patch diff --git a/backport-bind-dyndb-ldap-11.10-bind-9.18.13.patch b/backport-bind-dyndb-ldap-11.10-bind-9.18.13.patch new file mode 100644 index 0000000..70e5ec3 --- /dev/null +++ b/backport-bind-dyndb-ldap-11.10-bind-9.18.13.patch @@ -0,0 +1,56 @@ +From 5d9a012e07578d1a813b385224ba53f77f06b026 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= +Date: Wed, 22 Mar 2023 13:38:18 +0100 +Subject: [PATCH] Remove rpz_attach for BIND 9.16+ + +rpz_attach is never supplied from BIND9 code both in 9.16 or 9.18. +Remove our custom function and pass NULL as well. It would be never +called anyway. + +Modified to directly remove the function without db_registered fix. +--- + src/ldap_driver.c | 20 ++++---------------- + 1 file changed, 4 insertions(+), 16 deletions(-) + +diff --git a/src/ldap_driver.c b/src/ldap_driver.c +index e4aeeb2..20e12fc 100644 +--- a/src/ldap_driver.c ++++ b/src/ldap_driver.c +@@ -804,22 +804,6 @@ rpz_attach(dns_db_t *db, dns_rpz_zones_t *rpzs, uint8_t rpz_num) + + dns_db_rpz_attach(ldapdb->rbtdb, rpzs, rpz_num); + } +-#else +-void +-rpz_attach(dns_db_t *db, void *void_rpzs, uint8_t rpz_num) +-{ +- ldapdb_t *ldapdb = (ldapdb_t *) db; +- dns_rpz_zones_t *rpzs = (dns_rpz_zones_t *) void_rpzs; +- isc_result_t result; +- +- REQUIRE(VALID_LDAPDB(ldapdb)); +- +- rpzs->zones[rpz_num]->db_registered = true; +- result = dns_db_updatenotify_register(ldapdb->rbtdb, +- dns_rpz_dbupdate_callback, +- rpzs->zones[rpz_num]); +- REQUIRE(result == ISC_R_SUCCESS); +-} + #endif + + /* +@@ -966,7 +950,11 @@ static dns_dbmethods_t ldapdb_methods = { + resigned, + isdnssec, + getrrsetstats, ++#if LIBDNS_VERSION_MAJOR < 1600 + rpz_attach, ++#else ++ NULL, ++#endif + NULL, /* rpz_ready */ + findnodeext, + findext, +-- +2.39.2 + diff --git a/backport-bind-dyndb-ldap-11.10-bind-9.18.19.patch b/backport-bind-dyndb-ldap-11.10-bind-9.18.19.patch new file mode 100644 index 0000000..a4cdc46 --- /dev/null +++ b/backport-bind-dyndb-ldap-11.10-bind-9.18.19.patch @@ -0,0 +1,405 @@ +From 131ddb918a5e80bfac2ce97d994f75d42fdf4546 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= +Date: Mon, 25 Sep 2023 12:33:42 +0200 +Subject: [PATCH] Detect and propagate atomic libraries like bind9 + +BIND9 headers expect atomic definitions are configured before they are +included. It needs adding atomic libraries detection in configure AND +including config.h before any ISC headers are included. + +Move dyndb-config.h before isc headers anywhere where needed. +--- + configure.ac | 72 +++++++++++++++++++++++++++++++++++++++++++++ + src/empty_zones.c | 3 +- + src/fs.c | 2 ++ + src/fwd_register.c | 3 +- + src/krb5_helper.c | 1 + + src/ldap_convert.c | 3 +- + src/ldap_entry.c | 4 ++- + src/lock.c | 2 ++ + src/log.c | 2 ++ + src/metadb.c | 2 ++ + src/mldap.c | 5 ++-- + src/rbt_helper.c | 3 +- + src/semaphore.c | 2 ++ + src/settings.c | 3 +- + src/str.c | 2 ++ + src/syncptr.c | 3 +- + src/zone.c | 2 ++ + src/zone_register.c | 3 +- + 18 files changed, 107 insertions(+), 10 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 9f7f3640c..c30f105db 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -145,6 +145,78 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([ + ], [AC_MSG_ERROR([Cross compiling is not supported.])] + ) + ++# Following atomic checks taken from bind9 configure ++# SPDX-License-Identifier: MPL-2.0 ++# ++# This Source Code Form is subject to the terms of the Mozilla Public ++# License, v. 2.0. If a copy of the MPL was not distributed with this ++# file, you can obtain one at https://mozilla.org/MPL/2.0/. ++# ++ISC_ATOMIC_LIBS="" ++AC_CHECK_HEADERS( ++ [stdatomic.h], ++ [AC_MSG_CHECKING([for memory model aware atomic operations]) ++ AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[atomic_int_fast32_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]] ++ )], ++ [AC_MSG_RESULT([stdatomic.h]) ++ AC_MSG_CHECKING([whether -latomic is needed for 64-bit stdatomic.h functions]) ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]] ++ )], ++ [AC_MSG_RESULT([no])], ++ [ISC_ATOMIC_LIBS="-latomic" ++ AX_SAVE_FLAGS([atomic]) ++ LIBS="$LIBS $ISC_ATOMIC_LIBS" ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]] ++ )], ++ [AC_MSG_RESULT([yes])], ++ [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])]) ++ AX_RESTORE_FLAGS([atomic]) ++ ]) ++ ], ++ [AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])] ++ )], ++ [AC_MSG_CHECKING([for memory model aware atomic operations]) ++ AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[int32_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]] ++ )], ++ [AC_MSG_RESULT([__atomic builtins]) ++ AC_DEFINE([HAVE___ATOMIC], [1], [define if __atomic builtins are not available]) ++ AC_MSG_CHECKING([whether -latomic is needed for 64-bit __atomic builtins]) ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]] ++ )], ++ [AC_MSG_RESULT([no])], ++ [ISC_ATOMIC_LIBS="-latomic" ++ AX_SAVE_FLAGS([atomic]) ++ LIBS="$LIBS $ISC_ATOMIC_LIBS" ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[#include ]], ++ [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]] ++ )], ++ [AC_MSG_RESULT([yes])], ++ [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])]) ++ AX_RESTORE_FLAGS([atomic]) ++ ]) ++ ], ++ [AC_MSG_FAILURE([not found]) ++ ]) ++ ]) ++LIBS="$LIBS $ISC_ATOMIC_LIBS" ++ + dnl isc_errno_toresult() was not available in older header files + AC_MSG_CHECKING([isc_errno_toresult availability]) + AC_TRY_RUN([ +diff --git a/src/empty_zones.c b/src/empty_zones.c +index 4e14a804a..f818046d4 100644 +--- a/src/empty_zones.c ++++ b/src/empty_zones.c +@@ -1,5 +1,7 @@ + #include + ++#include "dyndb-config.h" ++ + #include + #include + #include +@@ -8,7 +10,6 @@ + #include + #include + +-#include "dyndb-config.h" + #include "empty_zones.h" + #include "util.h" + #include "zone_register.h" +diff --git a/src/fs.c b/src/fs.c +index 09df5842a..4f3c9c069 100644 +--- a/src/fs.c ++++ b/src/fs.c +@@ -8,6 +8,8 @@ + + #include + ++#include "dyndb-config.h" ++ + #include + #include + #include +diff --git a/src/fwd_register.c b/src/fwd_register.c +index 5a3d4e2c2..85792d52e 100644 +--- a/src/fwd_register.c ++++ b/src/fwd_register.c +@@ -2,11 +2,12 @@ + * Copyright (C) 2013-2014 bind-dyndb-ldap authors; see COPYING for license + */ + ++#include "dyndb-config.h" ++ + #include + #include + #include + +-#include "dyndb-config.h" + #include "rbt_helper.h" + #include "fwd_register.h" + #include "util.h" +diff --git a/src/krb5_helper.c b/src/krb5_helper.c +index 5d7ee6a9a..92412304b 100644 +--- a/src/krb5_helper.c ++++ b/src/krb5_helper.c +@@ -4,6 +4,7 @@ + + #define _POSIX_C_SOURCE 200112L /* setenv */ + ++#include "dyndb-config.h" + #include + #include + #include +diff --git a/src/ldap_convert.c b/src/ldap_convert.c +index 87f635f79..0a946c421 100644 +--- a/src/ldap_convert.c ++++ b/src/ldap_convert.c +@@ -2,6 +2,8 @@ + * Copyright (C) 2009-2015 bind-dyndb-ldap authors; see COPYING for license + */ + ++#include "dyndb-config.h" ++ + #include + #include + #include +@@ -20,7 +22,6 @@ + #include + #include + +-#include "dyndb-config.h" + #include "str.h" + #include "ldap_convert.h" + #include "log.h" +diff --git a/src/ldap_entry.c b/src/ldap_entry.c +index cdf26d858..a29797b1c 100644 +--- a/src/ldap_entry.c ++++ b/src/ldap_entry.c +@@ -2,12 +2,14 @@ + * Copyright (C) 2011-2014 bind-dyndb-ldap authors; see COPYING for license + */ + #include ++#include ++ ++#include "dyndb-config.h" + + #include + #include + #include + +-#include + #include + #include + #include +diff --git a/src/lock.c b/src/lock.c +index df6e5ccba..abb5fe0d7 100644 +--- a/src/lock.c ++++ b/src/lock.c +@@ -2,6 +2,8 @@ + * Copyright (C) 2014 bind-dyndb-ldap authors; see COPYING for license + */ + ++#include "dyndb-config.h" ++ + #include + #include + +diff --git a/src/log.c b/src/log.c +index 1eba3cde2..78f9e68b5 100644 +--- a/src/log.c ++++ b/src/log.c +@@ -4,6 +4,8 @@ + + #include + ++#include "dyndb-config.h" ++ + #include + #include + +diff --git a/src/metadb.c b/src/metadb.c +index 276de244f..f035269d2 100644 +--- a/src/metadb.c ++++ b/src/metadb.c +@@ -4,6 +4,8 @@ + * Meta-database for information which are not represented in DNS data. + */ + ++#include "dyndb-config.h" ++ + #include + #include + +diff --git a/src/mldap.c b/src/mldap.c +index 0bc2d332f..92a330ccb 100644 +--- a/src/mldap.c ++++ b/src/mldap.c +@@ -8,8 +8,10 @@ + #include + #include + #include +- + #include ++ ++#include "dyndb-config.h" ++ + #include + #include + #include +@@ -27,7 +29,6 @@ + #include "metadb.h" + #include "mldap.h" + #include "util.h" +-#include "dyndb-config.h" + + #if LIBDNS_VERSION_MAJOR < 1600 + #define REFCOUNT_CAST(n) ((typeof(((isc_refcount_t *)0)->refs)) (n)) +diff --git a/src/rbt_helper.c b/src/rbt_helper.c +index 6009553bf..d918801c6 100644 +--- a/src/rbt_helper.c ++++ b/src/rbt_helper.c +@@ -2,12 +2,13 @@ + * Copyright (C) 2013-2014 bind-dyndb-ldap authors; see COPYING for license + */ + ++#include "dyndb-config.h" ++ + #include + #include + + #include "util.h" + #include "rbt_helper.h" +-#include "dyndb-config.h" + + #define LDAPDB_RBTITER_MAGIC ISC_MAGIC('L', 'D', 'P', 'I') + +diff --git a/src/semaphore.c b/src/semaphore.c +index b6d02ffac..8b549b8a4 100644 +--- a/src/semaphore.c ++++ b/src/semaphore.c +@@ -8,6 +8,8 @@ + * own signal. However, for our purposes, this shouldn't be needed. + */ + ++#include "dyndb-config.h" ++ + #include + #include + #include +diff --git a/src/settings.c b/src/settings.c +index 2a0bb1982..2c9d18238 100644 +--- a/src/settings.c ++++ b/src/settings.c +@@ -2,6 +2,8 @@ + * Copyright (C) 2009-2014 bind-dyndb-ldap authors; see COPYING for license + */ + ++#include "dyndb-config.h" ++ + #include + #include + #include +@@ -24,7 +26,6 @@ + #include "types.h" + #include "ldap_helper.h" + #include "zone_register.h" +-#include "dyndb-config.h" + + #if LIBDNS_VERSION_MAJOR < 1600 + #define cfg_parse_buffer cfg_parse_buffer4 +diff --git a/src/str.c b/src/str.c +index 6797eded0..a68f66c73 100644 +--- a/src/str.c ++++ b/src/str.c +@@ -9,6 +9,8 @@ + * Review all the REQUIRE() macros. + */ + ++#include "dyndb-config.h" ++ + #include + #include + #include +diff --git a/src/syncptr.c b/src/syncptr.c +index f7b8c02bc..7fab14a9e 100644 +--- a/src/syncptr.c ++++ b/src/syncptr.c +@@ -6,6 +6,8 @@ + #include + #include + ++#include "dyndb-config.h" ++ + #include + #include + #include +@@ -18,7 +20,6 @@ + #include + #include + +-#include "dyndb-config.h" + #include "util.h" + #include "ldap_convert.h" + #include "ldap_entry.h" +diff --git a/src/zone.c b/src/zone.c +index 0180ba8ea..899f612c3 100644 +--- a/src/zone.c ++++ b/src/zone.c +@@ -3,6 +3,8 @@ + */ + + #include ++#include "dyndb-config.h" ++ + #include + #include + +diff --git a/src/zone_register.c b/src/zone_register.c +index 504aa9be2..4db5e02c7 100644 +--- a/src/zone_register.c ++++ b/src/zone_register.c +@@ -2,6 +2,8 @@ + * Copyright (C) 2009-2014 bind-dyndb-ldap authors; see COPYING for license + */ + ++#include "dyndb-config.h" ++ + #include + #include + #include +@@ -12,7 +14,6 @@ + #include + #include + +-#include "dyndb-config.h" + #include "fs.h" + #include "ldap_driver.h" + #include "log.h" +-- +2.41.0 + diff --git a/backport-bind-dyndb-ldap-11.10-dns_name_init.patch b/backport-bind-dyndb-ldap-11.10-dns_name_init.patch new file mode 100644 index 0000000..66885aa --- /dev/null +++ b/backport-bind-dyndb-ldap-11.10-dns_name_init.patch @@ -0,0 +1,38 @@ +From dbbcc2f07ea6955c6b0b5a719f8058c54b1d750c Mon Sep 17 00:00:00 2001 +From: Alexander Bokovoy +Date: Wed, 14 Feb 2024 14:29:00 +0200 +Subject: [PATCH] use BIND macros when defining DNS names + +Fixes: https://pagure.io/bind-dyndb-ldap/issue/228 + +Signed-off-by: Alexander Bokovoy +--- + src/mldap.c | 13 +------------ + 1 file changed, 1 insertion(+), 12 deletions(-) + +diff --git a/src/mldap.c b/src/mldap.c +index 92a330c..79efddb 100644 +--- a/src/mldap.c ++++ b/src/mldap.c +@@ -50,18 +50,7 @@ + static unsigned char uuid_rootname_ndata[] + = { 4, 'u', 'u', 'i', 'd', 4, 'l', 'd', 'a', 'p', 0 }; + static unsigned char uuid_rootname_offsets[] = { 0, 5, 10 }; +-static dns_name_t uuid_rootname = +-{ +- DNS_NAME_MAGIC, +- uuid_rootname_ndata, +- sizeof(uuid_rootname_ndata), +- sizeof(uuid_rootname_offsets), +- DNS_NAMEATTR_READONLY | DNS_NAMEATTR_ABSOLUTE, +- uuid_rootname_offsets, +- NULL, +- { (void *)-1, (void *)-1 }, +- { NULL, NULL } +-}; ++static dns_name_t uuid_rootname = DNS_NAME_INITABSOLUTE(uuid_rootname_ndata, uuid_rootname_offsets); + + struct mldapdb { + isc_mem_t *mctx; +-- +2.43.0 \ No newline at end of file diff --git a/bind-dyndb-ldap.spec b/bind-dyndb-ldap.spec index dc579b6..79aceb5 100644 --- a/bind-dyndb-ldap.spec +++ b/bind-dyndb-ldap.spec @@ -5,7 +5,7 @@ Name: bind-dyndb-ldap Version: 11.10 -Release: 1 +Release: 2 Summary: LDAP back-end plug-in for BIND License: GPLv2+ URL: https://releases.pagure.org/bind-dyndb-ldap @@ -16,6 +16,9 @@ Patch1: bind-dyndb-ldap-bind-9.18.10-db-options.patch Patch2: bind-dyndb-ldap-bind-9.18.10-logs.patch Patch3: bind-dyndb-ldap-bind-9.18.10-staleok.patch Patch4: bind-dyndb-ldap-11.10-bind-9.18.11.patch +Patch5: backport-bind-dyndb-ldap-11.10-bind-9.18.13.patch +Patch6: backport-bind-dyndb-ldap-11.10-bind-9.18.19.patch +Patch7: backport-bind-dyndb-ldap-11.10-dns_name_init.patch BuildRequires: bind-devel >= %{bind_version} BuildRequires: krb5-devel @@ -23,8 +26,9 @@ BuildRequires: openldap-devel BuildRequires: libuuid-devel BuildRequires: automake, autoconf, libtool, make BuildRequires: openssl-devel +BuildRequires: autoconf-archive -%if %{with bind_pkcs11} +%if %{with_bind_pkcs11} BuildRequires: bind-pkcs11-devel >= %{bind_version} Requires(pre): bind-pkcs11 >= %{bind_version} Requires: bind-pkcs11 >= %{bind_version}, bind-pkcs11-utils >= %{bind_version} @@ -96,6 +100,12 @@ sed -i.bak -e "$SEDSCRIPT" /etc/named.conf %changelog +* Tue Mar 05 2024 xinghe - 11.10-2 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix build error + * Sun Jan 29 2023 xinghe - 11.10-1 - Type:requirement - CVE:NA