From a6ad42250210eed6b63e7c3fe16c9f94d3715403 Mon Sep 17 00:00:00 2001
From: Pawel Kaczmarczyk
Date: Thu, 1 Feb 2018 12:53:21 +0100
Subject: [PATCH] [Package] Synchronously checking access to file
ACR: http://suprem.sec.samsung.net/jira/browse/TWDAPI-187
Change-Id: I9b16ca1a9d175815f09087ce6801a3ad85343dd8
Signed-off-by: Pawel Kaczmarczyk
---
src/package/package_instance.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/package/package_instance.cc b/src/package/package_instance.cc
index d0a11470..17c2f2a9 100644
--- a/src/package/package_instance.cc
+++ b/src/package/package_instance.cc
@@ -24,6 +24,7 @@
#include "common/task-queue.h"
#include "common/tools.h"
#include "package/package_info_provider.h"
+#include "common/filesystem/filesystem_provider.h"
namespace extension {
namespace package {
@@ -297,6 +298,10 @@ void PackageInstance::PackageManagerInstall(const picojson::value& args, picojso
const std::string& packageFileURI =
convertUriToPath(args.get("packageFileURI").get());
+ const std::string real_path = common::FilesystemProvider::Create().GetRealPath(packageFileURI);
+
+ CHECK_STORAGE_ACCESS(real_path, &out);
+
if (!request_) {
LoggerE("package_manager_request_h is NULL");
InvokeErrorCallbackAsync(callback_id,
--
2.34.1