CORBA::Object_ptr TAO_CEC_ProxyPushSupplier::apply_policy_obj (CORBA::Object_ptr pre) { #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 CORBA::Object_var post = CORBA::Object::_duplicate (pre); if (this->timeout_ > ACE_Time_Value::zero) { CORBA::PolicyList policy_list; policy_list.length (1); #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) if (this->typed_event_channel_) { policy_list[0] = this->typed_event_channel_-> create_roundtrip_timeout_policy (this->timeout_); } else { #endif policy_list[0] = this->event_channel_-> create_roundtrip_timeout_policy (this->timeout_); #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) } #endif post = pre->_set_policy_overrides (policy_list, CORBA::ADD_OVERRIDE); policy_list[0]->destroy (); policy_list.length (0); } return post._retn (); #else return CORBA::Object::_duplicate (pre); #endif /* TAO_HAS_CORBA_MESSAGING */ }
int insecure_invocation_test (CORBA::ORB_ptr orb, CORBA::Object_ptr obj) { // Disable protection for this insecure invocation test. Security::QOP qop = Security::SecQOPNoProtection; CORBA::Any no_protection; no_protection <<= qop; // Create the Security::QOPPolicy. CORBA::Policy_var policy = orb->create_policy (Security::SecQOPPolicy, no_protection); CORBA::PolicyList policy_list (1); policy_list.length (1); policy_list[0] = CORBA::Policy::_duplicate (policy.in ()); // Create an object reference that uses plain IIOP (i.e. no // protection). CORBA::Object_var object = obj->_set_policy_overrides (policy_list, CORBA::SET_OVERRIDE); Foo::Bar_var server = Foo::Bar::_narrow (object.in ()); if (CORBA::is_nil (server.in ())) { ACE_ERROR ((LM_ERROR, "(%P|%t) ERROR: Object reference <%s> is " "nil.\n", ior)); return 1; } try { // This invocation should result in a CORBA::NO_PERMISSION // exception. server->baz (); } catch (const CORBA::NO_PERMISSION&) { ACE_DEBUG ((LM_INFO, "(%P|%t) Received CORBA::NO_PERMISSION from " "server, as expected.\n")); return 0; } ACE_ERROR ((LM_ERROR, "(%P|%t) ERROR: CORBA::NO_PERMISSION was not thrown.\n" "(%P|%t) ERROR: It should have been thrown.\n")); return 1; }
CORBA::Object_ptr ImR_Locator_i::set_timeout_policy (CORBA::Object_ptr obj, const ACE_Time_Value& to) { CORBA::Object_var ret (CORBA::Object::_duplicate (obj)); try { TimeBase::TimeT timeout; ORBSVCS_Time::Time_Value_to_TimeT (timeout, to); CORBA::Any tmp; tmp <<= timeout; CORBA::PolicyList policies (1); policies.length (1); policies[0] = orb_->create_policy (Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, tmp); ret = obj->_set_policy_overrides (policies, CORBA::ADD_OVERRIDE); policies[0]->destroy (); if (CORBA::is_nil (ret.in ())) { if (debug_ > 0) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) ImR: Unable to set timeout policy.\n"))); } ret = CORBA::Object::_duplicate (obj); } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ( ACE_TEXT ("(%P|%t) ImR_Locator_i::set_timeout_policy ()")); } return ret._retn (); }