From b5806c47c59f7376fee16ff5c7cd0d5c32d9dbaf Mon Sep 17 00:00:00 2001
From: Joel Galenson <jgalenson@google.com>
Date: Fri, 5 Oct 2018 15:55:31 -0700
Subject: [PATCH] Add code to check for unescaped periods in file_contexts.

Test: Run script and find unescaped periods.
Change-Id: I35a4366aa576d5c6036d0dcfb068ca4e0f27fff9
---
 tools/sepolicy_cleanup_check.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/sepolicy_cleanup_check.sh b/tools/sepolicy_cleanup_check.sh
index 9def7e024..dd8c7af69 100755
--- a/tools/sepolicy_cleanup_check.sh
+++ b/tools/sepolicy_cleanup_check.sh
@@ -108,6 +108,10 @@ find $sedir -name "*.te" -not -path "*prebuilts*" | while read -r file; do
   fi
 done
 
+echo
+echo "Scanning for labels in file_contexts that do not escape '.' properly."
+find $sedir -name file_contexts -not -path "*prebuilts*" -exec grep -H "^[^#].*[^\\]\.[^*]" '{}' \;
+
 echo
 echo "Scanning for rules that use the wrong file/dir macros."
 grep -r ":file.*_dir_perms" --exclude=\*_macros $sedir
-- 
GitLab