* 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,12 +62,15 @@ 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
# 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
@ -82,14 +85,16 @@ if [ -f "$FPBIN" -a -w "$sysfpdirbase" ] ; then
fpinifile="$sysfpdir"/fp.ini
fpcfgfile="$sysfpdir"/fp.cfg
fi
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
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