From 9313e2afdfcaa6dda94e82d2cdf220365b241b08 Mon Sep 17 00:00:00 2001 From: jvdias Date: Wed, 14 Jun 2006 05:26:43 +0000 Subject: fix bugs 191093, 189789; backport selected fixes from upstream v9_3_3b1 CVS --- bind-chroot-admin.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'bind-chroot-admin.in') diff --git a/bind-chroot-admin.in b/bind-chroot-admin.in index 95e6eca..9395c6e 100644 --- a/bind-chroot-admin.in +++ b/bind-chroot-admin.in @@ -50,6 +50,15 @@ function rootdir() return 1; } +function selinux_enabled() +{ + [ -e /etc/selinux/config ] && . /etc/selinux/config; + if [ -n "$SELINUX" ] && [ "$SELINUX" != 'disabled' ] ; then + return 0; + fi; + return 1; +} + function check_dirs() { if [ -z "$BIND_CHROOT_PREFIX" ]; then @@ -89,7 +98,7 @@ function check_dirs() [ ! -e "${BIND_CHROOT_PREFIX}/etc/localtime" ] && [ -e /etc/localtime ] && /bin/cp -fp /etc/localtime "${BIND_CHROOT_PREFIX}/etc/localtime"; chown root:named "${BIND_CHROOT_PREFIX}"/dev/{random,null,zero}; chmod 660 "${BIND_CHROOT_PREFIX}"/dev/{random,null,zero}; - if [ -d /selinux ] && [ -e /selinux/enforce ] && [ -x /usr/bin/chcon ]; then + if selinux_enabled && [ -x /usr/bin/chcon ]; then for dev in random zero null; do /usr/bin/chcon --reference=/dev/$dev ${BIND_CHROOT_PREFIX}/dev/$dev; done @@ -250,7 +259,7 @@ function sync_files() chmod 660 ${pfx}/var/named/{data/*,slaves/*} >/dev/null 2>&1; chmod 770 ${pfx}/var/named/{data/*/.,slaves/*/.} >/dev/null 2>&1; if [ -e $changed ]; then - if [ -e /selinux/enforce ] && [ -x /sbin/restorecon ]; then + if selinux_enabled && [ -x /sbin/restorecon ]; then /sbin/restorecon -R ${BIND_CHROOT_PREFIX}/etc ${BIND_CHROOT_PREFIX}/var/named ${BIND_CHROOT_PREFIX}/var/run/named >/dev/null 2>&1; if [ -e ${BIND_CHROOT_PREFIX}/etc/localtime ] && [ -e /etc/localtime ] ; then /usr/bin/chcon --reference=/etc/localtime ${BIND_CHROOT_PREFIX}/etc/localtime >/dev/null 2>&1; -- cgit