Add /data/storage_area to app data directories
libselinux has special handling for the app data directories such as /data/user/$userId/$pkgName and /data/user_de/$userId/$pkgName, because their SELinux contexts are determined differently from "normal" files. /data/storage_area/$userId/$pkgName will be a new app data directory (with a different SELinux context, but determined through the same process). THerefore, add it to the list of app data directories. Bug: 325129836 Change-Id: I4371c23193e6ad07207bc1f22cfd6d1580ccd600
This commit is contained in:
parent
c8d5fc8b44
commit
261afd394b
1 changed files with 12 additions and 0 deletions
|
@ -257,6 +257,7 @@ struct pkg_info *package_info_lookup(const char *name)
|
|||
#define DATA_DATA_PATH "/data/data"
|
||||
#define DATA_USER_PATH "/data/user"
|
||||
#define DATA_USER_DE_PATH "/data/user_de"
|
||||
#define DATA_STORAGE_AREA_PATH "/data/storage_area"
|
||||
#define USER_PROFILE_PATH "/data/misc/profiles/cur/*"
|
||||
#define SDK_SANDBOX_DATA_CE_PATH "/data/misc_ce/*/sdksandbox"
|
||||
#define SDK_SANDBOX_DATA_DE_PATH "/data/misc_de/*/sdksandbox"
|
||||
|
@ -270,6 +271,7 @@ struct pkg_info *package_info_lookup(const char *name)
|
|||
#define DATA_DATA_PREFIX DATA_DATA_PATH "/"
|
||||
#define DATA_USER_PREFIX DATA_USER_PATH "/"
|
||||
#define DATA_USER_DE_PREFIX DATA_USER_DE_PATH "/"
|
||||
#define DATA_STORAGE_AREA_PREFIX DATA_STORAGE_AREA_PATH "/"
|
||||
#define DATA_MISC_CE_PREFIX DATA_MISC_CE_PATH "/"
|
||||
#define DATA_MISC_DE_PREFIX DATA_MISC_DE_PATH "/"
|
||||
#define EXPAND_MNT_PATH_PREFIX EXPAND_MNT_PATH "/"
|
||||
|
@ -289,6 +291,7 @@ static bool is_app_data_path(const char *pathname) {
|
|||
return (!strncmp(pathname, DATA_DATA_PREFIX, sizeof(DATA_DATA_PREFIX)-1) ||
|
||||
!strncmp(pathname, DATA_USER_PREFIX, sizeof(DATA_USER_PREFIX)-1) ||
|
||||
!strncmp(pathname, DATA_USER_DE_PREFIX, sizeof(DATA_USER_DE_PREFIX)-1) ||
|
||||
!strncmp(pathname, DATA_STORAGE_AREA_PREFIX, sizeof(DATA_STORAGE_AREA_PREFIX)-1) ||
|
||||
!fnmatch(EXPAND_USER_PATH, pathname, flags) ||
|
||||
!fnmatch(EXPAND_USER_DE_PATH, pathname, flags) ||
|
||||
!fnmatch(SDK_SANDBOX_DATA_CE_PATH, pathname, flags) ||
|
||||
|
@ -357,6 +360,15 @@ static int extract_pkgname_and_userid(const char *pathname, char **pkgname, unsi
|
|||
pathname++;
|
||||
else
|
||||
return -1;
|
||||
} else if (!strncmp(pathname, DATA_STORAGE_AREA_PREFIX, sizeof(DATA_STORAGE_AREA_PREFIX)-1)) {
|
||||
pathname += sizeof(DATA_STORAGE_AREA_PREFIX) - 1;
|
||||
int rc = extract_userid(&pathname, userid);
|
||||
if (rc)
|
||||
return -1;
|
||||
if (*pathname == '/')
|
||||
pathname++;
|
||||
else
|
||||
return -1;
|
||||
} else if (!fnmatch(EXPAND_USER_PATH, pathname, FNM_LEADING_DIR|FNM_PATHNAME)) {
|
||||
pathname += sizeof(EXPAND_USER_PATH);
|
||||
int rc = extract_userid(&pathname, userid);
|
||||
|
|
Loading…
Reference in a new issue