rpms/ypbind/devel nis.sh,1.4,1.5 ypbind.spec,1.69,1.70

Karel Klíč kklic at fedoraproject.org
Wed May 19 14:32:07 UTC 2010


Author: kklic

Update of /cvs/pkgs/rpms/ypbind/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv22598

Modified Files:
	nis.sh ypbind.spec 
Log Message:
Fix rhbz#593278, improve nis.sh and spec file


Index: nis.sh
===================================================================
RCS file: /cvs/pkgs/rpms/ypbind/devel/nis.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- nis.sh	18 Mar 2009 12:19:32 -0000	1.4
+++ nis.sh	19 May 2010 14:32:06 -0000	1.5
@@ -19,40 +19,42 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 # Author(s): David Cantrell <dcantrell at redhat.com>
-#
 
 CONF=/etc/yp.conf
+SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
 
-fixContext() {
+fix_context() {
     if [ -x /sbin/restorecon ]; then
         /sbin/restorecon ${1} >/dev/null 2>&1
     fi
 }
 
 save_config_file() {
-    origfile="${1}"
-    savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}"
-
     if [ ! -d ${SAVEDIR} ]; then
         mkdir -p ${SAVEDIR}
     fi
 
-    if [ -e ${origfile} ]; then
-        mv ${origfile} ${savefile}
+    if [ -e ${CONF} ]; then
+        # cp+rm instead of mv: preserve SELinux context
+        # rhbz#509240
+        # Do not rely on restorecon.
+        cp -c ${CONF} ${SAVECONF}
+        rm ${CONF}
     else
-        echo > ${savefile}
+        echo > ${SAVECONF}
+        # Try restorecon
+        fix_context ${SAVECONF}
     fi
-
-    fixContext ${savefile}
 }
 
 nis_config() {
     if [ ! "${PEERNIS}" = "no" ]; then
         if [ -n "${new_nis_domain}" ]; then
             domainname "${new_nis_domain}"
-            save_config_file ${CONF}
+            save_config_file
             let contents=0
             echo '# generated by /sbin/dhclient-script' > ${CONF}
+            fix_context ${CONF}
 
             if [ -n "${new_nis_servers}" ]; then
                 for i in ${new_nis_servers} ; do
@@ -65,14 +67,12 @@ nis_config() {
             fi
 
             if [ ${contents} -gt 0 ]; then
-                if [ -x /etc/rc.d/init.d/ypbind ] &&
-                   [ -r /var/run/ypbind.pid ]; then
-                    service ypbind restart >/dev/null 2>&1
-                fi
+                service ypbind condrestart >/dev/null 2>&1
             fi
         elif [ -n "${new_nis_servers}" ]; then
-            save_config_file ${CONF}
+            save_config_file
             echo '# generated by /sbin/dhclient-script' > ${CONF}
+            fix_context ${CONF}
             let contents=0
 
             for i in ${new_nis_servers} ; do
@@ -81,10 +81,7 @@ nis_config() {
             done
 
             if [ $contents -gt 0 ]; then
-                if [ -x /etc/rc.d/init.d/ypbind ] &&
-                   [ -r /var/run/ypbind.pid ]; then
-                    service ypbind restart >/dev/null 2>&1
-                fi
+                service ypbind condrestart >/dev/null 2>&1
             fi
         fi
     fi
@@ -92,13 +89,20 @@ nis_config() {
 
 nis_restore() {
     if [ ! "${PEERNIS}" = "no" ]; then
-        if [ -f ${SAVEDIR}/${CONF}.predhclient.${interface} ]; then
+        if [ -f ${SAVECONF} ]; then
             rm -f ${CONF}
-            mv -f ${SAVEDIR}/${CONF}.predhclient.${interface} ${CONF}
-            fixContext /etc/yp.conf
-            if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then
-                service ypbind restart >/dev/null 2>&1
-            fi
+            # cp+rm instead of mv: preserve SELinux context
+            # rhbz#509240
+            cp -c ${SAVECONF} ${CONF}
+            rm ${SAVECONF}
+            fix_context ${CONF} # Restorecon again to be sure.
+            service ypbind condrestart >/dev/null 2>&1
         fi
     fi
 }
+
+# Local Variables:
+# indent-tabs-mode: nil
+# sh-basic-offset: 4
+# show-trailing-whitespace: t
+# End:


Index: ypbind.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ypbind/devel/ypbind.spec,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -p -r1.69 -r1.70
--- ypbind.spec	24 Feb 2010 15:37:31 -0000	1.69
+++ ypbind.spec	19 May 2010 14:32:07 -0000	1.70
@@ -1,7 +1,7 @@
 Summary: The NIS daemon which binds NIS clients to an NIS domain
 Name: ypbind
 Version: 1.31
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2
 Group: System Environment/Daemons
 Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
@@ -17,8 +17,6 @@ Requires(preun): initscripts
 Requires(postun): initscripts
 Requires: rpcbind, yp-tools
 Epoch: 3
-Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
 BuildRequires: dbus-glib-devel, docbook-style-xsl
 
 %description
@@ -57,9 +55,6 @@ install -m 755 %{SOURCE2} $RPM_BUILD_ROO
 
 %{find_lang} %{name}
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %post
 /sbin/chkconfig --add ypbind
 
@@ -85,6 +80,13 @@ fi
 %doc README NEWS COPYING
 
 %changelog
+* Wed May 19 2010 Karel Klic <kklic at redhat.com> - 3:1.31-4
+- Update SELinux context of /etc/yp.conf in nis.sh (rhbz#593278)
+- nis.sh: use condrestart instead of pidfile checking
+- nis.sh: various simplifications
+- Removed BuildRoot tag
+- Removed %%clean section
+
 * Wed Feb 24 2010 Karel Klic <kklic at redhat.com> - 3:1.31-3
 - Added COPYING file to the package
 



More information about the scm-commits mailing list