From c93cc03488ebfbad41552a398c8ac5bbe8d2875a Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 18 Nov 2005 15:48:44 +0000 Subject: Prevent globbing in unwanted places, allow space in User Name --- ezjail-config.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ezjail-config.sh b/ezjail-config.sh index 85d35e3..69a93f4 100644 --- a/ezjail-config.sh +++ b/ezjail-config.sh @@ -2,6 +2,7 @@ # # BEFORE: rcconf +set -o noglob if [ -f /etc/ezjail.flavour ]; then . /etc/ezjail.flavour @@ -18,12 +19,11 @@ ezjail_flavour_packages=${ezjail_flavour_packages:-""} # try to create users for user in $ezjail_flavour_users; do TIFS=$IFS; IFS=:; set -- $user; IFS=$TIFS - if [ $# -eq 8 ]; then gc=1; name=$1; grouplist=$3; gidlist=$4; home=$7 [ $2 ] && uid="-u $2" || uid="" - [ $5 ] && comment="-c \"`echo $5 | tr _ ' '`\"" || comment="" + [ $5 ] && comment="-c$5" || comment="" [ $6 ] && pass="$6" || pass="*" [ $8 ] && shell="-s $8" || shell="" @@ -40,7 +40,7 @@ for user in $ezjail_flavour_users; do fi # create user [ $grouplist ] && grouplist="-G $grouplist" - [ $name ] && echo "$pass" | pw useradd -n $name $uid $shell $mkhome $home $grouplist $comment -H 0 + [ $name ] && echo "$pass" | pw useradd -n $name $uid $shell $mkhome $home $grouplist "`echo $comment | tr = ' '`" -H 0 fi done @@ -48,18 +48,20 @@ done cd $ezjail_flavour_root for file in $ezjail_flavour_files; do TIFS=$IFS; IFS=:; set -- $file; IFS=$TIFS - + set +o noglob if [ $# -eq 3 -a "$3" ]; then owner=$1; [ $2 ] && owner="$1:$2" - for file in $3; do - find ${file#/} | cpio -p -l -d / - chown -R $owner $file + for file in ./$3; do + find ${file} | cpio -p -d / + chown -R $owner /$file done fi + set -o noglob done # finally install packages [ -d /basejail/config/pkg ] && cd /basejail/config/pkg +set +o noglob [ "${ezjail_flavour_packages}" ] && pkg_add ${ezjail_flavour_packages} # Get rid off ourself -- cgit v1.2.3