From 7d0fa69a5a28bbb16e55af3df998fa62ca289244 Mon Sep 17 00:00:00 2001 From: levasseur Date: Fri, 17 Dec 2021 16:12:07 +0100 Subject: [PATCH] zzz_main.sh: do more checks arround module list --- lib/zzz_main_fct.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/zzz_main_fct.sh b/lib/zzz_main_fct.sh index 5d11f21..daac027 100644 --- a/lib/zzz_main_fct.sh +++ b/lib/zzz_main_fct.sh @@ -296,10 +296,16 @@ process_commandline_and_vars() # Check for module list existance and basic syntax if [[ -n $MODULE_LIST ]]; then - if [[ $(echo $MODULE_LIST | grep '-') ]]; then - prnt E "Dash is forbidden in module name." - die 5 - fi + for $mod in $MODULE_LIST; do + if [[ $mod =~ ['\"\'\ \\-!@#$%&*=+'] ]]; then + prnt E "The module \"$mod\" contains a forbidden character in its name." + die 5 + fi + if [[ ! -s "modules/$mod.sh" ]]; then + prnt E "The asked module \"$mod\", doesn't have any module file or module file is empty." + die 18 + fi + done else prnt E "No module to execute!" die 5