Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6fb92bd8 authored by Nick Kralevich's avatar Nick Kralevich Committed by Android Git Automerger
Browse files

am 252b0e2b: Merge "SELinux changes to check policy versions during a reload."

* commit '252b0e2b':
  SELinux changes to check policy versions during a reload.
parents e8f90ca6 252b0e2b
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -841,24 +841,21 @@ static int bootchart_init_action(int nargs, char **args)

static const struct selinux_opt seopts_prop[] = {
        { SELABEL_OPT_PATH, "/property_contexts" },
        { SELABEL_OPT_PATH, "/data/security/current/property_contexts" },
        { 0, NULL }
};

struct selabel_handle* selinux_android_prop_context_handle(void)
{
    int i = 0;
    struct selabel_handle* sehandle = NULL;
    while ((sehandle == NULL) && seopts_prop[i].value) {
        sehandle = selabel_open(SELABEL_CTX_ANDROID_PROP, &seopts_prop[i], 1);
        i++;
    }

    int policy_index = selinux_android_use_data_policy() ? 1 : 0;
    struct selabel_handle* sehandle = selabel_open(SELABEL_CTX_ANDROID_PROP,
                                                   &seopts_prop[policy_index], 1);
    if (!sehandle) {
        ERROR("SELinux:  Could not load property_contexts:  %s\n",
              strerror(errno));
        return NULL;
    }
    INFO("SELinux: Loaded property contexts from %s\n", seopts_prop[i - 1].value);
    INFO("SELinux: Loaded property contexts from %s\n", seopts_prop[policy_index].value);
    return sehandle;
}