namespace launchpad {
namespace fs = std::filesystem;
+namespace {
+
+void RemoveAulKeys(tizen_base::Bundle* b) {
+ b->Delete(kAulSdk);
+ b->Delete(kAulMountGlobalResDir);
+ b->Delete(kAulMountAllowedResDir);
+ b->Delete(kAulMountLibDir);
+ b->Delete(kAulMountGadgetPaths);
+ b->Delete(kAulMountGadgetPkgIds);
+}
+
+} // namespace
+
AppExecutor::AppExecutor() {
LauncherInfoInflator inflator;
launcher_infos_ = inflator.Inflate("/usr/share/aul");
auto& b = const_cast<tizen_base::Bundle&>(app_info->GetBundle());
Debug::GetInst().PrepareDebugger(b);
+ auto cloned_b = tizen_base::Bundle(b);
+ RemoveAulKeys(&cloned_b);
auto app_args =
- CreateAppArgv(app_info->GetAppPath(), b, app_info->GetAppType());
+ CreateAppArgv(app_info->GetAppPath(), cloned_b, app_info->GetAppType());
b.Add(kAulAppArgs, app_args);
b.Add(kAulLuxCmd, std::to_string(static_cast<int>(LuxCmd::ExecuteApp)));
return paths;
}
+std::vector<std::string> ModifyDirectories(
+ std::vector<std::string> sources) {
+ std::vector<std::string> res;
+ for (auto& source : sources) {
+ if (access(source.c_str(), F_OK) != 0) {
+ SECURE_LOGD("No such directory. path=%s", source.c_str());
+ continue;
+ }
+
+ res.push_back(std::move(source));
+ }
+
+ return res;
+}
+
} // namespace
void Util::SetEnvironments(const AppInfo* app_info) {
int Util::MountResourceDirectories(const AppInfo* app_info) {
auto& root_path = app_info->GetRootPath();
auto& b = app_info->GetBundle();
- auto global_res_dir = b.GetStringArray(kAulMountGlobalResDir);
+ auto global_res_dir =
+ ModifyDirectories(b.GetStringArray(kAulMountGlobalResDir));
if (!global_res_dir.empty())
MountDirectories(global_res_dir, root_path + "/res/mount/global");
- auto allowed_res_dir = b.GetStringArray(kAulMountAllowedResDir);
+ auto allowed_res_dir =
+ ModifyDirectories(b.GetStringArray(kAulMountAllowedResDir));
if (!allowed_res_dir.empty())
MountDirectories(allowed_res_dir, root_path + "/res/mount/allowed");
}
int Util::MountLibraryDirectories(const tizen_base::Bundle& b) {
- auto lib_dir = b.GetStringArray(kAulMountLibDir);
+ auto lib_dir = ModifyDirectories(b.GetStringArray(kAulMountLibDir));
if (!lib_dir.empty()) {
auto root_path = b.GetString(kAulRootPath);
MountDirectories(lib_dir, root_path + "/lib/");
}
int Util::MountGadgetDirectories(const tizen_base::Bundle& b) {
- auto gadget_paths = b.GetStringArray(kAulMountGadgetPaths);
+ auto gadget_paths = ModifyDirectories(b.GetStringArray(kAulMountGadgetPaths));
if (!gadget_paths.empty()) {
gadget_paths = ValidateAndModifyGadgetPaths(gadget_paths);
auto root_path = b.GetString(kAulRootPath);
std::placeholders::_1),
std::bind(&StepPrepareExecution::SendStartupSignal, this,
std::placeholders::_1),
+ std::bind(&StepPrepareExecution::RemoveAulkeys, this,
+ std::placeholders::_1),
};
}
return 0;
}
+int StepPrepareExecution::RemoveAulkeys(AppInfo* app_info) {
+ auto& b = const_cast<tizen_base::Bundle&>(app_info->GetBundle());
+ b.Delete(kAulSdk);
+ b.Delete(kAulMountGlobalResDir);
+ b.Delete(kAulMountAllowedResDir);
+ b.Delete(kAulMountLibDir);
+ b.Delete(kAulMountGadgetPaths);
+ b.Delete(kAulMountGadgetPkgIds);
+ return 0;
+}
+
} // namespace launchpad
int PrepareAppSocket(AppInfo* app_info);
int PrepareIdFile(AppInfo* app_info);
int SendStartupSignal(AppInfo* app_info);
+ int RemoveAulkeys(AppInfo* app_info);
private:
std::vector<std::function<int(AppInfo*)>> steps_;