diff options
author | msmit <msmit@remedy.nl> | 2011-05-04 11:38:50 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2011-05-04 11:38:50 +0000 |
commit | 1c9566997efef1c0c62f8705bd4d21638eb20e00 (patch) | |
tree | aae142319b3ed8d22369a364beb8aa62b6b1e86e /CIAO/connectors/dds4ccm/impl/ndds | |
parent | e3e19eccf2cb5001cebb4542695d85c14a4be8c6 (diff) | |
download | ATCD-1c9566997efef1c0c62f8705bd4d21638eb20e00.tar.gz |
Wed May 4 11:37:31 UTC 2011 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/ndds/DomainParticipant.cpp:
* connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp:
* connectors/dds4ccm/impl/ndds/Publisher.cpp:
* connectors/dds4ccm/impl/ndds/Subscriber.cpp:
* connectors/dds4ccm/impl/ndds/Utils.cpp:
Improved handling of Qos profile string. Throwing a ::CORBA::INTERAL
when the Qos profile string does not meet the requirements
(i.e. containing a '#'-sign).
* connectors/dds4ccm/tests/QosProfile/descriptors/PlanNoHash.cdp:
* connectors/dds4ccm/tests/QosProfile/descriptors/PlanWrongNames.cdp:
* connectors/dds4ccm/tests/QosProfile/descriptors/run_test.pl:
Extended this test with a malformed Qos profile string.
* connectors/dds4ccm/tests/QosProfile/descriptors/Plan.cdp:
Removed this file.
Diffstat (limited to 'CIAO/connectors/dds4ccm/impl/ndds')
-rw-r--r-- | CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp | 35 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp | 26 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/impl/ndds/Publisher.cpp | 12 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp | 25 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/impl/ndds/Utils.cpp | 24 |
5 files changed, 118 insertions, 4 deletions
diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp index b56d64e1c0b..a6707e03503 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp @@ -69,6 +69,18 @@ namespace CIAO char * lib_name = get_library_name(qos_profile); char * prof_name = get_profile_name(qos_profile); + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (lib_name); + ACE_OS::free (prof_name); + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_DomainParticipant_i::create_publisher_with_profile<%C> - " + "Malformed qos_profile. Expected format: " + "<library_name>#<profile_name>\n", + qos_profile)); + throw ::CORBA::INTERNAL (); + } + DDSPublisher * ccm_dds_pub = this->rti_entity ()->create_publisher_with_profile ( lib_name, @@ -242,6 +254,18 @@ namespace CIAO char * lib_name = get_library_name(qos_profile); char * prof_name = get_profile_name(qos_profile); + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (lib_name); + ACE_OS::free (prof_name); + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_DomainParticipant_i::create_subscriber_with_profile<%C> - " + "Malformed qos_profile. Expected format: " + "<library_name>#<profile_name>\n", + qos_profile)); + throw ::CORBA::INTERNAL (); + } + DDSSubscriber * ccm_dds_sub = this->rti_entity ()->create_subscriber_with_profile ( lib_name, @@ -549,6 +573,17 @@ namespace CIAO char * lib_name = get_library_name(qos_profile); char * prof_name = get_profile_name(qos_profile); + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (lib_name); + ACE_OS::free (prof_name); + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_DomainParticipant_i::create_topic_with_profile <%C> - " + "Malformed qos_profile. Expected format: " + "<library_name>#<profile_name>\n", + qos_profile)); + throw ::CORBA::INTERNAL (); + } dds_tp = this->rti_entity ()->create_topic_with_profile ( impl_name, type_name, diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp index 4363a03b9a1..df9ed0d542b 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp @@ -151,6 +151,19 @@ namespace CIAO char * lib_name = get_library_name(qos_profile); char * prof_name = get_profile_name(qos_profile); + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (lib_name); + ACE_OS::free (prof_name); + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_DomainParticipantFactory_i::" + "create_participant_with_profile <%C> - " + "Malformed qos_profile. Expected format: " + "<library_name>#<profile_name>\n", + qos_profile)); + throw ::CORBA::INTERNAL (); + } + dds_dp = DDSDomainParticipantFactory::get_instance ()-> create_participant_with_profile (domain_id, lib_name, @@ -343,6 +356,19 @@ namespace CIAO char * lib_name = get_library_name(qos_profile); char * prof_name = get_profile_name(qos_profile); + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (lib_name); + ACE_OS::free (prof_name); + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_DomainParticipantFactory_i::" + "set_default_participant_qos_with_profile <%C> - " + "Malformed qos_profile. Expected format: " + "<library_name>#<profile_name>\n", + qos_profile)); + throw ::CORBA::INTERNAL (); + } + ::DDS::ReturnCode_t retcode = DDSDomainParticipantFactory::get_instance ()-> set_default_participant_qos_with_profile (lib_name, prof_name); diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Publisher.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Publisher.cpp index 78e4a2e9c37..2b0c7d98c71 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Publisher.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/Publisher.cpp @@ -119,6 +119,18 @@ namespace CIAO char * lib_name = get_library_name(qos_profile); char * prof_name = get_profile_name(qos_profile); + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (lib_name); + ACE_OS::free (prof_name); + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_Publisher_i::create_datawriter_with_profile <%C> - " + "Malformed qos_profile. Expected format: " + "<library_name>#<profile_name>\n", + qos_profile)); + throw ::CORBA::INTERNAL (); + } + DDSDataWriter *ccm_dds_dw = this->rti_entity ()->create_datawriter_with_profile ( topic->get_rti_entity (), lib_name, diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp index 1f623a56194..74a3db0d8ea 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp @@ -112,6 +112,18 @@ namespace CIAO char * lib_name = get_library_name(qos_profile); char * prof_name = get_profile_name(qos_profile); + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (lib_name); + ACE_OS::free (prof_name); + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_Subscriber_i::create_datareader_with_profile <%C> - " + "Malformed qos_profile. Expected format: " + "<library_name>#<profile_name>\n", + qos_profile)); + throw ::CORBA::INTERNAL (); + } + DDSDataReader * dr = this->rti_entity ()->create_datareader_with_profile ( topic, lib_name, @@ -133,6 +145,19 @@ namespace CIAO { char * lib_name = get_library_name (qos_profile); char * prof_name = get_profile_name (qos_profile); + + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (lib_name); + ACE_OS::free (prof_name); + DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO + "DDS_Subscriber_i::create_datareader_with_profile <%C> - " + "Malformed qos_profile. Expected format: " + "<library_name>#<profile_name>\n", + qos_profile)); + throw ::CORBA::INTERNAL (); + } + DDSDataReader * dr = this->rti_entity ()->create_datareader_with_profile (topic, lib_name, prof_name, diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Utils.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Utils.cpp index 5b6dc8e3151..722eecdd245 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Utils.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/Utils.cpp @@ -1,7 +1,7 @@ // $Id$ #include "dds4ccm/impl/ndds/Utils.h" -#include "ace/Log_Msg.h" +#include "dds4ccm/impl/logger/Log_Macros.h" #include "ace/Tokenizer_T.h" namespace CIAO @@ -13,7 +13,15 @@ namespace CIAO char* buf = ACE_OS::strdup (qos_profile); ACE_Tokenizer_T<char> tok (buf); tok.delimiter_replace ('#', 0); - char * ret = ACE_OS::strdup (tok.next ()); + const char * lib_name = tok.next (); + + if (lib_name == 0) + { + ACE_OS::free (buf); + return 0; + } + + char * ret = ACE_OS::strdup (lib_name); ACE_OS::free (buf); return ret; } @@ -23,8 +31,16 @@ namespace CIAO char* buf = ACE_OS::strdup (qos_profile); ACE_Tokenizer_T<char> tok (buf); tok.delimiter_replace ('#', 0); - tok.next (); - char * ret = ACE_OS::strdup (tok.next ()); + const char * lib_name = tok.next (); + const char * prof_name = tok.next (); + + if (lib_name == 0 || prof_name == 0) + { + ACE_OS::free (buf); + return 0; + } + + char * ret = ACE_OS::strdup (prof_name); ACE_OS::free (buf); return ret; } |