Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-extras: Commit

system/extras


Commit MetaInfo

Révision801d95ca3b71ecf297ce940624f0556d44bc63a2 (tree)
l'heure2019-09-19 12:10:20
Auteurandroid-build-team Robot <android-build-team-robot@goog...>
Commiterandroid-build-team Robot

Message de Log

Snap for 5885124 from ef17b323e8be065ed9fbcd1ea863d72e63488fc0 to qt-qpr1-release

Change-Id: I7cd78bea3bf10c61d2653ecc50c8741e96a5b6be

Change Summary

Modification

--- a/libfscrypt/fscrypt_init_extensions.cpp
+++ b/libfscrypt/fscrypt_init_extensions.cpp
@@ -39,7 +39,7 @@
3939
4040 static const std::string arbitrary_sequence_number = "42";
4141
42-static int set_system_de_policy_on(char const* dir);
42+static int set_policy_on(char const* ref_basename, char const* dir);
4343
4444 int fscrypt_install_keyring()
4545 {
@@ -65,7 +65,7 @@ int fscrypt_set_directory_policy(const char* dir)
6565 // Special-case /data/media/obb per b/64566063
6666 if (strcmp(dir, "/data/media/obb") == 0) {
6767 // Try to set policy on this directory, but if it is non-empty this may fail.
68- set_system_de_policy_on(dir);
68+ set_policy_on(fscrypt_key_ref, dir);
6969 return 0;
7070 }
7171
@@ -97,11 +97,20 @@ int fscrypt_set_directory_policy(const char* dir)
9797 return 0;
9898 }
9999 }
100- return set_system_de_policy_on(dir);
100+ std::vector<std::string> per_boot_directories = {
101+ "per_boot",
102+ };
103+ for (const auto& d : per_boot_directories) {
104+ if ((prefix + d) == dir) {
105+ LOG(INFO) << "Setting per_boot key on " << dir;
106+ return set_policy_on(fscrypt_key_per_boot_ref, dir);
107+ }
108+ }
109+ return set_policy_on(fscrypt_key_ref, dir);
101110 }
102111
103-static int set_system_de_policy_on(char const* dir) {
104- std::string ref_filename = std::string("/data") + fscrypt_key_ref;
112+static int set_policy_on(char const* ref_basename, char const* dir) {
113+ std::string ref_filename = std::string("/data") + ref_basename;
105114 std::string policy;
106115 if (!android::base::ReadFileToString(ref_filename, &policy)) {
107116 LOG(ERROR) << "Unable to read system policy to set on " << dir;
--- a/libfscrypt/include/fscrypt/fscrypt.h
+++ b/libfscrypt/include/fscrypt/fscrypt.h
@@ -32,6 +32,7 @@ int fscrypt_policy_ensure(const char *directory, const char *policy,
3232
3333 static const char* fscrypt_unencrypted_folder = "/unencrypted";
3434 static const char* fscrypt_key_ref = "/unencrypted/ref";
35+static const char* fscrypt_key_per_boot_ref = "/unencrypted/per_boot_ref";
3536 static const char* fscrypt_key_mode = "/unencrypted/mode";
3637
3738 __END_DECLS
Afficher sur ancien navigateur de dépôt.