test_dir=("/usr" "/etc" "/opt")
result_file="/opt/share/security-config/result/execute_label_check.result"
log_file="/opt/share/security-config/log/execute_label_check.log"
+exception_file="/usr/share/security-config/test/execute_label_check_test/execute_label_check_exception.list"
+
+# check exception
+# args : $1 = file path
+function CHECK_EXCEPTION
+{
+ while read exception_list_line
+ do
+ if [ "$1" == $exception_list_line ]
+ then
+ return 1
+ fi
+ done < $exception_file
+
+ return 0
+}
# args : $1 = target dir path. Searching recursively inside of it.
function run_chsmack
execute_label=$(echo $LINE | cut -d '"' -f4)
if [ "$execute_label" != "_" ]
then
- echo $LINE >> $log_file
+ file_path=$(echo $LINE | cut -d " " -f1)
+ CHECK_EXCEPTION $file_path # exception check
+ if [ "$?" == 0 ]
+ then
+ echo $LINE >> $log_file
+ fi
fi
done
}