Make sure HOME et al have no unsafe characters.

This commit is contained in:
Werner Koch 2011-11-29 08:52:12 +01:00
parent 88fea6abe6
commit c741c6fc3a
4 changed files with 45 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2011-11-29 Werner Koch <wk@g10code.com>
* autogen.sh: Make sure HOME et al have no unsafe characters.
2011-11-28 Jim Meyering <meyering@redhat.com>
accept --with-libgpg-error-prefix as well as --with-gpg-error-prefix

View File

@ -47,6 +47,26 @@ if test x"$1" = x"--force"; then
shift
fi
# Reject unsafe characters in $HOME, $tsdir and cwd. We consider spaces
# as unsafe because it is too easy to get scripts wrong in this regard.
am_lf='
'
case `pwd` in
*[\;\\\"\#\$\&\'\`$am_lf\ \ ]*)
echo "unsafe working directory name"; DIE=yes;;
esac
case $tsdir in
*[\;\\\"\#\$\&\'\`$am_lf\ \ ]*)
echo "unsafe source directory: \`$tsdir'"; DIE=yes;;
esac
case $HOME in
*[\;\\\"\#\$\&\'\`$am_lf\ \ ]*)
echo "unsafe home directory: \`$HOME'"; DIE=yes;;
esac
if test "$DIE" = "yes"; then
exit 1
fi
# Begin list of optional variables sourced from ~/.gnupg-autogen.rc
w32_toolprefixes=
w32_extraoptions=

View File

@ -1,3 +1,7 @@
2011-11-29 Werner Koch <wk@g10code.com>
* build-all.sh: Make sure HOME has no unsafe characters.
2011-11-28 Werner Koch <wk@g10code.com>,
Jim Meyering <jim@meyering.net>

View File

@ -17,6 +17,23 @@
p=$HOME/tmp/gpg-tmp
parts="libgpg-error libassuan libksba libgcrypt gnupg"
die=no
here="`pwd`"
# Reject unsafe characters in $PWD and $HOME. We consider spaces as
# unsafe because it is too easy to get scripts wrong in this regard.
am_lf='
'
case $here in
*[\;\\\"\#\$\&\'\`$am_lf\ \ ]*)
echo "unsafe working directory: \`$here'"; die=yes;;
esac
case $HOME in
*[\;\\\"\#\$\&\'\`$am_lf\ \ ]*)
echo "unsafe home directory: \`$HOME'"; die=yes;;
esac
test $die = yes && exit 1
# Check that all components are available
for i in $parts; do
if test -d $i ; then
:
@ -35,7 +52,6 @@ done
export PATH=$p/bin:$PATH
export LD_LIBRARY_PATH=$p/lib
here="$(pwd)"
prev=
cfg="configure --enable-maintainer-mode --prefix=$p"