From 5e8633d92fb7d9807ce271ab9ee1306602ff136a Mon Sep 17 00:00:00 2001 From: yang1946 Date: Fri, 15 Dec 2023 10:48:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E8=83=BDso=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yang1946 --- .../innerkits/code_sign_utils/src/code_sign_utils.cpp | 7 ++++--- test/unittest/code_sign_utils_test.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/interfaces/innerkits/code_sign_utils/src/code_sign_utils.cpp b/interfaces/innerkits/code_sign_utils/src/code_sign_utils.cpp index 7625264..dc16c1a 100644 --- a/interfaces/innerkits/code_sign_utils/src/code_sign_utils.cpp +++ b/interfaces/innerkits/code_sign_utils/src/code_sign_utils.cpp @@ -231,13 +231,14 @@ void CodeSignUtils::ShowCodeSignInfo(const std::string &path, const struct code_ int32_t CodeSignUtils::EnforceCodeSignForAppWithOwnerId(const std::string &ownerId, const std::string &path, const EntryMap &entryPathMap, FileType type) { - if (type == FILE_ENTRY_ADD || type == FILE_ALL) { + if (type == FILE_ENTRY_ADD || type == FILE_ENTRY_ONLY || type == FILE_ALL) { + if (type == FILE_ENTRY_ONLY && !isSupportOHCodeSign()) { + return CS_SUCCESS; + } storedEntryMap_.insert(entryPathMap.begin(), entryPathMap.end()); if (type == FILE_ENTRY_ADD) { return CS_SUCCESS; } - } else if (type == FILE_ENTRY_ONLY) { - return CS_SUCCESS; } std::string realPath; int32_t ret = IsValidPathAndFileType(path, realPath, type); diff --git a/test/unittest/code_sign_utils_test.cpp b/test/unittest/code_sign_utils_test.cpp index be9b131..50593c4 100644 --- a/test/unittest/code_sign_utils_test.cpp +++ b/test/unittest/code_sign_utils_test.cpp @@ -465,7 +465,7 @@ HWTEST_F(CodeSignUtilsTest, CodeSignUtilsTest_0016, TestSize.Level0) std::string targetPath2 = TEST_APP_DTAT_DIR + "libs/arm64/libentry.so"; entryMap.emplace(filePath2, targetPath2); - ret = utils.EnforceCodeSignForApp(hapRealPath, entryMap, FILE_ENTRY_ONLY); + ret = utils.EnforceCodeSignForApp(hapRealPath, entryMap, FILE_ENTRY_ADD); EXPECT_EQ(ret, CS_SUCCESS); ret = utils.EnforceCodeSignForApp(hapRealPath, entryMap, FILE_ALL); -- Gitee