diff options
author | jeliazkov_i <jeliazkov_i@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-28 16:07:19 +0000 |
---|---|---|
committer | jeliazkov_i <jeliazkov_i@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-28 16:07:19 +0000 |
commit | 6e00d68a7355287d416f9313823a13250088c5a7 (patch) | |
tree | b11b6f2b30a76025103c7596eef5c5f12db6e26d /TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp | |
parent | b10dce6434dd8adeb860f24c118cfb27768148cd (diff) | |
download | ATCD-6e00d68a7355287d416f9313823a13250088c5a7.tar.gz |
Tue Sep 28 11:01:00 2004 Iliyan Jeliazkov <jeliazkov_i@ociweb.com>
Added a new method to create secure profiles and restored the signature
of make_profile () to conform to an interface defined in
Transport_Connector.h. Added exception checking macro calls.
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp | 110 |
1 files changed, 71 insertions, 39 deletions
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp index 00be46eb157..d602407c5f7 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp @@ -271,7 +271,7 @@ TAO::SSLIOP::Connector::create_profile (TAO_InputCDR& cdr) } TAO_Profile * -TAO::SSLIOP::Connector::make_profile (int is_secure ACE_ENV_ARG_DECL) +TAO::SSLIOP::Connector::make_profile (ACE_ENV_SINGLE_ARG_DECL) { // The endpoint should be of the form: // N.n@host:port/object_key @@ -281,7 +281,7 @@ TAO::SSLIOP::Connector::make_profile (int is_secure ACE_ENV_ARG_DECL) TAO_Profile *profile = 0; ACE_NEW_THROW_EX (profile, TAO_SSLIOP_Profile (this->orb_core (), - is_secure), // SSL component + 0), // SSL component CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO_DEFAULT_MINOR_CODE, @@ -294,76 +294,108 @@ TAO::SSLIOP::Connector::make_profile (int is_secure ACE_ENV_ARG_DECL) TAO_Profile * +TAO::SSLIOP::Connector::make_secure_profile (ACE_ENV_SINGLE_ARG_DECL) +{ + // The endpoint should be of the form: + // N.n@host:port/object_key + // or: + // host:port/object_key + + TAO_Profile *profile = 0; + ACE_NEW_THROW_EX (profile, + TAO_SSLIOP_Profile (this->orb_core (), + 1), // SSL component + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK_RETURN (0); + + return profile; +} + + + +TAO_Profile * TAO::SSLIOP::Connector::corbaloc_scan (const char *endpoint, size_t &len ACE_ENV_ARG_DECL) { int ssl_only = 0; - if( this->check_prefix( endpoint) == 0) - { - ssl_only = 1; - } + if (this->check_prefix (endpoint) == 0) + { + ssl_only = 1; + } else - { - if (this->TAO_IIOP_Connector::check_prefix ( endpoint) != 0) - return 0; - } - - // Determine the (first in a list of possibly > 1) endpoint address - const char *comma_pos = ACE_OS::strchr ( endpoint,','); - const char *slash_pos = ACE_OS::strchr ( endpoint,'/'); - if( comma_pos == 0 && slash_pos == 0) - { - if( TAO_debug_level) - { + { + if (this->TAO_IIOP_Connector::check_prefix (endpoint) != 0) + return 0; + } + + // Determine the (first in a list of possibly > 1) endpoint address + const char *comma_pos = ACE_OS::strchr (endpoint,','); + const char *slash_pos = ACE_OS::strchr (endpoint,'/'); + if (comma_pos == 0 && slash_pos == 0) + { + if (TAO_debug_level) + { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) SSLIOP_Connector::corbaloc_scan warning: ") ACE_TEXT("supplied string contains no comma or slash: %s\n"), endpoint)); - } - len = ACE_OS::strlen (endpoint); - } - else if( slash_pos != 0 || comma_pos > slash_pos) - { - // The endpoint address does not extend past the first '/' or ',' - len = slash_pos - endpoint; - } - else - { - len = comma_pos - endpoint; - } - - return this->make_profile( ssl_only ACE_ENV_ARG_PARAMETER); + } + len = ACE_OS::strlen (endpoint); + } + else if (slash_pos != 0 || comma_pos > slash_pos) + { + // The endpoint address does not extend past the first '/' or ',' + len = slash_pos - endpoint; + } + else + { + len = comma_pos - endpoint; + } + + //Create the corresponding profile + TAO_Profile *ptmp = 0; + if (ssl_only) + ptmp = this->make_secure_profile (ACE_ENV_SINGLE_ARG_PARAMETER); + else + ptmp = this->make_profile (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_CHECK_RETURN (0); + return ptmp; } + int TAO::SSLIOP::Connector::check_prefix (const char *endpoint) { // Check for a valid string if (!endpoint || !*endpoint) return -1; // Failure - + const char *protocol[] = { "ssliop", "sslioploc" }; - + size_t first_slot = ACE_OS::strchr (endpoint, ':') - endpoint; - + size_t len0 = ACE_OS::strlen (protocol[0]); size_t len1 = ACE_OS::strlen (protocol[1]); - + // Check for the proper prefix in the IOR. If the proper prefix // isn't in the IOR then it is not an IOR we can use. if (first_slot == len0 && ACE_OS::strncmp (endpoint, protocol[0], len0) == 0) return 0; - + if (first_slot == len1 && ACE_OS::strncmp (endpoint, protocol[1], len1) == 0) return 0; - + // Failure: not an SSLIOP IOR // DO NOT throw an exception here. return -1; } - TAO_Transport* TAO::SSLIOP::Connector::iiop_connect ( TAO_SSLIOP_Endpoint *ssl_endpoint, |