Gentoo Archives: gentoo-commits

From: "Christian Ruppert (idl0r)" <idl0r@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-dns/bind: ChangeLog bind-9.7.3_p1.ebuild bind-9.8.0_p2.ebuild bind-9.8.0_p1.ebuild
Date: Fri, 27 May 2011 18:53:14
Message-Id: 20110527185303.1EB5520054@flycatcher.gentoo.org
1 idl0r 11/05/27 18:53:03
2
3 Modified: ChangeLog
4 Added: bind-9.7.3_p1.ebuild bind-9.8.0_p2.ebuild
5 Removed: bind-9.8.0_p1.ebuild
6 Log:
7 Version bump due to CVE-2011-1910, bug 368863.
8
9 (Portage version: 2.2.0_alpha37/cvs/Linux x86_64)
10
11 Revision Changes Path
12 1.332 net-dns/bind/ChangeLog
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?rev=1.332&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?rev=1.332&content-type=text/plain
16 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?r1=1.331&r2=1.332
17
18 Index: ChangeLog
19 ===================================================================
20 RCS file: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v
21 retrieving revision 1.331
22 retrieving revision 1.332
23 diff -u -r1.331 -r1.332
24 --- ChangeLog 8 May 2011 23:08:32 -0000 1.331
25 +++ ChangeLog 27 May 2011 18:53:03 -0000 1.332
26 @@ -1,6 +1,13 @@
27 # ChangeLog for net-dns/bind
28 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
29 -# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.331 2011/05/08 23:08:32 idl0r Exp $
30 +# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.332 2011/05/27 18:53:03 idl0r Exp $
31 +
32 +*bind-9.8.0_p2 (27 May 2011)
33 +*bind-9.7.3_p1 (27 May 2011)
34 +
35 + 27 May 2011; Christian Ruppert <idl0r@g.o> +bind-9.7.3_p1.ebuild,
36 + -bind-9.8.0_p1.ebuild, +bind-9.8.0_p2.ebuild:
37 + Version bump due to CVE-2011-1910, bug 368863.
38
39 08 May 2011; Christian Ruppert <idl0r@g.o> bind-9.8.0_p1.ebuild:
40 Fix geoip patch for 9.8.0_p1, bug 366499.
41
42
43
44 1.1 net-dns/bind/bind-9.7.3_p1.ebuild
45
46 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.7.3_p1.ebuild?rev=1.1&view=markup
47 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.7.3_p1.ebuild?rev=1.1&content-type=text/plain
48
49 Index: bind-9.7.3_p1.ebuild
50 ===================================================================
51 # Copyright 1999-2011 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53 # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.7.3_p1.ebuild,v 1.1 2011/05/27 18:53:03 idl0r Exp $
54
55 EAPI="3"
56
57 inherit eutils autotools toolchain-funcs flag-o-matic
58
59 MY_PV="${PV/_p/-P}"
60 MY_P="${PN}-${MY_PV}"
61
62 SDB_LDAP_VER="1.1.0-fc14"
63
64 GEOIP_PV=1.3
65 #GEOIP_PV_AGAINST="${MY_PV}"
66 GEOIP_PV_AGAINST="9.7.2-P2"
67 GEOIP_P="bind-geoip-${GEOIP_PV}"
68 GEOIP_PATCH_A="${GEOIP_P}-${GEOIP_PV_AGAINST}.patch"
69 GEOIP_DOC_A="${GEOIP_P}-readme.txt"
70 GEOIP_SRC_URI_BASE="http://bind-geoip.googlecode.com/"
71
72 DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
73 HOMEPAGE="http://www.isc.org/software/bind"
74 SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
75 doc? ( mirror://gentoo/dyndns-samples.tbz2 )
76 geoip? ( ${GEOIP_SRC_URI_BASE}/files/${GEOIP_DOC_A}
77 ${GEOIP_SRC_URI_BASE}/files/${GEOIP_PATCH_A} )
78 sdb-ldap? ( http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2 )"
79
80 LICENSE="as-is"
81 SLOT="0"
82 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
83 IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads
84 resolvconf urandom xml geoip gssapi sdb-ldap"
85
86 DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
87 mysql? ( >=virtual/mysql-4.0 )
88 odbc? ( >=dev-db/unixODBC-2.2.6 )
89 ldap? ( net-nds/openldap )
90 idn? ( net-dns/idnkit )
91 postgres? ( dev-db/postgresql-base )
92 threads? ( >=sys-libs/libcap-2.1.0 )
93 xml? ( dev-libs/libxml2 )
94 geoip? ( >=dev-libs/geoip-1.4.6 )
95 gssapi? ( virtual/krb5 )
96 sdb-ldap? ( net-nds/openldap )"
97
98 RDEPEND="${DEPEND}
99 selinux? ( sec-policy/selinux-bind )
100 resolvconf? ( net-dns/openresolv )
101 sys-process/psmisc"
102
103 S="${WORKDIR}/${MY_P}"
104
105 pkg_setup() {
106 use threads && {
107 ewarn
108 ewarn "If you're in vserver enviroment, you're probably want to"
109 ewarn "disable threads support because of linux capabilities dependency"
110 ewarn
111 }
112
113 ebegin "Creating named group and user"
114 enewgroup named 40
115 enewuser named 40 -1 /etc/bind named
116 eend ${?}
117 }
118
119 src_prepare() {
120 # Adjusting PATHs in manpages
121 for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
122 sed -i \
123 -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
124 -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
125 -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
126 "${i}" || die "sed failed, ${i} doesn't exist"
127 done
128
129 if use dlz; then
130 # bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
131 # (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
132 if use mysql && has_version ">=dev-db/mysql-5"; then
133 epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
134 fi
135
136 if use odbc; then
137 epatch "${FILESDIR}/${P}-odbc-dlz-detect.patch"
138 fi
139 fi
140
141 # should be installed by bind-tools
142 sed -i -r -e "s:(nsupdate|dig) ::g" bin/Makefile.in || die
143
144 # sdb-ldap patch as per bug #160567
145 # Upstream URL: http://bind9-ldap.bayour.com/
146 # New patch take from bug 302735
147 if use sdb-ldap; then
148 epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
149 cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named
150 cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools
151 cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools
152 fi
153
154 if use geoip; then
155 cp "${DISTDIR}"/${GEOIP_PATCH_A} "${S}" || die
156 sed -i -e 's:PATCHVER=2:PATCHVER=3:' \
157 -e 's/-RELEASEVER=2/-RELEASEVER=1/' \
158 -e 's/+RELEASEVER=2-geoip-1.3/+RELEASEVER=1-geoip-1.3/' \
159 ${GEOIP_PATCH_A} || die
160 epatch ${GEOIP_PATCH_A}
161 fi
162
163 # bug #220361
164 rm {aclocal,libtool}.m4
165 WANT_AUTOCONF=2.5 AT_NO_RECURSIVE=1 eautoreconf
166
167 # remove useless c++ checks
168 epunt_cxx
169 }
170
171 src_configure() {
172 local myconf=""
173
174 use dlz && {
175 myconf="${myconf} --with-dlz-filesystem --with-dlz-stub"
176 use postgres && myconf="${myconf} --with-dlz-postgres"
177 use mysql && myconf="${myconf} --with-dlz-mysql"
178 use berkdb && myconf="${myconf} --with-dlz-bdb"
179 use ldap && myconf="${myconf} --with-dlz-ldap"
180 use odbc && myconf="${myconf} --with-dlz-odbc"
181 }
182
183 if use threads; then
184 if use dlz && use mysql; then
185 ewarn
186 ewarn "MySQL uses thread local storage in its C api. Thus MySQL"
187 ewarn "requires that each thread of an application execute a MySQL"
188 ewarn "\"thread initialization\" to setup the thread local storage."
189 ewarn "This is impossible to do safely while staying within the DLZ"
190 ewarn "driver API. This is a limitation caused by MySQL, and not"
191 ewarn "the DLZ API."
192 ewarn "Because of this BIND MUST only run with a single thread when"
193 ewarn "using the MySQL driver."
194 ewarn
195 myconf="${myconf} --disable-linux-caps --disable-threads"
196 ewarn "Threading support disabled"
197 else
198 myconf="${myconf} --enable-linux-caps --enable-threads"
199 einfo "Threading support enabled"
200 fi
201 else
202 myconf="${myconf} --disable-linux-caps --disable-threads"
203 fi
204
205 if use urandom; then
206 myconf="${myconf} --with-randomdev=/dev/urandom"
207 else
208 myconf="${myconf} --with-randomdev=/dev/random"
209 fi
210
211 use geoip && myconf="${myconf} --with-geoip"
212
213 # bug #158664
214 gcc-specs-ssp && replace-flags -O[23s] -O
215
216 export BUILD_CC=$(tc-getBUILD_CC)
217 econf \
218 --sysconfdir=/etc/bind \
219 --localstatedir=/var \
220 --with-libtool \
221 $(use_with ssl openssl) \
222 $(use_with idn) \
223 $(use_enable ipv6) \
224 $(use_with xml libxml2) \
225 $(use_with gssapi) \
226 ${myconf}
227
228 # bug #151839
229 echo '#undef SO_BSDCOMPAT' >> config.h
230 }
231
232 src_install() {
233 emake DESTDIR="${D}" install || die
234
235 dodoc CHANGES FAQ README
236
237 if use idn; then
238 dodoc contrib/idn/README.idnkit || die
239 fi
240
241 if use doc; then
242 dodoc doc/arm/Bv9ARM.pdf || die
243
244 docinto misc
245 dodoc doc/misc/* || die
246
247 # might a 'html' useflag make sense?
248 docinto html
249 dohtml -r doc/arm/* || die
250
251 docinto draft
252 dodoc doc/draft/* || die
253
254 docinto rfc
255 dodoc doc/rfc/* || die
256
257 docinto contrib
258 dodoc contrib/named-bootconf/named-bootconf.sh \
259 contrib/nanny/nanny.pl || die
260
261 # some handy-dandy dynamic dns examples
262 cd "${D}"/usr/share/doc/${PF}
263 tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
264 fi
265
266 use geoip && dodoc "${DISTDIR}"/${GEOIP_P}-readme.txt
267
268 insinto /etc/bind
269 newins "${FILESDIR}"/named.conf-r5 named.conf || die
270
271 # ftp://ftp.rs.internic.net/domain/named.cache:
272 insinto /var/bind
273 doins "${FILESDIR}"/named.cache || die
274
275 insinto /var/bind/pri
276 newins "${FILESDIR}"/127.zone-r1 127.zone || die
277 newins "${FILESDIR}"/localhost.zone-r3 localhost.zone || die
278
279 newinitd "${FILESDIR}"/named.init-r10 named || die
280 newconfd "${FILESDIR}"/named.confd-r6 named || die
281
282 newenvd "${FILESDIR}"/10bind.env 10bind || die
283
284 # Let's get rid of those tools and their manpages since they're provided by bind-tools
285 rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
286 rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
287 rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
288 rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
289
290 dosym /var/bind/named.cache /var/bind/root.cache || die
291 dosym /var/bind/pri /etc/bind/pri || die
292 dosym /var/bind/sec /etc/bind/sec || die
293 dosym /var/bind/dyn /etc/bind/dyn || die
294 keepdir /var/bind/{pri,sec,dyn}
295
296 dodir /var/{run,log}/named || die
297
298 fowners root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}
299 fowners root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
300 fperms 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
301 fperms 0750 /etc/bind /var/bind/pri
302 fperms 0770 /var/{run,log}/named /var/bind/{,sec,dyn}
303 }
304
305 pkg_postinst() {
306 if [ ! -f '/etc/bind/rndc.key' ]; then
307 if use urandom; then
308 einfo "Using /dev/urandom for generating rndc.key"
309 /usr/sbin/rndc-confgen -r /dev/urandom -a
310 echo
311 else
312 einfo "Using /dev/random for generating rndc.key"
313 /usr/sbin/rndc-confgen -a
314 echo
315 fi
316 chown root:named /etc/bind/rndc.key
317 chmod 0640 /etc/bind/rndc.key
318 fi
319
320 einfo
321 einfo "You can edit /etc/conf.d/named to customize named settings"
322 einfo
323 use mysql || use postgres || use ldap && {
324 elog "If your named depends on MySQL/PostgreSQL or LDAP,"
325 elog "uncomment the specified rc_named_* lines in your"
326 elog "/etc/conf.d/named config to ensure they'll start before bind"
327 einfo
328 }
329 einfo "If you'd like to run bind in a chroot AND this is a new"
330 einfo "install OR your bind doesn't already run in a chroot:"
331 einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
332 einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
333 einfo
334
335 CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
336 if [[ -n ${CHROOT} ]]; then
337 elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
338 elog "To enable the old behaviour (without using mount) uncomment the"
339 elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
340 elog "If you decide to use the new/default method, ensure to make backup"
341 elog "first and merge your existing configs/zones to /etc/bind and"
342 elog "/var/bind because bind will now mount the needed directories into"
343 elog "the chroot dir."
344 fi
345
346 ewarn
347 ewarn "NOTE: /var/bind/named.ca has been renamed to /var/bind/named.cache"
348 ewarn "you may need to fix your named.conf!"
349 ewarn
350 ewarn "NOTE: If you upgrade from <net-dns/bind-9.4.3_p5-r1, you may encounter permission problems"
351 ewarn "To fix the permissions do:"
352 ewarn "chown root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}"
353 ewarn "chown root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
354 ewarn "chmod 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
355 ewarn "chmod 0750 /etc/bind /var/bind/pri"
356 ewarn "chmod 0770 /var/{run,log}/named /var/bind/{,sec,dyn}"
357 ewarn
358 }
359
360 pkg_config() {
361 CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
362 CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
363 CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
364
365 if [[ -z "${CHROOT}" ]]; then
366 eerror "This config script is designed to automate setting up"
367 eerror "a chrooted bind/named. To do so, please first uncomment"
368 eerror "and set the CHROOT variable in '/etc/conf.d/named'."
369 die "Unset CHROOT"
370 fi
371 if [[ -d "${CHROOT}" ]]; then
372 ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
373 ewarn "To enable the old behaviour (without using mount) uncomment the"
374 ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
375 ewarn
376 ewarn "${CHROOT} already exists... some things might become overridden"
377 ewarn "press CTRL+C if you don't want to continue"
378 sleep 10
379 fi
380
381 echo; einfo "Setting up the chroot directory..."
382
383 mkdir -m 0750 -p ${CHROOT}
384 mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/{run,log}}
385 mkdir -m 0750 -p ${CHROOT}/etc/bind
386 mkdir -m 0770 -p ${CHROOT}/var/{bind,{run,log}/named}
387 chown root:named ${CHROOT} ${CHROOT}/var/{bind,{run,log}/named} ${CHROOT}/etc/bind
388
389 mknod ${CHROOT}/dev/null c 1 3
390 chmod 0666 ${CHROOT}/dev/null
391
392 mknod ${CHROOT}/dev/zero c 1 5
393 chmod 0666 ${CHROOT}/dev/zero
394
395 if use urandom; then
396 mknod ${CHROOT}/dev/urandom c 1 9
397 chmod 0666 ${CHROOT}/dev/urandom
398 else
399 mknod ${CHROOT}/dev/random c 1 8
400 chmod 0666 ${CHROOT}/dev/random
401 fi
402
403 if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
404 cp -a /etc/bind ${CHROOT}/etc/
405 cp -a /var/bind ${CHROOT}/var/
406 fi
407
408 if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
409 mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
410 fi
411
412 elog "You may need to add the following line to your syslog-ng.conf:"
413 elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
414 }
415
416
417
418 1.1 net-dns/bind/bind-9.8.0_p2.ebuild
419
420 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.8.0_p2.ebuild?rev=1.1&view=markup
421 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.8.0_p2.ebuild?rev=1.1&content-type=text/plain
422
423 Index: bind-9.8.0_p2.ebuild
424 ===================================================================
425 # Copyright 1999-2011 Gentoo Foundation
426 # Distributed under the terms of the GNU General Public License v2
427 # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.8.0_p2.ebuild,v 1.1 2011/05/27 18:53:03 idl0r Exp $
428
429 EAPI="3"
430
431 inherit eutils autotools toolchain-funcs flag-o-matic multilib
432
433 MY_PV="${PV/_p/-P}"
434 MY_PV="${MY_PV/_rc/rc}"
435 MY_P="${PN}-${MY_PV}"
436
437 SDB_LDAP_VER="1.1.0-fc14"
438
439 GEOIP_PV=1.3
440 #GEOIP_PV_AGAINST="${MY_PV}"
441 GEOIP_PV_AGAINST="9.7.2-P2"
442 GEOIP_P="bind-geoip-${GEOIP_PV}"
443 GEOIP_PATCH_A="${GEOIP_P}-${GEOIP_PV_AGAINST}.patch"
444 GEOIP_DOC_A="${GEOIP_P}-readme.txt"
445 GEOIP_SRC_URI_BASE="http://bind-geoip.googlecode.com/"
446
447 DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
448 HOMEPAGE="http://www.isc.org/software/bind"
449 SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
450 doc? ( mirror://gentoo/dyndns-samples.tbz2 )
451 geoip? ( ${GEOIP_SRC_URI_BASE}/files/${GEOIP_DOC_A}
452 ${GEOIP_SRC_URI_BASE}/files/${GEOIP_PATCH_A} )
453 sdb-ldap? ( http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2 )"
454
455 LICENSE="as-is"
456 SLOT="0"
457 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
458 IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads
459 resolvconf urandom xml geoip gssapi sdb-ldap"
460
461 DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
462 mysql? ( >=virtual/mysql-4.0 )
463 odbc? ( >=dev-db/unixODBC-2.2.6 )
464 ldap? ( net-nds/openldap )
465 idn? ( net-dns/idnkit )
466 postgres? ( dev-db/postgresql-base )
467 threads? ( >=sys-libs/libcap-2.1.0 )
468 xml? ( dev-libs/libxml2 )
469 geoip? ( >=dev-libs/geoip-1.4.6 )
470 gssapi? ( virtual/krb5 )
471 sdb-ldap? ( net-nds/openldap )"
472
473 RDEPEND="${DEPEND}
474 selinux? ( sec-policy/selinux-bind )
475 resolvconf? ( net-dns/openresolv )
476 sys-process/psmisc"
477
478 S="${WORKDIR}/${MY_P}"
479
480 pkg_setup() {
481 use threads && {
482 ewarn
483 ewarn "If you're in vserver enviroment, you're probably want to"
484 ewarn "disable threads support because of linux capabilities dependency"
485 ewarn
486 }
487
488 ebegin "Creating named group and user"
489 enewgroup named 40
490 enewuser named 40 -1 /etc/bind named
491 eend ${?}
492 }
493
494 src_prepare() {
495 # Adjusting PATHs in manpages
496 for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
497 sed -i \
498 -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
499 -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
500 -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
501 "${i}" || die "sed failed, ${i} doesn't exist"
502 done
503
504 if use dlz; then
505 # bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
506 # (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
507 if use mysql && has_version ">=dev-db/mysql-5"; then
508 epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
509 fi
510
511 if use odbc; then
512 epatch "${FILESDIR}/${P}-odbc-dlz-detect.patch"
513 fi
514 fi
515
516 # should be installed by bind-tools
517 sed -i -r -e "s:(nsupdate|dig) ::g" bin/Makefile.in || die
518
519 # sdb-ldap patch as per bug #160567
520 # Upstream URL: http://bind9-ldap.bayour.com/
521 # New patch take from bug 302735
522 if use sdb-ldap; then
523 epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
524 cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named
525 cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools
526 cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools
527 fi
528
529 if use geoip; then
530 cp "${DISTDIR}"/${GEOIP_PATCH_A} "${S}" || die
531 sed -i -e 's:MINORVER=7:MINORVER=8:' \
532 -e 's:PATCHVER=2:PATCHVER=0:' ${GEOIP_PATCH_A} || die
533 epatch ${GEOIP_PATCH_A}
534 fi
535
536 # bug #220361
537 rm {aclocal,libtool}.m4
538 WANT_AUTOCONF=2.5 AT_NO_RECURSIVE=1 eautoreconf
539
540 # remove useless c++ checks
541 epunt_cxx
542 }
543
544 src_configure() {
545 local myconf=""
546
547 use dlz && {
548 myconf="${myconf} --with-dlz-filesystem --with-dlz-stub"
549 use postgres && myconf="${myconf} --with-dlz-postgres"
550 use mysql && myconf="${myconf} --with-dlz-mysql"
551 use berkdb && myconf="${myconf} --with-dlz-bdb"
552 use ldap && myconf="${myconf} --with-dlz-ldap"
553 use odbc && myconf="${myconf} --with-dlz-odbc"
554 }
555
556 if use threads; then
557 if use dlz && use mysql; then
558 ewarn
559 ewarn "MySQL uses thread local storage in its C api. Thus MySQL"
560 ewarn "requires that each thread of an application execute a MySQL"
561 ewarn "\"thread initialization\" to setup the thread local storage."
562 ewarn "This is impossible to do safely while staying within the DLZ"
563 ewarn "driver API. This is a limitation caused by MySQL, and not"
564 ewarn "the DLZ API."
565 ewarn "Because of this BIND MUST only run with a single thread when"
566 ewarn "using the MySQL driver."
567 ewarn
568 myconf="${myconf} --disable-linux-caps --disable-threads"
569 ewarn "Threading support disabled"
570 else
571 myconf="${myconf} --enable-linux-caps --enable-threads"
572 einfo "Threading support enabled"
573 fi
574 else
575 myconf="${myconf} --disable-linux-caps --disable-threads"
576 fi
577
578 if use urandom; then
579 myconf="${myconf} --with-randomdev=/dev/urandom"
580 else
581 myconf="${myconf} --with-randomdev=/dev/random"
582 fi
583
584 use geoip && myconf="${myconf} --with-geoip"
585
586 # bug #158664
587 gcc-specs-ssp && replace-flags -O[23s] -O
588
589 export BUILD_CC=$(tc-getBUILD_CC)
590 econf \
591 --sysconfdir=/etc/bind \
592 --localstatedir=/var \
593 --with-libtool \
594 $(use_with ssl openssl) \
595 $(use_with idn) \
596 $(use_enable ipv6) \
597 $(use_with xml libxml2) \
598 $(use_with gssapi) \
599 ${myconf}
600
601 # bug #151839
602 echo '#undef SO_BSDCOMPAT' >> config.h
603 }
604
605 src_install() {
606 emake DESTDIR="${D}" install || die
607
608 dodoc CHANGES FAQ README
609
610 if use idn; then
611 dodoc contrib/idn/README.idnkit || die
612 fi
613
614 if use doc; then
615 dodoc doc/arm/Bv9ARM.pdf || die
616
617 docinto misc
618 dodoc doc/misc/* || die
619
620 # might a 'html' useflag make sense?
621 docinto html
622 dohtml -r doc/arm/* || die
623
624 docinto draft
625 dodoc doc/draft/* || die
626
627 docinto rfc
628 dodoc doc/rfc/* || die
629
630 docinto contrib
631 dodoc contrib/named-bootconf/named-bootconf.sh \
632 contrib/nanny/nanny.pl || die
633
634 # some handy-dandy dynamic dns examples
635 cd "${D}"/usr/share/doc/${PF}
636 tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
637 fi
638
639 use geoip && dodoc "${DISTDIR}"/${GEOIP_P}-readme.txt
640
641 insinto /etc/bind
642 newins "${FILESDIR}"/named.conf-r5 named.conf || die
643
644 # ftp://ftp.rs.internic.net/domain/named.cache:
645 insinto /var/bind
646 doins "${FILESDIR}"/named.cache || die
647
648 insinto /var/bind/pri
649 newins "${FILESDIR}"/127.zone-r1 127.zone || die
650 newins "${FILESDIR}"/localhost.zone-r3 localhost.zone || die
651
652 newinitd "${FILESDIR}"/named.init-r10 named || die
653 newconfd "${FILESDIR}"/named.confd-r6 named || die
654
655 if use ssl && [ -e /usr/lib/engines/libgost.so ]; then
656 sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}/' "${D}/etc/init.d/named" || die
657 else
658 sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}/' "${D}/etc/init.d/named" || die
659 fi
660
661 newenvd "${FILESDIR}"/10bind.env 10bind || die
662
663 # Let's get rid of those tools and their manpages since they're provided by bind-tools
664 rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
665 rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
666 rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
667 rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
668
669 dosym /var/bind/named.cache /var/bind/root.cache || die
670 dosym /var/bind/pri /etc/bind/pri || die
671 dosym /var/bind/sec /etc/bind/sec || die
672 dosym /var/bind/dyn /etc/bind/dyn || die
673 keepdir /var/bind/{pri,sec,dyn}
674
675 dodir /var/{run,log}/named || die
676
677 fowners root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}
678 fowners root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
679 fperms 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
680 fperms 0750 /etc/bind /var/bind/pri
681 fperms 0770 /var/{run,log}/named /var/bind/{,sec,dyn}
682 }
683
684 pkg_postinst() {
685 if [ ! -f '/etc/bind/rndc.key' ]; then
686 if use urandom; then
687 einfo "Using /dev/urandom for generating rndc.key"
688 /usr/sbin/rndc-confgen -r /dev/urandom -a
689 echo
690 else
691 einfo "Using /dev/random for generating rndc.key"
692 /usr/sbin/rndc-confgen -a
693 echo
694 fi
695 chown root:named /etc/bind/rndc.key
696 chmod 0640 /etc/bind/rndc.key
697 fi
698
699 einfo
700 einfo "You can edit /etc/conf.d/named to customize named settings"
701 einfo
702 use mysql || use postgres || use ldap && {
703 elog "If your named depends on MySQL/PostgreSQL or LDAP,"
704 elog "uncomment the specified rc_named_* lines in your"
705 elog "/etc/conf.d/named config to ensure they'll start before bind"
706 einfo
707 }
708 einfo "If you'd like to run bind in a chroot AND this is a new"
709 einfo "install OR your bind doesn't already run in a chroot:"
710 einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
711 einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
712 einfo
713
714 CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
715 if [[ -n ${CHROOT} ]]; then
716 elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
717 elog "To enable the old behaviour (without using mount) uncomment the"
718 elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
719 elog "If you decide to use the new/default method, ensure to make backup"
720 elog "first and merge your existing configs/zones to /etc/bind and"
721 elog "/var/bind because bind will now mount the needed directories into"
722 elog "the chroot dir."
723 fi
724
725 ewarn
726 ewarn "NOTE: /var/bind/named.ca has been renamed to /var/bind/named.cache"
727 ewarn "you may need to fix your named.conf!"
728 ewarn
729 ewarn "NOTE: If you upgrade from <net-dns/bind-9.4.3_p5-r1, you may encounter permission problems"
730 ewarn "To fix the permissions do:"
731 ewarn "chown root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}"
732 ewarn "chown root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
733 ewarn "chmod 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
734 ewarn "chmod 0750 /etc/bind /var/bind/pri"
735 ewarn "chmod 0770 /var/{run,log}/named /var/bind/{,sec,dyn}"
736 ewarn
737 }
738
739 pkg_config() {
740 CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
741 CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
742 CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
743
744 if [[ -z "${CHROOT}" ]]; then
745 eerror "This config script is designed to automate setting up"
746 eerror "a chrooted bind/named. To do so, please first uncomment"
747 eerror "and set the CHROOT variable in '/etc/conf.d/named'."
748 die "Unset CHROOT"
749 fi
750 if [[ -d "${CHROOT}" ]]; then
751 ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
752 ewarn "To enable the old behaviour (without using mount) uncomment the"
753 ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
754 ewarn
755 ewarn "${CHROOT} already exists... some things might become overridden"
756 ewarn "press CTRL+C if you don't want to continue"
757 sleep 10
758 fi
759
760 echo; einfo "Setting up the chroot directory..."
761
762 mkdir -m 0750 -p ${CHROOT}
763 mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/{run,log}}
764 mkdir -m 0750 -p ${CHROOT}/etc/bind
765 mkdir -m 0770 -p ${CHROOT}/var/{bind,{run,log}/named}
766 # As of bind 9.8.0
767 if has_version net-dns/bind[ssl] -a -e /usr/lib/engines/libgost.so; then
768 if [ "$(get_libdir)" = "lib64" ]; then
769 mkdir -m 0755 -p ${CHROOT}/usr/lib64/engines
770 ln -s lib64 ${CHROOT}/usr/lib
771 else
772 mkdir -m 0755 -p ${CHROOT}/usr/lib/engines
773 fi
774 fi
775 chown root:named ${CHROOT} ${CHROOT}/var/{bind,{run,log}/named} ${CHROOT}/etc/bind
776
777 mknod ${CHROOT}/dev/null c 1 3
778 chmod 0666 ${CHROOT}/dev/null
779
780 mknod ${CHROOT}/dev/zero c 1 5
781 chmod 0666 ${CHROOT}/dev/zero
782
783 if use urandom; then
784 mknod ${CHROOT}/dev/urandom c 1 9
785 chmod 0666 ${CHROOT}/dev/urandom
786 else
787 mknod ${CHROOT}/dev/random c 1 8
788 chmod 0666 ${CHROOT}/dev/random
789 fi
790
791 if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
792 cp -a /etc/bind ${CHROOT}/etc/
793 cp -a /var/bind ${CHROOT}/var/
794 fi
795
796 if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
797 mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
798 fi
799
800 elog "You may need to add the following line to your syslog-ng.conf:"
801 elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
802 }