Set uid/gid of newly created user dirs to system/system.
Bug: 23395513
Change-Id: I3d76b77339f995103c0aec09c6de77b3c8cdc0dd
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index 95cbfb7..c337dbb 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -15,6 +15,8 @@
#include <cutils/properties.h>
#include <openssl/sha.h>
+#include <private/android_filesystem_config.h>
+
#include "unencrypted_properties.h"
#include "key_control.h"
#include "cryptfs.h"
@@ -585,6 +587,9 @@
if (chmod(path, S_IRWXU | S_IRWXG | S_IXOTH) < 0) {
return -1;
}
+ if (chown(path, AID_SYSTEM, AID_SYSTEM) < 0) {
+ return -1;
+ }
if (e4crypt_crypto_complete(DATA_MNT_POINT) == 0) {
// ext4enc:TODO handle errors from this.
e4crypt_set_user_policy(DATA_MNT_POINT, user_handle, path, true);