!1053 fix: fix fuzztest

Merge pull request !1053 from 居凯/master
This commit is contained in:
openharmony_ci 2024-09-29 12:31:45 +00:00 committed by Gitee
commit eb730447d3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 29 deletions

View File

@ -120,7 +120,7 @@ void FillFuzzExecutorRegisterInfo(Parcel &parcel, ExecutorRegisterInfo &executor
IAM_LOGI("FillFuzzExecutorRegisterInfo success");
}
CoAuthService g_coAuthService;
std::shared_ptr<CoAuthService> g_coAuthService = CoAuthService::GetInstance();
sptr<ExecutorMessengerService> executorMessengerService = ExecutorMessengerService::GetInstance();
void FuzzRegister(Parcel &parcel)
@ -134,22 +134,22 @@ void FuzzRegister(Parcel &parcel)
CoAuthServiceFuzzer(parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadInt32(),
parcel.ReadInt32()));
}
g_coAuthService.ExecutorRegister(executorInfo, callback);
g_coAuthService->ExecutorRegister(executorInfo, callback);
IAM_LOGI("FuzzRegister end");
}
void FuzzOther(Parcel &parcel)
{
IAM_LOGI("begin");
g_coAuthService.Init();
g_coAuthService->Init();
auto callback = Common::MakeShared<CoAuthServiceFuzzer>(parcel.ReadInt32(), parcel.ReadInt32(),
parcel.ReadInt32(), parcel.ReadInt32(), parcel.ReadInt32());
uint64_t executorIndex = parcel.ReadUint64();
AuthType authType = static_cast<AuthType>(parcel.ReadInt32());
g_coAuthService.AddExecutorDeathRecipient(executorIndex, authType, callback);
g_coAuthService.OnStart();
g_coAuthService.OnStop();
g_coAuthService->AddExecutorDeathRecipient(executorIndex, authType, callback);
g_coAuthService->OnStart();
g_coAuthService->OnStop();
IAM_LOGI("end");
}
@ -190,22 +190,22 @@ void FuzzDump(Parcel &parcel)
for (uint32_t i = 0; i < msg.size(); i++) {
args.push_back(cmd[msg[i] % CMD_LEN]);
}
g_coAuthService.Dump(fd, args);
g_coAuthService->Dump(fd, args);
IAM_LOGI("FuzzDump end");
}
void FuzzNotifyFwkReady(Parcel &parcel)
{
IAM_LOGI("FuzzNotifyFwkReady begin");
g_coAuthService.NotifyFwkReady();
g_coAuthService->NotifyFwkReady();
IAM_LOGI("FuzzNotifyFwkReady end");
}
void FuzzUnRegisterAccessTokenListener(Parcel &parcel)
{
IAM_LOGI("FuzzNotifyFwkReady begin");
g_coAuthService.RegisterAccessTokenListener();
g_coAuthService.UnRegisterAccessTokenListener();
g_coAuthService->RegisterAccessTokenListener();
g_coAuthService->UnRegisterAccessTokenListener();
IAM_LOGI("FuzzNotifyFwkReady end");
}

View File

@ -35,10 +35,6 @@ namespace OHOS {
namespace UserIam {
namespace UserAuth {
namespace {
const int CMD_LEN = 19;
std::u16string cmd[] = {u"-h", u"-lc", u"-ls", u"-c", u"-c [base system]", u"-s", u"-s [SA0 SA1]", u"-s [SA] -a [-h]",
u"-e", u"--net", u"--storage", u"-p", u"-p [pid]", u"--cpuusage [pid]", u"cified pid", u"--cpufreq", u"--mem [pid]",
u"--zip", u"--mem-smaps pid [-v]"};
class DummyIdmGetCredentialInfoCallback : public IdmGetCredInfoCallbackInterface {
public:
@ -219,20 +215,6 @@ void FuzzDelUser(Parcel &parcel)
IAM_LOGI("end");
}
void FuzzDump(Parcel &parcel)
{
IAM_LOGI("FuzzDump begin");
std::vector<uint8_t> msg;
Common::FillFuzzUint8Vector(parcel, msg);
int32_t fd = parcel.ReadInt32();
std::vector<std::u16string> args;
for (uint32_t i = 0; i < msg.size(); i++) {
args.push_back(cmd[msg[i] % CMD_LEN]);
}
g_UserIdmService.Dump(fd, args);
IAM_LOGI("FuzzDump end");
}
void DelCredential(Parcel &parcel)
{
IAM_LOGI("begin");
@ -304,7 +286,6 @@ FuzzFunc *g_fuzzFuncs[] = {
FuzzDelUser,
DelCredential,
FuzzClearRedundancyCredential,
FuzzDump,
FuzzClearRedundancyCredentialInner,
FuzzEnforceDelUserInner,
FuzzCancelCurrentEnroll,