--- /usr/local/etc/rc.d/named.orig 2019-05-16 12:49:16.000000000 -0700 +++ /usr/local/etc/rc.d/named 2019-05-16 12:49:16.000000000 -0700 @@ -60,6 +60,7 @@ _named_confdirroot="${named_conf%/*}" _named_confdir="${named_chrootdir}${_named_confdirroot}" _named_program_root="${named_program%/sbin/named}" +_named_libdir="/usr/local/lib/named" _openssl_engines="/usr/lib/engines" # Needed if named.conf and rndc.conf are moved or if rndc.conf is used @@ -155,6 +156,20 @@ fi fi + # The named libraries should be present in the chroot, named loads them + # after chrooting. + if [ -d ${_named_libdir} ]; then + mkdir -p ${named_chrootdir}${_named_libdir} + if can_mount nullfs ; then + mount -t nullfs ${_named_libdir} ${named_chrootdir}${_named_libdir} + else + warn "named chroot: cannot nullfs mount named" \ + "libraries into the chroot, will copy the shared" \ + "libraries instead." + cp -f ${_named_libdir}/*.so ${named_chrootdir}${_named_libdir} + fi + fi + # Copy and/or update key files to the chroot /etc # for file in localtime protocols services; do @@ -242,6 +257,11 @@ if [ -d ${_openssl_engines} ]; then if can_mount nullfs; then umount ${named_chrootdir}${_openssl_engines} + fi + fi + if [ -d ${_named_libdir} ]; then + if can_mount nullfs; then + umount ${named_chrootdir}${_named_libdir} fi fi if [ -c ${named_chrootdir}/dev/null ]; then