From 3e9ceb0aced20946202dae6545a319f53a4c7065 Mon Sep 17 00:00:00 2001 From: Pawel Kaczmarczyk Date: Thu, 18 Jan 2018 12:34:57 +0100 Subject: [PATCH] [Messaging] Synchronously checking access to file ACR: http://suprem.sec.samsung.net/jira/browse/TWDAPI-187 [Verification] Tested in Chromium console Passrate with storage privileges: tct-messaging-email-tizen-tests: 100% tct-messaging-sms-tizen-tests: 100% tct-messaging-mms-tizen-tests: 100% Change-Id: Iacf8b3c647d65e20fc73a810746ff1a536f7507d Signed-off-by: Pawel Kaczmarczyk --- src/messaging/messaging_instance.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/messaging/messaging_instance.cc b/src/messaging/messaging_instance.cc index 2cf41a50..91578660 100644 --- a/src/messaging/messaging_instance.cc +++ b/src/messaging/messaging_instance.cc @@ -20,6 +20,7 @@ #include #include +#include "common/filesystem/filesystem_provider.h" #include "common/logger.h" #include "common/tools.h" @@ -203,6 +204,18 @@ void MessagingInstance::MessageServiceSendMessage(const picojson::value& args, picojson::object data = args.get(); picojson::value v_message = data.at(SEND_MESSAGE_ARGS_MESSAGE); + + bool has_attachments = v_message.get("hasAttachment").get(); + if (has_attachments) { + const auto& attachments = v_message.get("attachments").get>(); + for (const auto& att : attachments) { + const auto& attachment_path = att.get("filePath").get(); + const auto& attachment_real_path = + common::FilesystemProvider::Create().GetRealPath(attachment_path); + CHECK_STORAGE_ACCESS(attachment_real_path, &out); + } + } + const double callbackId = args.get(JSON_CALLBACK_ID).get(); auto json = std::shared_ptr(new picojson::value(picojson::object())); -- 2.34.1