15b8fca66Sopenharmony_ci/* 25b8fca66Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 35b8fca66Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 45b8fca66Sopenharmony_ci * you may not use this file except in compliance with the License. 55b8fca66Sopenharmony_ci * You may obtain a copy of the License at 65b8fca66Sopenharmony_ci * 75b8fca66Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 85b8fca66Sopenharmony_ci * 95b8fca66Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 105b8fca66Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 115b8fca66Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125b8fca66Sopenharmony_ci * See the License for the specific language governing permissions and 135b8fca66Sopenharmony_ci * limitations under the License. 145b8fca66Sopenharmony_ci */ 155b8fca66Sopenharmony_ci 165b8fca66Sopenharmony_ci#include "addstateregistrytoken_fuzzer.h" 175b8fca66Sopenharmony_ci 185b8fca66Sopenharmony_ci#include <iostream> 195b8fca66Sopenharmony_ci 205b8fca66Sopenharmony_ci#include "nativetoken_kit.h" 215b8fca66Sopenharmony_ci#include "token_setproc.h" 225b8fca66Sopenharmony_ci 235b8fca66Sopenharmony_cinamespace OHOS { 245b8fca66Sopenharmony_ciconst int PERMS_NUM = 6; 255b8fca66Sopenharmony_ci 265b8fca66Sopenharmony_ciAddStateRegistryTokenFuzzer::AddStateRegistryTokenFuzzer() 275b8fca66Sopenharmony_ci{ 285b8fca66Sopenharmony_ci const char *perms[PERMS_NUM] = { 295b8fca66Sopenharmony_ci "ohos.permission.CELL_LOCATION", 305b8fca66Sopenharmony_ci "ohos.permission.GET_NETWORK_INFO", 315b8fca66Sopenharmony_ci "ohos.permission.SET_TELEPHONY_STATE", 325b8fca66Sopenharmony_ci "ohos.permission.GET_TELEPHONY_STATE", 335b8fca66Sopenharmony_ci "ohos.permission.LOCATION", 345b8fca66Sopenharmony_ci "ohos.permission.READ_CALL_LOG", 355b8fca66Sopenharmony_ci }; 365b8fca66Sopenharmony_ci 375b8fca66Sopenharmony_ci NativeTokenInfoParams testStateRegistryInfoParams = { 385b8fca66Sopenharmony_ci .dcapsNum = 0, 395b8fca66Sopenharmony_ci .permsNum = PERMS_NUM, 405b8fca66Sopenharmony_ci .aclsNum = 0, 415b8fca66Sopenharmony_ci .dcaps = nullptr, 425b8fca66Sopenharmony_ci .perms = perms, 435b8fca66Sopenharmony_ci .acls = nullptr, 445b8fca66Sopenharmony_ci .processName = "state_registry_fuzzer", 455b8fca66Sopenharmony_ci .aplStr = "system_basic", 465b8fca66Sopenharmony_ci }; 475b8fca66Sopenharmony_ci currentID_ = GetAccessTokenId(&testStateRegistryInfoParams); 485b8fca66Sopenharmony_ci SetSelfTokenID(currentID_); 495b8fca66Sopenharmony_ci Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo(); 505b8fca66Sopenharmony_ci} 515b8fca66Sopenharmony_ciAddStateRegistryTokenFuzzer::~AddStateRegistryTokenFuzzer() {} 525b8fca66Sopenharmony_ci} // namespace OHOS