OSDN Git Service

Fix relabeling of secondary user package directories.
authorStephen Smalley <sds@tycho.nsa.gov>
Mon, 8 Sep 2014 19:51:55 +0000 (15:51 -0400)
committerStephen Smalley <sds@tycho.nsa.gov>
Mon, 8 Sep 2014 19:51:55 +0000 (15:51 -0400)
When relabeling secondary user package directories, we need to use
the uid of the directory rather than the primary package UID;
otherwise, levelFrom=user will not work correctly.

Change-Id: I0d76ec6ec6fe56a566023ca5e1398efdf28fc81e
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
cmds/installd/commands.c

index a347fa8..7a0ad2a 100644 (file)
@@ -1518,7 +1518,7 @@ int restorecon_data(const char* pkgName, const char* seinfo, uid_t uid)
             continue;
         }
 
-        if (selinux_android_restorecon_pkgdir(pkgdir, seinfo, uid, flags) < 0) {
+        if (selinux_android_restorecon_pkgdir(pkgdir, seinfo, s.st_uid, flags) < 0) {
             ALOGE("restorecon failed for %s: %s\n", pkgdir, strerror(errno));
             ret |= -1;
         }