Add BIND 9.16.13 support

This commit is contained in:
Petr Menšík 2021-03-26 16:25:59 +01:00
parent 003159c25b
commit a302ab4ecc
3 changed files with 130 additions and 1 deletions

View File

@ -0,0 +1,65 @@
From 1d03c1e5b2e6c932c3a773518a0224d6bcd9d28b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Fri, 26 Mar 2021 11:46:26 +0100
Subject: [PATCH 2/2] rwlock initialization does not return value
API has changed, it no longer returns a value in isc_rwlock_init.
It returned always ISC_SUCCCESS on 9.16 anyway, so skip the check
on every 9.16 build.
---
src/fwd_register.c | 5 +++++
src/zone_register.c | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/src/fwd_register.c b/src/fwd_register.c
index cc9764bdf..fcbd66fd7 100644
--- a/src/fwd_register.c
+++ b/src/fwd_register.c
@@ -6,6 +6,7 @@
#include <isc/util.h>
#include <dns/name.h>
+#include "config.h"
#include "rbt_helper.h"
#include "fwd_register.h"
#include "util.h"
@@ -35,7 +36,11 @@ fwdr_create(isc_mem_t *mctx, fwd_register_t **fwdrp)
ZERO_PTR(fwdr);
isc_mem_attach(mctx, &fwdr->mctx);
CHECK(dns_rbt_create(mctx, NULL, NULL, &fwdr->rbt));
+#if LIBDNS_VERSION_MAJOR >= 1600
+ (void)isc_rwlock_init(&fwdr->rwlock, 0, 0);
+#else
CHECK(isc_rwlock_init(&fwdr->rwlock, 0, 0));
+#endif
*fwdrp = fwdr;
return ISC_R_SUCCESS;
diff --git a/src/zone_register.c b/src/zone_register.c
index 07b1546d6..28d9b7ae8 100644
--- a/src/zone_register.c
+++ b/src/zone_register.c
@@ -12,6 +12,7 @@
#include <dns/result.h>
#include <dns/zone.h>
+#include "config.h"
#include "fs.h"
#include "ldap_driver.h"
#include "log.h"
@@ -115,7 +116,12 @@ zr_create(isc_mem_t *mctx, ldap_instance_t *ldap_inst,
ZERO_PTR(zr);
isc_mem_attach(mctx, &zr->mctx);
CHECK(dns_rbt_create(mctx, delete_zone_info, mctx, &zr->rbt));
+#if LIBDNS_VERSION_MAJOR >= 1600
+ /* Never fails on BIND 9.16, even it if returns value */
+ (void)isc_rwlock_init(&zr->rwlock, 0, 0);
+#else
CHECK(isc_rwlock_init(&zr->rwlock, 0, 0));
+#endif
zr->global_settings = glob_settings;
zr->ldap_inst = ldap_inst;
--
2.26.2

View File

@ -0,0 +1,58 @@
From f0d75b778ee7bfd0feb368b51027943085a54705 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Fri, 26 Mar 2021 00:59:17 +0100
Subject: [PATCH 1/2] Add support for dns library without libinterface
BIND 9.16.12 and more recent have removed numeric versioning of library.
Instead it just contain complete text version. Extract numbers from it
and export it in similar manner.
---
configure.ac | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index e8bce4abc..ca7ef188b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,19 +90,31 @@ AC_CHECK_LIB([krb5], [krb5_cc_initialize], [],
AC_CHECK_LIB([uuid], [uuid_unparse], [],
AC_MSG_ERROR([Install UUID library development files]))
+AC_LANG(C)
# Check version of libdns
AC_MSG_CHECKING([libdns version])
-AC_TRY_RUN([
+AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h>
#include <dns/version.h>
-int main(void) {
- printf("%d\n", dns_libinterface);
- return 0;
-}],[LIBDNS_VERSION_MAJOR=`./conftest$ac_exeext`
+],[ printf("%d\n", dns_libinterface) ])], [
+ LIBDNS_VERSION_MAJOR=`./conftest$ac_exeext`
+ AC_DEFINE_UNQUOTED([LIBDNS_VERSION_MAJOR], [$LIBDNS_VERSION_MAJOR],
+ [Define libdns version])], [
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+#include <dns/version.h>
+]],[[
+ unsigned major, minor, patch, scanned;
+ /* emulate dns_libinterface from minor and patch version */
+ scanned = sscanf(dns_version, "%u.%u.%u", &major, &minor, &patch);
+ printf("%02d%02d\n", minor, patch);
+ return !(scanned == 3 && major == 9);
+ ]])], [
+ LIBDNS_VERSION_MAJOR=`./conftest$ac_exeext`
AC_DEFINE_UNQUOTED([LIBDNS_VERSION_MAJOR], [$LIBDNS_VERSION_MAJOR],
[Define libdns version])],
-[AC_MSG_ERROR([Can't obtain libdns version.])],
-[AC_MSG_ERROR([Cross compiling is not supported.])]
+ [AC_MSG_ERROR([Can't obtain libdns version.])])
+], [AC_MSG_ERROR([Cross compiling is not supported.])]
)
dnl isc_errno_toresult() was not available in older header files
--
2.26.2

View File

@ -12,7 +12,7 @@
Name: bind-dyndb-ldap
Version: 11.7
Release: 1%{?dist}
Release: 2%{?dist}
Summary: LDAP back-end plug-in for BIND
License: GPLv2+
@ -20,6 +20,9 @@ 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.6-bind-9.16.13-version.patch
Patch2: bind-dyndb-ldap-11.6-bind-9.16.13-rwlock.patch
BuildRequires: bind-devel >= %{bind_version}, bind-lite-devel >= %{bind_version}
BuildRequires: krb5-devel
BuildRequires: openldap-devel
@ -114,6 +117,9 @@ sed -i.bak -e "$SEDSCRIPT" /etc/named.conf
%changelog
* Fri Mar 26 2021 Petr Menšík <pemensik@redhat.com> - 11.7-2
- Support for BIND 9.16.13
* Wed Feb 24 2021 Alexander Bokovoy <abokovoy@redhat.com> - 11.7-1
- Upstream release 11.7