1
0
forked from rpms/bind

Allow use of isc/util.h without "config.h"

It prevents compilation of bind-dyndb-ldap. Because config.h is never
used by bind-dyndb-ldap, stop exporting it in devel package. It should
be only implementation detail.

(cherry picked from commit 2e4a03677c85aae0659ec29432362548ce722747)

Resolves: rhbz#1956777
This commit is contained in:
Petr Menšík 2021-03-26 11:21:37 +01:00
parent 9f34324bc0
commit 348d01cc21
2 changed files with 56 additions and 6 deletions

View File

@ -0,0 +1,53 @@
From 48df32cadb5071f5b186b00da3f4406a13320b44 Mon Sep 17 00:00:00 2001
From: Petr Mensik <pemensik@redhat.com>
Date: Fri, 26 Mar 2021 11:01:59 +0100
Subject: [PATCH] Do not require config.h to use isc/util.h
util.h requires ISC_CONSTRUCTOR definition, which depends on config.h
inclusion. It does not include it from isc/util.h (or any other header).
Using isc/util.h fails hard when isc/util.h is used without including
bind's config.h.
Move the check to c file, where ISC_CONSTRUCTOR is used. Ensure config.h
is included there.
---
lib/isc/include/isc/util.h | 2 --
lib/isc/lib.c | 5 +++++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h
index 3c8c40b..3144557 100644
--- a/lib/isc/include/isc/util.h
+++ b/lib/isc/include/isc/util.h
@@ -54,8 +54,6 @@
#elif WIN32
#define ISC_CONSTRUCTOR(priority)
#define ISC_DESTRUCTOR(priority)
-#else
-#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
#endif
/*%
diff --git a/lib/isc/lib.c b/lib/isc/lib.c
index 27d7be1..08a1b91 100644
--- a/lib/isc/lib.c
+++ b/lib/isc/lib.c
@@ -17,10 +17,15 @@
#include <isc/tls.h>
#include <isc/util.h>
+#include "config.h"
#include "mem_p.h"
#include "tls_p.h"
#include "trampoline_p.h"
+#ifndef ISC_CONSTRUCTOR
+#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
+#endif
+
/***
*** Functions
***/
--
2.26.2

View File

@ -114,6 +114,8 @@ Patch157:bind-9.11-fips-tests.patch
Patch164:bind-9.11-rh1666814.patch
Patch170:bind-9.11-feature-test-named.patch
Patch171:bind-9.11-tests-variants.patch
# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/4840
Patch172:bind-9.16-isc-constructor.h
Requires(post): systemd
Requires(preun): systemd
@ -418,6 +420,7 @@ in HTML and PDF format.
%patch164 -p1 -b .rh1666814
%patch170 -p1 -b .featuretest-named
%patch171 -p1 -b .test-variant
%patch172 -p1 -b .isc-constructor
%if %{with PKCS11}
%patch135 -p1 -b .config-pkcs11
@ -708,11 +711,6 @@ install -m 644 %{SOURCE49} ${RPM_BUILD_ROOT}%{_sysconfdir}/named-chroot.files
# Install isc/errno2result.h header
install -m 644 lib/isc/unix/errno2result.h ${RPM_BUILD_ROOT}%{_includedir}/bind9/isc
pushd build
# Files required to run test-suite outside of build tree:
cp -fp config.h ${RPM_BUILD_ROOT}/%{_includedir}/bind9
popd
# Remove libtool .la files:
find ${RPM_BUILD_ROOT}/%{_libdir} -name '*.la' -exec '/bin/rm' '-f' '{}' ';';
@ -1035,7 +1033,6 @@ fi;
%{_libdir}/libisc.so
%{_libdir}/libisccfg.so
%dir %{_includedir}/bind9
%{_includedir}/bind9/config.h
%{_includedir}/bind9/bind9
%{_includedir}/bind9/isccc
%{_includedir}/bind9/ns