diff --git a/frameworks/datatransmitmgr/dev_slinfo_adpt.c b/frameworks/datatransmitmgr/dev_slinfo_adpt.c index bc7c90d4a04eba181f1b4ed8d3f1e6d312bb6834..a7b4182f404c82c670a5774e4fe472482e2eb093 100644 --- a/frameworks/datatransmitmgr/dev_slinfo_adpt.c +++ b/frameworks/datatransmitmgr/dev_slinfo_adpt.c @@ -14,11 +14,8 @@ */ #include "dev_slinfo_adpt.h" - #include - #include "securec.h" - #include "dev_slinfo_list.h" #include "dev_slinfo_log.h" #include "dev_slinfo_mgr.h" @@ -47,7 +44,7 @@ static int32_t DlopenSDK(void) { g_deviceSecLevelHandle = dlopen("libdslm_sdk.z.so", RTLD_LAZY | RTLD_NODELETE); if (g_deviceSecLevelHandle == NULL) { - DATA_SEC_LOG_ERROR("Failed to load libdevicesecmgrsdktmp: %s", dlerror()); + DATA_SEC_LOG_ERROR("failed to load libdevicesecmgrsdktmp: %s", dlerror()); return DEVSL_ERROR; } @@ -69,7 +66,7 @@ static int32_t InitDeviceSecEnv(void) if (requestDeviceSecurityInfo == NULL) { dlclose(g_deviceSecLevelHandle); g_deviceSecLevelHandle = NULL; - DATA_SEC_LOG_ERROR("Failed to find symbol: %s", dlerror()); + DATA_SEC_LOG_ERROR("failed to find symbol: %s", dlerror()); return DEVSL_ERROR; } FreeDeviceSecurityInfoFunction freeDeviceSecurityInfo = (FreeDeviceSecurityInfoFunction)dlsym( @@ -77,7 +74,7 @@ static int32_t InitDeviceSecEnv(void) if (freeDeviceSecurityInfo == NULL) { dlclose(g_deviceSecLevelHandle); g_deviceSecLevelHandle = NULL; - DATA_SEC_LOG_ERROR("Failed to find symbol: %s", dlerror()); + DATA_SEC_LOG_ERROR("failed to find symbol: %s", dlerror()); return DEVSL_ERROR; } GetDeviceSecurityLevelValueFunction getDeviceSecurityLevelValue = (GetDeviceSecurityLevelValueFunction)dlsym( @@ -85,7 +82,7 @@ static int32_t InitDeviceSecEnv(void) if (getDeviceSecurityLevelValue == NULL) { dlclose(g_deviceSecLevelHandle); g_deviceSecLevelHandle = NULL; - DATA_SEC_LOG_ERROR("Failed to find symbol: %s", dlerror()); + DATA_SEC_LOG_ERROR("failed to find symbol: %s", dlerror()); return DEVSL_ERROR; } RequestDeviceSecurityInfoAsyncFunction requestDeviceSecurityInfoAsync = @@ -93,7 +90,7 @@ static int32_t InitDeviceSecEnv(void) if (requestDeviceSecurityInfoAsync == NULL) { dlclose(g_deviceSecLevelHandle); g_deviceSecLevelHandle = NULL; - DATA_SEC_LOG_ERROR("Failed to find symbol: %s", dlerror()); + DATA_SEC_LOG_ERROR("failed to find symbol: %s", dlerror()); return DEVSL_ERROR; } (void)memset_s(&g_deviceSecEnv, sizeof(g_deviceSecEnv), 0, sizeof(g_deviceSecEnv)); diff --git a/frameworks/datatransmitmgr/dev_slinfo_list.c b/frameworks/datatransmitmgr/dev_slinfo_list.c index 0b8086e21bdc3298ff39de924f9ec6b5dfb27e69..165d744f25b754024a7c38bed5bacf7a7e213629 100644 --- a/frameworks/datatransmitmgr/dev_slinfo_list.c +++ b/frameworks/datatransmitmgr/dev_slinfo_list.c @@ -14,10 +14,8 @@ */ #include "dev_slinfo_list.h" - #include #include "securec.h" - #include "dev_slinfo_adpt.h" #include "dev_slinfo_log.h" @@ -155,7 +153,8 @@ void LookupCallback(struct DATASLListParams *list, DEVSLQueryParams *queryParams int32_t InitPthreadMutex(void) { - int32_t ret = pthread_mutex_init(&g_mutex, NULL); + int32_t ret; + ret = pthread_mutex_init(&g_mutex, NULL); return ret; } diff --git a/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/datatransmitmgr_fuzzer.cpp b/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/datatransmitmgr_fuzzer.cpp index 961e4e670ff15c38e5efd4d992bdb8f75ddcae04..c3fca2832f82f42c6f3232e6c312bcfdf50bdefa 100644 --- a/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/datatransmitmgr_fuzzer.cpp +++ b/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/datatransmitmgr_fuzzer.cpp @@ -15,16 +15,10 @@ #include "datatransmitmgr_fuzzer.h" -#include #include #include -#include -#include -#include -#include #include "securec.h" - #include "dev_slinfo_mgr.h" namespace OHOS { diff --git a/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/datatransmitmgr_fuzzer.h b/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/datatransmitmgr_fuzzer.h index 9bf73094bc54a0472e77a104a5dbd003d9515b55..0a69ca9a654e0e7c542e546c6a8bc712721729c6 100644 --- a/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/datatransmitmgr_fuzzer.h +++ b/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/datatransmitmgr_fuzzer.h @@ -16,6 +16,13 @@ #ifndef DATATRANSMITMGR_FUZZER_H #define DATATRANSMITMGR_FUZZER_H +#include +#include +#include +#include +#include +#include + #define FUZZ_PROJECT_NAME "datatransmitmgr_fuzzer" #endif \ No newline at end of file diff --git a/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/project.xml b/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/project.xml index 833d01c67faa7f377c66c9dfa9cf0e40e6fa78b2..db52ac0989203364c009b2b1c0025afff037d378 100644 --- a/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/project.xml +++ b/test/fuzztest/datatransmitmgr/datatransmitmgr_fuzzer/project.xml @@ -18,7 +18,7 @@ 1000 - 300 + 30 4096 diff --git a/test/unittest/datatransmitmgr/DevSLMgrTest.cpp b/test/unittest/datatransmitmgr/DevSLMgrTest.cpp index 4b81f9e7916538e56edd256f24946fe7a5f907b0..2e5fd646dbf9ad1b255b3eb286d84d2d19734254 100644 --- a/test/unittest/datatransmitmgr/DevSLMgrTest.cpp +++ b/test/unittest/datatransmitmgr/DevSLMgrTest.cpp @@ -13,22 +13,33 @@ * limitations under the License. */ -#include "DevSLMgrTest.h" - -#include #include #include #include - -#include "accesstoken_kit.h" +#include +#include "gtest/gtest.h" #include "file_ex.h" -#include "nativetoken_kit.h" #include "securec.h" #include "softbus_bus_center.h" +#include "dev_slinfo_adpt.h" +#include "DevSLMgrTest.h" +#include "DevslinfoListTest.h" +#include "nativetoken_kit.h" #include "token_setproc.h" +#include "accesstoken_kit.h" -#include "DevslinfoListTest.h" -#include "dev_slinfo_adpt.h" +using namespace testing::ext; +class DevSLMgrTest : public testing::Test { +public: + DevSLMgrTest(); + ~DevSLMgrTest(); + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +private: + static bool isEnforcing_; +}; static const int32_t DEV_SEC_LEVEL_ERR = 100; static const int32_t LIST_LENGTH = 128; @@ -42,9 +53,7 @@ struct DeviceSecurityInfo { extern "C" { extern void OnApiDeviceSecInfoCallback(const DeviceIdentify *identify, struct DeviceSecurityInfo *info); } -namespace OHOS { -namespace Security { -namespace DevSLMgrTest { + static void NativeTokenGet() { uint64_t tokenId; @@ -468,7 +477,4 @@ static HWTEST_F(DevSLMgrTest, TestGetHighestSecLevelExcept005, TestSize.Level1) ClearList(g_tmpList); g_tmpList = nullptr; DATASL_OnStop(); -} -} // namespace DevSLMgrTest -} // namespace Security -} // namespace OHOS \ No newline at end of file +} \ No newline at end of file diff --git a/test/unittest/datatransmitmgr/DevSLMgrTest.h b/test/unittest/datatransmitmgr/DevSLMgrTest.h index 27d35b24d909f2052c720824b4aa853651597a48..472e5d279df0273a24207c0d86cade7261728448 100644 --- a/test/unittest/datatransmitmgr/DevSLMgrTest.h +++ b/test/unittest/datatransmitmgr/DevSLMgrTest.h @@ -16,25 +16,4 @@ #ifndef DATASECURITYLEVEL_TEST_H #define DATASECURITYLEVEL_TEST_H -#include - -namespace OHOS { -namespace Security { -namespace DevSLMgrTest { -using namespace testing::ext; -class DevSLMgrTest : public testing::Test { -public: - DevSLMgrTest(); - ~DevSLMgrTest(); - static void SetUpTestCase(); - static void TearDownTestCase(); - void SetUp() override; - void TearDown() override; -private: - static bool isEnforcing_; -}; -} // namespace DevSLMgrTest -} // namespace Security -} // namespace OHOS - #endif \ No newline at end of file