From: sanghyeok.oh Date: Wed, 23 Oct 2019 11:13:34 +0000 (+0900) Subject: policychecker: print error related information X-Git-Tag: submit/tizen/20191031.025611^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_7.0;p=platform%2Fcore%2Fsystem%2Fdbus-tools.git policychecker: print error related information Change-Id: I07dbeffd02cf67f98ec0363b7b4aaa55e8f34e02 Signed-off-by: sanghyeok.oh --- diff --git a/policychecker/check.in b/policychecker/check.in index 393785a..d451840 100755 --- a/policychecker/check.in +++ b/policychecker/check.in @@ -12,6 +12,7 @@ sub_conf_path=("system.d" "session.d") bus_type=-1 config_file=-1 checker_include_all=0 +verbose_mode=0 schema_file="$checker_dir/rules.xsl" system_privileges_file="$tmpdir/privileges_system" @@ -31,13 +32,14 @@ usage() { echo -e "\tfilename dbus policy configuration file" echo -e "\t-s system bus" echo -e "\t-u session bus" + echo -e "\t-d enable verbose mode" echo -e "\t-v include every iso xsls" echo -e "\t-p enable profile mode" } # use "checker opt + config-file" # getopts doesn't support - "checker config-file + opt" -while getopts :suvp opt +while getopts :sudvp opt do case "$opt" in s) if [ $bus_type -eq -1 ]; then bus_type=0 @@ -49,8 +51,11 @@ do case "$opt" in echo "check session bus" fi ;; - v) checker_include_all=1 - echo "use iso_dsdl_include.xsl" + d) echo "enable verbose mode" + verbose_mode=1 + ;; + v) echo "include every xsl. iso_dsdl_include.xsl" + checker_include_all=1 ;; p) echo "enable profile mode" xslt_processor="$xslt_processor --profile" @@ -141,23 +146,164 @@ function check_policy_file(){ echo } +# print_matched_xml (str filename, int policyindex, str allow/deny, int allowindex) +# print_matched_xml "$filename" $policy "" 0 +function print_matched_xml(){ + local cnt_policy=0 + local cnt_allow=0 + local cnt_deny=0 + local filename="$1" + local policy_index=$2 + local allowdeny="$3" + local allow_index=$4 + local found_policy_tag=0 + local print_to_end=0 + local line_cnt=0 + local is_comment=0 + local reg1="^[[:blank:]]*[[:blank:]]*$" + local reg3="^.*-->[[:blank:]]*$" + local reg_start_allow="^[[:blank:]]*<$allowdeny.*$" + local reg_end_tag=".*/>[[:blank:]]*$" + local reg_start_policy="^[[:blank:]]*