]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c
SecurityPkg: Clean up source files
[mirror_edk2.git] / SecurityPkg / UserIdentification / UserProfileManagerDxe / ModifyIdentityPolicy.c
index 2e2d67edfc82903d3dadd237088277ff51b64188..602c4a8397c1ffcc79262717c682e965e859e55b 100644 (file)
@@ -1,13 +1,13 @@
 /** @file\r
   The functions for identification policy modification.\r
-    \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
+\r
+Copyright (c) 2009 - 2018, 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
 http://opensource.org/licenses/bsd-license.php\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   provider can't appear twice in one identity policy.\r
 \r
   @param[in] NewGuid       Points to the credential provider guid.\r
-  \r
+\r
   @retval TRUE     The NewGuid was found in the identity policy.\r
   @retval FALSE    The NewGuid was not found.\r
 \r
@@ -52,16 +52,16 @@ ProviderAlreadyInPolicy (
     }\r
     Offset += Identity->Length;\r
   }\r
-  \r
+\r
   return FALSE;\r
 }\r
 \r
 \r
 /**\r
-  Add or delete the user's credential record in the provider.\r
+  Add the user's credential record in the provider.\r
 \r
-  @param[in]  ProviderGuid        Point to credential provider guid.\r
-  @param[in]  User                Points to user profile.\r
+  @param[in]  Identity     Identity policy item including credential provider.\r
+  @param[in]  User         Points to user profile.\r
 \r
   @retval EFI_SUCCESS      Add or delete record successfully.\r
   @retval Others           Fail to add or delete record.\r
@@ -70,12 +70,12 @@ ProviderAlreadyInPolicy (
 EFI_STATUS\r
 EnrollUserOnProvider (\r
   IN  EFI_USER_INFO_IDENTITY_POLICY              *Identity,\r
-  IN  EFI_USER_PROFILE_HANDLE                    User \r
+  IN  EFI_USER_PROFILE_HANDLE                    User\r
   )\r
 {\r
   UINTN                          Index;\r
   EFI_USER_CREDENTIAL2_PROTOCOL  *UserCredential;\r
-  \r
+\r
   //\r
   // Find the specified credential provider.\r
   //\r
@@ -86,7 +86,7 @@ EnrollUserOnProvider (
     }\r
   }\r
 \r
-  return EFI_NOT_FOUND;  \r
+  return EFI_NOT_FOUND;\r
 }\r
 \r
 \r
@@ -103,12 +103,12 @@ EnrollUserOnProvider (
 EFI_STATUS\r
 DeleteUserOnProvider (\r
   IN  EFI_USER_INFO_IDENTITY_POLICY              *Identity,\r
-  IN  EFI_USER_PROFILE_HANDLE                    User \r
+  IN  EFI_USER_PROFILE_HANDLE                    User\r
   )\r
 {\r
   UINTN                          Index;\r
   EFI_USER_CREDENTIAL2_PROTOCOL  *UserCredential;\r
-  \r
+\r
   //\r
   // Find the specified credential provider.\r
   //\r
@@ -119,13 +119,13 @@ DeleteUserOnProvider (
     }\r
   }\r
 \r
-  return EFI_NOT_FOUND;  \r
+  return EFI_NOT_FOUND;\r
 }\r
 \r
 \r
 /**\r
   Delete User's credental from all the providers that exist in User's identity policy.\r
-  \r
+\r
   @param[in]  IdentityPolicy     Point to User's identity policy.\r
   @param[in]  IdentityPolicyLen  The length of the identity policy.\r
   @param[in]  User               Points to user profile.\r
@@ -135,7 +135,7 @@ VOID
 DeleteCredentialFromProviders (\r
   IN     UINT8                                *IdentityPolicy,\r
   IN     UINTN                                 IdentityPolicyLen,\r
-  IN     EFI_USER_PROFILE_HANDLE               User \r
+  IN     EFI_USER_PROFILE_HANDLE               User\r
   )\r
 {\r
   EFI_USER_INFO_IDENTITY_POLICY    *Identity;\r
@@ -157,17 +157,13 @@ DeleteCredentialFromProviders (
 \r
 \r
 /**\r
-  Remove the provider in FindIdentity from the user identification information record.\r
-  \r
-  @param[in, out] NewInfo       On entry, points to the user information to remove provider. \r
-                                On return, points to the user information the provider is removed.\r
-  @param[in]      FindIdentity  Point to the user identity policy.\r
+  Remove the provider specified by Offset from the new user identification record.\r
 \r
-  @retval TRUE                  The provider is removed successfully.\r
-  @retval FALSE                 Fail to remove the provider.\r
+  @param[in]  IdentityPolicy    Point to user identity item in new identification policy.\r
+  @param[in]  Offset            The item offset in the new identification policy.\r
 \r
 **/\r
