Fix lib rpk mount 25/305225/2
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 30 Jan 2024 06:56:15 +0000 (15:56 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 31 Jan 2024 08:20:12 +0000 (08:20 +0000)
Only allowed package can use lib rpk.
A lib rpk can contains resources for lib.

Change-Id: I49e6d5ef35c58ea49402aa234e1139c8e7b44b95
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/lib/launch/step_prepare_starting_app.cc
src/lib/res_info/res_mount_package_info.cc
src/lib/res_info/res_mount_package_info.hh

index 98fe164de29ed8c2a6420c56745df5a5d9094f0c..18b7d17ac8b10eef67d9d7a5ac259bf462ad8c08 100644 (file)
@@ -647,10 +647,8 @@ int StepPrepareStartingApp::SetResPackagePaths(LaunchContext* context) {
                   AUL_K_MOUNT_ALLOWED_RES_DIR);
   AddDataToBundle(info->GetGlobalPaths(), context->GetBundle(),
                   AUL_K_MOUNT_GLOBAL_RES_DIR);
-  AddDataToBundle(info->GetAllowedLibPaths(), context->GetBundle(),
-                  AUL_K_MOUNT_ALLOWED_LIB_RES_DIR);
-  AddDataToBundle(info->GetGlobalLibPaths(), context->GetBundle(),
-                  AUL_K_MOUNT_GLOBAL_LIB_RES_DIR);
+  AddDataToBundle(info->GetLibPaths(), context->GetBundle(),
+                  AUL_K_MOUNT_LIB_DIR);
   AddDataToBundle(info->GetGadgetPkgIds(), context->GetBundle(),
                   AUL_K_MOUNT_GADGET_PKGIDS);
   AddDataToBundle(info->GetGadgetPaths(), context->GetBundle(),
index 2d16a85933b4db77a3a84bdf7f2d6b7b06e36e5c..93ccce7757a8c7bf90a544a78daf892468febbbb 100644 (file)
@@ -29,6 +29,7 @@ namespace amd {
 constexpr const char ALLOWED_SUFFIX[] = "/res/allowed";
 constexpr const char GLOBAL_SUFFIX[] = "/res/global";
 constexpr const char kGadgetPrefix[] = "org.tizen.appfw.gadget.";
+constexpr const char kLibDir[] = "/lib";
 
 ResMountPackageInfo::ResMountPackageInfo(
     const std::vector<std::shared_ptr<ResPkgInfo>>& allowed_packages,
@@ -40,22 +41,14 @@ ResMountPackageInfo::ResMountPackageInfo(
       gadget_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX);
     }
 
-    if (pkg->IsLib()) {
-      allowed_lib_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX +
-                                      "/" + pkg->GetResType());
-    } else {
-      allowed_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX);
-    }
-  }
+    if (pkg->IsLib())
+      lib_paths_.emplace_back(pkg->GetRootPath() + kLibDir);
 
-  for (const auto& pkg : global_packages) {
-    if (pkg->IsLib()) {
-      global_lib_paths_.emplace_back(pkg->GetRootPath() + GLOBAL_SUFFIX + "/" +
-                                     pkg->GetResType());
-    } else {
-      global_paths_.emplace_back(pkg->GetRootPath() + GLOBAL_SUFFIX);
-    }
+    allowed_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX);
   }
+
+  for (const auto& pkg : global_packages)
+    global_paths_.emplace_back(pkg->GetRootPath() + GLOBAL_SUFFIX);
 }
 
 static int ResInfoGetGadgetResPackagesInfo(
@@ -130,13 +123,8 @@ const std::vector<std::string>& ResMountPackageInfo::GetGlobalPaths() const {
   return global_paths_;
 }
 
-const std::vector<std::string>&
-ResMountPackageInfo::GetAllowedLibPaths() const {
-  return allowed_lib_paths_;
-}
-
-const std::vector<std::string>& ResMountPackageInfo::GetGlobalLibPaths() const {
-  return global_lib_paths_;
+const std::vector<std::string>& ResMountPackageInfo::GetLibPaths() const {
+  return lib_paths_;
 }
 
 const std::set<std::string>& ResMountPackageInfo::GetGadgetPkgIds() const {
index e6a4ba78c8670b74fdd2c44607f37433e071e71a..83577c9c212fcefde8c59fb87093789db58c0fc8 100644 (file)
@@ -38,16 +38,14 @@ class ResMountPackageInfo {
 
   const std::vector<std::string>& GetAllowedPaths() const;
   const std::vector<std::string>& GetGlobalPaths() const;
-  const std::vector<std::string>& GetAllowedLibPaths() const;
-  const std::vector<std::string>& GetGlobalLibPaths() const;
+  const std::vector<std::string>& GetLibPaths() const;
   const std::set<std::string>& GetGadgetPkgIds() const;
   const std::vector<std::string>& GetGadgetPaths() const;
 
  private:
   std::vector<std::string> allowed_paths_;
   std::vector<std::string> global_paths_;
-  std::vector<std::string> allowed_lib_paths_;
-  std::vector<std::string> global_lib_paths_;
+  std::vector<std::string> lib_paths_;
   std::set<std::string> gadget_pkgids_;
   std::vector<std::string> gadget_paths_;
 };