summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsniukalov <sniukalov@luxoft.com>2019-05-30 09:51:31 +0300
committermked-luxoft <mked@luxoft.com>2019-08-29 17:56:13 +0300
commit387839d70d7867c671fae9233687c610a7c4acfc (patch)
treed3092092224e01dac28d56bb4c48091887edb908
parentf3ce96ae1246c65dbf4e4ae536e5503107365c0e (diff)
downloadsdl_core-387839d70d7867c671fae9233687c610a7c4acfc.tar.gz
Fix OnServiceUpdate for unsecure force protected service
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index 70148a1d73..c2423b2fb6 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -1654,15 +1654,25 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
const uint32_t connection_key = session_observer_.KeyFromPair(
packet->connection_id(), packet->session_id());
+ const auto& force_protected = get_settings().force_protected_service();
+
+ const bool is_force_protected =
+ (helpers::in_range(force_protected, service_type));
+
+ const bool can_start_unprotected = is_force_protected && protection;
+
service_status_update_handler_->OnServiceUpdate(
connection_key, service_type, ServiceStatus::SERVICE_RECEIVED);
if ((ServiceType::kMobileNav == service_type && !is_video_allowed) ||
- (ServiceType::kAudio == service_type && !is_audio_allowed)) {
+ (ServiceType::kAudio == service_type && !is_audio_allowed) ||
+ (is_force_protected && !can_start_unprotected)) {
LOG4CXX_DEBUG(logger_,
"Rejecting StartService for service:"
<< service_type << ", over transport: " << transport
<< ", disallowed by settings.");
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key, service_type, ServiceStatus::SERVICE_START_FAILED);
SendStartSessionNAck(
connection_id, session_id, protocol_version, service_type);
return RESULT_OK;