prepare archive support, and fixing archive-bomb-problem

pull/10/head
Raphaël Vinot 2013-03-12 19:08:46 +01:00
parent c25ba6cf23
commit a2d1ec8e63
1 changed files with 19 additions and 0 deletions

View File

@ -3,6 +3,8 @@
source ./constraint.sh source ./constraint.sh
source ./constraint_conv.sh source ./constraint_conv.sh
RECURSIVE_ARCHIVE_MAX=3
RECURSIVE_ARCHIVE_CURRENT=0
copy(){ copy(){
src_file=${1} src_file=${1}
@ -37,6 +39,10 @@ video(){
# Random - Used # Random - Used
archive(){
}
application(){ application(){
echo App file ${1} echo App file ${1}
src_file=${1} src_file=${1}
@ -108,6 +114,19 @@ main(){
# first param is the destination dir # first param is the destination dir
dest=${1} dest=${1}
if [ ${2} ]; then
RECURSIVE_ARCHIVE_CURRENT=${RECURSIVE_ARCHIVE_CURRENT}+1
SRC=${3}
if [ ${RECURSIVE_ARCHIVE_CURRENT} -gt ${RECURSIVE_ARCHIVE_MAX} ]; then
echo Archive bomb.
rm -rf ${SRC}
exit
fi
else
RECURSIVE_ARCHIVE_CURRENT=0
fi
FILE_COMMAND='file -b --mime-type' FILE_COMMAND='file -b --mime-type'
FILE_LIST=`find ${SRC} -type f` FILE_LIST=`find ${SRC} -type f`
for file in ${FILE_LIST}; do for file in ${FILE_LIST}; do