From 0771dd3be8bad18f669de978f3be5e08cf2dbd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Mon, 24 Jun 2019 14:25:55 +0200 Subject: [PATCH] Make the usage of libxml2 opaque to the caller The libxml2 have previously leaked into the global namespace leading to forced -I for every compilation unit using isc/xml.h header. This MR fixes the usage making the caller object opaque. --- bin/check/Makefile.in | 4 +- bin/confgen/Makefile.in | 4 +- bin/delv/Makefile.in | 4 +- bin/dig/Makefile.in | 4 +- bin/dnssec/Makefile.in | 4 +- bin/named/Makefile.in | 7 +- bin/named/include/named/server.h | 1 - bin/named/main.c | 1 + bin/named/server.c | 1 - bin/named/statschannel.c | 17 +- bin/nsupdate/Makefile.in | 4 +- bin/pkcs11/Makefile.in | 2 +- bin/plugins/Makefile.in | 2 +- bin/rndc/Makefile.in | 4 +- bin/tests/Makefile.in | 4 +- bin/tests/optional/Makefile.in | 4 +- bin/tests/pkcs11/Makefile.in | 2 +- bin/tests/pkcs11/benchmarks/Makefile.in | 2 +- bin/tests/system/Makefile.in | 2 +- bin/tests/system/conf.sh.in | 3 +- bin/tests/system/dyndb/driver/Makefile.in | 2 +- bin/tests/system/pipelined/Makefile.in | 2 +- bin/tests/system/rndc/Makefile.in | 2 +- bin/tests/system/rpz/Makefile.in | 2 +- bin/tests/system/rsabigexponent/Makefile.in | 2 +- bin/tests/system/tkey/Makefile.in | 2 +- bin/tools/Makefile.in | 4 +- config.h.in | 2 +- configure | 239 ++++++++++++++------ configure.ac | 63 +----- contrib/dlz/bin/dlzbdb/Makefile.in | 2 +- fuzz/Makefile.in | 2 +- lib/bind9/Makefile.in | 2 +- lib/dns/Makefile.in | 5 +- lib/dns/cache.c | 9 +- lib/dns/include/dns/cache.h | 2 +- lib/dns/tests/Makefile.in | 2 +- lib/dns/tests/master_test.c | 1 - lib/irs/tests/Makefile.in | 2 +- lib/isc/Makefile.in | 3 +- lib/isc/include/isc/Makefile.in | 3 +- lib/isc/include/isc/mem.h | 3 +- lib/isc/include/isc/socket.h | 3 +- lib/isc/include/isc/task.h | 3 +- lib/isc/include/isc/xml.h | 35 --- lib/isc/mem.c | 9 +- lib/isc/task.c | 9 +- lib/isc/tests/Makefile.in | 2 +- lib/isc/unix/Makefile.in | 3 +- lib/isc/unix/socket.c | 9 +- lib/isc/win32/libisc.vcxproj.filters.in | 3 - lib/isc/win32/libisc.vcxproj.in | 1 - lib/isc/win32/socket.c | 8 +- lib/isccc/Makefile.in | 2 +- lib/isccc/tests/Makefile.in | 2 +- lib/isccfg/Makefile.in | 2 +- lib/isccfg/tests/Makefile.in | 2 +- lib/ns/Makefile.in | 2 +- lib/ns/tests/Makefile.in | 2 +- lib/samples/Makefile-postinstall.in | 2 +- lib/samples/Makefile.in | 2 +- make/rules.in | 3 + util/copyrights | 1 - 63 files changed, 302 insertions(+), 235 deletions(-) delete mode 100644 lib/isc/include/isc/xml.h diff --git a/bin/check/Makefile.in b/bin/check/Makefile.in index 04e0af788c..7f9e95c2fe 100644 --- a/bin/check/Makefile.in +++ b/bin/check/Makefile.in @@ -23,8 +23,8 @@ CWARNINGS = DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} BIND9LIBS = ../../lib/bind9/libbind9.@A@ NSLIBS = ../../lib/ns/libns.@A@ diff --git a/bin/confgen/Makefile.in b/bin/confgen/Makefile.in index 383f651294..da8c4effde 100644 --- a/bin/confgen/Makefile.in +++ b/bin/confgen/Makefile.in @@ -27,8 +27,8 @@ CWARNINGS = ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCCLIBS = ../../lib/isccc/libisccc.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ diff --git a/bin/delv/Makefile.in b/bin/delv/Makefile.in index 3253b20714..ec34e5d952 100644 --- a/bin/delv/Makefile.in +++ b/bin/delv/Makefile.in @@ -24,8 +24,8 @@ CWARNINGS = ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} IRSLIBS = ../../lib/irs/libirs.@A@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ diff --git a/bin/dig/Makefile.in b/bin/dig/Makefile.in index d80a2b2838..9c0a473374 100644 --- a/bin/dig/Makefile.in +++ b/bin/dig/Makefile.in @@ -27,8 +27,8 @@ CWARNINGS = ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} IRSLIBS = ../../lib/irs/libirs.@A@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in index e67cba9eb2..3559b717d7 100644 --- a/bin/dnssec/Makefile.in +++ b/bin/dnssec/Makefile.in @@ -21,8 +21,8 @@ CDEFINES = -DVERSION=\"${VERSION}\" CWARNINGS = DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSDEPLIBS = ../../lib/dns/libdns.@A@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in index 6cb812ba0d..d870e450c7 100644 --- a/bin/named/Makefile.in +++ b/bin/named/Makefile.in @@ -46,7 +46,8 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \ ${NS_INCLUDES} ${DNS_INCLUDES} \ ${BIND9_INCLUDES} ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} \ ${ISC_INCLUDES} ${DLZDRIVER_INCLUDES} \ - ${DBDRIVER_INCLUDES} @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@ + ${DBDRIVER_INCLUDES} @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@ \ + ${LIBXML2_CFLAGS} CDEFINES = @CONTRIB_DLZ@ @@ -55,8 +56,8 @@ CWARNINGS = DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCCLIBS = ../../lib/isccc/libisccc.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} BIND9LIBS = ../../lib/bind9/libbind9.@A@ NSLIBS = ../../lib/ns/libns.@A@ diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h index 25d0e4b755..8443201908 100644 --- a/bin/named/include/named/server.h +++ b/bin/named/include/named/server.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include diff --git a/bin/named/main.c b/bin/named/main.c index 92cd24c9fc..83af0e13e8 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -79,6 +79,7 @@ #include #ifdef HAVE_LIBXML2 #include +#include #endif #ifdef HAVE_ZLIB #include diff --git a/bin/named/server.c b/bin/named/server.c index b0019af6b8..febe8a4b18 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -47,7 +47,6 @@ #include #include #include -#include #include #include diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 7d9be5d489..3e99c62552 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -43,6 +43,11 @@ #include #include +#if HAVE_LIBXML2 +#include +#define ISC_XMLCHAR (const xmlChar *) +#endif /* HAVE_LIBXML2 */ + #include "bind9.xsl.h" struct named_statschannel { @@ -1067,7 +1072,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg, stats_dumparg_t dumparg; FILE *fp; #ifdef HAVE_LIBXML2 - xmlTextWriterPtr writer; + void *writer; int xmlrc; #endif #ifdef HAVE_JSON_C @@ -1113,7 +1118,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg, break; case isc_statsformat_xml: #ifdef HAVE_LIBXML2 - writer = (xmlTextWriterPtr) arg; + writer = arg; if (category != NULL) { /* */ @@ -1187,7 +1192,7 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { stats_dumparg_t *dumparg = arg; FILE *fp; #ifdef HAVE_LIBXML2 - xmlTextWriterPtr writer; + void *writer; int xmlrc; #endif #ifdef HAVE_JSON_C @@ -1253,7 +1258,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { bool nxrrset = false; bool stale = false; #ifdef HAVE_LIBXML2 - xmlTextWriterPtr writer; + void *writer; int xmlrc; #endif #ifdef HAVE_JSON_C @@ -1337,7 +1342,7 @@ opcodestat_dump(dns_opcode_t code, uint64_t val, void *arg) { char codebuf[64]; stats_dumparg_t *dumparg = arg; #ifdef HAVE_LIBXML2 - xmlTextWriterPtr writer; + void *writer; int xmlrc; #endif #ifdef HAVE_JSON_C @@ -1394,7 +1399,7 @@ rcodestat_dump(dns_rcode_t code, uint64_t val, void *arg) { char codebuf[64]; stats_dumparg_t *dumparg = arg; #ifdef HAVE_LIBXML2 - xmlTextWriterPtr writer; + void *writer; int xmlrc; #endif #ifdef HAVE_JSON_C diff --git a/bin/nsupdate/Makefile.in b/bin/nsupdate/Makefile.in index 4c7515a456..9d4c4fd1e0 100644 --- a/bin/nsupdate/Makefile.in +++ b/bin/nsupdate/Makefile.in @@ -28,8 +28,8 @@ CWARNINGS = DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ IRSLIBS = ../../lib/irs/libirs.@A@ diff --git a/bin/pkcs11/Makefile.in b/bin/pkcs11/Makefile.in index 11556dcb02..060ae4d6e9 100644 --- a/bin/pkcs11/Makefile.in +++ b/bin/pkcs11/Makefile.in @@ -17,7 +17,7 @@ CINCLUDES = ${ISC_INCLUDES} @JSON_C_CFLAGS@ CDEFINES = -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../../lib/isc/libisc.@A@ diff --git a/bin/plugins/Makefile.in b/bin/plugins/Makefile.in index 00ceb46755..f9d10f281b 100644 --- a/bin/plugins/Makefile.in +++ b/bin/plugins/Makefile.in @@ -19,7 +19,7 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \ DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} NSLIBS = ../../lib/ns/libns.@A@ LIBS = diff --git a/bin/rndc/Makefile.in b/bin/rndc/Makefile.in index 3e453ea140..60d162eeb5 100644 --- a/bin/rndc/Makefile.in +++ b/bin/rndc/Makefile.in @@ -23,8 +23,8 @@ CWARNINGS = ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCCLIBS = ../../lib/isccc/libisccc.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index b35b0ecc17..5a88c0a453 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -21,8 +21,8 @@ CWARNINGS = BACKTRACECFLAGS = @BACKTRACECFLAGS@ DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ DNSDEPLIBS = ../../lib/dns/libdns.@A@ diff --git a/bin/tests/optional/Makefile.in b/bin/tests/optional/Makefile.in index e5eeaca807..0ea2850588 100644 --- a/bin/tests/optional/Makefile.in +++ b/bin/tests/optional/Makefile.in @@ -23,8 +23,8 @@ BACKTRACECFLAGS = @BACKTRACECFLAGS@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCCFGLIBS = ../../../lib/isccfg/libisccfg.@A@ DNSDEPLIBS = ../../../lib/dns/libdns.@A@ diff --git a/bin/tests/pkcs11/Makefile.in b/bin/tests/pkcs11/Makefile.in index 848816292e..012d1f52b9 100644 --- a/bin/tests/pkcs11/Makefile.in +++ b/bin/tests/pkcs11/Makefile.in @@ -16,7 +16,7 @@ top_srcdir = @top_srcdir@ CINCLUDES = ${ISC_INCLUDES} CDEFINES = -ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} LIBS = ${ISCLIBS} @LIBS@ diff --git a/bin/tests/pkcs11/benchmarks/Makefile.in b/bin/tests/pkcs11/benchmarks/Makefile.in index 94ebff48fb..99617ffe56 100644 --- a/bin/tests/pkcs11/benchmarks/Makefile.in +++ b/bin/tests/pkcs11/benchmarks/Makefile.in @@ -16,7 +16,7 @@ top_srcdir = @top_srcdir@ CINCLUDES = ${ISC_INCLUDES} CDEFINES = -ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} LIBS = ${ISCLIBS} @LIBS@ diff --git a/bin/tests/system/Makefile.in b/bin/tests/system/Makefile.in index 21c92fff27..73be90eb82 100644 --- a/bin/tests/system/Makefile.in +++ b/bin/tests/system/Makefile.in @@ -23,7 +23,7 @@ CDEFINES = @USE_GSSAPI@ @CONTRIB_DLZ@ CWARNINGS = DNSLIBS = -ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSDEPLIBS = ISCDEPLIBS = diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index ff48313fbb..818661062b 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -111,7 +111,8 @@ PYTHON=@PYTHON@ # # Determine if we support various optional features. # -HAVEXMLSTATS=@XMLSTATS@ +LIBXML2_LIBS="@LIBXML2_LIBS@" +HAVEXMLSTATS=${LIBXML2_LIBS:+1} JSON_C_LIBS="@JSON_C_LIBS@" HAVEJSONSTATS=${JSON_C_LIBS:+1} ZLIB=@ZLIB@ diff --git a/bin/tests/system/dyndb/driver/Makefile.in b/bin/tests/system/dyndb/driver/Makefile.in index 7d4922a9fe..510bceaf18 100644 --- a/bin/tests/system/dyndb/driver/Makefile.in +++ b/bin/tests/system/dyndb/driver/Makefile.in @@ -19,7 +19,7 @@ CDEFINES = CWARNINGS = DNSLIBS = ../../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCLIBS = ../../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSDEPLIBS = ../../../../../lib/dns/libdns.@A@ ISCDEPLIBS = ../../../../../lib/isc/libisc.@A@ diff --git a/bin/tests/system/pipelined/Makefile.in b/bin/tests/system/pipelined/Makefile.in index 25ac24fbc1..296e0ef624 100644 --- a/bin/tests/system/pipelined/Makefile.in +++ b/bin/tests/system/pipelined/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = CWARNINGS = DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ ISCDEPLIBS = ../../../../lib/isc/libisc.@A@ diff --git a/bin/tests/system/rndc/Makefile.in b/bin/tests/system/rndc/Makefile.in index e2fb4464e4..dc85d978b7 100644 --- a/bin/tests/system/rndc/Makefile.in +++ b/bin/tests/system/rndc/Makefile.in @@ -20,7 +20,7 @@ CINCLUDES = ${ISC_INCLUDES} CDEFINES = CWARNINGS = -ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSDEPLIBS = ISCDEPLIBS = ../../../../lib/isc/libisc.@A@ diff --git a/bin/tests/system/rpz/Makefile.in b/bin/tests/system/rpz/Makefile.in index d7835884da..17460169dc 100644 --- a/bin/tests/system/rpz/Makefile.in +++ b/bin/tests/system/rpz/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = CWARNINGS = DNSLIBS = -ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSDEPLIBS = ISCDEPLIBS = ../../../../lib/isc/libisc.@A@ diff --git a/bin/tests/system/rsabigexponent/Makefile.in b/bin/tests/system/rsabigexponent/Makefile.in index dd0f71b4c6..251b3c55ef 100644 --- a/bin/tests/system/rsabigexponent/Makefile.in +++ b/bin/tests/system/rsabigexponent/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = CWARNINGS = DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ ISCDEPLIBS = ../../../../lib/isc/libisc.@A@ diff --git a/bin/tests/system/tkey/Makefile.in b/bin/tests/system/tkey/Makefile.in index c7e2330e8f..e95da42895 100644 --- a/bin/tests/system/tkey/Makefile.in +++ b/bin/tests/system/tkey/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = CWARNINGS = DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ -ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ ISCDEPLIBS = ../../../../lib/isc/libisc.@A@ diff --git a/bin/tools/Makefile.in b/bin/tools/Makefile.in index c2f8c16b67..f3127ed754 100644 --- a/bin/tools/Makefile.in +++ b/bin/tools/Makefile.in @@ -23,8 +23,8 @@ CWARNINGS = DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ DNSDEPLIBS = ../../lib/dns/libdns.@A@ diff --git a/config.h.in b/config.h.in index 817fd003e5..be91c71e81 100644 --- a/config.h.in +++ b/config.h.in @@ -252,7 +252,7 @@ /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET -/* Define if libxml2 was found */ +/* Use libxml2 library */ #undef HAVE_LIBXML2 /* Define to 1 if you have the header file. */ diff --git a/configure b/configure index 038696f642..e7dce69f64 100755 --- a/configure +++ b/configure @@ -728,7 +728,8 @@ MKDEPCC ZLIB JSON_C_LIBS JSON_C_CFLAGS -XMLSTATS +LIBXML2_LIBS +LIBXML2_CFLAGS NZDTARGETS NZDSRCS NZD_TOOLS @@ -964,6 +965,8 @@ PKG_CONFIG_PATH PKG_CONFIG_LIBDIR OPENSSL_CFLAGS OPENSSL_LIBS +LIBXML2_CFLAGS +LIBXML2_LIBS JSON_C_CFLAGS JSON_C_LIBS LIBIDN2_CFLAGS @@ -1653,7 +1656,8 @@ Optional Packages: Specify path for system-supplied GSSAPI [default=auto] --with-lmdb=PATH build with LMDB library [yes|no|path] - --with-libxml2=PATH build with libxml2 library [yes|no|path] + --with-libxml2 build with libxml2 library [yes|no|auto] (default is + auto) --with-libjson deprecated, use --with-json-c --with-json-c build with json-c library [yes|no|detect] (default is detect) @@ -1710,6 +1714,10 @@ Some influential environment variables: C compiler flags for OPENSSL, overriding pkg-config OPENSSL_LIBS linker flags for OPENSSL, overriding pkg-config + LIBXML2_CFLAGS + C compiler flags for LIBXML2, overriding pkg-config + LIBXML2_LIBS + linker flags for LIBXML2, overriding pkg-config JSON_C_CFLAGS C compiler flags for JSON_C, overriding pkg-config JSON_C_LIBS linker flags for JSON_C, overriding pkg-config @@ -12653,8 +12661,6 @@ fi # # expanded_sysconfdir is needed for replacement in the python utilities # -# TODO: use sed in the Makefile instead of autoconf to do the replacement -# expanded_sysconfdir=`eval echo $sysconfdir` @@ -17029,83 +17035,190 @@ fi # # was --with-libxml2 specified? # -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml2 library" >&5 -$as_echo_n "checking for libxml2 library... " >&6; } # Check whether --with-libxml2 was given. if test "${with_libxml2+set}" = set; then : - withval=$with_libxml2; use_libxml2="$withval" + withval=$with_libxml2; else - use_libxml2="auto" + with_libxml2="auto" fi -case "$use_libxml2" in - no) - DST_LIBXML2_INC="" - ;; - auto|yes) - case X`(xml2-config --version) 2>/dev/null` in - X2.[6789].*) - libxml2_libs=`xml2-config --libs` - libxml2_cflags=`xml2-config --cflags` - ;; - *) - if test "yes" = "$use_libxml2" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +case $with_libxml2 in #( + no) : + ;; #( + auto) : + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 >= 2.6.0" >&5 +$as_echo_n "checking for libxml-2.0 >= 2.6.0... " >&6; } + +if test -n "$LIBXML2_CFLAGS"; then + pkg_cv_LIBXML2_CFLAGS="$LIBXML2_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.6.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBXML2_LIBS"; then + pkg_cv_LIBXML2_LIBS="$LIBXML2_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.6.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "required libxml2 version not available" "$LINENO" 5 - else - libxml2_libs= - libxml2_cflags= - fi - ;; - esac - ;; - *) - if test -f "$use_libxml2/bin/xml2-config" ; then - libxml2_libs=`$use_libxml2/bin/xml2-config --libs` - libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags` - fi - ;; -esac -if test "X$libxml2_libs" != "X" -then - CFLAGS="$CFLAGS $libxml2_cflags" - LIBS="$LIBS $libxml2_libs" - # - # Sanity check xml2-config output. - # - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -return(xmlTextWriterStartElement(NULL, NULL)); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes else - as_fn_error $? "xml2-config returns badness" "$LINENO" 5 + _pkg_short_errors_supported=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + if test $_pkg_short_errors_supported = yes; then + LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0 >= 2.6.0" 2>&1` + else + LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0 >= 2.6.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBXML2_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS + LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } $as_echo "#define HAVE_LIBXML2 1" >>confdefs.h - XMLSTATS=1 +fi ;; #( + yes) : + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 >= 2.6.0" >&5 +$as_echo_n "checking for libxml-2.0 >= 2.6.0... " >&6; } + +if test -n "$LIBXML2_CFLAGS"; then + pkg_cv_LIBXML2_CFLAGS="$LIBXML2_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.6.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBXML2_LIBS"; then + pkg_cv_LIBXML2_LIBS="$LIBXML2_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.6.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried fi + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0 >= 2.6.0" 2>&1` + else + LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0 >= 2.6.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBXML2_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libxml-2.0 >= 2.6.0) were not met: + +$LIBXML2_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBXML2_CFLAGS +and LIBXML2_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBXML2_CFLAGS +and LIBXML2_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS + LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h + +fi ;; #( + *) : + as_fn_error $? "Specifying libxml2 installation path is not supported, adjust PKG_CONFIG_PATH instead" "$LINENO" 5 ;; +esac + # # DEPRECATED # diff --git a/configure.ac b/configure.ac index 4744433c2f..812b0e1b2f 100644 --- a/configure.ac +++ b/configure.ac @@ -1260,58 +1260,19 @@ AC_SUBST(NZDTARGETS) # # was --with-libxml2 specified? # -AC_MSG_CHECKING(for libxml2 library) -AC_ARG_WITH(libxml2, - AS_HELP_STRING([--with-libxml2[=PATH]], - [build with libxml2 library [yes|no|path]]), - use_libxml2="$withval", use_libxml2="auto") +AC_ARG_WITH([libxml2], + [AS_HELP_STRING([--with-libxml2], + [build with libxml2 library [yes|no|auto] (default is auto)])], + [], [with_libxml2="auto"]) -case "$use_libxml2" in - no) - DST_LIBXML2_INC="" - ;; - auto|yes) - case X`(xml2-config --version) 2>/dev/null` in - X2.[[6789]].*) - libxml2_libs=`xml2-config --libs` - libxml2_cflags=`xml2-config --cflags` - ;; - *) - if test "yes" = "$use_libxml2" ; then - AC_MSG_RESULT(no) - AC_MSG_ERROR(required libxml2 version not available) - else - libxml2_libs= - libxml2_cflags= - fi - ;; - esac - ;; - *) - if test -f "$use_libxml2/bin/xml2-config" ; then - libxml2_libs=`$use_libxml2/bin/xml2-config --libs` - libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags` - fi - ;; -esac - -if test "X$libxml2_libs" != "X" -then - CFLAGS="$CFLAGS $libxml2_cflags" - LIBS="$LIBS $libxml2_libs" - # - # Sanity check xml2-config output. - # - AC_TRY_LINK([#include ], - [return(xmlTextWriterStartElement(NULL, NULL));], - AC_MSG_RESULT(yes), - AC_MSG_ERROR(xml2-config returns badness)) - AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found]) - XMLSTATS=1 -else - AC_MSG_RESULT(no) -fi -AC_SUBST(XMLSTATS) +AS_CASE([$with_libxml2], + [no],[], + [auto],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0], + [AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])], + [:])], + [yes],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0], + [AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])])], + [AC_MSG_ERROR([Specifying libxml2 installation path is not supported, adjust PKG_CONFIG_PATH instead])]) # # DEPRECATED diff --git a/contrib/dlz/bin/dlzbdb/Makefile.in b/contrib/dlz/bin/dlzbdb/Makefile.in index 0dcf434cff..f6de035197 100644 --- a/contrib/dlz/bin/dlzbdb/Makefile.in +++ b/contrib/dlz/bin/dlzbdb/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = @CONTRIB_DLZ@ CWARNINGS = DLZLIBS = @DLZ_DRIVER_LIBS@ -ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DEPLIBS = ${ISCDEPLIBS} diff --git a/fuzz/Makefile.in b/fuzz/Makefile.in index 6bc7dd7de8..0ce63817eb 100644 --- a/fuzz/Makefile.in +++ b/fuzz/Makefile.in @@ -9,7 +9,7 @@ CINCLUDES = -I. -I.. ${DNS_INCLUDES} ${ISC_INCLUDES} \ @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@ CDEFINES = -DFUZZDIR=\"$(abs_srcdir)\" -ISCLIBS = ../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../lib/isc/libisc.@A@ DNSLIBS = ../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../lib/dns/libdns.@A@ diff --git a/lib/bind9/Makefile.in b/lib/bind9/Makefile.in index ff6069ccde..759417df9a 100644 --- a/lib/bind9/Makefile.in +++ b/lib/bind9/Makefile.in @@ -23,7 +23,7 @@ CINCLUDES = -I. ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \ CDEFINES = CWARNINGS = -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ NSLIBS = ../../lib/ns/libns.@A@ diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index 55b354bcd8..0142658cc0 100644 --- a/lib/dns/Makefile.in +++ b/lib/dns/Makefile.in @@ -27,13 +27,14 @@ VERSION=@BIND9_VERSION@ USE_ISC_SPNEGO = @USE_ISC_SPNEGO@ CINCLUDES = -I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \ - ${ISC_INCLUDES} @OPENSSL_INCLUDES@ @DST_GSSAPI_INC@ @JSON_C_CFLAGS@ + ${ISC_INCLUDES} @OPENSSL_INCLUDES@ @DST_GSSAPI_INC@ @JSON_C_CFLAGS@ \ + ${LIBXML2_CFLAGS} CDEFINES = @USE_GSSAPI@ ${USE_ISC_SPNEGO} CWARNINGS = -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../../lib/isc/libisc.@A@ diff --git a/lib/dns/cache.c b/lib/dns/cache.c index c795c5a057..034cbe72bd 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -40,6 +39,11 @@ #include #include +#ifdef HAVE_LIBXML2 +#include +#define ISC_XMLCHAR (const xmlChar *) +#endif /* HAVE_LIBXML2 */ + #include "rbtdb.h" #define CACHE_MAGIC ISC_MAGIC('$', '$', '$', '$') @@ -1355,10 +1359,11 @@ error: } int -dns_cache_renderxml(dns_cache_t *cache, xmlTextWriterPtr writer) { +dns_cache_renderxml(dns_cache_t *cache, void *writer0) { int indices[dns_cachestatscounter_max]; uint64_t values[dns_cachestatscounter_max]; int xmlrc; + xmlTextWriterPtr writer = (xmlTextWriterPtr)writer0; REQUIRE(VALID_CACHE(cache)); diff --git a/lib/dns/include/dns/cache.h b/lib/dns/include/dns/cache.h index 68667c7fe1..dfcbabbff9 100644 --- a/lib/dns/include/dns/cache.h +++ b/lib/dns/include/dns/cache.h @@ -321,7 +321,7 @@ dns_cache_updatestats(dns_cache_t *cache, isc_result_t result); #ifdef HAVE_LIBXML2 int -dns_cache_renderxml(dns_cache_t *cache, xmlTextWriterPtr writer); +dns_cache_renderxml(dns_cache_t *cache, void *writer0); /* * Render cache statistics and status in XML for 'writer'. */ diff --git a/lib/dns/tests/Makefile.in b/lib/dns/tests/Makefile.in index ec949e3d21..f2c0a115c4 100644 --- a/lib/dns/tests/Makefile.in +++ b/lib/dns/tests/Makefile.in @@ -19,7 +19,7 @@ CINCLUDES = -I. -Iinclude ${DNS_INCLUDES} ${ISC_INCLUDES} \ @OPENSSL_INCLUDES@ @CMOCKA_CFLAGS@ @JSON_C_CFLAGS@ CDEFINES = -DTESTS="\"${top_builddir}/lib/dns/tests/\"" -ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../../isc/libisc.@A@ DNSLIBS = ../libdns.@A@ @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../libdns.@A@ diff --git a/lib/dns/tests/master_test.c b/lib/dns/tests/master_test.c index e6ae11281e..73a0e64be2 100644 --- a/lib/dns/tests/master_test.c +++ b/lib/dns/tests/master_test.c @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/lib/irs/tests/Makefile.in b/lib/irs/tests/Makefile.in index bc7df554cc..c800afebd3 100644 --- a/lib/irs/tests/Makefile.in +++ b/lib/irs/tests/Makefile.in @@ -22,7 +22,7 @@ CFGLIBS = ../../isccfg/libisccfg.@A@ CFGDEPLIBS = ../../isccfg/libisccfg.@A@ DNSLIBS = ../../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../../dns/libdns.@A@ -ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../../isc/libisc.@A@ IRSLIBS = ../libirs.@A@ IRSDEPLIBS = ../libirs.@A@ diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 07ad791be0..49e0854e1a 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -20,7 +20,8 @@ VERSION=@BIND9_VERSION@ CINCLUDES = -I${srcdir}/unix/include \ -I${srcdir}/pthreads/include \ -I./include \ - -I${srcdir}/include ${DNS_INCLUDES} @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@ + -I${srcdir}/include ${DNS_INCLUDES} @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@ \ + ${LIBXML2_CFLAGS} CDEFINES = CWARNINGS = diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in index 2e1cb4ab22..b431437742 100644 --- a/lib/isc/include/isc/Makefile.in +++ b/lib/isc/include/isc/Makefile.in @@ -33,8 +33,7 @@ HEADERS = aes.h app.h assertions.h atomic.h backtrace.h \ region.h resource.h result.h resultclass.h rwlock.h \ safe.h serial.h siphash.h sockaddr.h socket.h \ stats.h stdio.h strerr.h string.h symtab.h \ - task.h taskpool.h timer.h tm.h types.h util.h version.h \ - xml.h + task.h taskpool.h timer.h tm.h types.h util.h version.h SUBDIRS = TARGETS = diff --git a/lib/isc/include/isc/mem.h b/lib/isc/include/isc/mem.h index ac757729c0..0fdd0f267f 100644 --- a/lib/isc/include/isc/mem.h +++ b/lib/isc/include/isc/mem.h @@ -22,7 +22,6 @@ #include #include #include -#include ISC_LANG_BEGINDECLS @@ -467,7 +466,7 @@ isc_mem_gettag(isc_mem_t *ctx); #ifdef HAVE_LIBXML2 int -isc_mem_renderxml(xmlTextWriterPtr writer); +isc_mem_renderxml(void *writer0); /*%< * Render all contexts' statistics and status in XML for writer. */ diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index db765b9b79..b09a757f7a 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -60,7 +60,6 @@ #include #include #include -#include ISC_LANG_BEGINDECLS @@ -1017,7 +1016,7 @@ isc_socket_hasreuseport(void); #ifdef HAVE_LIBXML2 int -isc_socketmgr_renderxml(isc_socketmgr_t *mgr, xmlTextWriterPtr writer); +isc_socketmgr_renderxml(isc_socketmgr_t *mgr, void *writer0); /*%< * Render internal statistics and other state into the XML document. */ diff --git a/lib/isc/include/isc/task.h b/lib/isc/include/isc/task.h index ebb8640507..9e75638948 100644 --- a/lib/isc/include/isc/task.h +++ b/lib/isc/include/isc/task.h @@ -80,7 +80,6 @@ #include #include #include -#include #define ISC_TASKEVENT_FIRSTEVENT (ISC_EVENTCLASS_TASK + 0) #define ISC_TASKEVENT_SHUTDOWN (ISC_EVENTCLASS_TASK + 1) @@ -763,7 +762,7 @@ isc_taskmgr_excltask(isc_taskmgr_t *mgr, isc_task_t **taskp); #ifdef HAVE_LIBXML2 int -isc_taskmgr_renderxml(isc_taskmgr_t *mgr, xmlTextWriterPtr writer); +isc_taskmgr_renderxml(isc_taskmgr_t *mgr, void *writer0); #endif #ifdef HAVE_JSON_C diff --git a/lib/isc/include/isc/xml.h b/lib/isc/include/isc/xml.h deleted file mode 100644 index a091d30103..0000000000 --- a/lib/isc/include/isc/xml.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * 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 http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_XML_H -#define ISC_XML_H 1 - -/* - * This file is here mostly to make it easy to add additional libxml header - * files as needed across all the users of this file. Rather than place - * these libxml includes in each file, one include makes it easy to handle - * the ifdef as well as adding the ability to add additional functions - * which may be useful. - */ - -#ifdef HAVE_LIBXML2 -#include -#include -#endif - -#define ISC_XMLCHAR (const xmlChar *) - -#define ISC_XML_RENDERCONFIG 0x00000001 /* render config data */ -#define ISC_XML_RENDERSTATS 0x00000002 /* render stats */ -#define ISC_XML_RENDERALL 0x000000ff /* render everything */ - -#endif /* ISC_XML_H */ diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 66be785057..962ef4a4bc 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -31,7 +31,11 @@ #include #include #include -#include + +#ifdef HAVE_LIBXML2 +#include +#define ISC_XMLCHAR (const xmlChar *) +#endif /* HAVE_LIBXML2 */ #include "mem_p.h" @@ -2141,11 +2145,12 @@ xml_renderctx(isc__mem_t *ctx, summarystat_t *summary, } int -isc_mem_renderxml(xmlTextWriterPtr writer) { +isc_mem_renderxml(void *writer0) { isc__mem_t *ctx; summarystat_t summary; uint64_t lost; int xmlrc; + xmlTextWriterPtr writer = (xmlTextWriterPtr)writer0; memset(&summary, 0, sizeof(summary)); diff --git a/lib/isc/task.c b/lib/isc/task.c index 7bfce3be63..da391e67af 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -34,7 +34,11 @@ #include #include #include -#include + +#ifdef HAVE_LIBXML2 +#include +#define ISC_XMLCHAR (const xmlChar *) +#endif /* HAVE_LIBXML2 */ #ifdef OPENSSL_LEAKS #include @@ -1666,10 +1670,11 @@ isc_task_exiting(isc_task_t *t) { #ifdef HAVE_LIBXML2 #define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0) int -isc_taskmgr_renderxml(isc_taskmgr_t *mgr0, xmlTextWriterPtr writer) { +isc_taskmgr_renderxml(isc_taskmgr_t *mgr0, void *writer0) { isc__taskmgr_t *mgr = (isc__taskmgr_t *)mgr0; isc__task_t *task = NULL; int xmlrc; + xmlTextWriterPtr writer = (xmlTextWriterPtr)writer0; LOCK(&mgr->lock); diff --git a/lib/isc/tests/Makefile.in b/lib/isc/tests/Makefile.in index 9b8ef1bb38..83f5a40a16 100644 --- a/lib/isc/tests/Makefile.in +++ b/lib/isc/tests/Makefile.in @@ -18,7 +18,7 @@ VERSION=@BIND9_VERSION@ CINCLUDES = -I. -Iinclude ${ISC_INCLUDES} @OPENSSL_INCLUDES@ @CMOCKA_CFLAGS@ @JSON_C_CFLAGS@ CDEFINES = -DTESTS="\"${top_builddir}/lib/isc/tests/\"" -ISCLIBS = ../libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../libisc.@A@ LIBS = @LIBS@ @CMOCKA_LIBS@ @JSON_C_LIBS@ diff --git a/lib/isc/unix/Makefile.in b/lib/isc/unix/Makefile.in index c138a60e42..f02a0109f7 100644 --- a/lib/isc/unix/Makefile.in +++ b/lib/isc/unix/Makefile.in @@ -15,7 +15,8 @@ CINCLUDES = -I${srcdir}/include \ -I${srcdir}/../pthreads/include \ -I../include \ -I${srcdir}/../include \ - -I${srcdir}/.. @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@ + -I${srcdir}/.. @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@ \ + ${LIBXML2_CFLAGS} CDEFINES = CWARNINGS = diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index d0e43c15be..3befd28724 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -58,7 +58,6 @@ #include #include #include -#include #ifdef ISC_PLATFORM_HAVESYSUNH #include @@ -87,6 +86,11 @@ #include #endif +#ifdef HAVE_LIBXML2 +#include +#define ISC_XMLCHAR (const xmlChar *) +#endif /* HAVE_LIBXML2 */ + /*% * Choose the most preferable multiplex method. */ @@ -5412,13 +5416,14 @@ _socktype(isc_sockettype_t type) #ifdef HAVE_LIBXML2 #define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0) int -isc_socketmgr_renderxml(isc_socketmgr_t *mgr0, xmlTextWriterPtr writer) { +isc_socketmgr_renderxml(isc_socketmgr_t *mgr0, void *writer0) { isc__socketmgr_t *mgr = (isc__socketmgr_t *)mgr0; isc__socket_t *sock = NULL; char peerbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_t addr; socklen_t len; int xmlrc; + xmlTextWriterPtr writer = (xmlTextWriterPtr)writer0; LOCK(&mgr->lock); diff --git a/lib/isc/win32/libisc.vcxproj.filters.in b/lib/isc/win32/libisc.vcxproj.filters.in index 95f5f2bdd3..c84e27c76a 100644 --- a/lib/isc/win32/libisc.vcxproj.filters.in +++ b/lib/isc/win32/libisc.vcxproj.filters.in @@ -260,9 +260,6 @@ Library Header Files - - Library Header Files - @IF PKCS11 Library Header Files diff --git a/lib/isc/win32/libisc.vcxproj.in b/lib/isc/win32/libisc.vcxproj.in index ee67ba54a1..0d5aa96709 100644 --- a/lib/isc/win32/libisc.vcxproj.in +++ b/lib/isc/win32/libisc.vcxproj.in @@ -373,7 +373,6 @@ copy InstallFiles ..\Build\Release\ - @IF PKCS11 diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index 053edba775..b1e26c33d3 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -68,6 +68,11 @@ #include +#ifdef HAVE_LIBXML2 +#include +#define ISC_XMLCHAR (const xmlChar *) +#endif /* HAVE_LIBXML2 */ + #include "errno2result.h" /* @@ -3630,13 +3635,14 @@ _socktype(isc_sockettype_t type) { #define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0) int -isc_socketmgr_renderxml(isc_socketmgr_t *mgr, xmlTextWriterPtr writer) +isc_socketmgr_renderxml(isc_socketmgr_t *mgr, void *writer0) { isc_socket_t *sock = NULL; char peerbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_t addr; socklen_t len; int xmlrc; + xmlTextWriterPtr writer = (xmlTextWriterPtr)writer0; LOCK(&mgr->lock); diff --git a/lib/isccc/Makefile.in b/lib/isccc/Makefile.in index cad75e2aa0..3ce1a2d26b 100644 --- a/lib/isccc/Makefile.in +++ b/lib/isccc/Makefile.in @@ -23,7 +23,7 @@ CINCLUDES = -I. ${DNS_INCLUDES} ${ISC_INCLUDES} \ CDEFINES = CWARNINGS = -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCCCLIBS = ../../lib/isccc/libisccc.@A@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ diff --git a/lib/isccc/tests/Makefile.in b/lib/isccc/tests/Makefile.in index c3029edd19..4519652cc8 100644 --- a/lib/isccc/tests/Makefile.in +++ b/lib/isccc/tests/Makefile.in @@ -22,7 +22,7 @@ VERSION=@BIND9_VERSION@ CINCLUDES = -I. -Iinclude ${ISCCC_INCLUDES} ${ISC_INCLUDES} @CMOCKA_CFLAGS@ @JSON_C_CFLAGS@ CDEFINES = -ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../../isc/libisc.@A@ ISCCCLIBS = ../libisccc.@A@ ISCCCDEPLIBS = ../libisccc.@A@ diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in index 9d00b11990..8e573840ed 100644 --- a/lib/isccfg/Makefile.in +++ b/lib/isccfg/Makefile.in @@ -22,7 +22,7 @@ CINCLUDES = -I. ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} @JSON_C_CFLAG CDEFINES = CWARNINGS = -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../../lib/cfg/libisccfg.@A@ diff --git a/lib/isccfg/tests/Makefile.in b/lib/isccfg/tests/Makefile.in index abadec2a63..c8a55a5969 100644 --- a/lib/isccfg/tests/Makefile.in +++ b/lib/isccfg/tests/Makefile.in @@ -20,7 +20,7 @@ CINCLUDES = -I. -Iinclude \ @OPENSSL_INCLUDES@ @CMOCKA_CFLAGS@ @JSON_C_CFLAGS@ CDEFINES = -DTESTS="\"${top_builddir}/lib/dns/tests/\"" -ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../../isc/libisc.@A@ DNSLIBS = ../../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../../dns/libdns.@A@ diff --git a/lib/ns/Makefile.in b/lib/ns/Makefile.in index 9ed1557387..8230b9ffd1 100644 --- a/lib/ns/Makefile.in +++ b/lib/ns/Makefile.in @@ -32,7 +32,7 @@ CDEFINES = -DNAMED_PLUGINDIR=\"${plugindir}\" CWARNINGS = -ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../../lib/isc/libisc.@A@ diff --git a/lib/ns/tests/Makefile.in b/lib/ns/tests/Makefile.in index b12c7cea1e..f48414d28e 100644 --- a/lib/ns/tests/Makefile.in +++ b/lib/ns/tests/Makefile.in @@ -19,7 +19,7 @@ CINCLUDES = -I. -Iinclude ${NS_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \ @OPENSSL_INCLUDES@ @CMOCKA_CFLAGS@ @JSON_C_CFLAGS@ CDEFINES = -DTESTS="\"${top_builddir}/lib/ns/tests/\"" -DNAMED_PLUGINDIR=\"${plugindir}\" -ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} ISCDEPLIBS = ../../isc/libisc.@A@ DNSLIBS = ../../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../../dns/libdns.@A@ diff --git a/lib/samples/Makefile-postinstall.in b/lib/samples/Makefile-postinstall.in index 142ffc3fbd..8992ced646 100644 --- a/lib/samples/Makefile-postinstall.in +++ b/lib/samples/Makefile-postinstall.in @@ -15,7 +15,7 @@ CDEFINES = CWARNINGS = DNSLIBS = -ldns @DNS_CRYPTO_LIBS@ -ISCLIBS = -lisc @OPENSSL_LIBS@ +ISCLIBS = -lisc @OPENSSL_LIBS@ @LIBXML2_LIBS@ ISCCFGLIBS = -lisccfg IRSLIBS = -lirs diff --git a/lib/samples/Makefile.in b/lib/samples/Makefile.in index 839607665c..f39bfedb63 100644 --- a/lib/samples/Makefile.in +++ b/lib/samples/Makefile.in @@ -24,7 +24,7 @@ CDEFINES = -DVERSION=\"${VERSION}\" \ -DSYSCONFDIR=\"${sysconfdir}\" CWARNINGS = -ISCLIBS = ../isc/libisc.@A@ @OPENSSL_LIBS@ +ISCLIBS = ../isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS} DNSLIBS = ../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../isccfg/libisccfg.@A@ IRSLIBS = ../irs/libirs.@A@ diff --git a/make/rules.in b/make/rules.in index 03e1fde18a..2347c86089 100644 --- a/make/rules.in +++ b/make/rules.in @@ -120,6 +120,9 @@ LFS_CFLAGS = @LFS_CFLAGS@ LFS_LDFLAGS = @LFS_LDFLAGS@ LFS_LIBS = @LFS_LIBS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ + .SUFFIXES: .SUFFIXES: .c .@O@ diff --git a/util/copyrights b/util/copyrights index 0161d7c0e0..6b46406881 100644 --- a/util/copyrights +++ b/util/copyrights @@ -2232,7 +2232,6 @@ ./lib/isc/include/isc/types.h C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2012,2013,2014,2016,2017,2018,2019 ./lib/isc/include/isc/util.h C 1998,1999,2000,2001,2004,2005,2006,2007,2010,2011,2012,2015,2016,2017,2018,2019 ./lib/isc/include/isc/version.h C 2001,2004,2005,2006,2007,2016,2018,2019 -./lib/isc/include/isc/xml.h C 2006,2007,2016,2018,2019 ./lib/isc/include/pk11/constants.h C 2014,2016,2017,2018,2019 ./lib/isc/include/pk11/internal.h C 2014,2016,2018,2019 ./lib/isc/include/pk11/pk11.h C 2014,2016,2018,2019