From 6de60fc2e7c5096ffd7e925d4d5cea83ccec5677 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Jun 27 2009 02:34:43 +0000 Subject: - Fix SELinux denials in dhclient-script when the script makes backup configuration files and restores them later (#483747) --- diff --git a/dhclient-script b/dhclient-script index 9306ff7..6028d92 100755 --- a/dhclient-script +++ b/dhclient-script @@ -55,7 +55,9 @@ save_previous() { fi if [ -e ${origfile} ]; then - mv ${origfile} ${savefile} + contents="$(< ${origfile})" + echo "${contents}" > ${savefile} + rm -f ${origfile} else echo > ${savefile} fi @@ -525,7 +527,9 @@ case "${reason}" in [[ "${DHCP_TIME_OFFSET_SETS_TIMEZONE}" = [yY1]* ]]; then if [ -e ${SAVEDIR}/localtime.predhclient.${interface} ]; then rm -f /etc/localtime - mv ${SAVEDIR}/localtime.predhclient.${interface} /etc/localtime + contents="$(< ${SAVEDIR}/localtime.predhclient.${interface})" + echo "${contents}" > /etc/localtime + rm -f ${SAVEDIR}/localtime.predhclient.${interface} touch /etc/localtime fix_context /etc/localtime fi @@ -533,14 +537,18 @@ case "${reason}" in if [ -f ${SAVEDIR}/ntp.conf.predhclient.${interface} ]; then rm -f /etc/ntp.conf - mv ${SAVEDIR}/ntp.conf.predhclient.${interface} /etc/ntp.conf + contents="$(< ${SAVEDIR}/ntp.conf.predhclient.${interface})" + echo "${contents}" > /etc/ntp.conf + rm -f ${SAVEDIR}/ntp.conf.predhclient.${interface} fix_context /etc/ntp.conf service ntpd condrestart >/dev/null 2>&1 fi if [ -f ${SAVEDIR}/yp.conf.predhclient.${interface} ]; then rm -f /etc/yp.conf - mv ${SAVEDIR}/yp.conf.predhclient.${interface} /etc/yp.conf + contents="$(< ${SAVEDIR}/yp.conf.predhclient.${interface})" + echo "${contents}" > /etc/yp.conf + rm -f ${SAVEDIR}/yp.conf.predhclient.${interface} fix_context /etc/yp.conf if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then service ypbind restart >/dev/null 2>&1 diff --git a/dhcp.spec b/dhcp.spec index 25b1096..94a0863 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -4,7 +4,7 @@ Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent Name: dhcp Version: 4.0.0 -Release: 35%{?dist} +Release: 36%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -449,6 +449,10 @@ fi %{_libdir}/libdhcp4client.so %changelog +* Fri Jun 26 2009 David Cantrell - 12:4.0.0-36 +- Fix SELinux denials in dhclient-script when the script makes backup + configuration files and restores them later (#483747) + * Mon Apr 20 2009 David Cantrell - 12:4.0.0-35 - Make dhclient-script work with pre-configured wireless interfaces (#491157)