@param[in] ByType If TRUE, Provider is credential class guid.\r
If FALSE, Provider is provider guid.\r
@param[in] User Points to user profile.\r
+ @param[in] Delete If TRUE, delete User from the provider; If FALSE, add \r
+ User info from the provider.\r
\r
@retval EFI_SUCCESS Add or delete record successfully.\r
@retval Others Fail to add or delete record.\r
ModifyProviderCredential (\r
IN EFI_GUID *Provider,\r
IN BOOLEAN ByType,\r
- IN USER_PROFILE_ENTRY *User\r
+ IN USER_PROFILE_ENTRY *User,\r
+ IN BOOLEAN Delete\r
)\r
{\r
UINTN Index;\r
- EFI_USER_CREDENTIAL_PROTOCOL *UserCredential;\r
+ EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
\r
if (Provider == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- \r
//\r
// Find the specified credential provider.\r
//\r
//\r
UserCredential = mProviderDb->Provider[Index];\r
if (CompareGuid (&UserCredential->Identifier, Provider)) {\r
- return UserCredential->Enroll (UserCredential, User);\r
+ if (Delete) {\r
+ return UserCredential->Delete (UserCredential, User);\r
+ } else {\r
+ return UserCredential->Enroll (UserCredential, User);\r
+ }\r
}\r
}\r
\r
Found the providers information in PolicyInfo, and then add or delete the user's credential\r
record in the providers.\r
\r
- @param User Points to user profile.\r
- @param PolicyInfo Point to identification policy to be modified.\r
- @param InfoLen The length of PolicyInfo.\r
+ @param[in] User Points to user profile.\r
+ @param[in] PolicyInfo Point to identification policy to be modified.\r
+ @param[in] InfoLen The length of PolicyInfo.\r
+ @param[in] Delete If TRUE, delete User from the provider; If FALSE, add \r
+ User info from the provider.\r
\r
@retval EFI_SUCCESS Modify PolicyInfo successfully.\r
@retval Others Fail to modify PolicyInfo.\r
ModifyCredentialInfo (\r
IN USER_PROFILE_ENTRY *User,\r
IN UINT8 *PolicyInfo,\r
- IN UINTN InfoLen\r
+ IN UINTN InfoLen,\r
+ IN BOOLEAN Delete\r
)\r
{\r
EFI_STATUS Status;\r
Identity = (EFI_USER_INFO_IDENTITY_POLICY *) (PolicyInfo + TotalLen);\r
switch (Identity->Type) {\r
case EFI_USER_INFO_IDENTITY_CREDENTIAL_TYPE:\r
- Status = ModifyProviderCredential ((EFI_GUID *) (Identity + 1), TRUE, User);\r
+ Status = ModifyProviderCredential ((EFI_GUID *) (Identity + 1), TRUE, User, Delete);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
break;\r
\r
case EFI_USER_INFO_IDENTITY_CREDENTIAL_PROVIDER:\r
- Status = ModifyProviderCredential ((EFI_GUID *) (Identity + 1), FALSE, User);\r
+ Status = ModifyProviderCredential ((EFI_GUID *) (Identity + 1), FALSE, User, Delete);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
//\r
// The credential is NOT found in the old identity policy; add it.\r
//\r
- Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+ Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, FALSE);\r
if (EFI_ERROR (Status)) {\r
break;\r
}\r
break;\r
}\r
\r
- ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+ ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, TRUE);\r
CredentialCount--;\r
}\r
}\r
//\r
// The credential is found in the old identity policy, so delete the old credential first.\r
//\r
- Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+ Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, TRUE);\r
if (EFI_ERROR (Status)) {\r
//\r
// Failed to delete old credential.\r
//\r
// Add the new credential.\r
//\r
- Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+ Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, FALSE);\r
if (EFI_ERROR (Status)) {\r
//\r
// Failed to enroll the user by new identification policy.\r
//\r
// The credential is NOT found in the new identity policy. Delete the old credential.\r
//\r
- ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+ ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, TRUE);\r
}\r
}\r
TotalLen += Identity->Length;\r
Status = ModifyCredentialInfo (\r
User,\r
(UINT8 *) ((EFI_USER_INFO *) Info + 1),\r
- InfoSize - sizeof (EFI_USER_INFO)\r
+ InfoSize - sizeof (EFI_USER_INFO),\r
+ FALSE\r
);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
if (Info->InfoType == EFI_USER_INFO_IDENTIFIER_RECORD) {\r
return EFI_ACCESS_DENIED;\r
} else if (Info->InfoType == EFI_USER_INFO_IDENTITY_POLICY_RECORD) {\r
- Status = ModifyCredentialInfo (User, (UINT8 *) (Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO));\r
+ Status = ModifyCredentialInfo (User, (UINT8 *) (Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO), TRUE);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
EFI_HII_HANDLE HiiHandle;\r
EFI_GUID FormSetId;\r
EFI_FORM_ID FormId;\r
- EFI_USER_CREDENTIAL_PROTOCOL *UserCredential;\r
+ EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
\r
if (Provider == NULL) {\r
return EFI_INVALID_PARAMETER;\r
EFI_STRING_ID ProvID;\r
CHAR16 *ProvStr;\r
UINTN Index;\r
- EFI_USER_CREDENTIAL_PROTOCOL *UserCredential;\r
+ EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
\r
for (Index = 0; Index < mProviderDb->Count; Index++) {\r
UserCredential = mProviderDb->Provider[Index];\r
HandleBuf = NULL;\r
Status = gBS->LocateHandleBuffer (\r
ByProtocol,\r
- &gEfiUserCredentialProtocolGuid,\r
+ &gEfiUserCredential2ProtocolGuid,\r
NULL,\r
&HandleCount,\r
&HandleBuf\r
//\r
mProviderDb = AllocateZeroPool (\r
sizeof (CREDENTIAL_PROVIDER_INFO) - \r
- sizeof (EFI_USER_CREDENTIAL_PROTOCOL *) + \r
- HandleCount * sizeof (EFI_USER_CREDENTIAL_PROTOCOL *)\r
+ sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) + \r
+ HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *)\r
);\r
if (mProviderDb == NULL) {\r
FreePool (HandleBuf);\r
for (Index = 0; Index < HandleCount; Index++) {\r
Status = gBS->HandleProtocol (\r
HandleBuf[Index],\r
- &gEfiUserCredentialProtocolGuid,\r
+ &gEfiUserCredential2ProtocolGuid,\r
(VOID **) &mProviderDb->Provider[Index]\r
);\r
if (EFI_ERROR (Status)) {\r
EFI_CREDENTIAL_LOGON_FLAGS AutoLogon;\r
EFI_USER_INFO *IdentifyInfo;\r
EFI_USER_INFO_IDENTITY_POLICY *Identity;\r
- EFI_USER_CREDENTIAL_PROTOCOL *UserCredential;\r
+ EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
USER_PROFILE_ENTRY *UserEntry;\r
\r
//\r
credential and add it.\r
\r
@param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL.\r
- @param[in] Changed Handle on which is installed an instance of the EFI_USER_CREDENTIAL_PROTOCOL \r
+ @param[in] Changed Handle on which is installed an instance of the EFI_USER_CREDENTIAL2_PROTOCOL \r
where the user has changed.\r
\r
@retval EFI_SUCCESS The User Identity Manager has handled the notification.\r
)\r
{\r
EFI_STATUS Status;\r
- EFI_USER_CREDENTIAL_PROTOCOL *Provider;\r
+ EFI_USER_CREDENTIAL2_PROTOCOL *Provider;\r
EFI_USER_INFO_IDENTIFIER UserId;\r
EFI_USER_INFO_HANDLE UserInfo;\r
EFI_USER_INFO_HANDLE UserInfo2;\r
\r
Status = gBS->HandleProtocol (\r
Changed,\r
- &gEfiUserCredentialProtocolGuid,\r
+ &gEfiUserCredential2ProtocolGuid,\r
(VOID **) &Provider\r
);\r
if (EFI_ERROR (Status)) {\r