From a2d1ec8e638ad8f8532f620dcc93620f1593dfb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 12 Mar 2013 19:08:46 +0100 Subject: [PATCH] prepare archive support, and fixing archive-bomb-problem --- filesystem/opt/groomer/functions.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/filesystem/opt/groomer/functions.sh b/filesystem/opt/groomer/functions.sh index 75799ac..bd4b657 100755 --- a/filesystem/opt/groomer/functions.sh +++ b/filesystem/opt/groomer/functions.sh @@ -3,6 +3,8 @@ source ./constraint.sh source ./constraint_conv.sh +RECURSIVE_ARCHIVE_MAX=3 +RECURSIVE_ARCHIVE_CURRENT=0 copy(){ src_file=${1} @@ -37,6 +39,10 @@ video(){ # Random - Used +archive(){ +} + + application(){ echo App file ${1} src_file=${1} @@ -108,6 +114,19 @@ main(){ # first param is the destination dir 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_LIST=`find ${SRC} -type f` for file in ${FILE_LIST}; do