From 42fdbd76e5dd71ef7dc7da76b52407dc16f07a63 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 26 Nov 2013 22:56:32 -0800 Subject: [PATCH] jailsetup.sh: verify $cfg_chroot is sane Before the jailsetup.sh script writes all over the chroot make sure that the $cfg_chroot variable is actually set and is not set to "/" in order to help prevent any catastrophes. --- jailsetup.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jailsetup.sh b/jailsetup.sh index baedf9b..e3dc00c 100755 --- a/jailsetup.sh +++ b/jailsetup.sh @@ -54,6 +54,13 @@ elif ! "$getent" group "$cfg_owning_group" >/dev/null; then exit 1 fi +# One last paranoid check before we go writing all over everything +if [ -z "$cfg_chroot" -o "$cfg_chroot" = "/" ]; then + echo "*** Error: chroot location is not set or is invalid." >&2 + echo "*** Error: perhaps you have an incorrect Config.pm?" >&2 + exit 1 +fi + umask 022 mkdir -p "$cfg_chroot" cd "$cfg_chroot" -- 2.11.4.GIT