]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileDelete.c
Enhance drivers for sanity check and coding style alignment.
[mirror_edk2.git] / SecurityPkg / UserIdentification / UserProfileManagerDxe / UserProfileDelete.c
index d0295b731b1aacae770a5c1122739e64deba5822..8be302e1ccb4fff3052e680e65c295a9a0869068 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The functions to delete a user profile.\r
     \r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
 which accompanies this distribution.  The full text of the license may be found at \r
@@ -185,6 +185,9 @@ DeleteUser (
   EFI_STATUS              Status;\r
   EFI_USER_PROFILE_HANDLE User;\r
   EFI_INPUT_KEY           Key;\r
+  EFI_USER_INFO_HANDLE    UserInfo;\r
+  EFI_USER_INFO           *Info;\r
+  UINTN                   InfoSize;\r
 \r
   //\r
   // Find specified user profile and delete it.\r
@@ -204,6 +207,32 @@ DeleteUser (
   }\r
 \r
   if (UserIndex == 1) {\r
+    //\r
+    // Get the identification policy.\r
+    //\r
+    Status = FindInfoByType (User, EFI_USER_INFO_IDENTITY_POLICY_RECORD, &UserInfo);\r
+    if (EFI_ERROR (Status)) {\r
+      goto Done;\r
+    }\r
+\r
+    InfoSize = 0;\r
+    Info = NULL;\r
+    Status   = mUserManager->GetInfo (mUserManager, User, UserInfo, Info, &InfoSize);\r
+    if (Status == EFI_BUFFER_TOO_SMALL) {\r
+      Info = AllocateZeroPool (InfoSize);\r
+      if (Info == NULL) {\r
+        goto Done;\r
+      }\r
+      Status = mUserManager->GetInfo (mUserManager, User, UserInfo, Info, &InfoSize);\r
+    }\r
+\r
+    //\r
+    // Delete the user on the credential providers by its identification policy.\r
+    //\r
+    ASSERT (Info != NULL);\r
+    DeleteCredentialFromProviders ((UINT8 *)(Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO), User);\r
+    FreePool (Info);\r
+    \r
     Status = mUserManager->Delete (mUserManager, User);\r
     if (EFI_ERROR (Status)) {\r
       goto Done;\r
@@ -303,7 +332,7 @@ SelectUserToDelete (
 \r
   HiiUpdateForm (\r
     mCallbackInfo->HiiHandle, // HII handle\r
-    &mUserProfileManagerGuid, // Formset GUID\r
+    &gUserProfileManagerGuid, // Formset GUID\r
     FORMID_DEL_USER,          // Form ID\r
     StartOpCodeHandle,        // Label for where to insert opcodes\r
     EndOpCodeHandle           // Replace data\r