* fix for potential security issue with ~/.fp directory owned by root

git-svn-id: trunk@12536 -
This commit is contained in:
Tomas Hajny 2009-01-10 23:42:03 +00:00
parent 8ad1500438
commit d8827829d6

View File

@ -62,34 +62,39 @@ else
fi
#
# Assume local FP IDE configuration unless writing system-wide version possible
fpinifile="$HOME"/.fp/fp.ini
fpcfgfile="$HOME"/.fp/fp.cfg
# Don't mess with IDE configuration if fp binary does not exist
if [ -f "$FPBIN" ] ; then
# Detect if we have write permission in sysfpdirbase (and fp binary exists).
if [ -f "$FPBIN" -a -w "$sysfpdirbase" ] ; then
echo Write permission in $sysfpdirbase.
if ! [ -d "$sysfpdirbase2" ] ; then
echo Directory $sysfpdirbase2 did not exist, attempting to create it now
mkdir $sysfpdirbase2 >/dev/null 2>&1
echo Attempting to create directory $sysfpdir
mkdir $sysfpdir >/dev/null 2>&1
elif ! [ -d "$sysfpdir" ] ; then
echo Directory $sysfpdir did not exist, attempting to create it now
mkdir $sysfpdir >/dev/null 2>&1
# Assume local FP IDE configuration unless writing system-wide version possible
fpinifile="$HOME"/.fp/fp.ini
fpcfgfile="$HOME"/.fp/fp.cfg
# Detect if we have write permission in sysfpdirbase.
if [ -w "$sysfpdirbase" ] ; then
echo Write permission in $sysfpdirbase.
if ! [ -d "$sysfpdirbase2" ] ; then
echo Directory $sysfpdirbase2 did not exist, attempting to create it now
mkdir $sysfpdirbase2 >/dev/null 2>&1
echo Attempting to create directory $sysfpdir
mkdir $sysfpdir >/dev/null 2>&1
elif ! [ -d "$sysfpdir" ] ; then
echo Directory $sysfpdir did not exist, attempting to create it now
mkdir $sysfpdir >/dev/null 2>&1
fi
if [ -w "$sysfpdir" ] ; then
fpinifile="$sysfpdir"/fp.ini
fpcfgfile="$sysfpdir"/fp.cfg
fi
fi
if [ -w "$sysfpdir" ] ; then
fpinifile="$sysfpdir"/fp.ini
fpcfgfile="$sysfpdir"/fp.cfg
fi
fi
#
# When the local FP IDE configuration is used, check if the directory exists
if [ $fpcfgfile = "$HOME"/.fp/fp.cfg -a ! -d "$HOME"/.fp ] ; then
echo Directory $HOME/.fp did not exist, attempting to create it now
mkdir "$HOME"/.fp >/dev/null 2>&1
if [ $fpcfgfile = "$HOME"/.fp/fp.cfg -a ! -d "$HOME"/.fp ] ; then
echo Directory $HOME/.fp did not exist, attempting to create it now
mkdir "$HOME"/.fp >/dev/null 2>&1
fi
fi
#
if [ -f $fpccfgfile ] ; then
mv "$fpccfgfile" "$fpccfgfile.orig" >/dev/null 2>&1