summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-01-24 10:57:15 -0500
committerJackLivio <jack@livio.io>2019-01-24 10:57:15 -0500
commitf1c9edcbcf2822cc93a38810a592bc6412070214 (patch)
treeaf9137e216d0552bc3255a039a2af0db261b534b
parent55a14219ced574948a44ffa30f1c76acab7eafa3 (diff)
downloadsdl_core-f1c9edcbcf2822cc93a38810a592bc6412070214.tar.gz
OnAppServiceDataNotificationFromMobile check parameters
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc16
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc3
2 files changed, 18 insertions, 1 deletions
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
index a7a8042fee..20036cc30a 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
@@ -67,6 +67,22 @@ void OnAppServiceDataNotificationFromMobile::Run() {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData");
MessageHelper::PrintSmartObject(*message_);
+
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::app_service_manifest]
+ [strings::service_type].asString();
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ bool result = policy_handler_.CheckAppServiceParameters(
+ app->policy_app_id(), std::string(), service_type, {});
+
+ if (!result) {
+ LOG4CXX_DEBUG(logger_,
+ "Incorrect service type received in "
+ "OnAppServiceDataNotificationFromMobile");
+ return;
+ }
}
} // namespace commands
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index b8da78aabf..480b8f0574 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1957,7 +1957,8 @@ bool PolicyHandler::CheckAppServiceParameters(
std::vector<uint32_t> handled_rpcs = {};
this->GetAppServiceParameters(
policy_app_id, service_name, service_type, handled_rpcs);
- if (service_name != requested_service_name) {
+ if (!requested_service_name.empty() &&
+ service_name != requested_service_name) {
return false;
}