OSDN Git Service

Delete synthetic password keystore keys when user is removed.
authorRubin Xu <rubinxu@google.com>
Fri, 15 Sep 2017 10:56:53 +0000 (11:56 +0100)
committerRubin Xu <rubinxu@google.com>
Wed, 15 Nov 2017 14:32:31 +0000 (14:32 +0000)
Bug: 65718620
Test: Add user, remove user, look at "adb shell su 1000 keystore_cli_v2 list"
      and make sure nothing remains.

Change-Id: I2cf862c35117faed38fdfe5c43ceece4e8dbc3c4

services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java

index ca6c9e7..1a1aa56 100644 (file)
@@ -390,11 +390,9 @@ public class SyntheticPasswordManager {
     }
 
     public void removeUser(int userId) {
-        if (isWeaverAvailable()) {
-            for (long handle : mStorage.listSyntheticPasswordHandlesForUser(WEAVER_SLOT_NAME,
-                    userId)) {
-                destroyWeaverSlot(handle, userId);
-            }
+        for (long handle : mStorage.listSyntheticPasswordHandlesForUser(SP_BLOB_NAME, userId)) {
+            destroyWeaverSlot(handle, userId);
+            destroySPBlobKey(getHandleName(handle));
         }
     }