diff options
author | Maksym Ked (GitHub) <41471947+mked-luxoft@users.noreply.github.com> | 2019-09-03 20:32:16 +0300 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2019-09-03 13:32:16 -0400 |
commit | f069a231347d739ca3b1f85599262e975144ccb4 (patch) | |
tree | 179fd250910f57fcaaeab97a0bf30e9d3862d57a | |
parent | e7b5c75c704f6cd577f0857e4cbe17cf6ec160fa (diff) | |
download | sdl_core-f069a231347d739ca3b1f85599262e975144ccb4.tar.gz |
Fix failing build with enable_security=off (#3006)
6 files changed, 24 insertions, 10 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 59df2430f9..969ec53c41 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -584,7 +584,9 @@ class ApplicationManagerImpl utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType> service_update_reason) FINAL; +#ifdef ENABLE_SECURITY bool OnPTUFailed() FINAL; +#endif // ENABLE_SECURITY /* * @brief Starts audio pass thru thread * diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 9db62d09d3..3d9aec65c2 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -2163,11 +2163,12 @@ bool ApplicationManagerImpl::OnHandshakeDone( } return false; } - +#ifdef ENABLE_SECURITY bool ApplicationManagerImpl::OnPTUFailed() { LOG4CXX_AUTO_TRACE(logger_); return false; } +#endif // ENABLE_SECURITY bool ApplicationManagerImpl::OnGetSystemTimeFailed() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index 9bcb43eae0..e29edd8f59 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -164,6 +164,7 @@ bool RPCServiceImpl::ManageMobileCommand( SendMessageToMobile(response); return false; } +#ifdef ENABLE_SECURITY if (EncryptionFlagCheckResult::kError_EncryptionNeeded == IsEncryptionRequired( *message, @@ -177,6 +178,7 @@ bool RPCServiceImpl::ManageMobileCommand( SendMessageToMobile(response); return false; } +#endif // ENABLE_SECURITY // Message for "CheckPermission" must be with attached schema mobile_so_factory().attachSchema(*message, false); diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 268af48fdc..1df830908a 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -1131,14 +1131,16 @@ void ProtocolHandlerImpl::OnUnexpectedDisconnect( void ProtocolHandlerImpl::NotifyOnGetSystemTimeFailed() { LOG4CXX_AUTO_TRACE(logger_); - security_manager_->ResetPendingSystemTimeRequests(); #ifdef ENABLE_SECURITY + security_manager_->ResetPendingSystemTimeRequests(); security_manager_->NotifyListenersOnGetSystemTimeFailed(); #endif // ENABLE_SECURITY } void ProtocolHandlerImpl::ProcessFailedPTU() { +#ifdef ENABLE_SECURITY security_manager_->ProcessFailedPTU(); +#endif // ENABLE_SECURITY } #ifdef EXTERNAL_PROPRIETARY_MODE @@ -1228,10 +1230,14 @@ void ProtocolHandlerImpl::OnAuthTokenUpdated(const std::string& policy_app_id, bool ProtocolHandlerImpl::IsRPCServiceSecure( const uint32_t connection_key) const { LOG4CXX_AUTO_TRACE(logger_); +#ifdef ENABLE_SECURITY security_manager::SSLContext* context = session_observer_.GetSSLContext(connection_key, ServiceType::kRpc); return (context && context->IsInitCompleted()); +#else + return false; +#endif // ENABLE_SECURITY } RESULT_CODE ProtocolHandlerImpl::SendFrame(const ProtocolFramePtr packet) { @@ -1617,6 +1623,7 @@ const ServiceStatus ProtocolHandlerImpl::ServiceDisallowedBySettings( std::find(audio_transports.begin(), audio_transports.end(), transport) != audio_transports.end(); +#ifdef ENABLE_SECURITY const auto& force_protected = get_settings().force_protected_service(); const auto& force_unprotected = get_settings().force_unprotected_service(); @@ -1631,11 +1638,6 @@ const ServiceStatus ProtocolHandlerImpl::ServiceDisallowedBySettings( const bool can_start_unprotected = is_force_unprotected && !protection; - if ((ServiceType::kMobileNav == service_type && !is_video_allowed) || - (ServiceType::kAudio == service_type && !is_audio_allowed)) { - return ServiceStatus::SERVICE_START_FAILED; - } - if (is_force_protected && !can_start_protected) { return ServiceStatus::PROTECTION_ENFORCED; } @@ -1643,6 +1645,12 @@ const ServiceStatus ProtocolHandlerImpl::ServiceDisallowedBySettings( if (is_force_unprotected && !can_start_unprotected) { return ServiceStatus::UNSECURE_START_FAILED; } +#endif // ENABLE_SECURITY + + if ((ServiceType::kMobileNav == service_type && !is_video_allowed) || + (ServiceType::kAudio == service_type && !is_audio_allowed)) { + return ServiceStatus::SERVICE_START_FAILED; + } return ServiceStatus::INVALID_ENUM; } diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc index 1bea53b075..07b562f3a2 100644 --- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc +++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc @@ -746,13 +746,12 @@ TEST_F(ProtocolHandlerImplTest, const uint8_t session_id1 = 1u; const ::transport_manager::ConnectionUID connection_id2 = 0xBu; const uint8_t session_id2 = 2u; + EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id2, session_id2)) + .WillRepeatedly(Return(connection_key)); #ifdef ENABLE_SECURITY AddSecurityManager(); - EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id2, session_id2)) - .WillRepeatedly(Return(connection_key)); - EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, start_service)) .Times(2) diff --git a/src/components/transport_manager/test/websocket_connection_test.cc b/src/components/transport_manager/test/websocket_connection_test.cc index db3bc598b1..d096d351f5 100644 --- a/src/components/transport_manager/test/websocket_connection_test.cc +++ b/src/components/transport_manager/test/websocket_connection_test.cc @@ -425,6 +425,7 @@ TEST_F(WebsocketConnectionTest, WSSConnection_SUCCESS_ValidTarget) { t1.join(); } +#ifdef ENABLE_SECURITY TEST_F(WebsocketConnectionTest, WSSConnection_FAILURE_InvalidTarget) { transport_manager::transport_adapter::CloudAppProperties properties{ .endpoint = "wss://" + kHost + ":" + std::to_string(kPort), @@ -486,6 +487,7 @@ TEST_F(WebsocketConnectionTest, WSSConnection_FAILURE_IncorrectCert) { wss_session->Stop(); t1.join(); } +#endif // ENABLE_SECURITY } // namespace transport_manager_test } // namespace components } // namespace test |