X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=SecurityPkg%2FUserIdentification%2FUserProfileManagerDxe%2FUserProfileManager.c;h=e73ba3a8fc50703abd3116e6b692775831d52c76;hp=74c979d58eec49f712ad57248abd44d27cfffa62;hb=28ce4cb3590bc3aaa91c3be75429d4e8722415e2;hpb=0c18794ea4289f03fefc7117b56740414cc0536c diff --git a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.c b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.c index 74c979d58e..e73ba3a8fc 100644 --- a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.c +++ b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.c @@ -1,23 +1,23 @@ /** @file - This driver is a configuration tool for adding, deleting or modifying user - profiles, including gathering the necessary information to ascertain their - identity in the future, updating user access policy and identification + This driver is a configuration tool for adding, deleting or modifying user + profiles, including gathering the necessary information to ascertain their + identity in the future, updating user access policy and identification policy, etc. -Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "UserProfileManager.h" -EFI_GUID mUserProfileManagerGuid = USER_PROFILE_MANAGER_GUID; EFI_USER_MANAGER_PROTOCOL *mUserManager = NULL; CREDENTIAL_PROVIDER_INFO *mProviderInfo = NULL; UINT8 mProviderChoice; @@ -35,7 +35,7 @@ HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = { (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) } }, - {0xad2e3474, 0x93e6, 0x488b, {0x93, 0x19, 0x64, 0x88, 0xfc, 0x68, 0x1f, 0x16}} + USER_PROFILE_MANAGER_GUID }, { END_DEVICE_PATH_TYPE, @@ -71,12 +71,12 @@ GetStringById ( /** - This function gets all the credential providers in the system and saved them + This function gets all the credential providers in the system and saved them to mProviderInfo. @retval EFI_SUCESS Init credential provider database successfully. @retval Others Fail to init credential provider database. - + **/ EFI_STATUS InitProviderInfo ( @@ -86,8 +86,8 @@ InitProviderInfo ( EFI_STATUS Status; UINTN HandleCount; EFI_HANDLE *HandleBuf; - UINTN Index; - + UINTN Index; + // // Try to find all the user credential provider driver. // @@ -95,7 +95,7 @@ InitProviderInfo ( HandleBuf = NULL; Status = gBS->LocateHandleBuffer ( ByProtocol, - &gEfiUserCredentialProtocolGuid, + &gEfiUserCredential2ProtocolGuid, NULL, &HandleCount, &HandleBuf @@ -103,7 +103,7 @@ InitProviderInfo ( if (EFI_ERROR (Status)) { return Status; } - + // // Get provider infomation. // @@ -111,9 +111,9 @@ InitProviderInfo ( FreePool (mProviderInfo); } mProviderInfo = AllocateZeroPool ( - sizeof (CREDENTIAL_PROVIDER_INFO) - - sizeof (EFI_USER_CREDENTIAL_PROTOCOL *) + - HandleCount * sizeof (EFI_USER_CREDENTIAL_PROTOCOL *) + sizeof (CREDENTIAL_PROVIDER_INFO) - + sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) + + HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) ); if (mProviderInfo == NULL) { FreePool (HandleBuf); @@ -124,7 +124,7 @@ InitProviderInfo ( for (Index = 0; Index < HandleCount; Index++) { Status = gBS->HandleProtocol ( HandleBuf[Index], - &gEfiUserCredentialProtocolGuid, + &gEfiUserCredential2ProtocolGuid, (VOID **) &mProviderInfo->Provider[Index] ); if (EFI_ERROR (Status)) { @@ -192,7 +192,7 @@ UserProfileManagerCallback ( if (QuestionId != QUESTIONID_USER_MANAGE) { return EFI_SUCCESS; } - + // // Get current user // @@ -202,7 +202,7 @@ UserProfileManagerCallback ( DEBUG ((DEBUG_ERROR, "Error: current user does not exist!\n")); return EFI_NOT_READY; } - + // // Get current user's right information. // @@ -210,7 +210,7 @@ UserProfileManagerCallback ( if (EFI_ERROR (Status)) { CurrentAccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF; } - + // // Init credential provider information. // @@ -218,16 +218,16 @@ UserProfileManagerCallback ( if (EFI_ERROR (Status)) { return Status; } - + // // Initialize the container for dynamic opcodes. // StartOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (StartOpCodeHandle != NULL); - + EndOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (EndOpCodeHandle != NULL); - + // // Create Hii Extend Label OpCode. // @@ -239,7 +239,7 @@ UserProfileManagerCallback ( ); StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; StartLabel->Number = LABEL_USER_MANAGE_FUNC; - + EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( EndOpCodeHandle, &gEfiIfrTianoGuid, @@ -248,7 +248,7 @@ UserProfileManagerCallback ( ); EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; EndLabel->Number = LABEL_END; - + // // Add user profile option. // @@ -264,7 +264,7 @@ UserProfileManagerCallback ( 0 // Action String ID ); } - + // // Add modify user profile option. // @@ -276,7 +276,7 @@ UserProfileManagerCallback ( EFI_IFR_FLAG_CALLBACK, // Question flag KEY_MODIFY_USER // Question ID ); - + // // Add delete user profile option // @@ -290,18 +290,18 @@ UserProfileManagerCallback ( KEY_DEL_USER // Question ID ); } - + HiiUpdateForm ( mCallbackInfo->HiiHandle, // HII handle - &mUserProfileManagerGuid, // Formset GUID + &gUserProfileManagerGuid, // Formset GUID FORMID_USER_MANAGE, // Form ID StartOpCodeHandle, // Label for where to insert opcodes EndOpCodeHandle // Replace data ); - + HiiFreeOpCodeHandle (StartOpCodeHandle); HiiFreeOpCodeHandle (EndOpCodeHandle); - + return EFI_SUCCESS; } break; @@ -310,15 +310,15 @@ UserProfileManagerCallback ( Status = EFI_SUCCESS; break; - case EFI_BROWSER_ACTION_CHANGING: - { + case EFI_BROWSER_ACTION_CHANGED: + { // // Handle the request from form. // if ((Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; } - + // // Judge first 2 bits. // @@ -338,13 +338,6 @@ UserProfileManagerCallback ( // Judge next 2 bits. // switch (QuestionId & KEY_SECOND_FORM_MASK) { - // - // Enter delete user profile form. - // - case KEY_ENTER_NEXT_FORM: - SelectUserToDelete (); - break; - // // Delete specified user profile. // @@ -369,13 +362,6 @@ UserProfileManagerCallback ( // Judge next 2 bits. // switch (QuestionId & KEY_SECOND_FORM_MASK) { - // - // Enter modify user profile form. - // - case KEY_ENTER_NEXT_FORM: - SelectUserToModify (); - break; - // // Enter user profile information form. // @@ -384,13 +370,6 @@ UserProfileManagerCallback ( // Judge next 3 bits. // switch (QuestionId & KEY_MODIFY_INFO_MASK) { - // - // Display user information form. - // - case KEY_ENTER_NEXT_FORM: - ModifyUserInfo ((UINT8) QuestionId); - break; - // // Modify user name. // @@ -410,19 +389,11 @@ UserProfileManagerCallback ( // Judge next 3 bits // switch (QuestionId & KEY_MODIFY_IP_MASK) { - // - // Display identity policy modify form. - // - case KEY_ENTER_NEXT_FORM: - ModifyIdentityPolicy (); - break; - // // Change credential provider option. // - case KEY_MODIFY_PROV: + case KEY_MODIFY_PROV: mProviderChoice = Value->u8; - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; break; // @@ -430,7 +401,6 @@ UserProfileManagerCallback ( // case KEY_MODIFY_CONN: mConncetLogical = Value->u8; - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; break; // @@ -445,7 +415,7 @@ UserProfileManagerCallback ( // case KEY_IP_RETURN_UIF: SaveIdentityPolicy (); - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; break; default: @@ -461,19 +431,11 @@ UserProfileManagerCallback ( // Judge next 3 bits. // switch (QuestionId & KEY_MODIFY_AP_MASK) { - // - // Display access policy modify form. - // - case KEY_ENTER_NEXT_FORM: - ModidyAccessPolicy (); - break; - // // Change access right choice. // case KEY_MODIFY_RIGHT: mAccessInfo.AccessRight = Value->u8; - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; break; // @@ -481,7 +443,6 @@ UserProfileManagerCallback ( // case KEY_MODIFY_SETUP: mAccessInfo.AccessSetup= Value->u8; - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; break; // @@ -489,61 +450,6 @@ UserProfileManagerCallback ( // case KEY_MODIFY_BOOT: mAccessInfo.AccessBootOrder = Value->u32; - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; - break; - - // - // Load device path form. - // - case KEY_MODIFY_LOAD: - // - // Judge next 2 bits. - // - switch (QuestionId & KEY_DISPLAY_DP_MASK) { - // - // Permit load device path. - // - case KEY_PERMIT_MODIFY: - DisplayLoadPermit (); - break; - - // - // Forbid load device path. - // - case KEY_FORBID_MODIFY: - DisplayLoadForbid (); - break; - - default: - break; - } - break; - - // - // Connect device path form. - // - case KEY_MODIFY_CONNECT: - // - // Judge next 2 bits. - // - switch (QuestionId & KEY_DISPLAY_DP_MASK) { - // - // Permit connect device path. - // - case KEY_PERMIT_MODIFY: - DisplayConnectPermit (); - break; - - // - // Forbid connect device path. - // - case KEY_FORBID_MODIFY: - DisplayConnectForbid (); - break; - - default: - break; - } break; // @@ -551,7 +457,7 @@ UserProfileManagerCallback ( // case KEY_AP_RETURN_UIF: SaveAccessPolicy (); - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; break; default: @@ -648,6 +554,179 @@ UserProfileManagerCallback ( } break; + + case EFI_BROWSER_ACTION_CHANGING: + { + // + // Handle the request from form. + // + if (Value == NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Judge first 2 bits. + // + switch (QuestionId & KEY_FIRST_FORM_MASK) { + // + // Delete user profile operation. + // + case KEY_DEL_USER: + // + // Judge next 2 bits. + // + switch (QuestionId & KEY_SECOND_FORM_MASK) { + // + // Enter delete user profile form. + // + case KEY_ENTER_NEXT_FORM: + SelectUserToDelete (); + break; + + default: + break; + } + break; + + // + // Modify user profile operation. + // + case KEY_MODIFY_USER: + // + // Judge next 2 bits. + // + switch (QuestionId & KEY_SECOND_FORM_MASK) { + // + // Enter modify user profile form. + // + case KEY_ENTER_NEXT_FORM: + SelectUserToModify (); + break; + + // + // Enter user profile information form. + // + case KEY_SELECT_USER: + // + // Judge next 3 bits. + // + switch (QuestionId & KEY_MODIFY_INFO_MASK) { + // + // Display user information form. + // + case KEY_ENTER_NEXT_FORM: + ModifyUserInfo ((UINT8) QuestionId); + break; + + // + // Modify identity policy. + // + case KEY_MODIFY_IP: + // + // Judge next 3 bits + // + switch (QuestionId & KEY_MODIFY_IP_MASK) { + // + // Display identity policy modify form. + // + case KEY_ENTER_NEXT_FORM: + ModifyIdentityPolicy (); + break; + + default: + break; + } + break; + + // + // Modify access policy. + // + case KEY_MODIFY_AP: + // + // Judge next 3 bits. + // + switch (QuestionId & KEY_MODIFY_AP_MASK) { + // + // Display access policy modify form. + // + case KEY_ENTER_NEXT_FORM: + ModidyAccessPolicy (); + break; + // + // Load device path form. + // + case KEY_MODIFY_LOAD: + // + // Judge next 2 bits. + // + switch (QuestionId & KEY_DISPLAY_DP_MASK) { + // + // Permit load device path. + // + case KEY_PERMIT_MODIFY: + DisplayLoadPermit (); + break; + + // + // Forbid load device path. + // + case KEY_FORBID_MODIFY: + DisplayLoadForbid (); + break; + + default: + break; + } + break; + + // + // Connect device path form. + // + case KEY_MODIFY_CONNECT: + // + // Judge next 2 bits. + // + switch (QuestionId & KEY_DISPLAY_DP_MASK) { + // + // Permit connect device path. + // + case KEY_PERMIT_MODIFY: + DisplayConnectPermit (); + break; + + // + // Forbid connect device path. + // + case KEY_FORBID_MODIFY: + DisplayConnectForbid (); + break; + + default: + break; + } + break; + + default: + break; + } + break; + + default: + break; + } + break; + + default: + break; + } + break; + + default: + break; + } + } + break; + default: // // All other action return unsupported. @@ -727,6 +806,8 @@ FakeRouteConfig ( return EFI_INVALID_PARAMETER; } + *Progress = Configuration; + return EFI_NOT_FOUND; } @@ -758,7 +839,7 @@ UserProfileManagerInit ( if (EFI_ERROR (Status)) { return EFI_SUCCESS; } - + // // Initialize driver private data. // @@ -766,14 +847,14 @@ UserProfileManagerInit ( ZeroMem (&mAccessInfo, sizeof (mAccessInfo)); CallbackInfo = AllocateZeroPool (sizeof (USER_PROFILE_MANAGER_CALLBACK_INFO)); - ASSERT (CallbackInfo != NULL); + ASSERT (CallbackInfo != NULL); CallbackInfo->Signature = USER_PROFILE_MANAGER_SIGNATURE; CallbackInfo->ConfigAccess.ExtractConfig = FakeExtractConfig; CallbackInfo->ConfigAccess.RouteConfig = FakeRouteConfig; CallbackInfo->ConfigAccess.Callback = UserProfileManagerCallback; CallbackInfo->DriverHandle = NULL; - + // // Install Device Path Protocol and Config Access protocol to driver handle. // @@ -791,16 +872,16 @@ UserProfileManagerInit ( // Publish HII data. // CallbackInfo->HiiHandle = HiiAddPackages ( - &mUserProfileManagerGuid, + &gUserProfileManagerGuid, CallbackInfo->DriverHandle, UserProfileManagerStrings, UserProfileManagerVfrBin, NULL ); - ASSERT (CallbackInfo->HiiHandle != NULL); + ASSERT (CallbackInfo->HiiHandle != NULL); mCallbackInfo = CallbackInfo; return Status; } - +