summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dmitry Dementyev <dementyev@google.com> 2024-12-19 11:02:42 -0800
committer Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-01-13 11:44:30 -0800
commitf79cc5227ff321ebaa588ac6cb36da70e8cbe2cf (patch)
treef5124252917e91a75daaaf14af01e5ce386ddb30
parent5f3e7eb481fcccc0131b16926d7cc1c523a357cf (diff)
Check account type returned by AbstractAccountAuthenticator.
AccountManagerService already knows which account is used during AbstractAccountAuthenticator.getAuthToken. KEY_ACCOUNT_NAME and KEY_ACCOUNT_TYPE in the response look unnecessary, but we can't change API at this moment. Bug: 364269936 Test: manual Flag: EXEMPT bugfix (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a3788486f2c7f728721c9700f7485f865b462609) Merged-In: Ifc62866f4feaca43abc32bc542b97f3741953f56 Change-Id: Ifc62866f4feaca43abc32bc542b97f3741953f56
-rw-r--r--services/core/java/com/android/server/accounts/AccountManagerService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 719928b8e582..9d7318641715 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -3227,6 +3227,12 @@ public class AccountManagerService
"the type and name should not be empty");
return;
}
+ if (!type.equals(mAccountType)) {
+ onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
+ "incorrect account type");
+ return;
+ }
+
Account resultAccount = new Account(name, type);
if (!customTokens) {
saveAuthTokenToDatabase(