use cp+rm instead of mv in nis.sh (#509240)

This commit is contained in:
Karel Klíč 2010-04-15 14:48:56 +00:00
parent dc39044280
commit c3750f49b8
2 changed files with 14 additions and 5 deletions

14
nis.sh
View File

@ -38,12 +38,15 @@ save_config_file() {
fi fi
if [ -e ${origfile} ]; then if [ -e ${origfile} ]; then
mv ${origfile} ${savefile} # cp+rm instead of mv: preserve SELinux context
# rhbz#509240
cp -c ${origfile} ${savefile}
rm ${origfile}
else else
echo > ${savefile} echo > ${savefile}
fi fi
fixContext ${savefile} fixContext ${savefile} # TODO: is it really needed?
} }
nis_config() { nis_config() {
@ -94,8 +97,11 @@ nis_restore() {
if [ ! "${PEERNIS}" = "no" ]; then if [ ! "${PEERNIS}" = "no" ]; then
if [ -f ${SAVEDIR}/${CONF}.predhclient.${interface} ]; then if [ -f ${SAVEDIR}/${CONF}.predhclient.${interface} ]; then
rm -f ${CONF} rm -f ${CONF}
mv -f ${SAVEDIR}/${CONF}.predhclient.${interface} ${CONF} # cp+rm instead of mv: preserve SELinux context
fixContext /etc/yp.conf # rhbz#509240
cp -c ${SAVEDIR}/${CONF}.predhclient.${interface} ${CONF}
rm ${SAVEDIR}/${CONF}.predhclient.${interface}
fixContext ${CONF}
if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then
service ypbind restart >/dev/null 2>&1 service ypbind restart >/dev/null 2>&1
fi fi

View File

@ -1,7 +1,7 @@
Summary: The NIS daemon which binds NIS clients to an NIS domain Summary: The NIS daemon which binds NIS clients to an NIS domain
Name: ypbind Name: ypbind
Version: 1.20.4 Version: 1.20.4
Release: 22%{?dist} Release: 23%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2 Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
@ -103,6 +103,9 @@ fi
%doc README NEWS %doc README NEWS
%changelog %changelog
* Thu Apr 15 2010 Karel Klic <kklic@redhat.com> - 3:1.20.4-23
- use cp+rm instead of mv in nis.sh (#509240)
* Thu Apr 15 2010 Karel Klic <kklic@redhat.com> - 3:1.20.4-22 * Thu Apr 15 2010 Karel Klic <kklic@redhat.com> - 3:1.20.4-22
- Improved -nm patch to go online when no connection is available - Improved -nm patch to go online when no connection is available
#480096 #480096