Special case fixups for unlabled files and directories.
Bug: 8116902
(cherry picked from commit 67c2662296fc8dfa233ace58567eaeba1a646d11)
Change-Id: I2041b827240d1102060e2ec5a5de8ea1ff4e171c
diff --git a/src/android.c b/src/android.c
index 578f0be..425821c 100644
--- a/src/android.c
+++ b/src/android.c
@@ -30,22 +30,22 @@
* on app data directories.
*/
static char const * const seapp_contexts_file[] = {
- "/data/security/seapp_contexts",
+ "/data/security/contexts/seapp_contexts",
"/seapp_contexts",
0 };
static const struct selinux_opt seopts[] = {
- { SELABEL_OPT_PATH, "/data/security/file_contexts" },
+ { SELABEL_OPT_PATH, "/data/security/current/file_contexts" },
{ SELABEL_OPT_PATH, "/file_contexts" },
{ 0, NULL } };
static const struct selinux_opt seopt_backup[] = {
- { SELABEL_OPT_PATH, "/data/security/file_contexts_backup" },
+ { SELABEL_OPT_PATH, "/data/security/current/file_contexts_backup" },
{ SELABEL_OPT_PATH, "/file_contexts" },
{ 0, NULL } };
static const char *const sepolicy_file[] = {
- "/data/security/sepolicy",
+ "/data/security/current/sepolicy",
"/sepolicy",
0 };
@@ -690,8 +690,8 @@
}
static int file_requires_fixup(const char *pathname,
- struct selabel_handle *sehandle_old,
- struct selabel_handle *sehandle_new)
+ struct selabel_handle *sehandle_old,
+ struct selabel_handle *sehandle_new)
{
int ret;
struct stat sb;
@@ -722,6 +722,11 @@
goto err;
}
+ if (strstr(current_context, "unlabeled") != NULL) {
+ ret = 1;
+ goto out;
+ }
+
ret = (strcmp(old_context, new_context) && !strcmp(current_context, old_context));
goto out;