summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2006-02-06 02:42:22 +0000
committererdgeist <erdgeist@erdgeist.org>2006-02-06 02:42:22 +0000
commitc81e58c9c99d8894e0c99cf0a79620d933b2ed8f (patch)
tree782c30a9568174d5fb3a07bbcbf30b45dd07fb17
parentf0e838773bf51a1f52be00d149a6ee660f82d58e (diff)
Protect against empty variable expansion problems in [ $var ]
-rwxr-xr-xezjail-admin12
1 files changed, 6 insertions, 6 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 4c1c82d..702de4c 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -62,7 +62,7 @@ create)
62 [ -d ${ezjail_jailbase} ] || exerr "Error: base jail does not exist. Please run 'ezjail-admin update' first." 62 [ -d ${ezjail_jailbase} ] || exerr "Error: base jail does not exist. Please run 'ezjail-admin update' first."
63 63
64 # relative paths don't make sense in rc.scripts 64 # relative paths don't make sense in rc.scripts
65 [ ${ezjail_jaildir#/} = ${ezjail_jaildir} ] && exerr "Error: Need an absolute path in ezjail_jaildir, it currently is set to: ${ezjail_jaildir}." 65 [ "${ezjail_jaildir#/}" = "${ezjail_jaildir}" ] && exerr "Error: Need an absolute path in ezjail_jaildir, it currently is set to: ${ezjail_jaildir}."
66 66
67 # jail names must not irritate file systems, excluding dots 67 # jail names must not irritate file systems, excluding dots
68 # from this list was done intentionally to permit foo.com 68 # from this list was done intentionally to permit foo.com
@@ -79,11 +79,11 @@ create)
79 79
80 # if jail root specified on command line is not absolute, 80 # if jail root specified on command line is not absolute,
81 # make it absolute inside our jail directory 81 # make it absolute inside our jail directory
82 [ ${newjail_root#/} = ${newjail_root} ] && newjail_root=${ezjail_jaildir}/${newjail_root} 82 [ "${newjail_root#/}" = "${newjail_root}" ] && newjail_root=${ezjail_jaildir}/${newjail_root}
83 83
84 # if jail root specified on command line does not lie 84 # if jail root specified on command line does not lie
85 # within our jail directory, we need to create a softlink 85 # within our jail directory, we need to create a softlink
86 if [ ${newjail_root##${ezjail_jaildir}} = ${newjail_root} ]; then 86 if [ "${newjail_root##${ezjail_jaildir}}" = "${newjail_root}" ]; then
87 newjail_softlink=${ezjail_jaildir}/`basename ${newjail_root}` 87 newjail_softlink=${ezjail_jaildir}/`basename ${newjail_root}`
88 [ -e ${newjail_softlink} -a ${newjail_fill} = "YES" ] && exerr "Error: an ezjail already exists at ${newjail_softlink}." 88 [ -e ${newjail_softlink} -a ${newjail_fill} = "YES" ] && exerr "Error: an ezjail already exists at ${newjail_softlink}."
89 fi 89 fi
@@ -180,7 +180,7 @@ delete)
180 [ "${oldjail_name}" -a $# = 1 ] || exerr 'Usage: ezjail delete [-w] jailname' 180 [ "${oldjail_name}" -a $# = 1 ] || exerr 'Usage: ezjail delete [-w] jailname'
181 181
182 # tidy up jail name the ezjail way 182 # tidy up jail name the ezjail way
183 oldjail_nname=`echo -n ${oldjail_name} | tr -c [:alnum:] _`; 183 oldjail_nname=`echo -n ${oldjail_name} | tr -c [:alnum:] _`
184 184
185 # check for existence of jail in our records 185 # check for existence of jail in our records
186 [ -f ${ezjail_jailcfgs}/${oldjail_nname} ] || exerr "Error: Nothing known about jail ${oldjail_name}." 186 [ -f ${ezjail_jailcfgs}/${oldjail_nname} ] || exerr "Error: Nothing known about jail ${oldjail_name}."
@@ -209,7 +209,7 @@ delete)
209 [ -L ${oldjail_softlink} ] && rm ${oldjail_softlink} 209 [ -L ${oldjail_softlink} ] && rm ${oldjail_softlink}
210 210
211 # if wiping the jail was requested, remove it 211 # if wiping the jail was requested, remove it
212 [ ${oldjail_wipe} = "YES" ] && rm -rf ${oldjail_rootdir} 212 [ "${oldjail_wipe}" = "YES" ] && rm -rf ${oldjail_rootdir}
213 213
214 ;; 214 ;;
215######################## ezjail-admin LIST ######################## 215######################## ezjail-admin LIST ########################
@@ -244,7 +244,7 @@ setup|update)
244 esac 244 esac
245 done; 245 done;
246 246
247 if [ ${updatejail_installaction} = "none" ]; then 247 if [ "${updatejail_installaction}" = "none" ]; then
248 # check, whether ezjail-update has been called. existence of 248 # check, whether ezjail-update has been called. existence of
249 # ezjail_jailbase is our indicator 249 # ezjail_jailbase is our indicator
250 [ -d ${ezjail_jailbase} ] || exerr "Error: base jail does not exist. You cannot fill base jails ports tree before creating it. Please run 'ezjail-admin update' first." 250 [ -d ${ezjail_jailbase} ] || exerr "Error: base jail does not exist. You cannot fill base jails ports tree before creating it. Please run 'ezjail-admin update' first."