-BOOLEAN\r
+VOID\r
 DeleteProviderFromPolicy (\r
   IN     EFI_USER_INFO_IDENTITY_POLICY         *IdentityPolicy,\r
   IN     UINTN                                 Offset\r
@@ -184,29 +180,31 @@ DeleteProviderFromPolicy (
     IdentityPolicy->Type           = EFI_USER_INFO_IDENTITY_TRUE;\r
     IdentityPolicy->Length         = sizeof (EFI_USER_INFO_IDENTITY_POLICY);\r
     mUserInfo.NewIdentityPolicyLen = IdentityPolicy->Length;\r
-    return TRUE;\r
+    return ;\r
   }\r
 \r
   DeleteLen = IdentityPolicy->Length + sizeof(EFI_USER_INFO_IDENTITY_POLICY);\r
   if ((Offset + IdentityPolicy->Length) != mUserInfo.NewIdentityPolicyLen) {\r
     //\r
     // This provider is not the last item in the identification policy, delete it and the connector.\r
-    //    \r
+    //\r
     RemainingLen = mUserInfo.NewIdentityPolicyLen - Offset - DeleteLen;\r
     CopyMem ((UINT8 *) IdentityPolicy, (UINT8 *) IdentityPolicy + DeleteLen, RemainingLen);\r
   }\r
-  mUserInfo.NewIdentityPolicyLen -= DeleteLen;  \r
\r
-  return FALSE;\r
+  mUserInfo.NewIdentityPolicyLen -= DeleteLen;\r
 }\r
 \r
 \r
 /**\r
-  Update the mUserInfo.NewIdentityPolicy, and UI when 'add option' is pressed.\r
+  Add a new provider to the mUserInfo.NewIdentityPolicy.\r
+\r
+  It is invoked when 'add option' in UI is pressed.\r
+\r
+  @param[in] NewGuid       Points to the credential provider guid.\r
 \r
 **/\r
 VOID\r
- AddProviderToPolicy (\r
+AddProviderToPolicy (\r
   IN  EFI_GUID                                  *NewGuid\r
   )\r
 {\r
@@ -250,7 +248,7 @@ VOID
     NewPolicyInfoLen = mUserInfo.NewIdentityPolicyLen + Policy->Length;\r
     FreePool (mUserInfo.NewIdentityPolicy);\r
   }\r
-  \r
+\r
   //\r
   // Save credential provider.\r
   //\r
@@ -327,7 +325,7 @@ UpdateCredentialProvider (
 \r
   @retval TRUE     The policy is a valid identity policy.\r
   @retval FALSE    The policy is not a valid identity policy.\r
-  \r
+\r
 **/\r
 BOOLEAN\r
 CheckNewIdentityPolicy (\r
@@ -339,7 +337,7 @@ CheckNewIdentityPolicy (
   EFI_INPUT_KEY                 Key;\r
   UINTN                         Offset;\r
   UINT32                        OpCode;\r
-  \r
+\r
   //\r
   // Check policy expression.\r
   //\r
@@ -351,7 +349,7 @@ CheckNewIdentityPolicy (
     //\r
     Identity = (EFI_USER_INFO_IDENTITY_POLICY *) (PolicyInfo + Offset);\r
     switch (Identity->Type) {\r
-      \r
+\r
     case EFI_USER_INFO_IDENTITY_TRUE:\r
       break;\r
 \r
@@ -410,11 +408,11 @@ CheckNewIdentityPolicy (
 \r
 /**\r
   Save the identity policy and update UI with it.\r
-  \r
-  This funciton will verify the new identity policy, in current implementation, \r
+\r
+  This function will verify the new identity policy, in current implementation,\r
   the identity policy can be:  T, P & P & P & ..., P | P | P | ...\r
   Here, "T" means "True", "P" means "Credential Provider", "&" means "and", "|" means "or".\r
-  Other identity policies are not supported.  \r
+  Other identity policies are not supported.\r
 \r
 **/\r
 VOID\r
@@ -441,7 +439,7 @@ SaveIdentityPolicy (
   if (EFI_ERROR (Status)) {\r
     return ;\r
   }\r
-  \r
+\r
   //\r
   // Update the informantion on credential provider.\r
   //\r
@@ -449,7 +447,7 @@ SaveIdentityPolicy (
   if (EFI_ERROR (Status)) {\r
     return ;\r
   }\r
-  \r
+\r
   //\r
   // Save new identification policy.\r
   //\r
@@ -463,7 +461,7 @@ SaveIdentityPolicy (
 \r
   Status = mUserManager->SetInfo (mUserManager, mModifyUser, &UserInfo, Info, Info->InfoSize);\r
   FreePool (Info);\r
-   \r
+\r
   //\r
   // Update the mUserInfo.IdentityPolicy by mUserInfo.NewIdentityPolicy\r
   //\r
@@ -475,7 +473,7 @@ SaveIdentityPolicy (
 \r
   mUserInfo.NewIdentityPolicy         = NULL;\r
   mUserInfo.NewIdentityPolicyLen      = 0;\r
-  mUserInfo.NewIdentityPolicyModified = FALSE;   \r
+  mUserInfo.NewIdentityPolicyModified = FALSE;\r
 \r
   //\r
   // Update identity policy choice.\r
@@ -489,14 +487,14 @@ SaveIdentityPolicy (
 \r
 **/\r
 VOID\r
- AddIdentityPolicyItem (\r
+AddIdentityPolicyItem (\r
   VOID\r
   )\r
 {\r
   if (mProviderInfo->Count == 0) {\r
     return ;\r
   }\r
-  \r
+\r
   //\r
   // Check the identity policy.\r
   //\r