From 9bc998cb2bfddf73aca4d3dc739c769144be4a70 Mon Sep 17 00:00:00 2001 From: "zhaoyuan17@huawei.com" Date: Fri, 24 Sep 2021 16:39:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A0=E9=99=A4check=20permit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaoyuan17@huawei.com --- services/formmgr/src/form_mgr_service.cpp | 41 ++++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/services/formmgr/src/form_mgr_service.cpp b/services/formmgr/src/form_mgr_service.cpp index 7fb4a8e61f..c9705a465e 100644 --- a/services/formmgr/src/form_mgr_service.cpp +++ b/services/formmgr/src/form_mgr_service.cpp @@ -351,26 +351,27 @@ ErrCode FormMgrService::Init() */ bool FormMgrService::CheckFormPermission() { - sptr iBundleMgr = FormBmsHelper::GetInstance().GetBundleMgr(); - if (iBundleMgr == nullptr) { - APP_LOGE("%{public}s, failed to get IBundleMgr.", __func__); - return false; - } - - int32_t uid = IPCSkeleton::GetCallingUid(); - if (!iBundleMgr->CheckIsSystemAppByUid(uid)) { - APP_LOGE("%{public}s fail, form is not system app. uid:%{public}d", __func__, uid); - return false; - } - - std::string bundleName; - bool result = iBundleMgr->GetBundleNameForUid(uid, bundleName); - if (!result || bundleName.empty()) { - APP_LOGE("%{public}s failed, cannot get bundle name by uid:%{public}d", __func__, uid); - return false; - } - - return CheckFormPermission(bundleName); + // sptr iBundleMgr = FormBmsHelper::GetInstance().GetBundleMgr(); + // if (iBundleMgr == nullptr) { + // APP_LOGE("%{public}s, failed to get IBundleMgr.", __func__); + // return false; + // } + + // int32_t uid = IPCSkeleton::GetCallingUid(); + // if (!iBundleMgr->CheckIsSystemAppByUid(uid)) { + // APP_LOGE("%{public}s fail, form is not system app. uid:%{public}d", __func__, uid); + // return false; + // } + + // std::string bundleName; + // bool result = iBundleMgr->GetBundleNameForUid(uid, bundleName); + // if (!result || bundleName.empty()) { + // APP_LOGE("%{public}s failed, cannot get bundle name by uid:%{public}d", __func__, uid); + // return false; + // } + + // return CheckFormPermission(bundleName); + return true; } bool FormMgrService::CheckFormPermission(const std::string &bundleName) const -- Gitee From 9516efef581179ddef04d11f17a116ce9ddc507d Mon Sep 17 00:00:00 2001 From: "zhaoyuan17@huawei.com" Date: Fri, 24 Sep 2021 20:40:19 +0800 Subject: [PATCH 2/2] clear permission Signed-off-by: zhaoyuan17@huawei.com --- services/formmgr/src/form_mgr_service.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/services/formmgr/src/form_mgr_service.cpp b/services/formmgr/src/form_mgr_service.cpp index c9705a465e..8f25249579 100644 --- a/services/formmgr/src/form_mgr_service.cpp +++ b/services/formmgr/src/form_mgr_service.cpp @@ -351,26 +351,6 @@ ErrCode FormMgrService::Init() */ bool FormMgrService::CheckFormPermission() { - // sptr iBundleMgr = FormBmsHelper::GetInstance().GetBundleMgr(); - // if (iBundleMgr == nullptr) { - // APP_LOGE("%{public}s, failed to get IBundleMgr.", __func__); - // return false; - // } - - // int32_t uid = IPCSkeleton::GetCallingUid(); - // if (!iBundleMgr->CheckIsSystemAppByUid(uid)) { - // APP_LOGE("%{public}s fail, form is not system app. uid:%{public}d", __func__, uid); - // return false; - // } - - // std::string bundleName; - // bool result = iBundleMgr->GetBundleNameForUid(uid, bundleName); - // if (!result || bundleName.empty()) { - // APP_LOGE("%{public}s failed, cannot get bundle name by uid:%{public}d", __func__, uid); - // return false; - // } - - // return CheckFormPermission(bundleName); return true; } -- Gitee