system_privileges_file="$tmpdir/privileges_system"
conf_privileges_file="$tmpdir/privileges_conf"
+cynara_db="/var/cynara/db"
cleanup() {
rm -rf $tmpdir
exit 1
fi
-if [ ! -d /var/cynara/db ]; then
+if [ ! -d $cynara_db ]; then
echo "Cynara database not found"
exit 1
fi
# DA: http://samsung.com/tizen/privilege/${privilege_name}
# IM: http://developer.samsung.com/tizen/privilege/${privilege_name}
# VD: http://developer.samsung.com/privilege/${privilege_name}
-PRIVILEGES=("http://tizen.org/privilege"
- "http://samsung.com/tizen/privilege"
- "http://developer.samsung.com/tizen/privilege"
- "http://developer.samsung.com/privilege")
+PRIVILEGES="
+http://tizen.org/privilege
+http://samsung.com/tizen/privilege
+http://developer.samsung.com/tizen/privilege
+http://developer.samsung.com/privilege
+"
# TEST 1/3: check cynara privileges existence (there are too many to perform this check using xsltproc)
-for p in ${PRIVILEGES[@]}; do
- grep $p /var/cynara/db/* | sed -e "s/;[^;]*;$//g" -e "s/.*http/http/g" | uniq >> $system_privileges_file
+for p in $PRIVILEGES; do
+ grep $p $cynara_db/* | cut -d\; -f3 | sort -u >> $system_privileges_file
done
-$xslt_processor $checker_dir/extract_privilege.xsl $config_file | uniq > $conf_privileges_file
+$xslt_processor $checker_dir/extract_privilege.xsl $config_file | sort -u > $conf_privileges_file
grep -Fxv -f $system_privileges_file $conf_privileges_file | while read line ; do echo "FAILED(cynara) no privilege in cynara db: $line" ; exit 1; done
# TEST 2/3: check allow/deny duplicates (impossible to do directly with xpath 1.0, I don't know how to embed it into schematron config)