OSDN Git Service

Don't apply default encryption to /data/user, it should get per-user
authorPaul Crowley <paulcrowley@google.com>
Wed, 6 May 2015 14:28:35 +0000 (15:28 +0100)
committerPaul Crowley <paulcrowley@google.com>
Thu, 9 Jul 2015 17:08:41 +0000 (18:08 +0100)
encryption.

Bug: 19704432

(cherry-picked from commit 0050336a0a19019a68374b9eef51e00d6b242f57)

Change-Id: I646f3408ccc06f580d62a2f90f7b895288585396

ext4_utils/ext4_crypt_init_extensions.cpp
ext4_utils/unencrypted_properties.cpp

index 3fb04b9..e1b69e1 100644 (file)
@@ -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<std::string>(properties::ref);
     if (policy.empty()) {
+        // ext4enc:TODO why is this OK?
         return 0;
     }
 
index d873e91..ed36e20 100644 (file)
@@ -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;