summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorRobin Lee <rgl@google.com>2014-06-09 12:51:06 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-09 12:51:06 +0000
commit04eb4227b0ee880141d6ffbf170e79b78affea15 (patch)
tree89579f29a4b28f18d212b37370b1263f447a86c2 /cmds
parentfb617aa82ad2b6671aa1bc37afa115418cd9091c (diff)
parentc4193f1fef52314b451f55cce48ce44f94b875b6 (diff)
downloadframeworks_native-04eb4227b0ee880141d6ffbf170e79b78affea15.zip
frameworks_native-04eb4227b0ee880141d6ffbf170e79b78affea15.tar.gz
frameworks_native-04eb4227b0ee880141d6ffbf170e79b78affea15.tar.bz2
am c4193f1f: Merge "Migrate keychain directories to /data/misc/user/0"
* commit 'c4193f1fef52314b451f55cce48ce44f94b875b6': Migrate keychain directories to /data/misc/user/0
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/installd.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 064ee32..f714836 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -489,6 +489,11 @@ int initialize_directories() {
goto fail;
}
+ if (ensure_config_user_dirs(0) == -1) {
+ ALOGE("Failed to setup misc for user 0");
+ goto fail;
+ }
+
if (version == 2) {
ALOGD("Upgrading to /data/misc/user directories");
@@ -517,12 +522,31 @@ int initialize_directories() {
closedir(dir);
}
- version = 3;
- }
+ // Just rename keychain files into user/0; they should already have the right permissions
+ char misc_dir[PATH_MAX];
+ char keychain_added_dir[PATH_MAX];
+ char keychain_removed_dir[PATH_MAX];
+ char config_added_dir[PATH_MAX];
+ char config_removed_dir[PATH_MAX];
+
+ snprintf(misc_dir, PATH_MAX, "%s/misc", android_data_dir.path);
+ snprintf(keychain_added_dir, PATH_MAX, "%s/keychain/cacerts-added", misc_dir);
+ snprintf(keychain_removed_dir, PATH_MAX, "%s/keychain/cacerts-removed", misc_dir);
+ snprintf(config_added_dir, PATH_MAX, "%s/user/0/cacerts-added", misc_dir);
+ snprintf(config_removed_dir, PATH_MAX, "%s/user/0/cacerts-removed", misc_dir);
+
+ if (access(keychain_added_dir, F_OK) == 0) {
+ if (rename(keychain_added_dir, config_added_dir) != 0) {
+ goto fail;
+ }
+ }
+ if (access(keychain_removed_dir, F_OK) == 0) {
+ if (rename(keychain_removed_dir, config_removed_dir) != 0) {
+ goto fail;
+ }
+ }
- if (ensure_config_user_dirs(0) == -1) {
- ALOGE("Failed to setup misc for user 0");
- goto fail;
+ version = 3;
}
// Persist layout version if changed