1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| bool e4crypt_prepare_user_storage(const char* volume_uuid, userid_t user_id, int serial, int flags) { LOG(DEBUG) << "e4crypt_prepare_user_storage for volume " << escape_null(volume_uuid) << ", user " << user_id << ", serial " << serial << ", flags " << flags;
if (flags & FLAG_STORAGE_DE) { auto system_legacy_path = android::vold::BuildDataSystemLegacyPath(user_id); auto misc_legacy_path = android::vold::BuildDataMiscLegacyPath(user_id); auto profiles_de_path = android::vold::BuildDataProfilesDePath(user_id);
auto system_de_path = android::vold::BuildDataSystemDePath(user_id); auto misc_de_path = android::vold::BuildDataMiscDePath(user_id); auto user_de_path = android::vold::BuildDataUserDePath(volume_uuid, user_id);
if (!prepare_dir(system_legacy_path, 0700, AID_SYSTEM, AID_SYSTEM)) return false; #if MANAGE_MISC_DIRS if (!prepare_dir(misc_legacy_path, 0750, multiuser_get_uid(user_id, AID_SYSTEM), multiuser_get_uid(user_id, AID_EVERYBODY))) return false; #endif if (!prepare_dir(profiles_de_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false;
if (!prepare_dir(system_de_path, 0770, AID_SYSTEM, AID_SYSTEM)) return false; if (!prepare_dir(misc_de_path, 01771, AID_SYSTEM, AID_MISC)) return false; if (!prepare_dir(user_de_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false;
if (e4crypt_is_native()) { std::string de_raw_ref; if (!lookup_key_ref(s_de_key_raw_refs, user_id, &de_raw_ref)) return false; if (!ensure_policy(de_raw_ref, system_de_path)) return false; if (!ensure_policy(de_raw_ref, misc_de_path)) return false; if (!ensure_policy(de_raw_ref, user_de_path)) return false; } }
if (flags & FLAG_STORAGE_CE) { auto system_ce_path = android::vold::BuildDataSystemCePath(user_id); auto misc_ce_path = android::vold::BuildDataMiscCePath(user_id); auto media_ce_path = android::vold::BuildDataMediaCePath(volume_uuid, user_id); auto user_ce_path = android::vold::BuildDataUserCePath(volume_uuid, user_id);
if (!prepare_dir(system_ce_path, 0770, AID_SYSTEM, AID_SYSTEM)) return false; if (!prepare_dir(misc_ce_path, 01771, AID_SYSTEM, AID_MISC)) return false; if (!prepare_dir(media_ce_path, 0770, AID_MEDIA_RW, AID_MEDIA_RW)) return false; if (!prepare_dir(user_ce_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false;
if (e4crypt_is_native()) { std::string ce_raw_ref; if (!lookup_key_ref(s_ce_key_raw_refs, user_id, &ce_raw_ref)) return false; if (!ensure_policy(ce_raw_ref, system_ce_path)) return false; if (!ensure_policy(ce_raw_ref, misc_ce_path)) return false; if (!ensure_policy(ce_raw_ref, media_ce_path)) return false; if (!ensure_policy(ce_raw_ref, user_ce_path)) return false;
android::vold::RestoreconRecursive(system_ce_path); android::vold::RestoreconRecursive(misc_ce_path); } }
return true; }
|
This is copyright.