#include "hello.h" #ifdef HAVE_UNISTD_H #include #endif #ifdef _WINDOWS #include #endif #include using namespace std; int main (int argc, char *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var obj = orb->resolve_initial_references ("SecurityLevel3::SecurityManager"); SecurityLevel3::SecurityManager_var secman = SecurityLevel3::SecurityManager::_narrow(obj); assert(!CORBA::is_nil(secman)); /* * IOR is in hello.ref in the local directory */ char pwd[256], uri[300]; sprintf (uri, "file://%s/hello.ref", getcwd(pwd, 256)); /* * Bind to Hello World server */ CORBA::Object_var obj2 = orb->string_to_object (uri); HelloWorld_var hello = HelloWorld::_narrow (obj2); if (CORBA::is_nil (hello)) { printf ("oops: could not locate HelloWorld server\n"); exit (1); } SecurityLevel3::TargetCredentials_var tcreds1 = secman->get_target_credentials(hello); assert(!CORBA::is_nil(tcreds1)); wcout << "client: TargetCredentials:" << endl; MICOSL3Utils::PP::print_target_credentials(&wcout, tcreds1); try { hello->hello (); } catch (CORBA::NO_PERMISSION& ex) { cerr << "client: caught NO_PERMISSION" << endl; } //SecurityLevel3::TargetCredentials_var tcreds2 = secman->get_target_credentials(hello); //MICOSL3Utils::PP::print_target_credentials(&wcout, tcreds1); orb->destroy(); return 0; }