From 15e73f525c38d9ccdf8806a6227e83867b8e259b Mon Sep 17 00:00:00 2001 From: Paul Crowley Date: Wed, 6 May 2015 15:28:35 +0100 Subject: Don't apply default encryption to /data/user, it should get per-user encryption. Bug: 19704432 (cherry-picked from commit 0050336a0a19019a68374b9eef51e00d6b242f57) Change-Id: I646f3408ccc06f580d62a2f90f7b895288585396 --- ext4_utils/ext4_crypt_init_extensions.cpp | 5 +++++ ext4_utils/unencrypted_properties.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp index 3fb04b98..e1b69e1e 100644 --- a/ext4_utils/ext4_crypt_init_extensions.cpp +++ b/ext4_utils/ext4_crypt_init_extensions.cpp @@ -142,10 +142,15 @@ int e4crypt_set_directory_policy(const char* dir) if (!dir || strncmp(dir, "/data/", 6) || strchr(dir + 6, '/')) { return 0; } + // ext4enc:TODO exclude /data/user with a horrible special case. + if (!strcmp(dir, "/data/user")) { + return 0; + } UnencryptedProperties props("/data"); std::string policy = props.Get(properties::ref); if (policy.empty()) { + // ext4enc:TODO why is this OK? return 0; } diff --git a/ext4_utils/unencrypted_properties.cpp b/ext4_utils/unencrypted_properties.cpp index d873e91f..ed36e206 100644 --- a/ext4_utils/unencrypted_properties.cpp +++ b/ext4_utils/unencrypted_properties.cpp @@ -84,6 +84,7 @@ UnencryptedProperties UnencryptedProperties::GetChild(const char* name) const bool UnencryptedProperties::Remove(const char* name) { + if (!OK()) return false; if (remove((folder_ + "/" + name).c_str()) && errno != ENOENT) { return false; -- cgit v1.2.3