if (!info)
return 0;
- AddDataToBundle(info->GetPkgIds(), context->GetBundle(),
- AUL_K_MOUNT_RES_PKGIDS);
AddDataToBundle(info->GetAllowedPaths(), context->GetBundle(),
AUL_K_MOUNT_ALLOWED_RES_DIR);
AddDataToBundle(info->GetGlobalPaths(), context->GetBundle(),
const std::vector<std::shared_ptr<ResPkgInfo>>& allowed_packages,
const std::vector<std::shared_ptr<ResPkgInfo>>& global_packages) {
for (const auto& pkg : allowed_packages) {
- pkgids_.insert(pkg->GetPkgId());
+ if (pkg->GetResType().length() > strlen(kGadgetPrefix) &&
+ !pkg->GetResType().compare(0, strlen(kGadgetPrefix), kGadgetPrefix)) {
+ gadget_pkgids_.insert(pkg->GetPkgId());
+ 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->GetResType().length() < strlen(kGadgetPrefix)) continue;
-
- if (!pkg->GetResType().compare(0, strlen(kGadgetPrefix), kGadgetPrefix)) {
- gadget_pkgids_.insert(pkg->GetPkgId());
- gadget_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX);
- }
}
for (const auto& pkg : global_packages) {
- pkgids_.insert(pkg->GetPkgId());
if (pkg->IsLib()) {
global_lib_paths_.emplace_back(pkg->GetRootPath() + GLOBAL_SUFFIX + "/" +
pkg->GetResType());
return 0;
}
-const std::set<std::string>& ResMountPackageInfo::GetPkgIds() const {
- return pkgids_;
-}
-
const std::vector<std::string>& ResMountPackageInfo::GetAllowedPaths() const {
return allowed_paths_;
}
static int GetMountPackageInfo(const std::string& appid, uid_t uid,
std::optional<ResMountPackageInfo>* info);
- const std::set<std::string>& GetPkgIds() const;
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>& GetGadgetPaths() const;
private:
- std::set<std::string> pkgids_;
std::vector<std::string> allowed_paths_;
std::vector<std::string> global_paths_;
std::vector<std::string> allowed_lib_paths_;