From: Andreas Steffen Date: Tue, 9 Aug 2011 19:09:37 +0000 (+0200) Subject: getting rid of axis2.html configuration X-Git-Tag: 4.6.0~577 X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=commitdiff_plain;h=dcae107b5a85e5a6dd0b925b807c22f4cbd95851 getting rid of axis2.html configuration --- diff --git a/src/libcharon/plugins/tnc_ifmap/Makefile.am b/src/libcharon/plugins/tnc_ifmap/Makefile.am index 50c312e..b8a57b1 100644 --- a/src/libcharon/plugins/tnc_ifmap/Makefile.am +++ b/src/libcharon/plugins/tnc_ifmap/Makefile.am @@ -4,7 +4,7 @@ INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libhydra \ AM_CFLAGS = -rdynamic -libstrongswan_tnc_ifmap_la_LIBADD = ${axis2c_LIBS} -laxutil -laxis2_engine +libstrongswan_tnc_ifmap_la_LIBADD = ${axis2c_LIBS} -laxutil -laxis2_engine -laxis2_http_sender if MONOLITHIC noinst_LTLIBRARIES = libstrongswan-tnc-ifmap.la diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c index d9b20df..1801b43 100644 --- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c +++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c @@ -19,6 +19,8 @@ #include #include +#include +#include #include #define IFMAP_NS "http://www.trustedcomputinggroup.org/2010/IFMAP/2" @@ -525,15 +527,15 @@ METHOD(tnc_ifmap_soap_t, destroy, void, free(this); } -/** - * See header - */ -tnc_ifmap_soap_t *tnc_ifmap_soap_create() +static bool axis2c_init(private_tnc_ifmap_soap_t *this) { - private_tnc_ifmap_soap_t *this; axis2_char_t *server, *client_home, *username, *password, *auth_type; axis2_endpoint_ref_t* endpoint_ref = NULL; axis2_options_t *options = NULL; + axis2_transport_in_desc_t *transport_in; + axis2_transport_out_desc_t *transport_out; + axis2_transport_sender_t *transport_sender; + axutil_property_t* property; client_home = lib->settings->get_str(lib->settings, "charon.plugins.tnc-ifmap.client_home", @@ -553,27 +555,34 @@ tnc_ifmap_soap_t *tnc_ifmap_soap_create() (!username) ? "username" : "", (!username && ! password) ? " and " : "", (!password) ? "password" : ""); - return NULL; + return FALSE; } - INIT(this, - .public = { - .newSession = _newSession, - .purgePublisher = _purgePublisher, - .publish_ike_sa = _publish_ike_sa, - .publish_device_ip = _publish_device_ip, - .endSession = _endSession, - .destroy = _destroy, - }, - ); - /* Create Axis2/C environment and options */ this->env = axutil_env_create_all(IFMAP_LOGFILE, AXIS2_LOG_LEVEL_TRACE); - options = axis2_options_create(this->env); + options = axis2_options_create(this->env); + + /* Path to the MAP server certificate */ + property =axutil_property_create_with_args(this->env, + 0, 0, 0, "/home/andi/axis2c/irond.pem"); - /* Define the IF-MAP server as the to endpoint reference */ + /* Define the MAP server as the to endpoint reference */ endpoint_ref = axis2_endpoint_ref_create(this->env, server); + + /* Set up https transport */ + axis2_options_set_http_auth_info(options, this->env, username, password, + auth_type); + transport_in = axis2_transport_in_desc_create(this->env, + AXIS2_TRANSPORT_ENUM_HTTPS); + transport_out = axis2_transport_out_desc_create(this->env, + AXIS2_TRANSPORT_ENUM_HTTPS); + transport_sender = axis2_http_transport_sender_create(this->env); + axis2_transport_out_desc_set_sender(transport_out, this->env, + transport_sender); + axis2_options_set_transport_in(options, this->env, transport_in); + axis2_options_set_transport_out(options, this->env, transport_out); axis2_options_set_to(options, this->env, endpoint_ref); + axis2_options_set_property(options, this->env, AXIS2_SSL_SERVER_CERT, property); /* Create the axis2 service client */ this->svc_client = axis2_svc_client_create(this->env, client_home); @@ -585,14 +594,39 @@ tnc_ifmap_soap_t *tnc_ifmap_soap_create() this->env->error->error_number, AXIS2_ERROR_GET_MESSAGE(this->env->error)); destroy(this); - return NULL; + return FALSE; } axis2_svc_client_set_options(this->svc_client, this->env, options); - axis2_options_set_http_auth_info(options, this->env, username, password, - auth_type); DBG1(DBG_TNC, "connecting as MAP client '%s' to MAP server at '%s'", - username, server); + username, server); + + return TRUE; +} + +/** + * See header + */ +tnc_ifmap_soap_t *tnc_ifmap_soap_create() +{ + private_tnc_ifmap_soap_t *this; + + INIT(this, + .public = { + .newSession = _newSession, + .purgePublisher = _purgePublisher, + .publish_ike_sa = _publish_ike_sa, + .publish_device_ip = _publish_device_ip, + .endSession = _endSession, + .destroy = _destroy, + }, + ); + + if (!axis2c_init(this)) + { + destroy(this); + return NULL; + } return &this->public; } diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.h b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.h index 833a748..820e1d1 100644 --- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.h +++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.h @@ -55,8 +55,7 @@ struct tnc_ifmap_soap_t { * @param up TRUE if IKE_SEA is up, FALSE if down * @return TRUE if command was successful */ - - bool (*publish_ike_sa)(tnc_ifmap_soap_t *this, u_int32_t ike_sa_id, + bool (*publish_ike_sa)(tnc_ifmap_soap_t *this, u_int32_t ike_sa_id, identification_t *id, bool is_user, host_t *host, bool up); @@ -66,7 +65,6 @@ struct tnc_ifmap_soap_t { * @param host IP address of local endpoint * @return TRUE if command was successful */ - bool (*publish_device_ip)(tnc_ifmap_soap_t *this, host_t *host); /**