From 3bd074fd404b4863d811d0a50e9ef484523c6b57 Mon Sep 17 00:00:00 2001 From: Miloslav Trmac Date: Mon, 8 May 2006 23:54:06 +0000 Subject: Fix handling of mount points with white space (#186713): - src/fstab-decode.c, src/fstab-decode.8: New files. - src/Makefile: Build and install fstab-decode. - initscripts.spec: Add fstab-decode to %files - rc.d/init.d/functions (fstab_decode_str): New function. (__umount_loop, __umount_loopback_loop): Factor out from copy&pasted copies. (action): Fix command quoting. - rc.d/rc.sysinit: Correctly quote and decode mount points. - rc.d/init.d/halt: Use __umount_* and fstab-decode. (action): Rename from runcmd. Fix command quoting. - rc.d/init.d/netfs: Use __umount_*. --- rc.d/rc.sysinit | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'rc.d/rc.sysinit') diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 96e79c82..c0195319 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -29,11 +29,11 @@ fi . /etc/init.d/functions # Check SELinux status -selinuxfs=`LC_ALL=C awk '/ selinuxfs / { print $2 }' /proc/mounts` +selinuxfs="$(fstab_decode_str `LC_ALL=C awk '/ selinuxfs / { print $2 }' /proc/mounts`)" SELINUX_STATE= if [ -n "$selinuxfs" ] && [ "`cat /proc/self/attr/current`" != "kernel" ]; then - if [ -r $selinuxfs/enforce ] ; then - SELINUX_STATE=`cat $selinuxfs/enforce` + if [ -r "$selinuxfs/enforce" ] ; then + SELINUX_STATE=`cat "$selinuxfs/enforce"` else # assume enforcing if you can't read it SELINUX_STATE=1 @@ -48,7 +48,7 @@ disable_selinux() { echo "*** Warning -- SELinux is active" echo "*** Disabling security enforcement for system recovery." echo "*** Run 'setenforce 1' to reenable." - echo "0" > $selinuxfs/enforce + echo "0" > "$selinuxfs/enforce" } relabel_selinux() { @@ -64,14 +64,14 @@ relabel_selinux() { *** Relabelling could take a very long time, depending on file *** *** system size and speed of hard drives. *** " - echo "0" > $selinuxfs/enforce + echo "0" > "$selinuxfs/enforce" /sbin/fixfiles restore > /dev/null 2>&1 rm -f /.autorelabel if [ ! -z "$REBOOTFLAG" ]; then echo $"Automatic reboot in progress." reboot -f fi - echo $SELINUX_STATE > $selinuxfs/enforce + echo $SELINUX_STATE > "$selinuxfs/enforce" if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then chvt 8 fi @@ -431,15 +431,16 @@ if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then if [ -x /sbin/convertquota ]; then # try to convert old quotas for mountpt in `LC_ALL=C awk '$4 ~ /quota/{print $2}' /etc/mtab` ; do + mountpt="$(fstab_decode_str "$mountpt")" if [ -f "$mountpt/quota.user" ]; then action $"Converting old user quota files: " \ - /sbin/convertquota -u $mountpt && \ - rm -f $mountpt/quota.user + /sbin/convertquota -u "$mountpt" && \ + rm -f "$mountpt/quota.user" fi if [ -f "$mountpt/quota.group" ]; then action $"Converting old group quota files: " \ - /sbin/convertquota -g $mountpt && \ - rm -f $mountpt/quota.group + /sbin/convertquota -g "$mountpt" && \ + rm -f "$mountpt/quota.group" fi done fi -- cgit v1.2.1