Variable name tidy up, forbid anything but [:alnum:]_ in variable names

This commit is contained in:
erdgeist 2006-02-01 19:54:26 +00:00
parent 8fda698012
commit 159b4a8c83

View File

@ -68,8 +68,9 @@ create)
# from this list was done intentionally to permit foo.com
# style directory names, however, the jail name will be
# foo_com in most scripts
newjail_name=`echo ${newjail_name} | tr /~ __`
newjail_nname=`echo ${newjail_name} | tr . _`
newjail_name=`echo -n ${newjail_name} | tr /~ __`
newjail_nname=`echo -n "${newjail_name}" | tr -c [:alnum:]_ _`
newjail_root=${newjail_root:-"${ezjail_jaildir}/${newjail_name}"}
# if jail root specified on command line is not absolute,
@ -175,7 +176,7 @@ delete)
[ "${oldjail_name}" -a $# = 1 ] || exerr 'Usage: ezjail delete [-w] jailname'
# tidy up jail name the ezjail way
oldjail_nname=`echo ${oldjail_name} | tr /~. ___`;
oldjail_nname=`echo -n ${oldjail_name} | tr -c [:alnum:]_ _`;
# check for existence of jail in our records
[ -f ${ezjail_jailcfgs}/${oldjail_nname} ] || exerr "Error: Nothing known about jail ${oldjail_name}."