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
if [ -e ${origfile} ]; then
mv ${origfile} ${savefile}
# cp+rm instead of mv: preserve SELinux context
# rhbz#509240
cp -c ${origfile} ${savefile}
rm ${origfile}
else
echo > ${savefile}
fi
fixContext ${savefile}
fixContext ${savefile} # TODO: is it really needed?
}
nis_config() {
@ -94,8 +97,11 @@ nis_restore() {
if [ ! "${PEERNIS}" = "no" ]; then
if [ -f ${SAVEDIR}/${CONF}.predhclient.${interface} ]; then
rm -f ${CONF}
mv -f ${SAVEDIR}/${CONF}.predhclient.${interface} ${CONF}
fixContext /etc/yp.conf
# cp+rm instead of mv: preserve SELinux context
# 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
service ypbind restart >/dev/null 2>&1
fi

View File

@ -1,7 +1,7 @@
Summary: The NIS daemon which binds NIS clients to an NIS domain
Name: ypbind
Version: 1.20.4
Release: 22%{?dist}
Release: 23%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
@ -103,6 +103,9 @@ fi
%doc README NEWS
%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
- Improved -nm patch to go online when no connection is available
#480096