From d89a0280662669d5a05c281298a388333617b202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 16 Jan 2023 21:43:12 +0100 Subject: [PATCH] Rebuilt for BIND 9.18.10 (#2143258) Include changes needed to build with latest BIND9. --- bind-dyndb-ldap-bind-9.18.10-db-options.patch | 104 ++++++++++++++ ...=> bind-dyndb-ldap-bind-9.18.10-logs.patch | 136 ++++++------------ bind-dyndb-ldap-bind-9.18.10-staleok.patch | 38 +++++ bind-dyndb-ldap.spec | 14 +- 4 files changed, 195 insertions(+), 97 deletions(-) create mode 100644 bind-dyndb-ldap-bind-9.18.10-db-options.patch rename bind-dyndb-ldap-11.10-bind-9.18.9.patch => bind-dyndb-ldap-bind-9.18.10-logs.patch (54%) create mode 100644 bind-dyndb-ldap-bind-9.18.10-staleok.patch diff --git a/bind-dyndb-ldap-bind-9.18.10-db-options.patch b/bind-dyndb-ldap-bind-9.18.10-db-options.patch new file mode 100644 index 0000000..fa7be2e --- /dev/null +++ b/bind-dyndb-ldap-bind-9.18.10-db-options.patch @@ -0,0 +1,104 @@ +From 5dd2fefa0bc7cd7689004cec64304c3a02be9eab Mon Sep 17 00:00:00 2001 +From: Alexander Bokovoy +Date: Thu, 12 Jan 2023 13:25:10 +0200 +Subject: [PATCH] Support bind 9.18.10 or later + +dns_db_allrdatasets() gained a new parameter. Adopt the code to allow +injecting 0 options if building against 9.18.10. + +Fixes: https://pagure.io/bind-dyndb-ldap/issue/216 + +Signed-off-by: Alexander Bokovoy +--- + src/ldap_driver.c | 7 ++++--- + src/ldap_helper.c | 4 ++-- + src/metadb.c | 3 ++- + src/util.h | 6 ++++++ + 4 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/src/ldap_driver.c b/src/ldap_driver.c +index 7367493..e4aeeb2 100644 +--- a/src/ldap_driver.c ++++ b/src/ldap_driver.c +@@ -465,13 +465,14 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, + + static isc_result_t + allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, +- isc_stdtime_t now, dns_rdatasetiter_t **iteratorp) ++ DNS_DB_ALLRDATASETS_OPTIONS(unsigned int options, isc_stdtime_t now), ++ dns_rdatasetiter_t **iteratorp) + { + ldapdb_t *ldapdb = (ldapdb_t *) db; + + REQUIRE(VALID_LDAPDB(ldapdb)); + +- return dns_db_allrdatasets(ldapdb->rbtdb, node, version, now, iteratorp); ++ return dns_db_allrdatasets(ldapdb->rbtdb, node, version, DNS_DB_ALLRDATASETS_OPTIONS(options, now), iteratorp); + } + + /* TODO: Add 'tainted' flag to the LDAP instance if something went wrong. */ +@@ -514,7 +515,7 @@ node_isempty(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, + + CHECK(ldapdb_name_fromnode(node, dns_fixedname_initname(&fname))); + +- result = dns_db_allrdatasets(db, node, version, now, &rds_iter); ++ result = dns_db_allrdatasets(db, node, version, DNS_DB_ALLRDATASETS_OPTIONS(0, now), &rds_iter); + if (result == ISC_R_NOTFOUND) { + *isempty = true; + } else if (result == ISC_R_SUCCESS) { +diff --git a/src/ldap_helper.c b/src/ldap_helper.c +index 7ea3df9..7ac3d91 100644 +--- a/src/ldap_helper.c ++++ b/src/ldap_helper.c +@@ -2005,7 +2005,7 @@ zone_sync_apex(const ldap_instance_t * const inst, + zone_settings, &rdatalist)); + + CHECK(dns_db_getoriginnode(rbtdb, &node)); +- result = dns_db_allrdatasets(rbtdb, node, version, 0, ++ result = dns_db_allrdatasets(rbtdb, node, version, DNS_DB_ALLRDATASETS_OPTIONS(0, 0), + &rbt_rds_iterator); + if (result == ISC_R_SUCCESS) { + CHECK(diff_ldap_rbtdb(inst->mctx, &name, &rdatalist, +@@ -3929,7 +3929,7 @@ update_restart: + CHECK(dns_db_newversion(ldapdb, &version)); + + CHECK(dns_db_findnode(rbtdb, &entry->fqdn, true, &node)); +- result = dns_db_allrdatasets(rbtdb, node, version, 0, &rbt_rds_iterator); ++ result = dns_db_allrdatasets(rbtdb, node, version, DNS_DB_ALLRDATASETS_OPTIONS(0, 0), &rbt_rds_iterator); + if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) + goto cleanup; + +diff --git a/src/metadb.c b/src/metadb.c +index f469a30..276de24 100644 +--- a/src/metadb.c ++++ b/src/metadb.c +@@ -217,7 +217,8 @@ metadb_node_delete(metadb_node_t **nodep) { + node = *nodep; + + dns_rdataset_init(&rdataset); +- CHECK(dns_db_allrdatasets(node->rbtdb, node->dbnode, node->version, 0, ++ CHECK(dns_db_allrdatasets(node->rbtdb, node->dbnode, node->version, ++ DNS_DB_ALLRDATASETS_OPTIONS(0, 0), + &iter)); + + for (result = dns_rdatasetiter_first(iter); +diff --git a/src/util.h b/src/util.h +index 5088ff3..e4620ff 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -29,6 +29,12 @@ extern bool verbose_checks; /* from settings.c */ + #define dns_name_copynf(src, dst) dns_name_copy((src), (dst)) + #endif + ++#if LIBDNS_VERSION_MAJOR >= 1810 ++#define DNS_DB_ALLRDATASETS_OPTIONS(options, tstamp) options, tstamp ++#else ++#define DNS_DB_ALLRDATASETS_OPTIONS(options, tstamp) tstamp ++#endif ++ + #define CLEANUP_WITH(result_code) \ + do { \ + result = (result_code); \ +-- +2.39.0 + diff --git a/bind-dyndb-ldap-11.10-bind-9.18.9.patch b/bind-dyndb-ldap-bind-9.18.10-logs.patch similarity index 54% rename from bind-dyndb-ldap-11.10-bind-9.18.9.patch rename to bind-dyndb-ldap-bind-9.18.10-logs.patch index 23cc1c4..e1111d4 100644 --- a/bind-dyndb-ldap-11.10-bind-9.18.9.patch +++ b/bind-dyndb-ldap-bind-9.18.10-logs.patch @@ -1,21 +1,20 @@ -From 818b95a37b9712c46eb64e3cfecfa1e8a2d0cade Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= -Date: Mon, 21 Nov 2022 17:03:59 +0100 -Subject: [PATCH] Support for BIND 9.18.9+ +From 00131b7b72daa953ab2bf5e6a4fd5508052debb0 Mon Sep 17 00:00:00 2001 +From: Alexander Bokovoy +Date: Thu, 12 Jan 2023 14:33:07 +0200 +Subject: [PATCH] adopt to bind 9.18.9+ loggers -Bind headers changed isc_error_fatal function. Also UNEXPECTED_ERROR -from util.h has changed function signature. Use a conditional -to provide compatibility for both new and previous versions. +Fixes: https://pagure.io/bind-dyndb-ldap/issues/216 + +Signed-off-by: Alexander Bokovoy --- - src/ldap_helper.c | 14 +++++--------- - src/log.h | 5 +++++ - src/settings.c | 16 ++++++++-------- - src/syncrepl.c | 7 +++---- - src/util.h | 10 +++++++++- - 5 files changed, 30 insertions(+), 22 deletions(-) + src/ldap_helper.c | 12 ++++-------- + src/log.h | 9 +++++++++ + src/settings.c | 12 ++++-------- + src/syncrepl.c | 6 ++---- + 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/ldap_helper.c b/src/ldap_helper.c -index 7ea3df9..593cb99 100644 +index 7ac3d91..acabd31 100644 --- a/src/ldap_helper.c +++ b/src/ldap_helper.c @@ -1317,8 +1317,7 @@ configure_zone_acl(isc_mem_t *mctx, dns_zone_t *zone, @@ -38,18 +37,16 @@ index 7ea3df9..593cb99 100644 } } -@@ -2951,9 +2949,8 @@ force_reconnect: +@@ -2951,8 +2949,7 @@ force_reconnect: ldap_inst); break; case AUTH_INVALID: - UNEXPECTED_ERROR(__FILE__, __LINE__, - "invalid auth_method_enum value %u", -- auth_method_enum); -+ DYNDB_UNEXPECTED_ERROR("invalid auth_method_enum value %u", -+ auth_method_enum); ++ unexpected_error("invalid auth_method_enum value %u", + auth_method_enum); break; - default: @@ -3782,8 +3779,7 @@ update_zone(isc_task_t *task, isc_event_t *event) else if (entry->class & LDAP_ENTRYCLASS_FORWARD) CHECK(ldap_parse_fwd_zoneentry(entry, inst)); @@ -61,98 +58,76 @@ index 7ea3df9..593cb99 100644 cleanup: diff --git a/src/log.h b/src/log.h -index da71f8b..4207f08 100644 +index da71f8b..844ac46 100644 --- a/src/log.h +++ b/src/log.h -@@ -17,8 +17,13 @@ +@@ -17,8 +17,17 @@ #define GET_LOG_LEVEL(level) (level) #endif -+#if LIBDNS_VERSION_MAJOR < 1809 - #define fatal_error(...) \ - isc_error_fatal(__FILE__, __LINE__, __VA_ARGS__) -+#else ++#if LIBDNS_VERSION_MAJOR >= 1809 +#define fatal_error(...) \ + isc_error_fatal(__FILE__, __LINE__, __func__, __VA_ARGS__) ++#define unexpected_error(...) \ ++ isc_error_unexpected(__FILE__, __LINE__, __func__, __VA_ARGS__) ++#else + #define fatal_error(...) \ + isc_error_fatal(__FILE__, __LINE__, __VA_ARGS__) ++#define unexpected_error(...) \ ++ isc_error_unexpected(__FILE__, __LINE__, __VA_ARGS__) +#endif #define log_bug(fmt, ...) \ log_error("bug in %s(): " fmt, __func__,##__VA_ARGS__) diff --git a/src/settings.c b/src/settings.c -index def60d7..0ae08a4 100644 +index def60d7..2a0bb19 100644 --- a/src/settings.c +++ b/src/settings.c -@@ -17,6 +17,7 @@ - #include - #include - -+#include "dyndb-config.h" - #include "log.h" - #include "settings.h" - #include "str.h" -@@ -24,7 +25,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 -@@ -178,7 +178,7 @@ setting_get(const char *const name, const setting_type_t type, +@@ -178,8 +178,7 @@ setting_get(const char *const name, const setting_type_t type, *(bool *)target = setting->value.value_boolean; break; default: - UNEXPECTED_ERROR(__FILE__, __LINE__, -+ DYNDB_UNEXPECTED_ERROR( - "invalid setting_type_t value %u", type); +- "invalid setting_type_t value %u", type); ++ unexpected_error("invalid setting_type_t value %u", type); break; } -@@ -278,8 +278,8 @@ set_value(isc_mem_t *mctx, const settings_set_t *set, setting_t *setting, + +@@ -278,8 +277,7 @@ set_value(isc_mem_t *mctx, const settings_set_t *set, setting_t *setting, CLEANUP_WITH(ISC_R_IGNORE); break; default: - UNEXPECTED_ERROR(__FILE__, __LINE__, - "invalid setting_type_t value %u", setting->type); -+ DYNDB_UNEXPECTED_ERROR("invalid setting_type_t value %u", -+ setting->type); ++ unexpected_error("invalid setting_type_t value %u", setting->type); break; } -@@ -304,8 +304,8 @@ set_value(isc_mem_t *mctx, const settings_set_t *set, setting_t *setting, +@@ -304,8 +302,7 @@ set_value(isc_mem_t *mctx, const settings_set_t *set, setting_t *setting, setting->value.value_boolean = numeric_value; break; default: - UNEXPECTED_ERROR(__FILE__, __LINE__, - "invalid setting_type_t value %u", setting->type); -+ DYNDB_UNEXPECTED_ERROR("invalid setting_type_t value %u", -+ setting->type); ++ unexpected_error("invalid setting_type_t value %u", setting->type); break; } setting->filled = 1; -@@ -389,8 +389,8 @@ setting_unset(const char *const name, const settings_set_t *set) +@@ -389,8 +386,7 @@ setting_unset(const char *const name, const settings_set_t *set) case ST_BOOLEAN: break; default: - UNEXPECTED_ERROR(__FILE__, __LINE__, - "invalid setting_type_t value %u", setting->type); -+ DYNDB_UNEXPECTED_ERROR("invalid setting_type_t value %u", -+ setting->type); ++ unexpected_error("invalid setting_type_t value %u", setting->type); break; } setting->filled = 0; diff --git a/src/syncrepl.c b/src/syncrepl.c -index 0bee09a..9be17bf 100644 +index 0bee09a..f94379c 100644 --- a/src/syncrepl.c +++ b/src/syncrepl.c -@@ -13,6 +13,7 @@ - - #include "dyndb-config.h" - #include "ldap_helper.h" -+#include "log.h" - #include "util.h" - #include "semaphore.h" - #include "syncrepl.h" -@@ -148,8 +149,7 @@ finish(isc_task_t *task, isc_event_t *event) { +@@ -148,8 +148,7 @@ finish(isc_task_t *task, isc_event_t *event) { case sync_datainit: case sync_finished: default: @@ -162,7 +137,7 @@ index 0bee09a..9be17bf 100644 "%u", bev->sctx->state); } sync_state_change(bev->sctx, new_state, false); -@@ -518,8 +518,7 @@ sync_barrier_wait(sync_ctx_t *sctx, ldap_instance_t *inst) { +@@ -518,8 +517,7 @@ sync_barrier_wait(sync_ctx_t *sctx, ldap_instance_t *inst) { case sync_databarrier: case sync_finished: default: @@ -172,35 +147,6 @@ index 0bee09a..9be17bf 100644 "%u", sctx->state); } -diff --git a/src/util.h b/src/util.h -index 5088ff3..4fff21a 100644 ---- a/src/util.h -+++ b/src/util.h -@@ -14,8 +14,8 @@ - #include - #include - --#include "log.h" - #include "dyndb-config.h" -+#include "log.h" - - extern bool verbose_checks; /* from settings.c */ - -@@ -29,6 +29,14 @@ extern bool verbose_checks; /* from settings.c */ - #define dns_name_copynf(src, dst) dns_name_copy((src), (dst)) - #endif - -+#if LIBDNS_VERSION_MAJOR < 1809 -+# define DYNDB_UNEXPECTED_ERROR(...) \ -+ isc_error_unexpected(__FILE__, __LINE__, __VA_ARGS__) -+#else -+# define DYNDB_UNEXPECTED_ERROR(...) \ -+ isc_error_unexpected(__FILE__, __LINE__, __func__, __VA_ARGS__) -+#endif -+ - #define CLEANUP_WITH(result_code) \ - do { \ - result = (result_code); \ -- -2.38.1 +2.39.0 diff --git a/bind-dyndb-ldap-bind-9.18.10-staleok.patch b/bind-dyndb-ldap-bind-9.18.10-staleok.patch new file mode 100644 index 0000000..2e9dd67 --- /dev/null +++ b/bind-dyndb-ldap-bind-9.18.10-staleok.patch @@ -0,0 +1,38 @@ +From 47902df23bf637e6c7ece67b928339e0fda58ae0 Mon Sep 17 00:00:00 2001 +From: Alexander Bokovoy +Date: Mon, 16 Jan 2023 11:03:24 +0200 +Subject: [PATCH] Handle dns_db_allrdatasets() backports too + +With https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7189 the +changes were also backported to 9.16.36+ as well. Instead of checking +version, check if an additional define is present. + +Signed-off-by: Alexander Bokovoy +--- + src/util.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/util.h b/src/util.h +index e4620ff..5da0f5c 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + #include "log.h" + #include "dyndb-config.h" +@@ -29,7 +30,7 @@ extern bool verbose_checks; /* from settings.c */ + #define dns_name_copynf(src, dst) dns_name_copy((src), (dst)) + #endif + +-#if LIBDNS_VERSION_MAJOR >= 1810 ++#ifdef DNS_DB_STALEOK + #define DNS_DB_ALLRDATASETS_OPTIONS(options, tstamp) options, tstamp + #else + #define DNS_DB_ALLRDATASETS_OPTIONS(options, tstamp) tstamp +-- +2.39.0 + diff --git a/bind-dyndb-ldap.spec b/bind-dyndb-ldap.spec index 0c9a750..ecb2c22 100644 --- a/bind-dyndb-ldap.spec +++ b/bind-dyndb-ldap.spec @@ -12,7 +12,7 @@ Name: bind-dyndb-ldap Version: 11.10 -Release: 8%{?dist} +Release: 9%{?dist} Summary: LDAP back-end plug-in for BIND License: GPLv2+ @@ -20,7 +20,13 @@ URL: https://releases.pagure.org/bind-dyndb-ldap Source0: https://releases.pagure.org/%{name}/%{name}-%{VERSION}.tar.bz2 Source1: https://releases.pagure.org/%{name}/%{name}-%{VERSION}.tar.bz2.asc -Patch1: bind-dyndb-ldap-11.10-bind-9.18.9.patch +# https://pagure.io/bind-dyndb-ldap/pull-request/217 +# https://pagure.io/bind-dyndb-ldap/c/00131b7b72daa953ab2bf5e6a4fd5508052debb0 +Patch1: bind-dyndb-ldap-bind-9.18.10-db-options.patch +# https://pagure.io/bind-dyndb-ldap/c/47902df23bf637e6c7ece67b928339e0fda58ae0 +Patch2: bind-dyndb-ldap-bind-9.18.10-logs.patch +# https://pagure.io/bind-dyndb-ldap/c/5dd2fefa0bc7cd7689004cec64304c3a02be9eab +Patch3: bind-dyndb-ldap-bind-9.18.10-staleok.patch BuildRequires: bind-devel >= %{bind_version}, bind-lite-devel >= %{bind_version} BuildRequires: krb5-devel @@ -116,6 +122,10 @@ sed -i.bak -e "$SEDSCRIPT" /etc/named.conf %changelog +* Mon Jan 16 2023 Petr Menšík - 11.10-9 +- Rebuilt for BIND 9.18.10 (#2143258) +- Include changes needed to build with latest BIND9 + * Mon Nov 21 2022 Petr Menšík - 11.10-8 - Rebuilt for BIND 9.18.9 (#2143258) - Support error header change