Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dns/bind/files/, net-dns/bind/
Date: Tue, 15 Sep 2020 17:58:59
Message-Id: 1600192653.afebccb91e5cb5df6fbb95523be96bdc60b430de.chutzpah@gentoo
1 commit: afebccb91e5cb5df6fbb95523be96bdc60b430de
2 Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
3 AuthorDate: Tue Sep 15 17:57:18 2020 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 15 17:57:33 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=afebccb9
7
8 net-dns/bind-9.16.6-r1: Revbump, pull in patch for bug #741162
9
10 Closes: https://bugs.gentoo.org/741162
11 Copyright: Sony Interactive Entertainment Inc.
12 Package-Manager: Portage-3.0.7, Repoman-3.0.1
13 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
14
15 net-dns/bind/bind-9.16.6-r1.ebuild | 379 ++++++++++++++++++++++++
16 net-dns/bind/files/bind-9.16.6-bug-741162.patch | 31 ++
17 2 files changed, 410 insertions(+)
18
19 diff --git a/net-dns/bind/bind-9.16.6-r1.ebuild b/net-dns/bind/bind-9.16.6-r1.ebuild
20 new file mode 100644
21 index 00000000000..4cce9cdc72a
22 --- /dev/null
23 +++ b/net-dns/bind/bind-9.16.6-r1.ebuild
24 @@ -0,0 +1,379 @@
25 +# Copyright 1999-2020 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +# Re dlz/mysql and threads, needs to be verified..
29 +# MySQL uses thread local storage in its C api. Thus MySQL
30 +# requires that each thread of an application execute a MySQL
31 +# thread initialization to setup the thread local storage.
32 +# This is impossible to do safely while staying within the DLZ
33 +# driver API. This is a limitation caused by MySQL, and not the DLZ API.
34 +# Because of this BIND MUST only run with a single thread when
35 +# using the MySQL driver.
36 +
37 +EAPI=7
38 +
39 +PYTHON_COMPAT=( python3_{6..9} )
40 +
41 +inherit python-r1 eutils autotools toolchain-funcs flag-o-matic multilib db-use systemd
42 +
43 +MY_PV="${PV/_p/-P}"
44 +MY_PV="${MY_PV/_rc/rc}"
45 +MY_P="${PN}-${MY_PV}"
46 +
47 +SDB_LDAP_VER="1.1.0-fc14"
48 +
49 +RRL_PV="${MY_PV}"
50 +
51 +# SDB-LDAP: http://bind9-ldap.bayour.com/
52 +
53 +DESCRIPTION="Berkeley Internet Name Domain - Name Server"
54 +HOMEPAGE="https://www.isc.org/software/bind"
55 +SRC_URI="https://downloads.isc.org/isc/bind9/${PV}/${P}.tar.xz
56 + doc? ( mirror://gentoo/dyndns-samples.tbz2 )"
57 +
58 +LICENSE="Apache-2.0 BSD BSD-2 GPL-2 HPND ISC MPL-2.0"
59 +SLOT="0"
60 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
61 +# -berkdb by default re bug 602682
62 +IUSE="-berkdb +caps +dlz dnstap doc dnsrps fixed-rrset geoip geoip2 gssapi
63 +json ldap libressl lmdb mysql odbc postgres python selinux static-libs
64 +urandom xml +zlib"
65 +# sdb-ldap - patch broken
66 +# no PKCS11 currently as it requires OpenSSL to be patched, also see bug 409687
67 +
68 +REQUIRED_USE="
69 + ?? ( geoip geoip2 )
70 + postgres? ( dlz )
71 + berkdb? ( dlz )
72 + mysql? ( dlz )
73 + odbc? ( dlz )
74 + ldap? ( dlz )
75 + dnsrps? ( dlz )
76 + python? ( ${PYTHON_REQUIRED_USE} )
77 +"
78 +
79 +DEPEND="
80 + acct-group/named
81 + acct-user/named
82 + !libressl? ( dev-libs/openssl:=[-bindist] )
83 + libressl? ( dev-libs/libressl:= )
84 + mysql? ( dev-db/mysql-connector-c:0= )
85 + odbc? ( >=dev-db/unixODBC-2.2.6 )
86 + ldap? ( net-nds/openldap )
87 + postgres? ( dev-db/postgresql:= )
88 + caps? ( >=sys-libs/libcap-2.1.0 )
89 + xml? ( dev-libs/libxml2 )
90 + geoip? ( >=dev-libs/geoip-1.4.6 )
91 + geoip2? ( dev-libs/libmaxminddb )
92 + gssapi? ( virtual/krb5 )
93 + json? ( dev-libs/json-c:= )
94 + lmdb? ( dev-db/lmdb )
95 + zlib? ( sys-libs/zlib )
96 + dnstap? ( dev-libs/fstrm dev-libs/protobuf-c )
97 + python? (
98 + ${PYTHON_DEPS}
99 + dev-python/ply[${PYTHON_USEDEP}]
100 + )
101 + dev-libs/libuv:=
102 +"
103 +
104 +RDEPEND="${DEPEND}
105 + selinux? ( sec-policy/selinux-bind )
106 + sys-process/psmisc"
107 +
108 +S="${WORKDIR}/${MY_P}"
109 +
110 +PATCHES=(
111 + # should fix https://bugs.gentoo.org/741162 taken from:
112 + # https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/4073
113 + "${FILESDIR}/bind-9.16.6-bug-741162.patch"
114 +)
115 +
116 +# bug 479092, requires networking
117 +# bug 710840, cmocka fails LDFLAGS='-Wl,-O1'
118 +#RESTRICT="test"
119 +
120 +src_prepare() {
121 + default
122 +
123 + # should be installed by bind-tools
124 + sed -i -r -e "s:(nsupdate|dig|delv) ::g" bin/Makefile.in || die
125 +
126 + # Disable tests for now, bug 406399
127 + sed -i '/^SUBDIRS/s:tests::' bin/Makefile.in lib/Makefile.in || die
128 +
129 + # bug #220361
130 + rm aclocal.m4 || die
131 + rm -rf libtool.m4/ || die
132 + eautoreconf
133 +
134 + use python && python_copy_sources
135 +}
136 +
137 +src_configure() {
138 + bind_configure --without-python
139 + use python && python_foreach_impl python_configure
140 +}
141 +
142 +bind_configure() {
143 + local myeconfargs=(
144 + AR="$(type -P $(tc-getAR))"
145 + --prefix="${EPREFIX}"/usr
146 + --sysconfdir=/etc/bind
147 + --localstatedir=/var
148 + --with-libtool
149 + --enable-full-report
150 + --without-readline
151 + --with-openssl="${EPREFIX}"/usr
152 + --without-cmocka
153 + $(use_enable caps linux-caps)
154 + $(use_enable dnsrps)
155 + $(use_enable dnstap)
156 + $(use_enable fixed-rrset)
157 + # $(use_enable static-libs static)
158 + $(use_with berkdb dlz-bdb)
159 + $(use_with dlz dlopen)
160 + $(use_with dlz dlz-filesystem)
161 + $(use_with dlz dlz-stub)
162 + $(use_with gssapi)
163 + $(use_with json json-c)
164 + $(use_with ldap dlz-ldap)
165 + $(use_with mysql dlz-mysql)
166 + $(use_with odbc dlz-odbc)
167 + $(use_with postgres dlz-postgres)
168 + $(use_with lmdb)
169 + $(use_with xml libxml2)
170 + $(use_with zlib)
171 + "${@}"
172 + )
173 +
174 + use geoip && myeconfargs+=( --enable-geoip )
175 + use geoip2 && myeconfargs+=( --with-maxminddb )
176 +
177 + # bug #158664
178 +# gcc-specs-ssp && replace-flags -O[23s] -O
179 +
180 + # To include db.h from proper path
181 + use berkdb && append-flags "-I$(db_includedir)"
182 +
183 + export BUILD_CC=$(tc-getBUILD_CC)
184 + econf "${myeconfargs[@]}"
185 +
186 + # bug #151839
187 + echo '#undef SO_BSDCOMPAT' >> config.h
188 +}
189 +
190 +python_configure() {
191 + pushd "${BUILD_DIR}" >/dev/null || die
192 + bind_configure --with-python
193 + popd >/dev/null || die
194 +}
195 +
196 +src_compile() {
197 + default
198 + use python && python_foreach_impl python_compile
199 +}
200 +
201 +python_compile() {
202 + pushd "${BUILD_DIR}"/bin/python >/dev/null || die
203 + emake
204 + popd >/dev/null || die
205 +}
206 +
207 +src_install() {
208 + default
209 +
210 + # don't create /var/run
211 + rmdir "${ED}"/var/run || die
212 +
213 + dodoc CHANGES README
214 +
215 + if use doc; then
216 + docinto misc
217 + dodoc -r doc/misc/
218 +
219 + # might a 'html' useflag make sense?
220 + docinto html
221 + dodoc -r doc/arm/
222 +
223 + docinto contrib
224 + dodoc contrib/scripts/{nanny.pl,named-bootconf.sh}
225 +
226 + # some handy-dandy dynamic dns examples
227 + pushd "${ED}"/usr/share/doc/${PF} 1>/dev/null || die
228 + tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
229 + popd 1>/dev/null || die
230 + fi
231 +
232 + insinto /etc/bind
233 + newins "${FILESDIR}"/named.conf-r8 named.conf
234 +
235 + # ftp://ftp.rs.internic.net/domain/named.cache:
236 + insinto /var/bind
237 + newins "${FILESDIR}"/named.cache-r3 named.cache
238 +
239 + insinto /var/bind/pri
240 + newins "${FILESDIR}"/localhost.zone-r3 localhost.zone
241 +
242 + newinitd "${FILESDIR}"/named.init-r13 named
243 + newconfd "${FILESDIR}"/named.confd-r7 named
244 +
245 + newenvd "${FILESDIR}"/10bind.env 10bind
246 +
247 + # Let's get rid of those tools and their manpages since they're provided by bind-tools
248 + rm -f "${ED}"/usr/share/man/man1/{dig,host,nslookup,delv,nsupdate}.1* || die
249 + rm -f "${ED}"/usr/share/man/man8/nsupdate.8* || die
250 + rm -f "${ED}"/usr/bin/{dig,host,nslookup,nsupdate} || die
251 + rm -f "${ED}"/usr/sbin/{dig,host,nslookup,nsupdate} || die
252 + for tool in dsfromkey importkey keyfromlabel keygen \
253 + revoke settime signzone verify; do
254 + rm -f "${ED}"/usr/{,s}bin/dnssec-"${tool}" || die
255 + rm -f "${ED}"/usr/share/man/man8/dnssec-"${tool}".8* || die
256 + done
257 +
258 + # bug 405251, library archives aren't properly handled by --enable/disable-static
259 + if ! use static-libs; then
260 + find "${ED}" -type f -name '*.a' -delete || die
261 + fi
262 +
263 + # bug 405251
264 + find "${ED}" -type f -name '*.la' -delete || die
265 +
266 + use python && python_foreach_impl python_install
267 +
268 + # bug 450406
269 + dosym named.cache /var/bind/root.cache
270 +
271 + dosym ../../var/bind/pri /etc/bind/pri
272 + dosym ../../var/bind/sec /etc/bind/sec
273 + dosym ../../var/bind/dyn /etc/bind/dyn
274 + keepdir /var/bind/{pri,sec,dyn} /var/log/named
275 +
276 + fowners root:named /{etc,var}/bind /var/log/named /var/bind/{sec,pri,dyn}
277 + fowners root:named /var/bind/named.cache /var/bind/pri/localhost.zone /etc/bind/{bind.keys,named.conf}
278 + fperms 0640 /var/bind/named.cache /var/bind/pri/localhost.zone /etc/bind/{bind.keys,named.conf}
279 + fperms 0750 /etc/bind /var/bind/pri
280 + fperms 0770 /var/log/named /var/bind/{,sec,dyn}
281 +
282 + systemd_newunit "${FILESDIR}/named.service-r1" named.service
283 + systemd_dotmpfilesd "${FILESDIR}"/named.conf
284 + exeinto /usr/libexec
285 + doexe "${FILESDIR}/generate-rndc-key.sh"
286 +}
287 +
288 +python_install() {
289 + pushd "${BUILD_DIR}"/bin/python >/dev/null || die
290 + emake DESTDIR="${D}" install
291 + python_scriptinto /usr/sbin
292 + python_doscript dnssec-{checkds,coverage}
293 + python_optimize
294 + popd >/dev/null || die
295 +}
296 +
297 +pkg_postinst() {
298 + if [ ! -f '/etc/bind/rndc.key' ]; then
299 + if use urandom; then
300 + einfo "Using /dev/urandom for generating rndc.key"
301 + /usr/sbin/rndc-confgen -r /dev/urandom -a
302 + echo
303 + else
304 + einfo "Using /dev/random for generating rndc.key"
305 + /usr/sbin/rndc-confgen -a
306 + echo
307 + fi
308 + chown root:named /etc/bind/rndc.key || die
309 + chmod 0640 /etc/bind/rndc.key || die
310 + fi
311 +
312 + einfo
313 + einfo "You can edit /etc/conf.d/named to customize named settings"
314 + einfo
315 + use mysql || use postgres || use ldap && {
316 + elog "If your named depends on MySQL/PostgreSQL or LDAP,"
317 + elog "uncomment the specified rc_named_* lines in your"
318 + elog "/etc/conf.d/named config to ensure they'll start before bind"
319 + einfo
320 + }
321 + einfo "If you'd like to run bind in a chroot AND this is a new"
322 + einfo "install OR your bind doesn't already run in a chroot:"
323 + einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
324 + einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
325 + einfo
326 +
327 + CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
328 + if [[ -n ${CHROOT} ]]; then
329 + elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
330 + elog "To enable the old behaviour (without using mount) uncomment the"
331 + elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
332 + elog "If you decide to use the new/default method, ensure to make backup"
333 + elog "first and merge your existing configs/zones to /etc/bind and"
334 + elog "/var/bind because bind will now mount the needed directories into"
335 + elog "the chroot dir."
336 + fi
337 +}
338 +
339 +pkg_config() {
340 + CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
341 + CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
342 + CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
343 +
344 + if [[ -z "${CHROOT}" ]]; then
345 + eerror "This config script is designed to automate setting up"
346 + eerror "a chrooted bind/named. To do so, please first uncomment"
347 + eerror "and set the CHROOT variable in '/etc/conf.d/named'."
348 + die "Unset CHROOT"
349 + fi
350 + if [[ -d "${CHROOT}" ]]; then
351 + ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
352 + ewarn "To enable the old behaviour (without using mount) uncomment the"
353 + ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
354 + ewarn
355 + ewarn "${CHROOT} already exists... some things might become overridden"
356 + ewarn "press CTRL+C if you don't want to continue"
357 + sleep 10
358 + fi
359 +
360 + echo; einfo "Setting up the chroot directory..."
361 +
362 + mkdir -m 0750 -p ${CHROOT} || die
363 + mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/log,run} || die
364 + mkdir -m 0750 -p ${CHROOT}/etc/bind || die
365 + mkdir -m 0770 -p ${CHROOT}/var/{bind,log/named} ${CHROOT}/run/named/ || die
366 +
367 + chown root:named \
368 + ${CHROOT} \
369 + ${CHROOT}/var/{bind,log/named} \
370 + ${CHROOT}/run/named/ \
371 + ${CHROOT}/etc/bind \
372 + || die
373 +
374 + mknod ${CHROOT}/dev/null c 1 3 || die
375 + chmod 0666 ${CHROOT}/dev/null || die
376 +
377 + mknod ${CHROOT}/dev/zero c 1 5 || die
378 + chmod 0666 ${CHROOT}/dev/zero || die
379 +
380 + if use urandom; then
381 + mknod ${CHROOT}/dev/urandom c 1 9 || die
382 + chmod 0666 ${CHROOT}/dev/urandom || die
383 + else
384 + mknod ${CHROOT}/dev/random c 1 8 || die
385 + chmod 0666 ${CHROOT}/dev/random || die
386 + fi
387 +
388 + if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
389 + cp -a /etc/bind ${CHROOT}/etc/ || die
390 + cp -a /var/bind ${CHROOT}/var/ || die
391 + fi
392 +
393 + if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
394 + if use geoip; then
395 + mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP || die
396 + elif use geoip2; then
397 + mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP2 || die
398 + fi
399 + fi
400 +
401 + elog "You may need to add the following line to your syslog-ng.conf:"
402 + elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
403 +}
404
405 diff --git a/net-dns/bind/files/bind-9.16.6-bug-741162.patch b/net-dns/bind/files/bind-9.16.6-bug-741162.patch
406 new file mode 100644
407 index 00000000000..9cc030c82b3
408 --- /dev/null
409 +++ b/net-dns/bind/files/bind-9.16.6-bug-741162.patch
410 @@ -0,0 +1,31 @@
411 +commit 56d2cf6f1ef008ab6cb50545af9b1d8a5c1ece81
412 +Author: Ondřej Surý <ondrej@×××.org>
413 +Date: Mon Aug 24 10:15:07 2020 +0200
414 +
415 + Print diagnostics on dns_name_issubdomain() failure in fctx_create()
416 +
417 + Log diagnostic message when dns_name_issubdomain() in the fctx_create()
418 + when the resolver is qname minimizing and forwarding at the same time.
419 +
420 + (cherry picked from commit 0a22024c270a38a54f0d51621a046b726df158c0)
421 +
422 +diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
423 +index 8a36693a9a..b37e756c53 100644
424 +--- a/lib/dns/resolver.c
425 ++++ b/lib/dns/resolver.c
426 +@@ -5122,7 +5122,14 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type,
427 +
428 + log_ns_ttl(fctx, "fctx_create");
429 +
430 +- INSIST(dns_name_issubdomain(&fctx->name, &fctx->domain));
431 ++ if (!dns_name_issubdomain(&fctx->name, &fctx->domain)) {
432 ++ dns_name_format(&fctx->domain, buf, sizeof(buf));
433 ++ UNEXPECTED_ERROR(__FILE__, __LINE__,
434 ++ "'%s' is not subdomain of '%s'", fctx->info,
435 ++ buf);
436 ++ result = ISC_R_UNEXPECTED;
437 ++ goto cleanup_fcount;
438 ++ }
439 +
440 + fctx->qmessage = NULL;
441 + result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER,