From dbecea21a4bb250f6a4129795e59314d198cd72f Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Fri, 6 Mar 2009 00:57:04 +0000 Subject: [PATCH] - restorecon fixes for /etc/localtime and /etc/resolv.conf (#488470) --- dhclient-script | 34 ++++++++++++++++++---------------- dhcp.spec | 5 ++++- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/dhclient-script b/dhclient-script index 8fa6ee4..9a2bea0 100755 --- a/dhclient-script +++ b/dhclient-script @@ -40,6 +40,12 @@ logmessage() { logger -p ${LOGFACILITY}.${LOGLEVEL} -t "NET" "dhclient: ${msg}" } +fix_context() { + if [ -x /sbin/restorecon ]; then + /sbin/restorecon ${1} >/dev/null 2>&1 + fi +} + save_previous() { origfile="${1}" savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}" @@ -54,7 +60,7 @@ save_previous() { echo > ${savefile} fi - restorecon ${savefile} >/dev/null 2>&1 + fix_context ${savefile} } make_resolv_conf() { @@ -94,9 +100,7 @@ make_resolv_conf() { change_resolv_conf ${rscf} rm -f ${rscf} - if [ -x /sbin/restorecon ]; then - /sbin/restorecon /etc/resolv.conf >/dev/null 2>&1 - fi + fix_context /etc/resolv.conf fi } @@ -350,6 +354,7 @@ dhconfig() { save_previous /etc/localtime cp -fp ${tzfile} /etc/localtime touch /etc/localtime + fix_context /etc/localtime fi fi fi @@ -475,22 +480,19 @@ case "${reason}" in rm -f /etc/localtime mv ${SAVEDIR}/localtime.predhclient.${interface} /etc/localtime touch /etc/localtime + fix_context /etc/localtime fi fi + fi - if [ -f ${SAVEDIR}/ntp.conf.predhclient.${interface} ]; then - rm -f /etc/ntp.conf - mv -f ${SAVEDIR}/ntp.conf.predhclient.${interface} /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 -f ${SAVEDIR}/yp.conf.predhclient.${interface} /etc/yp.conf - if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then - service ypbind restart >/dev/null 2>&1 + # execute any additional client side configuration scripts we have + if [ -d /etc/dhcp/dhclient.d ]; then + for f in /etc/dhcp/dhclient.d/*.sh ; do + if [ -x ${f} ]; then + subsystem="${f%.sh}" + . ${f} "${subsystem}_restore" fi - fi + done fi if [ -x /etc/dhclient-${interface}-down-hooks ]; then diff --git a/dhcp.spec b/dhcp.spec index 515b4a1..6e57db8 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -4,7 +4,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.1.0 -Release: 9%{?dist} +Release: 10%{?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. @@ -419,6 +419,9 @@ fi %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz %changelog +* Thu Mar 05 2009 David Cantrell - 12:4.1.0-10 +- restorecon fixes for /etc/localtime and /etc/resolv.conf (#488470) + * Tue Feb 24 2009 Fedora Release Engineering - 12:4.1.0-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild