summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2011-11-29 08:52:12 +0100
committerWerner Koch <wk@gnupg.org>2011-11-29 08:52:12 +0100
commitc741c6fc3aaa8b75a434faa143c06dd059970d41 (patch)
tree99d8b9da09b02b2086d278b4b029e9e42b39f662
parentAdd build script to build all components in one run. (diff)
downloadgnupg2-c741c6fc3aaa8b75a434faa143c06dd059970d41.tar.xz
gnupg2-c741c6fc3aaa8b75a434faa143c06dd059970d41.zip
Make sure HOME et al have no unsafe characters.
-rw-r--r--ChangeLog4
-rwxr-xr-xautogen.sh20
-rw-r--r--scripts/ChangeLog4
-rwxr-xr-xscripts/build-all.sh18
4 files changed, 45 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e17ba8b1..5e5a0149d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/autogen.sh b/autogen.sh
index f4a1de70f..8a424bce5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -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=
diff --git a/scripts/ChangeLog b/scripts/ChangeLog
index fec54059d..1a664ca68 100644
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -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>
diff --git a/scripts/build-all.sh b/scripts/build-all.sh
index 3cd4f303c..23af6203d 100755
--- a/scripts/build-all.sh
+++ b/scripts/build-all.sh
@@ -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"