summaryrefslogtreecommitdiff
path: root/scripts/install
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2010-07-28 02:42:52 -0700
committerBob Gilligan <gilligan@vyatta.com>2010-07-28 02:42:52 -0700
commitd3bb616ddd7d97455919dcd49e132f8d271bf38b (patch)
tree28269d97c14facc20b9787712e609f00e55bc9ec /scripts/install
parent5728249e7176331e00f82a323f65b62975c752c6 (diff)
downloadvyatta-cfg-system-d3bb616ddd7d97455919dcd49e132f8d271bf38b.tar.gz
vyatta-cfg-system-d3bb616ddd7d97455919dcd49e132f8d271bf38b.zip
Bugfix 5711: Don't allow special characters in image names.
Diffstat (limited to 'scripts/install')
-rwxr-xr-xscripts/install/install-image-existing13
-rwxr-xr-xscripts/install/install-image-new5
2 files changed, 14 insertions, 4 deletions
diff --git a/scripts/install/install-image-existing b/scripts/install/install-image-existing
index 27d19f4d..b05de08e 100755
--- a/scripts/install/install-image-existing
+++ b/scripts/install/install-image-existing
@@ -59,9 +59,18 @@ NEWNAME=$NEWVER
echo -n "What would you like to name this image? [$NEWNAME]: "
read response
if [ -n "$response" ]; then
+ badchars=`echo $response | sed -e 's/[a-zA-Z0-9\.\_+-]//g'`
+ if [ -n "$badchars" ]; then
+ echo "Image name must be composed of a-z, A-Z, 0-9, or one of ._+-"
+ exit 1
+ fi
NEWNAME=$response
fi
+if [ -z "$NEWNAME" ]; then
+ failure_exit 'Invalid image name.'
+fi
+
# Validate image name
if [ "$NEWNAME" = "grub" -o "${NEWNAME:0:7}" = "vmlinuz" -o \
"${NEWNAME:0:6}" = "initrd" -o "${NEWNAME:0:10}" = "System.map" -o \
@@ -70,10 +79,6 @@ if [ "$NEWNAME" = "grub" -o "${NEWNAME:0:7}" = "vmlinuz" -o \
exit 1;
fi
-if [ -z "$NEWNAME" ]; then
- failure_exit 'Invalid image name.'
-fi
-
echo "OK. This image will be named: $NEWNAME"
# this is the default if current install is union
diff --git a/scripts/install/install-image-new b/scripts/install/install-image-new
index 5726fa03..c669da8e 100755
--- a/scripts/install/install-image-new
+++ b/scripts/install/install-image-new
@@ -33,6 +33,11 @@ fi
echo -n "What would you like to name this image? [$image_name]: "
read response
if [ -n "$response" ]; then
+ badchars=`echo $response | sed -e 's/[a-zA-Z0-9\.\_+-]//g'`
+ if [ -n "$badchars" ]; then
+ echo "Image name must be composed of a-z, A-Z, 0-9, or one of ._+-"
+ exit 1
+ fi
image_name=$response
fi