diff options
author | Elisey Zamakhov <EZamakhov@luxoft.com> | 2014-07-10 20:19:18 +0400 |
---|---|---|
committer | Elisey Zamakhov <EZamakhov@luxoft.com> | 2014-07-10 20:19:18 +0400 |
commit | 564a2e77bcccb3e59fa2058ce0efd106ab738f2d (patch) | |
tree | 526b04c01aa74bb5283e0a0dc25cdd6f9952bdc6 | |
parent | 84113416f55720fc16af9c83748cc3ff20d593e7 (diff) | |
parent | 0b84b892ff7ac410858edb67200ed1d58cf65d8b (diff) | |
download | sdl_core-564a2e77bcccb3e59fa2058ce0efd106ab738f2d.tar.gz |
Revere Merge branch 'develop' into feature/WP2.2_SecureService
No subject for review
27 files changed, 423 insertions, 131 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c3a615aebb..6b94c12764 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ set(TARGET_OPTION "$ENV{TARGET}") set(MEDIA_MODE_OPTION "$ENV{MEDIA_MODE}") set(HMI_ADAPTER_OPTION "$ENV{HMI_ADAPTER}") set(ENABLE_LOG_OPTION "$ENV{ENABLE_LOG}") +set(ARCH_TYPE_OPTION "$ENV{ARCH_TYPE}") add_custom_target(pasa-tarball COMMAND ${CMAKE_SOURCE_DIR}/tools/Utils/export-customer-specific.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} PASA @@ -72,6 +73,15 @@ add_custom_target(ford-tarball DEPENDS HMI_API MOBILE_API v4_protocol_v1_2_no_extra ) +if (ARCH_TYPE_OPTION) + if (NOT (${ARCH_TYPE_OPTION} STREQUAL "x86") AND NOT (${ARCH_TYPE_OPTION} STREQUAL "armv7")) + message(AUTHOR_WARNING "HW architecture is not defined, using x86. Allowed values are x86/armv7 (case sensitive)") + set(ARCH_TYPE_OPTION "x86") + endif () +else () + set(ARCH_TYPE_OPTION "x86") +endif() + if (OS_TYPE_OPTION) if (${OS_TYPE_OPTION} STREQUAL "QNX") message(STATUS "Jenkins integration: set build process for QNX") diff --git a/qnx_6.5.0_linux_x86.cmake b/qnx_6.5.0_linux_x86.cmake index 205162c779..5e5954b0c1 100644 --- a/qnx_6.5.0_linux_x86.cmake +++ b/qnx_6.5.0_linux_x86.cmake @@ -1,4 +1,4 @@ -SET(CMAKE_SYSTEM_PROCESSOR x86)
+SET(CMAKE_SYSTEM_PROCESSOR ${ARCH_TYPE_OPTION})
SET(CMAKE_SYSTEM_NAME QNX)
IF(CMAKE_HOST_LINUX)
@@ -7,14 +7,14 @@ ENDIF(CMAKE_HOST_LINUX) FIND_PATH(QNX_HOST
NAME usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}
- PATHS $ENV{QNX_HOST} /opt/qnx650/host/linux/x86
+ PATHS $ENV{QNX_HOST}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
)
FIND_PATH(QNX_TARGET
NAME usr/include/qnx_errno.h
- PATHS $ENV{QNX_TARGET} /opt/qnx650/target/qnx6
+ PATHS $ENV{QNX_TARGET}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
)
@@ -23,7 +23,7 @@ IF(CMAKE_HOST_LINUX) FIND_PATH(QNX_CONFIGURATION
NAME /etc/qnx/bin/qnxactivate
PATHS $ENV{QNX_CONFIGURATION}
- "/opt/qnx650/host/linux/x86/usr/bin/qconfig"
+ "$ENV{QNX_HOST}/usr/bin/qconfig"
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
)
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h index 202a8fa2ac..f1620d7785 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h @@ -102,20 +102,6 @@ class AddCommandRequest : public CommandRequestImpl { */ bool CheckCommandParentId(ApplicationConstSharedPtr app); - /* - * @brief Check if commands has valid syntax - * - * @return TRUE on success, otherwise FALSE - */ - bool CheckVRCommandsNames(); - - /* - * @brief Check if menuNames has valid syntax - * - * @return TRUE on success, otherwise FALSE - */ - bool CheckMenuName(); - DISALLOW_COPY_AND_ASSIGN(AddCommandRequest); /* @@ -125,6 +111,14 @@ class AddCommandRequest : public CommandRequestImpl { */ bool IsPendingResponseExist(); + /** + * @brief Checks add command param + * When type is String there is a check on the contents \t\n \\t \\n + * @return if add command contains \t\n \\t \\n return TRUE, + * FALSE otherwise + */ + bool IsWhiteSpaceExist(); + bool send_ui_; bool send_vr_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h index 4b271a4709..02423f0630 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_maneuver_request.h @@ -79,7 +79,7 @@ class AlertManeuverRequest : public CommandRequestImpl { * @return if alert maneuver contains \t\n \\t \\n return TRUE, * FALSE otherwise */ - bool IsWhitespaceExist(); + bool IsWhiteSpaceExist(); mobile_apis::Result::eType tts_speak_result_code_; mobile_apis::Result::eType navi_alert_maneuver_result_code_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h index 47e9d5ad91..1936c9678e 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h @@ -168,7 +168,7 @@ class CreateInteractionChoiceSetRequest : public CommandRequestImpl { * @param choice_set which must check * @return if choice_set contains \t\n \\t \\n return TRUE, FALSE otherwise */ - bool IsWhitespaceExist(const smart_objects::SmartObject& choice_set); + bool IsWhiteSpaceExist(const smart_objects::SmartObject& choice_set); DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h index 4f39bdeb37..d4c4ddac9b 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h @@ -110,7 +110,7 @@ class PerformAudioPassThruRequest : public CommandRequestImpl { * @return if perform audio pass thru contains \t\n \\t \\n return TRUE, * FALSE otherwise */ - bool IsWhitespaceExist(); + bool IsWhiteSpaceExist(); //flag display state of speak during perform audio pass thru bool is_active_tts_speak_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h index d009d26d5d..85207ea571 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h @@ -195,7 +195,7 @@ class PerformInteractionRequest : public CommandRequestImpl { * @return if perform interaction contains \t\n \\t \\n return TRUE, * FALSE otherwise */ - bool IsWhitespaceExist(); + bool IsWhiteSpaceExist(); /** * @brief Send HMI close PopUp and call DisablePerformInteraction diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h index 5e387efe2e..fb873229b6 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h @@ -178,7 +178,7 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { * @return if register app interface contains \t\n \\t \\n return TRUE, * FALSE otherwise */ - bool IsWhitespaceExist(); + bool IsWhiteSpaceExist(); std::string response_info_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h index 0c6305ec66..738d198e45 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/scrollable_message_request.h @@ -75,6 +75,13 @@ class ScrollabelMessageRequest : public CommandRequestImpl { virtual void on_event(const event_engine::Event& event); private: + /** + * @brief Checks scrollabel message param + * When type is String there is a check on the contents \t\n \\t \\n + * @return if scrollabel message contains \t\n \\t \\n return TRUE, + * FALSE otherwise + */ + bool IsWhiteSpaceExist(); DISALLOW_COPY_AND_ASSIGN(ScrollabelMessageRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h index 17bb31fe6f..d9e18dd76f 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h @@ -101,7 +101,7 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl { * @return if set global properties contains \t\n \\t \\n return TRUE, * FALSE otherwise */ - bool IsWhitespaceExist(); + bool IsWhiteSpaceExist(); DISALLOW_COPY_AND_ASSIGN(SetGlobalPropertiesRequest); diff --git a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h index 19ba37f37c..a22ee9852a 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/show_constant_tbt_request.h @@ -72,6 +72,13 @@ class ShowConstantTBTRequest : public CommandRequestImpl { virtual void on_event(const event_engine::Event& event); private: + /** + * @brief Checks show constant TBT params(turnIcon, ...). + * When type is String there is a check on the contents \t\n \\t \\n + * @return if show constant TBT contains \t\n \\t \\n return TRUE, + * FALSE otherwise + */ + bool IsWhiteSpaceExist(); DISALLOW_COPY_AND_ASSIGN(ShowConstantTBTRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h b/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h index 6eca4e75c0..7d3b2096af 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/speak_request.h @@ -81,7 +81,7 @@ class SpeakRequest : public CommandRequestImpl { * @brief Checks speak param ttsChunks on the contents \t\n \\t \\n * @return if speak contains \t\n \\t \\n return TRUE, FALSE otherwise */ - bool IsWhitespaceExist(); + bool IsWhiteSpaceExist(); DISALLOW_COPY_AND_ASSIGN(SpeakRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h index 71fb677978..c65c2bc534 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/update_turn_list_request.h @@ -80,6 +80,14 @@ class UpdateTurnListRequest : public CommandRequestImpl { */ bool CheckTurnListArray(); + /** + * @brief Checks update turn list param + * When type is String there is a check on the contents \t\n \\t \\n + * @return if update turn list contains \t\n \\t \\n return TRUE, + * FALSE otherwise + */ + bool IsWhiteSpaceExist(); + DISALLOW_COPY_AND_ASSIGN(UpdateTurnListRequest); }; diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc index 002943bc62..0b4b324826 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc @@ -122,10 +122,6 @@ void AddCommandRequest::Run() { return; } - if (!CheckVRCommandsNames()) { - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } data_exist = true; } @@ -135,14 +131,17 @@ void AddCommandRequest::Run() { return; } + // Checking add command on contained \t\n \\t \\n + if (IsWhiteSpaceExist()) { + LOG4CXX_ERROR(logger_, + "Incoming add command has contains \t\n \\t \\n"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + smart_objects::SmartObject ui_msg_params = smart_objects::SmartObject( smart_objects::SmartType_Map); if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { - if (!CheckMenuName()) { - LOG4CXX_ERROR_EXT(logger_, "MenuName is invalid"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } ui_msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; ui_msg_params[strings::menu_params] = @@ -257,31 +256,6 @@ bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) { return true; } -bool AddCommandRequest::CheckVRCommandsNames() { - for (size_t i = 0; - i < (*message_)[strings::msg_params][strings::vr_commands].length(); - ++i) { - const std::string& str = - (*message_)[strings::msg_params][strings::vr_commands][i].asString(); - - if (!CheckSyntax(str)) { - LOG4CXX_INFO(logger_, "Invalid command name."); - return false; - } - } - return true; -} - -bool AddCommandRequest::CheckMenuName() { - const std::string& str = (*message_)[strings::msg_params][strings::menu_params] - [strings::menu_name].asString(); - if (!CheckSyntax(str)) { - LOG4CXX_INFO(logger_, "Invalid menu name."); - return false; - } - return true; -} - bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) { if (!app) { return false; @@ -385,6 +359,48 @@ bool AddCommandRequest::IsPendingResponseExist() { return send_ui_ != is_ui_received_ || send_vr_ != is_vr_received_; } +bool AddCommandRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "AddCommandRequest::IsWhiteSpaceExist"); + bool return_value = false; + const char* str = NULL; + + if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { + str = (*message_)[strings::msg_params][strings::menu_params] + [strings::menu_name].asCharArray(); + if (!CheckSyntax(str)) { + LOG4CXX_INFO(logger_, "Invalid menu name syntax check failed."); + return_value = true; + } + } + + if ((*message_)[strings::msg_params].keyExists(strings::vr_commands)) { + size_t len = + (*message_)[strings::msg_params][strings::vr_commands].length(); + + for (size_t i = 0; i < len; ++i) { + str = (*message_)[strings::msg_params] + [strings::vr_commands][i].asCharArray(); + if (!CheckSyntax(str)) { + LOG4CXX_INFO(logger_, "Invalid vr_commands syntax check failed"); + return_value = true; + break; + } + } + } + + if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) { + str = (*message_)[strings::msg_params] + [strings::cmd_icon][strings::value].asCharArray(); + + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, "Invalid cmd_icon value syntax check failed"); + return_value = true; + } + } + + return return_value; +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc index f0d2f0a836..f297e388b2 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc @@ -78,7 +78,7 @@ void AlertManeuverRequest::Run() { } // Checking alert maneuver on contained \t\n \\t \\n - if (IsWhitespaceExist()) { + if (IsWhiteSpaceExist()) { LOG4CXX_ERROR(logger_, "Incoming alert maneuver has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -192,7 +192,8 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { } } -bool AlertManeuverRequest::IsWhitespaceExist() { +bool AlertManeuverRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "AlertManeuverRequest::IsWhiteSpaceExist"); bool return_value = false; const char* str = NULL; @@ -206,13 +207,32 @@ bool AlertManeuverRequest::IsWhitespaceExist() { for (; it_tc != it_tc_end; ++it_tc) { str = (*it_tc)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "tts_chunks syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); return_value = true; break; } } } + if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + const smart_objects::SmartArray* sb_array = + (*message_)[strings::msg_params][strings::soft_buttons].asArray(); + + smart_objects::SmartArray::const_iterator it_sb = sb_array->begin(); + smart_objects::SmartArray::const_iterator it_sb_end = sb_array->end(); + + for (; it_sb != it_sb_end; ++it_sb) { + if ((*it_sb).keyExists(strings::image)) { + str = (*it_sb)[strings::image][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_ERROR(logger_, + "Invalid soft_buttons image value syntax check failed"); + return_value = true; + } + } + } + } + return return_value; } diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc index 923e2058cb..0b9d219384 100644 --- a/src/components/application_manager/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_request.cc @@ -336,12 +336,13 @@ void AlertRequest::SendPlayToneNotification(int32_t app_id) { } bool AlertRequest::CheckStringsOfAlertRequest() { + LOG4CXX_INFO(logger_, "AlertRequest::CheckStringsOfAlertRequest"); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) { str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "alert_text_1 syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed"); return false; } } @@ -349,7 +350,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "alert_text_2 syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed"); return false; } } @@ -357,7 +358,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) { str = (*message_)[strings::msg_params][strings::alert_text3].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "alert_text_3 syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid alert_text_3 syntax check failed"); return false; } } @@ -368,7 +369,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() { for (size_t i = 0; i < tts_chunks_array.length(); ++i) { str = tts_chunks_array[i][strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "tts_chunks syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); return false; } } diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc index 6cc2996688..74be02d170 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc @@ -213,7 +213,7 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( } // Checking choice set on contained \t\n \\t \\n - if (IsWhitespaceExist((*it_array))) { + if (IsWhiteSpaceExist((*it_array))) { LOG4CXX_ERROR(logger_, "Incoming choice set has contains \t\n \\t \\n"); return mobile_apis::Result::INVALID_DATA; @@ -256,40 +256,53 @@ bool CreateInteractionChoiceSetRequest::compareStr( return 0 == strcasecmp(str1.asCharArray(), str2.asCharArray()); } -bool CreateInteractionChoiceSetRequest::IsWhitespaceExist( +bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( const smart_objects::SmartObject& choice_set) { + LOG4CXX_INFO(logger_, "CreateInteractionChoiceSetRequest::IsWhiteSpaceExist"); bool return_value = false; + const char* str = NULL; - const char* str = choice_set[strings::menu_name].asCharArray(); + str = choice_set[strings::menu_name].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "menu_name syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid menu_name syntax check failed"); return_value = true; } - str = choice_set[strings::secondary_text].asCharArray(); - if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "secondary_text syntax check failed"); - return_value = true; + if (choice_set.keyExists(strings::secondary_text)) { + str = choice_set[strings::secondary_text].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_ERROR(logger_, "Invalid secondary_text syntax check failed"); + return_value = true; + } } - str = choice_set[strings::tertiary_text].asCharArray(); - if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "tertiary_text syntax check failed"); - return_value = true; + if (choice_set.keyExists(strings::tertiary_text)) { + str = choice_set[strings::tertiary_text].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_ERROR(logger_, "Invalid tertiary_text syntax check failed"); + return_value = true; + } } - const smart_objects::SmartArray* vr_array = - choice_set[strings::vr_commands].asArray(); + if (choice_set.keyExists(strings::vr_commands)) { + size_t len = + choice_set[strings::vr_commands].length(); - smart_objects::SmartArray::const_iterator it_vr = vr_array->begin(); - smart_objects::SmartArray::const_iterator it_vr_end = vr_array->end(); + for (size_t i = 0; i < len; ++i) { + str = choice_set[strings::vr_commands][i].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed"); + return_value = true; + break; + } + } + } - for (; it_vr != it_vr_end; ++it_vr) { - str = (*it_vr).asCharArray(); + if (choice_set.keyExists(strings::image)) { + str = choice_set[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "vr_commands syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid image value syntax check failed"); return_value = true; - break; } } diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc index 1e4a5b323a..8967f747eb 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -91,7 +91,7 @@ void PerformAudioPassThruRequest::Run() { } // Checking perform audio pass thru on contained \t\n \\t \\n - if (IsWhitespaceExist()) { + if (IsWhiteSpaceExist()) { LOG4CXX_ERROR(logger_, "Incoming perform audio pass thru has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -242,7 +242,8 @@ void PerformAudioPassThruRequest::StartMicrophoneRecording() { (*message_)[str::msg_params][str::audio_type].asInt()); } -bool PerformAudioPassThruRequest::IsWhitespaceExist() { +bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "PerformAudioPassThruRequest::IsWhiteSpaceExist"); bool return_value = false; const char* str = NULL; @@ -256,7 +257,7 @@ bool PerformAudioPassThruRequest::IsWhitespaceExist() { for (; it_ip != it_ip_end; ++it_ip) { str = (*it_ip)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "initial_prompt syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid initial_prompt syntax check failed"); return_value = true; break; } diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc index 7177a03bb7..0e080181ac 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc @@ -129,7 +129,7 @@ void PerformInteractionRequest::Run() { } // Checking perform interaction on contained \t\n \\t \\n - if (IsWhitespaceExist()) { + if (IsWhiteSpaceExist()) { LOG4CXX_ERROR(logger_, "Incoming perform interaction has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -736,14 +736,15 @@ void PerformInteractionRequest::DisablePerformInteraction() { } } -bool PerformInteractionRequest::IsWhitespaceExist() { +bool PerformInteractionRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "PerformInteractionRequest::IsWhiteSpaceExist"); bool return_value = false; const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::initial_text)) { str = (*message_)[strings::msg_params][strings::initial_text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "initial_text syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid initial_text syntax check failed"); return_value = true; } } @@ -758,7 +759,7 @@ bool PerformInteractionRequest::IsWhitespaceExist() { for (; it_ip != it_ip_end; ++it_ip) { str = (*it_ip)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "initial_prompt syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid initial_prompt syntax check failed"); return_value = true; break; } @@ -775,7 +776,7 @@ bool PerformInteractionRequest::IsWhitespaceExist() { for (; it_hp != it_hp_end; ++it_hp) { str = (*it_hp)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "help_prompt syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid help_prompt syntax check failed"); return_value = true; break; } @@ -792,7 +793,7 @@ bool PerformInteractionRequest::IsWhitespaceExist() { for (; it_tp != it_tp_end; ++it_tp) { str = (*it_tp)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "timeout_prompt syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid timeout_prompt syntax check failed"); return_value = true; break; } @@ -809,7 +810,7 @@ bool PerformInteractionRequest::IsWhitespaceExist() { for (; it_vh != it_vh_end; ++it_vh) { str = (*it_vh)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "vr_help syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid vr_help syntax check failed"); return_value = true; break; } diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index 68634a7e92..34a8d97246 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -197,7 +197,7 @@ void RegisterAppInterfaceRequest::Run() { } // Checking register app interface on contained \t\n \\t \\n - if (IsWhitespaceExist()) { + if (IsWhiteSpaceExist()) { LOG4CXX_INFO(logger_, "Incoming register app interface has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -741,18 +741,18 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { return false; } -bool RegisterAppInterfaceRequest::IsWhitespaceExist() { +bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::IsWhiteSpaceExist"); bool return_value = false; const char* str = NULL; - if ((*message_)[strings::msg_params].keyExists(strings::app_name)) { - str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); - if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "app_name syntax check failed"); - return_value = true; - } + str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_ERROR(logger_, "Invalid app_name syntax check failed"); + return_value = true; } + if ((*message_)[strings::msg_params].keyExists(strings::tts_name)) { const smart_objects::SmartArray* tn_array = (*message_)[strings::msg_params][strings::tts_name].asArray(); @@ -763,15 +763,13 @@ bool RegisterAppInterfaceRequest::IsWhitespaceExist() { for (; it_tn != it_tn_end; ++it_tn) { str = (*it_tn)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "tts_name syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid tts_name syntax check failed"); return_value = true; break; } } } - return return_value; - } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc index 083376e031..f18f604c02 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc @@ -87,6 +87,14 @@ void ScrollabelMessageRequest::Run() { return; } + // Checking scrollabel message on contained \t\n \\t \\n + if (IsWhiteSpaceExist()) { + LOG4CXX_ERROR(logger_, + "Incoming scrollabel message has contains \t\n \\t \\n"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + smart_objects::SmartObject msg_params = smart_objects::SmartObject( smart_objects::SmartType_Map); @@ -143,6 +151,34 @@ void ScrollabelMessageRequest::on_event(const event_engine::Event& event) { } } +bool ScrollabelMessageRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "ScrollabelMessageRequest::IsWhiteSpaceExist"); + bool return_value = false; + const char* str = NULL; + + if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + const smart_objects::SmartArray* sb_array = + (*message_)[strings::msg_params][strings::soft_buttons].asArray(); + + smart_objects::SmartArray::const_iterator it_sb = sb_array->begin(); + smart_objects::SmartArray::const_iterator it_sb_end = sb_array->end(); + + for (; it_sb != it_sb_end; ++it_sb) { + if ((*it_sb).keyExists(strings::image)) { + str = (*it_sb)[strings::image][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, + "Invalid soft_buttons image value syntax check failed"); + return_value = true; + break; + } + } + } + } + + return return_value; +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc index d156e5d5d2..086950e11c 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc @@ -107,7 +107,7 @@ void SetGlobalPropertiesRequest::Run() { } // Checking set global properties on contained \t\n \\t \\n - if (IsWhitespaceExist()) { + if (IsWhiteSpaceExist()) { LOG4CXX_ERROR(logger_, "Incoming set global properties has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -378,7 +378,8 @@ bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( || params.keyExists(strings::keyboard_properties); } -bool SetGlobalPropertiesRequest::IsWhitespaceExist() { +bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "SetGlobalPropertiesRequest::IsWhiteSpaceExist"); bool return_value = false; const char* str; @@ -395,7 +396,7 @@ bool SetGlobalPropertiesRequest::IsWhitespaceExist() { for (; it_hp != it_hp_end; ++it_hp) { str = (*it_hp)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "help_prompt syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid help_prompt syntax check failed"); return_value = true; break; } @@ -412,13 +413,44 @@ bool SetGlobalPropertiesRequest::IsWhitespaceExist() { for (; it_tp != it_tp_end; ++it_tp) { str = (*it_tp)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "timeout_prompt syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid timeout_prompt syntax check failed"); return_value = true; break; } } } + if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) { + const smart_objects::SmartArray* vh_array = + (*message_)[strings::msg_params][strings::vr_help].asArray(); + + smart_objects::SmartArray::const_iterator it_vh = vh_array->begin(); + smart_objects::SmartArray::const_iterator it_vh_end = vh_array->end(); + + for (; it_vh != it_vh_end; ++it_vh) { + if ((*it_vh).keyExists(strings::image)) { + str = (*it_vh)[strings::image][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_ERROR(logger_, + "Invalid vrHelp image value syntax check failed"); + return_value = true; + break; + } + } + } + } + + + if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) { + str = (*message_)[strings::msg_params] + [strings::menu_icon][strings::value].asCharArray(); + + if (!CheckSyntax(str, true)) { + LOG4CXX_ERROR(logger_, "Invalid menu_icon value syntax check failed"); + return_value = true; + } + } + return return_value; } diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc index 052557263d..e6e78a5688 100644 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc @@ -104,6 +104,14 @@ void ShowConstantTBTRequest::Run() { } } + // Checking show constant TBT on contained \t\n \\t \\n + if (IsWhiteSpaceExist()) { + LOG4CXX_ERROR(logger_, + "Incoming show constant TBT has contains \t\n \\t \\n"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + msg_params[strings::app_id] = app->app_id(); msg_params[hmi_request::navi_texts] = smart_objects::SmartObject( @@ -192,6 +200,52 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { } } +bool ShowConstantTBTRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "ShowConstantTBTRequest::IsWhiteSpaceExist"); + bool return_value = false; + const char* str = NULL; + + if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + const smart_objects::SmartArray* sb_array = + (*message_)[strings::msg_params][strings::soft_buttons].asArray(); + + smart_objects::SmartArray::const_iterator it_sb = sb_array->begin(); + smart_objects::SmartArray::const_iterator it_sb_end = sb_array->end(); + + for (; it_sb != it_sb_end; ++it_sb) { + if ((*it_sb).keyExists(strings::image)) { + str = (*it_sb)[strings::image][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, + "Invalid soft_buttons image value syntax check failed"); + return_value = true; + break; + } + } + } + } + + if ((*message_)[strings::msg_params].keyExists(strings::turn_icon)) { + str = (*message_)[strings::msg_params] + [strings::turn_icon][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, "Invalid turn_icon value syntax check failed"); + return_value = true; + } + } + + if ((*message_)[strings::msg_params].keyExists(strings::next_turn_icon)) { + str = (*message_)[strings::msg_params] + [strings::next_turn_icon][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, "Invalid next_turn_icon value syntax check failed"); + return_value = true; + } + } + + return return_value; +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc index c5905f35f5..d7c960d5ab 100644 --- a/src/components/application_manager/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_request.cc @@ -236,54 +236,55 @@ void ShowRequest::on_event(const event_engine::Event& event) { } bool ShowRequest::CheckStringsOfShowRequest() { + LOG4CXX_INFO(logger_, "ShowRequest::CheckStringsOfShowRequest"); const char* str; if ((*message_)[strings::msg_params].keyExists(strings::main_field_4)) { str = (*message_)[strings::msg_params][strings::main_field_4].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "main_field_4 syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid main_field_4 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) { str = (*message_)[strings::msg_params][strings::main_field_3].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "main_field_3 syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid main_field_3 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_2)) { str = (*message_)[strings::msg_params][strings::main_field_2].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "main_field_2 syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid main_field_2 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) { str = (*message_)[strings::msg_params][strings::main_field_1].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "main_field_1 syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid main_field_1 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) { str = (*message_)[strings::msg_params][strings::status_bar].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "status_bar syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid status_bar syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) { str = (*message_)[strings::msg_params][strings::media_clock].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "media_clock syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid media_clock syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::media_track)) { str = (*message_)[strings::msg_params][strings::media_track].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "media_track syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid media_track syntax check failed"); return false; } } @@ -293,7 +294,7 @@ bool ShowRequest::CheckStringsOfShowRequest() { for (size_t i = 0; i < custom_presets_array.length(); ++i) { str = custom_presets_array[i].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "custom_presets syntax check failed"); + LOG4CXX_INFO(logger_, "Invalid custom_presets syntax check failed"); return false; } } @@ -307,11 +308,44 @@ bool ShowRequest::CheckStringsOfShowRequest() { smart_objects::SmartArray::const_iterator it_sb_end = sb_array->end(); for (; it_sb != it_sb_end; ++it_sb) { - str = (*it_sb)[strings::text].asCharArray(); - if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "soft_buttons syntax check failed"); - return false; + + if ((*it_sb).keyExists(strings::text)) { + str = (*it_sb)[strings::text].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, + "Invalid soft_buttons text syntax check failed"); + return false; + } } + + if ((*it_sb).keyExists(strings::image)) { + str = (*it_sb)[strings::image][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, + "Invalid soft_buttons image value syntax check failed"); + return false; + } + } + + } + } + + if ((*message_)[strings::msg_params].keyExists(strings::graphic)) { + str = (*message_)[strings::msg_params] + [strings::graphic][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, "Invalid graphic value syntax check failed"); + return false; + } + } + + if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) { + str = (*message_)[strings::msg_params] + [strings::secondary_graphic][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, + "Invalid secondary_graphic value syntax check failed"); + return false; } } return true; diff --git a/src/components/application_manager/src/commands/mobile/speak_request.cc b/src/components/application_manager/src/commands/mobile/speak_request.cc index ffa26711ef..c175d9b6c9 100644 --- a/src/components/application_manager/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/src/commands/mobile/speak_request.cc @@ -59,7 +59,7 @@ void SpeakRequest::Run() { } // Checking speak on contained \t\n \\t \\n - if (IsWhitespaceExist()) { + if (IsWhiteSpaceExist()) { LOG4CXX_ERROR(logger_, "Incoming speak has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); @@ -124,7 +124,8 @@ void SpeakRequest::ProcessTTSSpeakResponse( return_info, &(message[strings::msg_params])); } -bool SpeakRequest::IsWhitespaceExist() { +bool SpeakRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "SpeakRequest::IsWhiteSpaceExist"); bool return_value = false; const char* str = NULL; @@ -138,7 +139,7 @@ bool SpeakRequest::IsWhitespaceExist() { for (; it_tc != it_tc_end; ++it_tc) { str = (*it_tc)[strings::text].asCharArray(); if (!CheckSyntax(str, true)) { - LOG4CXX_INFO(logger_, "tts_chunks syntax check failed"); + LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); return_value = true; break; } diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc index 0b0d724eec..9b1a7b6cbd 100644 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc +++ b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc @@ -87,6 +87,14 @@ void UpdateTurnListRequest::Run() { } } + // Checking update turn list on contained \t\n \\t \\n + if (IsWhiteSpaceExist()) { + LOG4CXX_ERROR(logger_, + "Incoming update turn list has contains \t\n \\t \\n"); + SendResponse(false, mobile_apis::Result::INVALID_DATA); + return; + } + smart_objects::SmartObject msg_params = smart_objects::SmartObject( smart_objects::SmartType_Map); msg_params = (*message_)[strings::msg_params]; @@ -173,6 +181,54 @@ bool UpdateTurnListRequest::CheckTurnListArray() { return true; } +bool UpdateTurnListRequest::IsWhiteSpaceExist() { + LOG4CXX_INFO(logger_, "UpdateTurnListRequest::IsWhiteSpaceExist"); + bool return_value = false; + const char* str = NULL; + + if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + const smart_objects::SmartArray* sb_array = + (*message_)[strings::msg_params][strings::soft_buttons].asArray(); + + smart_objects::SmartArray::const_iterator it_sb = sb_array->begin(); + smart_objects::SmartArray::const_iterator it_sb_end = sb_array->end(); + + for (; it_sb != it_sb_end; ++it_sb) { + if ((*it_sb).keyExists(strings::image)) { + str = (*it_sb)[strings::image][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, + "Invalid soft_buttons image value syntax check failed"); + return_value = true; + break; + } + } + } + } + + if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) { + const smart_objects::SmartArray* tl_array = + (*message_)[strings::msg_params][strings::turn_list].asArray(); + + smart_objects::SmartArray::const_iterator it_tl = tl_array->begin(); + smart_objects::SmartArray::const_iterator it_tl_end = tl_array->end(); + + for (; it_tl != it_tl_end; ++it_tl) { + if ((*it_tl).keyExists(strings::turn_icon)) { + str = (*it_tl)[strings::turn_icon][strings::value].asCharArray(); + if (!CheckSyntax(str, true)) { + LOG4CXX_INFO(logger_, + "Invalid turn_list turn_icon value syntax check failed"); + return_value = true; + break; + } + } + } + } + + return return_value; +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index a9b5dfe817..a866e8a614 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -508,6 +508,11 @@ void PolicyHandler::OnPendingPermissionChange( BinaryMessageSptr PolicyHandler::AddHttpHeader( const BinaryMessageSptr& pt_string) { + // Creating new value to avoid backslashes with direct converting from string + Json::Value policy_table(Json::objectValue); + Json::Reader reader; + reader.parse(std::string(pt_string->begin(), pt_string->end()), policy_table); + Json::Value packet(Json::objectValue); packet["HTTPRequest"] = Json::Value(Json::objectValue); packet["HTTPRequest"]["headers"] = Json::Value(Json::objectValue); @@ -526,12 +531,10 @@ BinaryMessageSptr PolicyHandler::AddHttpHeader( packet["HTTPRequest"]["headers"]["Content_Length"] = Json::Value(static_cast<int>(pt_string->size())); packet["HTTPRequest"]["body"] = Json::Value(Json::objectValue); - packet["HTTPRequest"]["body"]["data"] = Json::Value(Json::arrayValue); - packet["HTTPRequest"]["body"]["data"][0] = Json::Value( - std::string(pt_string->begin(), - pt_string->end())); + packet["HTTPRequest"]["body"]["data"] = Json::Value(Json::objectValue); + packet["HTTPRequest"]["body"]["data"] = policy_table; - Json::FastWriter writer; + Json::StyledWriter writer; std::string message = writer.write(packet); LOG4CXX_DEBUG(logger_, "Packet PT: " << message); return new BinaryMessage(message.begin(), message.end()); |