Correct double-convert from uid to userid
This was making readMasterKey and writeMasterKey always operate on
user 0, because of a double-division - getUserState(*) already
takes into account that the argument is a uid.
Fixes a number of issues related to multi-user and keystore; works
toward fixing bug 16233206.
Change-Id: Ia1434fd0d076b0c36d383ff7390b17c78d7811b5
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 4335f8a..bda6948 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -970,14 +970,12 @@
}
ResponseCode writeMasterKey(const android::String8& pw, uid_t uid) {
- uid_t user_id = get_user_id(uid);
- UserState* userState = getUserState(user_id);
+ UserState* userState = getUserState(uid);
return userState->writeMasterKey(pw, mEntropy);
}
ResponseCode readMasterKey(const android::String8& pw, uid_t uid) {
- uid_t user_id = get_user_id(uid);
- UserState* userState = getUserState(user_id);
+ UserState* userState = getUserState(uid);
return userState->readMasterKey(pw, mEntropy);
}