From 71f3ca3c7b2e595afa9cdd2e23d114d668865c49 Mon Sep 17 00:00:00 2001 From: doccvs Date: Tue, 1 May 2001 05:56:09 +0000 Subject: ChangeLogTag: Mon Apr 30 22:50:27 2001 Priyanka Gontla --- TAO/ChangeLogs/ChangeLog-02a | 7 +++++++ TAO/tao/CORBALOC_Parser.cpp | 45 +++++++++++++++++++++++++++++++++++++++++--- TAO/tao/CORBALOC_Parser.h | 4 +++- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index dd63f70d202..63c7b171cba 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,10 @@ +Mon Apr 30 22:50:27 2001 Priyanka Gontla + + * tao/CORBALOC_Parser.h: + * tao/CORBALOC_Parser.cpp: + Fixed the blocker bug 849. Included some parsing code so as to + check if the protocol used by the application is a known protocol. + Mon Apr 30 19:17:42 2001 Jeff Parsons * TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp: diff --git a/TAO/tao/CORBALOC_Parser.cpp b/TAO/tao/CORBALOC_Parser.cpp index 1537534d0c0..aa9faa3cace 100644 --- a/TAO/tao/CORBALOC_Parser.cpp +++ b/TAO/tao/CORBALOC_Parser.cpp @@ -19,6 +19,10 @@ TAO_CORBALOC_Parser::~TAO_CORBALOC_Parser (void) } static const char corbaloc_prefix[] = "corbaloc:"; +static const char iiop_prefix[] = "iiop:"; +static const char uiop_prefix[] = "uiop:"; +static const char shmiop_prefix[] = "shmiop:"; +static const char rir_prefix[] = "rir:"; int TAO_CORBALOC_Parser::match_prefix (const char *ior_string) const @@ -57,6 +61,7 @@ TAO_CORBALOC_Parser::parse_string_count_helper (const char * &corbaloc_name, ACE_THROW (CORBA::BAD_PARAM (TAO_OMG_VMCID | 10, CORBA::COMPLETED_NO)); + } } @@ -353,7 +358,9 @@ TAO_CORBALOC_Parser::parse_string_rir_helper (const char * } int -TAO_CORBALOC_Parser::check_prefix (const char *end_point) +TAO_CORBALOC_Parser::check_prefix (const char *end_point, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) { // This checks if the prefix is "rir:" or not. Returns a -1 if it is @@ -362,6 +369,34 @@ TAO_CORBALOC_Parser::check_prefix (const char *end_point) if (!end_point || !*end_point) return -1; // Failure + // Lets first check if it is a valid protocol: + if (!(ACE_OS::strncmp (end_point, + iiop_prefix, + sizeof iiop_prefix - 1) == 0) || + + (ACE_OS::strncmp (end_point, + shmiop_prefix, + sizeof shmiop_prefix - 1) == 0) || + + (ACE_OS::strncmp (end_point, + uiop_prefix, + sizeof uiop_prefix - 1) == 0) || + + (ACE_OS::strncmp (end_point, + rir_prefix, + sizeof rir_prefix - 1) == 0)) + { + + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) ") + ACE_TEXT ("no usable transport protocol ") + ACE_TEXT ("was found.\n"))); + + ACE_THROW_RETURN (CORBA::BAD_PARAM (TAO_OMG_VMCID | 10, + CORBA::COMPLETED_NO), + -1); + } + const char *protocol[] = {"rir:"}; size_t slot = ACE_OS::strchr (end_point, '/') - end_point; @@ -399,8 +434,12 @@ TAO_CORBALOC_Parser::parse_string (const char *ior, // Length of obj_addr_list CORBA::ULong addr_list_length = 0; - // If the protocol is not "rir:" - if (this->check_prefix (corbaloc_name) != 0) + // If the protocol is not "rir:" and also is a valid protocol + int check_prefix_result = this->check_prefix (corbaloc_name, + ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (check_prefix_result != 0) { // Count the length of the obj_addr_list and number of // endpoints in the obj_addr_list diff --git a/TAO/tao/CORBALOC_Parser.h b/TAO/tao/CORBALOC_Parser.h index 579de3bfdf1..0e7ae1a911b 100644 --- a/TAO/tao/CORBALOC_Parser.h +++ b/TAO/tao/CORBALOC_Parser.h @@ -58,7 +58,9 @@ public: private: /// Checks the prefix to see if it is RIR. - virtual int check_prefix (const char *endpoint); + virtual int check_prefix (const char *endpoint, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); /// Helps count the length of the and the number of /// individual in the . -- cgit v1.2.1