00001 #include "orbsvcs/SSLIOP/SSLIOP_Invocation_Interceptor.h"
00002 #include "orbsvcs/SSLIOP/SSLIOP_Current.h"
00003
00004 #include "orbsvcs/SecurityLevel2C.h"
00005
00006 #include "tao/ORB_Constants.h"
00007 #include "tao/PortableServer/PS_CurrentC.h"
00008 #include "tao/PortableServer/POAC.h"
00009 #include "tao/debug.h"
00010
00011 #if defined (SSLIOP_DEBUG_PEER_CERTIFICATE)
00012 #include <openssl/x509.h>
00013 #endif
00014
00015 ACE_RCSID (SSLIOP,
00016 SSLIOP_Invocation_Interceptor,
00017 "$Id: SSLIOP_Invocation_Interceptor.cpp 80431 2008-01-15 19:06:41Z johnnyw $")
00018
00019
00020 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00021
00022 TAO::SSLIOP::Server_Invocation_Interceptor::Server_Invocation_Interceptor
00023 (
00024 PortableInterceptor::ORBInitInfo_ptr info,
00025 ::Security::QOP default_qop,
00026 size_t tss_slot
00027 )
00028 : qop_ (default_qop)
00029 {
00030
00031
00032
00033
00034
00035 CORBA::Object_var obj =
00036 info->resolve_initial_references ("SSLIOPCurrent");
00037
00038 this->ssliop_current_ = ::SSLIOP::Current::_narrow (obj.in ());
00039
00040 if (!CORBA::is_nil (this->ssliop_current_.in ()))
00041 {
00042 TAO::SSLIOP::Current *tao_current =
00043 dynamic_cast<TAO::SSLIOP::Current *> (this->ssliop_current_.in ());
00044
00045 if (tao_current != 0)
00046 {
00047 if (TAO_debug_level > 3)
00048 ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) SSLIOP_Invocation_Interceptor::CTOR--setting up SSLIOP Current with slot %d\n", tss_slot));
00049 tao_current->tss_slot (tss_slot);
00050 }
00051 else
00052 throw CORBA::INTERNAL ();
00053 }
00054
00055 obj = info->resolve_initial_references ("SecurityLevel2:SecurityManager");
00056 this->sec2manager_ = SecurityLevel2::SecurityManager::_narrow (obj.in ());
00057
00058 if (! CORBA::is_nil (this->sec2manager_.in ()))
00059 {
00060
00061 }
00062
00063 #if 0
00064
00065
00066
00067 obj = info->resolve_initial_references ("POACurrent");
00068 this->poa_current_ = PortableServer::Current::_narrow (obj.in ());
00069 #endif
00070 }
00071
00072 TAO::SSLIOP::Server_Invocation_Interceptor::~Server_Invocation_Interceptor (
00073 void)
00074 {
00075 }
00076
00077 char *
00078 TAO::SSLIOP::Server_Invocation_Interceptor::name ()
00079 {
00080 return CORBA::string_dup ("TAO::SSLIOP::Server_Invocation_Interceptor");
00081 }
00082
00083 void
00084 TAO::SSLIOP::Server_Invocation_Interceptor::destroy ()
00085 {
00086 }
00087
00088 void
00089 TAO::SSLIOP::Server_Invocation_Interceptor::receive_request_service_contexts (
00090 PortableInterceptor::ServerRequestInfo_ptr )
00091 {
00092 }
00093
00094
00095 void
00096 TAO::SSLIOP::Server_Invocation_Interceptor::receive_request (
00097 PortableInterceptor::ServerRequestInfo_ptr ri )
00098 {
00099 SecurityLevel2::AccessDecision_var ad_tmp =
00100 this->sec2manager_->access_decision ();
00101 TAO::SL2::AccessDecision_var ad =
00102 TAO::SL2::AccessDecision::_narrow (ad_tmp.in ());
00103
00104 CORBA::Boolean const no_ssl =
00105 this->ssliop_current_->no_context ();
00106
00107 if (TAO_debug_level >= 3)
00108 ACE_DEBUG ((LM_DEBUG, "SSLIOP (%P|%t) Interceptor (context), ssl=%d\n", !(no_ssl)));
00109
00110
00111
00112
00113
00114
00115
00116 if (no_ssl && this->qop_ != ::Security::SecQOPNoProtection)
00117 {
00118
00119
00120
00121
00122
00123
00124 SecurityLevel2::CredentialsList cred_list;
00125 #if 0
00126 try {
00127 SecurityLevel2::ReceivedCredentials_var rcvd_creds =
00128 this->sec2_current_->received_credentials ();
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 cred_list.length(1);
00139 cred_list[0] = rcvd_creds.in ();
00140
00141
00142
00143
00144 }
00145 catch (...) {
00146 }
00147 #endif
00148
00149
00150 CORBA::ORBid_var orb_id = ri->orb_id ();
00151 CORBA::OctetSeq_var adapter_id = ri->adapter_id ();
00152 CORBA::OctetSeq_var object_id = ri->object_id ();
00153 CORBA::String_var operation_name = ri->operation ();
00154
00155 CORBA::Boolean it_should_happen = false;
00156 it_should_happen = ad->access_allowed_ex (orb_id.in (),
00157 adapter_id.in (),
00158 object_id.in (),
00159 cred_list,
00160 operation_name.in());
00161 if (TAO_debug_level >= 3)
00162 {
00163 ACE_DEBUG ((LM_DEBUG,
00164 "TAO (%P|%t) SL2::access_allowed_ex returned %s\n",
00165 it_should_happen ? "true" : "false"));
00166 }
00167
00168 if (! it_should_happen)
00169 throw CORBA::NO_PERMISSION ();
00170 }
00171 }
00172
00173 void
00174 TAO::SSLIOP::Server_Invocation_Interceptor::send_reply (
00175 PortableInterceptor::ServerRequestInfo_ptr )
00176 {
00177 }
00178
00179 void
00180 TAO::SSLIOP::Server_Invocation_Interceptor::send_exception (
00181 PortableInterceptor::ServerRequestInfo_ptr )
00182 {
00183 }
00184
00185 void
00186 TAO::SSLIOP::Server_Invocation_Interceptor::send_other (
00187 PortableInterceptor::ServerRequestInfo_ptr )
00188 {
00189 }
00190
00191 TAO_END_VERSIONED_NAMESPACE_DECL