diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
commit | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (patch) | |
tree | 197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/orbsvcs/examples/Security | |
parent | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (diff) | |
download | ATCD-3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/examples/Security')
35 files changed, 1133 insertions, 0 deletions
diff --git a/TAO/orbsvcs/examples/Security/Makefile.am b/TAO/orbsvcs/examples/Security/Makefile.am new file mode 100644 index 00000000000..9772a9daeed --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Makefile.am @@ -0,0 +1,13 @@ +## Process this file with automake to create Makefile.in +## +## $Id$ +## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## ../bin/mwc.pl -type automake -noreldefs TAO.mwc + +SUBDIRS = \ + Send_File + diff --git a/TAO/orbsvcs/examples/Security/README b/TAO/orbsvcs/examples/Security/README new file mode 100644 index 00000000000..db13c886738 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/README @@ -0,0 +1,9 @@ +# $Id$ + +TAO CORBA Security Service Examples +=================================== + +Directory Description +--------- ----------- +Send_File Example that demonstrates use of SSLIOP pluggable protocol + diff --git a/TAO/orbsvcs/examples/Security/SecurityLevel1/README b/TAO/orbsvcs/examples/Security/SecurityLevel1/README new file mode 100644 index 00000000000..a29c58d2ee7 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/SecurityLevel1/README @@ -0,0 +1,47 @@ +$Id$ + +* README * + + + In this example, the server will have some (or may be just +one, if that will serve the purpose .. anyways since these will be +just simple dummy methods, it shouldnt matter) methods with different +levels of authorization. When a client wants to invoke any of these +methods, it has to be authenticated first(I am not sure, as of now, +the way for authenticating or the fact if this is really needed +.. well for starters, I will leave authentication). Then based on the +principals privilege attributes, the invocation will be +successful or denied. + +This test makes use of the Current::get_attributes to get the +attributes of the prinicipal which are used to provide or deny +access. + +We will check the values for all the possible attribute types that a +server could check in the remote case. And, as in the example, run +clients with both valid and invalid credentials. + +Also, we also need to make sure that the server is actually +returning the correct credentials and not garbling or giving some +random values. + +This will prove that + +1. Authorization is working. +2. All the attribute types which are supposed to work are working + properly. +3. Authentication is already working but we could also check that once + again. But, authentication is not limited to the ORB. It could be + checked using an outside agent too. + + + Since, the only thing that the SecurityLevel1 does is to get the +credentials of the initiating principal, to test the implementation, +in my view, + +1. We need to see if the method is returning the correct credentials. +2. If all the attribute types are working... ie.. show what are the + different types of attributes and what can be valid values for them + etc. +3. We need to show how one can make use of these values to provide or + deny access to the initiating principal. diff --git a/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test.idl b/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test.idl new file mode 100644 index 00000000000..f2c1b7ecbdf --- /dev/null +++ b/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test.idl @@ -0,0 +1,10 @@ +/* + * $Id$ + */ + +interface SLevel1_Server +{ + boolean authorize_level1 (); + + boolean authorize_level2 (); +}; diff --git a/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test_i.cpp b/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test_i.cpp new file mode 100644 index 00000000000..2153014c111 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test_i.cpp @@ -0,0 +1,122 @@ +// $Id$ + +#include "SLevel1_Test_i.h" + +#if !defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (SecurityLevel1, + SLevel1_Test_i, + "$Id$") + +static int authorize_1 = 1; +static int authorize_2 = 1; + +CORBA::Boolean +SLevel1_Server_i::authorize_level1 (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + /// Get a reference to the SecurityCurrent object. + CORBA::Object_var obj = + orb->resolve_initial_references ("SecurityCurrent" ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + /// Narrow it down correctly. + SecurityLevel1::Current_var current = + SecurityLevel1::Current::_narrow (obj.in ()); + + /// Check for nil reference. + if (CORBA::is_nil (current.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the SecurityCurrent object\n"), + 1); + + Security::AttributeType desired_attribute_1; + + /// @@ Need to check more abt this variable + desired_attribute.attribute_family.family_definer = 0; + + /// Implies Privilege Attributes + desired_attribute.attribute_family.family = 1; + + /// AccessId: the identity of the principal used for access + /// control + desired_attribute.attibute_type = 2; + + // Second desired attribute + Security::AttributeType desired_attribute_2; + + /// @@ Need to check more abt this variable + desired_attribute.attribute_family.family_definer = 0; + + /// Implies Privilege Attributes. + desired_attribute.attribute_family.family = 1; + + /// Primary Group ID. + /// @@ I am not sure if Ossama will have all these attribute types + /// If it is not the same, one might have to change the comments + /// to show the attribute_type that is checked and change the + /// number accordingly. + desired_attribute.attibute_type = 3; + + /// Define the AttributeTypeList + Security::AttributeTypeList attribute_type_list; + attribute_type_list.length (2); + attribute_type_list[0] = &desired_attribute_1; + attribute_type_list[1] = &desired_attribute_2; + + /// Get the desired security attributes + Security::AttributeList_var attribute_list = + current->get_attributes (attribute_type_list); + + /* @@ What did we do till now ?? + * We set attribute_type_list so that we get the values of + * the variables we are interested in. Depending on how Ossama + * implements, the valid values of family_definer, family and the + * attribute type and its values all change .. but the process is + * similar. + * The type which is returned from the get_attribute method is a + * sequence of the AttributeList struct. This struct has three + * members: the attribute type, the defining_authority and the + * value of the attribute type. + * + * @@ What should we do now ?? + * Compare the returned values with the values we, as in the + * server, decided and check if they are the same. + + * Once we retrieve this sequence, we can invoke a method which + * has a generic list of attribute_types and corresponding values + * which are valid to authorize access to the requested + * invocation. Or complete this stuff with a single if condition + * make things easier. + * + */ + + if ((attribute_type == 1) && (attribute_value == 10)) + { + // Lets say, this is the valid case. + authorize_1 = 0; + } + + /// If the owner of this invocation is authorized to invoke this + /// method, return 0 else return 1. + if (authorize_1 == 0) + return 0; + else + return 1; +} + + +CORBA::Boolean +SLevel1_Server_i::authorize_level2 (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + /// If the owner of this invocation is authorized to invoke this + /// method, return 0 else return 1. + if (authorize_2 == 0) + return 0; + else + return 1; +} diff --git a/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test_i.h b/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test_i.h new file mode 100644 index 00000000000..d284e65c293 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/SecurityLevel1/SLevel1_Test_i.h @@ -0,0 +1,39 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// orbsvcs/examples/Security/SecurityLevel1 +// +// = FILENAME +// SLevel1_Test_i.h +// +// = AUTHOR +// Priyanka Gontla <gontla_p@ociweb.com> +// +// ============================================================================ + +#ifndef TAO_SLEVEL1_TEST_I_H +#define TAO_SLEVEL1_TEST_I_H + +#include "SLevel1_TestS.h" + +class SLevel1_Server_i : public POA_SLevel1_Server +{ + public: + /// Constructor + SLevel1_Server_i (); + + /// + CORBA::Boolean authorize_level1 (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + CORBA::Boolean authorize_level2 (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + static int authorized_1; + static int authorized_2; + +}; + +#endif /* TAO_SLEVEL1_TEST_I_H */ diff --git a/TAO/orbsvcs/examples/Security/SecurityLevel1/client.cpp b/TAO/orbsvcs/examples/Security/SecurityLevel1/client.cpp new file mode 100644 index 00000000000..b7779c65615 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/SecurityLevel1/client.cpp @@ -0,0 +1,89 @@ +// $Id$ + +#include "SLevel1_TestC.h" + +ACE_RCSID (SecurityLevel1, client, "$Id$") + +const char *ior = "file://test.ior"; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv []) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var object = + orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + SLevel1_Server_var server = + SLevel1_Server::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (server.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Object reference <%s> is nil\n", + ior), + 1); + } + + CORBA::Boolean authorized = + server->authorize_level1 (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (authorized == 0) + ACE_DEBUG ((LM_DEBUG, + "AUTHORIZED\n")); + else if (authorized == 1) + ACE_DEBUG ((LM_DEBUG, + "DENIED: You Do NOT have enough privileges\n")); + + server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Caught exception:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} + diff --git a/TAO/orbsvcs/examples/Security/SecurityLevel1/server.cpp b/TAO/orbsvcs/examples/Security/SecurityLevel1/server.cpp new file mode 100644 index 00000000000..2b39bda82e3 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/SecurityLevel1/server.cpp @@ -0,0 +1,75 @@ +// $Id$ + +#include "SLevel1_Test_i.h" + +ACE_RCSID (SecurityLevel1, + server, + "$Id$") + +const char *ior_output_file = 0; + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + /// Our regular ORB Initialization. + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + /// Get a reference to the RootPOA. + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + 1); + + /// Narrow down the reference to the currect interface. + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + SLevel1_Server_i level1_server (); + + SLevel1_Server_var server = + level1_server._this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (server.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // If the ior_output_file exists, output the ior to it + if (ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + } + + // Start the ORB + orb->run (); + + root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + } + ACE_CATCH (CORBA::SytemException, ex) + { + ACE_DEBUG ((LM_DEBUG, + "System Exception raised: %s", ex)); + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/orbsvcs/examples/Security/Send_File/Makefile.am b/TAO/orbsvcs/examples/Security/Send_File/Makefile.am new file mode 100644 index 00000000000..c65c9708777 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/Makefile.am @@ -0,0 +1,100 @@ +## Process this file with automake to create Makefile.in +## +## $Id$ +## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## ../bin/mwc.pl -type automake -noreldefs TAO.mwc + +ACE_BUILDDIR = $(top_builddir)/.. +ACE_ROOT = $(top_srcdir)/.. +TAO_BUILDDIR = $(top_builddir) +TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl +TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl +TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf +TAO_ROOT = $(top_srcdir) + +## Makefile.Security_Send_File_Idl.am + +BUILT_SOURCES = \ + testC.cpp \ + testC.h \ + testC.inl \ + testS.cpp \ + testS.h \ + testS.inl + +CLEANFILES = \ + test-stamp \ + testC.cpp \ + testC.h \ + testC.inl \ + testS.cpp \ + testS.h \ + testS.inl + +testC.cpp testC.h testC.inl testS.cpp testS.h testS.inl: test-stamp + +test-stamp: $(srcdir)/test.idl $(TAO_IDL_DEP) + $(TAO_IDL) $(TAO_IDLFLAGS) -Sa -St $(srcdir)/test.idl + @touch $@ + + +noinst_HEADERS = \ + test.idl + +## Makefile.Security_Send_File_Client.am + +noinst_PROGRAMS = client + +client_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) + +client_SOURCES = \ + client.cpp \ + testC.cpp \ + test_i.h \ + test_i.i + +client_LDADD = \ + $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ + $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ + $(TAO_BUILDDIR)/tao/libTAO.la \ + $(ACE_BUILDDIR)/ace/libACE.la + +## Makefile.Security_Send_File_Server.am + +noinst_PROGRAMS += server + +server_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) + +server_SOURCES = \ + server.cpp \ + testC.cpp \ + testS.cpp \ + test_i.cpp \ + test_i.h \ + test_i.i + +server_LDADD = \ + $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ + $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ + $(TAO_BUILDDIR)/tao/libTAO.la \ + $(ACE_BUILDDIR)/ace/libACE.la + +## Clean up template repositories, etc. +clean-local: + -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* + -rm -f gcctemp.c gcctemp so_locations *.ics + -rm -rf cxx_repository ptrepository ti_files + -rm -rf templateregistry ir.out + -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/TAO/orbsvcs/examples/Security/Send_File/README b/TAO/orbsvcs/examples/Security/Send_File/README new file mode 100644 index 00000000000..c02ca187f21 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/README @@ -0,0 +1,73 @@ +# $Id$ + +Description: + + This is a simple test for SSLIOP, it sends a file, +line-per-line to the server, using truss we can take a look at the +buffers and verify that they are giberish. + +Expected output: + The server prints out the IOR of the object it serves. Later +it prints all the lines sent by the client. The client shouldn't +print out anything, it returns 0 on success. + +How to run: + +# Setup the environment and add the fake CA to your trusted list: +$ SSL_CERT_FILE=cacert.pem +$ export SSL_CERT_FILE + + Now run the simplest test: + +# Run the server +$ server -ORBSvcConf server_nopasswd.conf -o test.ior + +# Run the client +$ client -ORBSvcConf client_nopasswd.conf -k file://test.ior < myfile + + notice that this test uses unsecure private key files. This +could be appropriate if the keys are kept is a very trusted system, +but usually you will want to use a pass phrase protected key: + +$ server -ORBSvcConf server.conf -o test.ior +$ client -ORBSvcConf client.conf -k file://test.ior < myfile + + In this case both the client and the server ask for the pass +phrase (it is 'test'). + +======= Testing IIOP interoperability + + We also want to verify that the client and server (assuming + "-SSLNoProtection" flag is set in server's `server.conf' file) + can interoperate with regular IIOP servers and clients. + First setup a pure IIOP server: + +$ server -o test.ior +$ client -ORBSvcConf client.conf -k file://test.ior < myfile + + next a pure IIOP client (assuming "-SSLNoProtection" flag is + set in server's `server.conf' file): + +$ server -ORBSvcConf server.conf -o test.ior +$ client -k file://test.ior < myfile + + and finally both are pure IIOP: + +$ server -o test.ior +$ client -k file://test.ior < certificate.pem + +======= Testing failed authentications: + + To test failed server authentications we simply run the client +and server as indicated below, but we enter invalid pass phrases in +the client and/or server. + +$ server -ORBSvcConf server.conf -o test.ior +$ client -ORBSvcConf client.conf -k file://test.ior < myfile + +======= Testing connections without client authentication: + + We run the server and client as follows: + +$ server -ORBSvcConf server_none.conf -o test.ior +$ client -ORBSvcConf client.conf -k file://test.ior < myfile diff --git a/TAO/orbsvcs/examples/Security/Send_File/Security_Send_File.mpc b/TAO/orbsvcs/examples/Security/Send_File/Security_Send_File.mpc new file mode 100644 index 00000000000..7752e40754b --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/Security_Send_File.mpc @@ -0,0 +1,31 @@ +// -*- MPC -*- +// $Id$ + +project(*Idl) : taoidldefaults { + IDL_Files { + test.idl + } + custom_only = 1 +} + +project(*Client) : orbsvcsexe, portableserver { + after += *Idl + source_files { + client.cpp + testC.cpp + } + IDL_Files { + } +} + +project(*Server) : orbsvcsexe, portableserver { + after += *Idl + source_files { + server.cpp + test_i.cpp + testS.cpp + testC.cpp + } + IDL_Files { + } +} diff --git a/TAO/orbsvcs/examples/Security/Send_File/cacert.pem b/TAO/orbsvcs/examples/Security/Send_File/cacert.pem new file mode 100644 index 00000000000..a9e905f4e6c --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/cacert.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDfTCCAuagAwIBAgIBADANBgkqhkiG9w0BAQQFADCBjDELMAkGA1UEBhMCVVMx +CzAJBgNVBAgTAkNBMQ8wDQYDVQQHEwZJcnZpbmUxEjAQBgNVBAoTCURPQyBHcm91 +cDEQMA4GA1UECxYHVUNJX0RPQzERMA8GA1UEAxMIUHJpeWFua2ExJjAkBgkqhkiG +9w0BCQEWF3Bnb250bGFAZG9jLmVjZS51Y2kuZWR1MB4XDTAxMDYxMTE3MjI0MVoX +DTExMDYwOTE3MjI0MVowgYwxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEPMA0G +A1UEBxMGSXJ2aW5lMRIwEAYDVQQKEwlET0MgR3JvdXAxEDAOBgNVBAsWB1VDSV9E +T0MxETAPBgNVBAMTCFByaXlhbmthMSYwJAYJKoZIhvcNAQkBFhdwZ29udGxhQGRv +Yy5lY2UudWNpLmVkdTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyFiCRDUH +nGJqQG9jT/2PhZUAgfwXvIwfDM8m/WujCt/buDcrOz767shBsk4HZhW91Vm4mE03 +K1zfCzojRigf28uyB/rlp60p2Fq0wvZBNNU5Muia6esleR4unb4QslOpcFhct/9n +UPnlnnsZOTaGWaELNKEjYfHqPh8PQ0lYurECAwEAAaOB7DCB6TAdBgNVHQ4EFgQU +0Y6IZjkLbLbtZ5aoKLcfd7Yc/kYwgbkGA1UdIwSBsTCBroAU0Y6IZjkLbLbtZ5ao +KLcfd7Yc/kahgZKkgY8wgYwxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEPMA0G +A1UEBxMGSXJ2aW5lMRIwEAYDVQQKEwlET0MgR3JvdXAxEDAOBgNVBAsWB1VDSV9E +T0MxETAPBgNVBAMTCFByaXlhbmthMSYwJAYJKoZIhvcNAQkBFhdwZ29udGxhQGRv +Yy5lY2UudWNpLmVkdYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4GB +AHYi8ulIzUI3p3+Ma16rumZxvKcmkJJbU6fpAv4ZvK6AWyy+6Ja0GD5N3SGEx+xU +nMffTR+LePa9PAZiR7dNkF6ikPxXZu4jn8KY2zFT3SB/VjCoEetR9i9QI//O0Fea +3yZ0NygNWe5cyVDLCb4meucJpsClfyL28DWzMwD2liX3 +-----END CERTIFICATE----- diff --git a/TAO/orbsvcs/examples/Security/Send_File/client.conf b/TAO/orbsvcs/examples/Security/Send_File/client.conf new file mode 100644 index 00000000000..5847fa22a03 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/client.conf @@ -0,0 +1,4 @@ +# $Id$ + +dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:client_key.pem -SSLCertificate PEM:client_cert.pem" +static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/orbsvcs/examples/Security/Send_File/client.conf.xml b/TAO/orbsvcs/examples/Security/Send_File/client.conf.xml new file mode 100644 index 00000000000..957235c7149 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/client.conf.xml @@ -0,0 +1,9 @@ +<?xml version='1.0'?> +<!-- Converted from ./orbsvcs/examples/Security/Send_File/client.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <!-- $Id$ --> + <dynamic id="SSLIOP_Factory" type="Service_Object"> + <initializer path="TAO_SSLIOP" init="_make_TAO_SSLIOP_Protocol_Factory" params="-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:client_key.pem -SSLCertificate PEM:client_cert.pem"/> + </dynamic> + <static id="Resource_Factory" params="-ORBProtocolFactory SSLIOP_Factory"/> +</ACE_Svc_Conf> diff --git a/TAO/orbsvcs/examples/Security/Send_File/client.cpp b/TAO/orbsvcs/examples/Security/Send_File/client.cpp new file mode 100644 index 00000000000..507bdde5847 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/client.cpp @@ -0,0 +1,90 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/Read_Buffer.h" +#include "testC.h" + +ACE_RCSID(Send_File, client, "$Id$") + +const char *ior = "file://test.ior"; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var object = + orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Simple_Server_var server = + Simple_Server::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (server.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Object reference <%s> is nil\n", + ior), + 1); + } + + while (!feof (stdin)) + { + ACE_Read_Buffer buf (stdin, 0); + char *line = buf.read ('\n'); + if (line == 0) + break; + server->send_line (line ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + buf.alloc ()->free (line); + } + + server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Caught exception:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/orbsvcs/examples/Security/Send_File/client_cert.pem b/TAO/orbsvcs/examples/Security/Send_File/client_cert.pem new file mode 100644 index 00000000000..0bebb696cfc --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/client_cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICgzCCAewCAQYwDQYJKoZIhvcNAQEEBQAwgYwxCzAJBgNVBAYTAlVTMQswCQYD +VQQIEwJDQTEPMA0GA1UEBxMGSXJ2aW5lMRIwEAYDVQQKEwlET0MgR3JvdXAxEDAO +BgNVBAsWB1VDSV9ET0MxETAPBgNVBAMTCFByaXlhbmthMSYwJAYJKoZIhvcNAQkB +FhdwZ29udGxhQGRvYy5lY2UudWNpLmVkdTAeFw0wMTA2MTExODEwMzRaFw0xMTA2 +MDkxODEwMzRaMIGGMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExDzANBgNVBAcT +BklydmluZTEQMA4GA1UEChMHVEFPK09DSTEMMAoGA1UECxMDT0NJMREwDwYDVQQD +EwhQcml5YW5rYTEmMCQGCSqGSIb3DQEJARYXcGdvbnRsYUBkb2MuZWNlLnVjaS5l +ZHUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL6f8pBX7Mi3FPY/OYBOq+kb +wQ3WX0Z8+nDxd7AiWDAx2AL5EaX8xnUiRi96OJ+CYPCYOUlavGVzZkRVMFdOuHAn +RvY2sCpvU2rkKpEx9Pd50l7FLnXJuflnRc6zIEKOvuQcPJvsP4AaxaFxTnZExXQJ +kDEiQP3mGID/eXtUzywbAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAuvSoOnMB6sxj +ft9YbdLeyATTPzHbxAb6zQo72DUmM3roNowUrefHymU8jZoC6HeaROeKCU0MkVes +l/jYlz/OwSYkbyGNIUkq4DHEWKzXEg8M603fsWK6IK3T5iPBHY+l/mYSEHJPfypZ +fl/y4YSNJZlrz6kCIHTcwfHXDRC1mjM= +-----END CERTIFICATE----- diff --git a/TAO/orbsvcs/examples/Security/Send_File/client_key.pem b/TAO/orbsvcs/examples/Security/Send_File/client_key.pem new file mode 100644 index 00000000000..1428b501712 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/client_key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQC+n/KQV+zItxT2PzmATqvpG8EN1l9GfPpw8XewIlgwMdgC+RGl +/MZ1IkYvejifgmDwmDlJWrxlc2ZEVTBXTrhwJ0b2NrAqb1Nq5CqRMfT3edJexS51 +ybn5Z0XOsyBCjr7kHDyb7D+AGsWhcU52RMV0CZAxIkD95hiA/3l7VM8sGwIDAQAB +AoGABGaa6fwtqkCXykuRX0XxsBME9PXTA0SVX5AjjDxuvsYXz5HCd4uLZV7iMexn +bD9NT6CkCe5/VPRCEyfIUuutVFc7lkPwuRw5FvNcf4gMH9ltufQfH/KeR7d2Jvge +zrTOH7nicshy67mfOEOaoDphWoT9uy+7ayym+EsJLJU37VkCQQD6xLRu5r9tKX2/ +NfIQsGxF3TZyXgxcuxMh9JOq5E9nBwhr1JaXDbXktXfIK/F3XWHLFS8CIg6PhgGY +i/+UtGzvAkEAwpoHp89U2jLdVRoIcwy5o7Ocwk3HCXem3UgFWXzzunGM1x+ozDFA +uo5nyXiAO6Buka9C2czje275kE18BbqLlQJBAMJNf/EeYdzXdVOfHPzJdlt72CAt +ty5y1ZRNyc10MgIGdQP4KObJ/NJFuZYkVmjCtm+A7neco+OZVcs5TsOOOYkCQBHQ +6EKEyM/xODJCX+OolpZWK1PeqwpC2hQIM/Uta2L2Yl6Pl3SaTcLGptnbHmJXHchY +s1YdW/ZBArgjX+dmXMECQApTKWbVLmNsEoOlHU/I/KhGsfuojrzBMMe3FKLiHpmu +u86L3vu3OGZFcPgjazxWZcip8JekeJ7c+6suLNNRQ5I= +-----END RSA PRIVATE KEY----- diff --git a/TAO/orbsvcs/examples/Security/Send_File/client_key_nopasswd.pem b/TAO/orbsvcs/examples/Security/Send_File/client_key_nopasswd.pem new file mode 100644 index 00000000000..35e449a2493 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/client_key_nopasswd.pem @@ -0,0 +1,16 @@ +RSA key ok +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDBuQXJQhW75XZJfatysGHE3/RXFeMSB8TOk/geXhlUAQTaHj/0 ++eQLNnz2ed8XFoyZFJYioUrcAHyC3LGv7CemhPAW0ZEBgXG8QX1eG8T+NlPh5pC8 +pMg8R67aVr/Rs3jvXsh7lI5rqCQ6Mr1fCg6qVdnJyH04gKKv4b0Iu29FDQIDAQAB +AoGADRU7yM3HvfrPNENicspqr+sYC1GVFkCkD/d6SEK+nye6diiY1SiTOBaj9dlh +MaP6NtRnF0uhTJ5TylqxPVpLixs6Dot/lX0Mu/bD80Zez1bWdQFivszOcDnxylHX +j4z3Sv5nSPWoOgssDVxWNpI9QHcC2E7zII094drJEG/UZIECQQDy0axJBAahSgMX +9CfpWJjXEMKD58RwddbiS2tGboLzdYXUVaE1qr4GN70jypGC4HmWZ6XV5HX4+fy3 +QltXF3GdAkEAzD0VpmOCan7jLty6+qklEwpyzMDJ9VH9QwfMyS5oSO4Dh08lC6WT +Ss+nQlXFwFYszKxd6kznEECGPlKybiC+MQJBANFdsKuUaRMQ+fHhd7hfyAlITi/l +2x8MvCeK2Ah2qTq6jpYy7zmS6x35WYBO3YB3hN8Gp5rxzjbLdfedo5xIfpECQGkk +ASM5EwhT7gxP4YnszYMx28uAa/d4j9KUD156H4F71iEwIzgNsvfOUqKZmUXclw9+ +pJJbqI/7R6CJ3gVHoeECQGpfgurJz2V5Z2/qsZIDJXgxFoW6vY9rZbZU80ZYx3Cb +RINCjB0G0ThsqH7FqCC3PAkEt0xThXqT2SM8ezVlENM= +-----END RSA PRIVATE KEY----- diff --git a/TAO/orbsvcs/examples/Security/Send_File/client_nopasswd.conf b/TAO/orbsvcs/examples/Security/Send_File/client_nopasswd.conf new file mode 100644 index 00000000000..b351c69d88a --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/client_nopasswd.conf @@ -0,0 +1,4 @@ +# $Id$ + +dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate NONE -SSLPrivateKey PEM:client_key.pem -SSLCertificate PEM:client_cert.pem" +static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/orbsvcs/examples/Security/Send_File/client_nopasswd.conf.xml b/TAO/orbsvcs/examples/Security/Send_File/client_nopasswd.conf.xml new file mode 100644 index 00000000000..a008b48bff7 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/client_nopasswd.conf.xml @@ -0,0 +1,9 @@ +<?xml version='1.0'?> +<!-- Converted from ./orbsvcs/examples/Security/Send_File/client_nopasswd.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <!-- $Id$ --> + <dynamic id="SSLIOP_Factory" type="Service_Object"> + <initializer path="TAO_SSLIOP" init="_make_TAO_SSLIOP_Protocol_Factory" params="-SSLAuthenticate NONE -SSLPrivateKey PEM:client_key.pem -SSLCertificate PEM:client_cert.pem"/> + </dynamic> + <static id="Resource_Factory" params="-ORBProtocolFactory SSLIOP_Factory"/> +</ACE_Svc_Conf> diff --git a/TAO/orbsvcs/examples/Security/Send_File/run_test.pl b/TAO/orbsvcs/examples/Security/Send_File/run_test.pl new file mode 100755 index 00000000000..b7b2ed47fea --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/run_test.pl @@ -0,0 +1,52 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use Env (ACE_ROOT); + +unshift @INC, "$ACE_ROOT/bin"; +require ACEutils; + +$status = 0; + +# Set the SSL environment +$ENV{'SSL_CERT_FILE'} = 'cacert.pem'; + +$iorfile = "server.ior"; +unlink $iorfile; +$SV = Process::Create ($EXEPREFIX."server$EXE_EXT ", + " -ORBSvcConf server_nopasswd" . + "$PerlACE::svcconf_ext " . + " -o $iorfile"); + +if (ACE::waitforfile_timed ($iorfile, 5) == -1) { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ", + " -ORBSvcConf client_nopasswd" . + "$PerlACE::svcconf_ext " . + " -k file://$iorfile < client.cpp"); + +$client = $CL->TimedWait (60); +if ($client == -1) { + print STDERR "ERROR: client timedout\n"; + $CL->Kill (); $CL->TimedWait (1); + $status = 1; +} + +$server = $SV->TimedWait (15); +if ($server == -1) { + print STDERR "ERROR: server timedout\n"; + $SV->Kill (); $SV->TimedWait (1); + $status = 1; +} + +unlink $iorfile; + +exit $status; diff --git a/TAO/orbsvcs/examples/Security/Send_File/server.conf b/TAO/orbsvcs/examples/Security/Send_File/server.conf new file mode 100644 index 00000000000..e178933feb9 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server.conf @@ -0,0 +1,4 @@ +# $Id$ + +dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:server_key.pem -SSLCertificate PEM:server_cert.pem -SSLNoProtection" +static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/orbsvcs/examples/Security/Send_File/server.conf.xml b/TAO/orbsvcs/examples/Security/Send_File/server.conf.xml new file mode 100644 index 00000000000..ffcee284699 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server.conf.xml @@ -0,0 +1,9 @@ +<?xml version='1.0'?> +<!-- Converted from ./orbsvcs/examples/Security/Send_File/server.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <!-- $Id$ --> + <dynamic id="SSLIOP_Factory" type="Service_Object"> + <initializer path="TAO_SSLIOP" init="_make_TAO_SSLIOP_Protocol_Factory" params="-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:server_key.pem -SSLCertificate PEM:server_cert.pem"/> + </dynamic> + <static id="Resource_Factory" params="-ORBProtocolFactory SSLIOP_Factory"/> +</ACE_Svc_Conf> diff --git a/TAO/orbsvcs/examples/Security/Send_File/server.cpp b/TAO/orbsvcs/examples/Security/Send_File/server.cpp new file mode 100644 index 00000000000..97a4beace1c --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server.cpp @@ -0,0 +1,113 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "test_i.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_unistd.h" + +ACE_RCSID(Send_File, server, "$Id$") + +const char *ior_output_file = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "o:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + 1); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + Simple_Server_i server_impl (orb.in ()); + + Simple_Server_var server = + server_impl._this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); + + // If the ior_output_file exists, output the ior to it + if (ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + } + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); + + root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_OS::sleep (5); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Caught exception:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/orbsvcs/examples/Security/Send_File/server_cert.pem b/TAO/orbsvcs/examples/Security/Send_File/server_cert.pem new file mode 100644 index 00000000000..0fc394c24d7 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server_cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICgzCCAewCAQMwDQYJKoZIhvcNAQEEBQAwgYwxCzAJBgNVBAYTAlVTMQswCQYD +VQQIEwJDQTEPMA0GA1UEBxMGSXJ2aW5lMRIwEAYDVQQKEwlET0MgR3JvdXAxEDAO +BgNVBAsWB1VDSV9ET0MxETAPBgNVBAMTCFByaXlhbmthMSYwJAYJKoZIhvcNAQkB +FhdwZ29udGxhQGRvYy5lY2UudWNpLmVkdTAeFw0wMTA2MTExNzQ4NTVaFw0xMTA2 +MDkxNzQ4NTVaMIGGMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExDzANBgNVBAcT +BklydmluZTEMMAoGA1UEChMDT0NJMRAwDgYDVQQLEwdUQU8rT0NJMREwDwYDVQQD +EwhQcml5YW5rYTEmMCQGCSqGSIb3DQEJARYXcGdvbnRsYUBkb2MuZWNlLnVjaS5l +ZHUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANKXmudWiLVu/zdBlSr0/dlr +pRe+Ie26cPyMo5lKiYNY77tABTiOXe5qLUEryjQ/fZ74gmBe4AYFwb7nu/f58X4A +0tzSg2M4spWM7N4tzf+YbcUipRt9sEISxwfUxNNWTKnLxvCmkzOsISisukdzTkqJ +fdzEcPfhO2BZKOdmlg1hAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAjUl3ami01tPY +P1vMp2642dsIKLZis0TmeWp6HNpm52TbiGZOCqDrvtSQ9+2vGz0BkHvGqWKtD+wv +zJH23fNnqFuzy1C1xtjoeqhXECTsWVTVdoEox8hSWxPiYRE2dioraZQQ5ENDosh+ +V9YcqJJpnKDUOSGVGuyaU7DpR8yK0pc= +-----END CERTIFICATE----- diff --git a/TAO/orbsvcs/examples/Security/Send_File/server_key.pem b/TAO/orbsvcs/examples/Security/Send_File/server_key.pem new file mode 100644 index 00000000000..567a41da6dc --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server_key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDSl5rnVoi1bv83QZUq9P3Za6UXviHtunD8jKOZSomDWO+7QAU4 +jl3uai1BK8o0P32e+IJgXuAGBcG+57v3+fF+ANLc0oNjOLKVjOzeLc3/mG3FIqUb +fbBCEscH1MTTVkypy8bwppMzrCEorLpHc05KiX3cxHD34TtgWSjnZpYNYQIDAQAB +AoGAC/TxpZrjLjH8KZ3+oy6/zv1upTd1Y7MHQT+W9lgmEKAXFHGhGkHzEVtT8HRV +CbxlHIaNmH0qiQ0AoB82K/E0BdIMvE+y2qQwlpMfBMX6/TACORReJN3NXGsXwHP4 +/pNlS4LX7/NZbxlReAlDNP+FO8sdKZTyM3VXHFWJbmm4wsECQQD06zQ4uthp0zI9 +WTZiiAUgYwOcnLnXwfWOLAr8RCnYgwiS7MBCcmhZAgWX5SZJYVCwEJ12DAHy02NJ +EhiSgo+JAkEA3B7PcS5FqZFi6wVjEG6yF8OuSb/rl+FZfV6utZdCVdMPxacEVxlD +q7H/dk23O4WwASBriU0PR9/KG3T/LvKBGQJAaYRn1EUTdcxKqcmkt6CYbNKbvL59 +BqqGq4DoHrUTPjd92ybq0fXOZQKM/Fr6OsUVaTVPUYtsz3wpG1MTiRN82QJACX6+ +vggb8yuVU8QAuPW9cu769q1zsTKEVLcf3C9xKhiXppQEyOkLFT3xYh4KGGQ06meG +m/6Z+SS7KCIM2+6UCQJBANHIzgxDWtrLuWJviNh9EbCsdMioxBH+LGaqFKLC70xD +Pyoqn+QJQu/ekT+FUb0BeFJfGPzFjh1mFYn4tXxWqMs= +-----END RSA PRIVATE KEY----- diff --git a/TAO/orbsvcs/examples/Security/Send_File/server_key_nopasswd.pem b/TAO/orbsvcs/examples/Security/Send_File/server_key_nopasswd.pem new file mode 100644 index 00000000000..2381bdcc6df --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server_key_nopasswd.pem @@ -0,0 +1,16 @@ +RSA key ok +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDOtfLxhcWktrjY/U9Mdsy9WaUeqFZGWkz2gknKMNrfJnKAdmuU +RaP2G9X565FhgyrEpb5bYJUC3aTLhdr5NsDFt3V1hhs9rev6WSeONmiAlOrUrKCB +cpF3K0HyU4bVp06/FgtWFUp8ja88B8zLhwak6KAGYBUQZXVtMsaJliYLNQIDAQAB +AoGAXIqghPg6j48uGhbtlXHqHysu/Ran6T8sDYAuwNI2aoiv4kshxnOW/+teVFDd ++SXb08XP/uCyVWIdEPCQI9obWppALzQhF5kALhchnlEATkVxkdx6T5PyGnFq5rpc +NCfb3Q68T5bcFvsgup9Lt8JpGBQGvjYJZYkJuMvWmH6Bc9ECQQD4TwB+p5MjRALX +lcMI8pURt6CKxpWLyFUUkQi6HksXzxeh4PDErLxsyFexKec7TOap5xnWZMPkjl76 +BdW65abrAkEA1R0XSCfu3B4LnX4zlDi+nUXG8YvquuZ21TRrNg3YmVcyF+jvkM1f +4MGRPRF3hnTuZhnlD+wEubpmpcoNnNTOXwJBAIfZOQ0SAzblC6UE42puxU2nJ+ck +1EZgeOPCoYKp9i11eJlw5mjDlGbziL59jWttHDlSHVmlUWMm3SFutcsFv7cCQQCK +i+UM5dklhOrsMpV5sQJK4IgblGi/pQBwTym79HhyB/vrC2ZjbwD77xtq5iYcZXxv +KDqAhWH1FLeS5K7A3KBlAkEAqwIhKyV1kK0EtvpNMprfIGNccRjNX8TJEQsN49EE +luhKkAam4CoA1R2wZc0VHfWqilK0qhrezXxlo4OeElxiRg== +-----END RSA PRIVATE KEY----- diff --git a/TAO/orbsvcs/examples/Security/Send_File/server_none.conf b/TAO/orbsvcs/examples/Security/Send_File/server_none.conf new file mode 100644 index 00000000000..e445c19615f --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server_none.conf @@ -0,0 +1,4 @@ +# $Id$ + +dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate NONE -SSLPrivateKey PEM:server_key.pem -SSLCertificate PEM:server_cert.pem" +static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/orbsvcs/examples/Security/Send_File/server_none.conf.xml b/TAO/orbsvcs/examples/Security/Send_File/server_none.conf.xml new file mode 100644 index 00000000000..bb29d1e558d --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server_none.conf.xml @@ -0,0 +1,9 @@ +<?xml version='1.0'?> +<!-- Converted from ./orbsvcs/examples/Security/Send_File/server_none.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <!-- $Id$ --> + <dynamic id="SSLIOP_Factory" type="Service_Object"> + <initializer path="TAO_SSLIOP" init="_make_TAO_SSLIOP_Protocol_Factory" params="-SSLAuthenticate NONE -SSLPrivateKey PEM:server_key.pem -SSLCertificate PEM:server_cert.pem"/> + </dynamic> + <static id="Resource_Factory" params="-ORBProtocolFactory SSLIOP_Factory"/> +</ACE_Svc_Conf> diff --git a/TAO/orbsvcs/examples/Security/Send_File/server_nopasswd.conf b/TAO/orbsvcs/examples/Security/Send_File/server_nopasswd.conf new file mode 100644 index 00000000000..e445c19615f --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server_nopasswd.conf @@ -0,0 +1,4 @@ +# $Id$ + +dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate NONE -SSLPrivateKey PEM:server_key.pem -SSLCertificate PEM:server_cert.pem" +static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory" diff --git a/TAO/orbsvcs/examples/Security/Send_File/server_nopasswd.conf.xml b/TAO/orbsvcs/examples/Security/Send_File/server_nopasswd.conf.xml new file mode 100644 index 00000000000..9e391e67290 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/server_nopasswd.conf.xml @@ -0,0 +1,9 @@ +<?xml version='1.0'?> +<!-- Converted from ./orbsvcs/examples/Security/Send_File/server_nopasswd.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <!-- $Id$ --> + <dynamic id="SSLIOP_Factory" type="Service_Object"> + <initializer path="TAO_SSLIOP" init="_make_TAO_SSLIOP_Protocol_Factory" params="-SSLAuthenticate NONE -SSLPrivateKey PEM:server_key.pem -SSLCertificate PEM:server_cert.pem"/> + </dynamic> + <static id="Resource_Factory" params="-ORBProtocolFactory SSLIOP_Factory"/> +</ACE_Svc_Conf> diff --git a/TAO/orbsvcs/examples/Security/Send_File/test.idl b/TAO/orbsvcs/examples/Security/Send_File/test.idl new file mode 100644 index 00000000000..a62d8becc91 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/test.idl @@ -0,0 +1,10 @@ +/* + * $Id$ + */ + +interface Simple_Server +{ + void send_line (in string line); + + oneway void shutdown (); +}; diff --git a/TAO/orbsvcs/examples/Security/Send_File/test_i.cpp b/TAO/orbsvcs/examples/Security/Send_File/test_i.cpp new file mode 100644 index 00000000000..62d1ff2e04a --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/test_i.cpp @@ -0,0 +1,24 @@ +// $Id$ + +#include "test_i.h" + +#if !defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(Send_File, test_i, "$Id$") + +void +Simple_Server_i::send_line (const char *line + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, "%s\n", line)); +} + +void +Simple_Server_i::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (0); +} diff --git a/TAO/orbsvcs/examples/Security/Send_File/test_i.h b/TAO/orbsvcs/examples/Security/Send_File/test_i.h new file mode 100644 index 00000000000..10b18e60116 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/test_i.h @@ -0,0 +1,49 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/Send_File +// +// = FILENAME +// test_i.h +// +// = AUTHOR +// Carlos O'Ryan +// +// ============================================================================ + +#ifndef TAO_SEND_FILE_TEST_I_H +#define TAO_SEND_FILE_TEST_I_H + +#include "testS.h" + +class Simple_Server_i : public POA_Simple_Server +{ + // = TITLE + // Simpler Server implementation + // + // = DESCRIPTION + // Implements the Simple_Server interface in test.idl + // +public: + Simple_Server_i (CORBA::ORB_ptr orb); + // ctor + + // = The Simple_Server methods. + void send_line (const char *line + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + CORBA::ORB_var orb_; +}; + +#if defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_SEND_FILE_TEST_I_H */ diff --git a/TAO/orbsvcs/examples/Security/Send_File/test_i.i b/TAO/orbsvcs/examples/Security/Send_File/test_i.i new file mode 100644 index 00000000000..97524552ff4 --- /dev/null +++ b/TAO/orbsvcs/examples/Security/Send_File/test_i.i @@ -0,0 +1,7 @@ +// $Id$ + +ACE_INLINE +Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} |