summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/tnc_ifmap
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-01-02 14:18:20 +0100
committerYves-Alexis Perez <corsac@debian.org>2013-01-02 14:18:20 +0100
commitc1343b3278cdf99533b7902744d15969f9d6fdc1 (patch)
treed5ed3dc5677a59260ec41cd39bb284d3e94c91b3 /src/libcharon/plugins/tnc_ifmap
parentb34738ed08c2227300d554b139e2495ca5da97d6 (diff)
downloadvyos-strongswan-c1343b3278cdf99533b7902744d15969f9d6fdc1.tar.gz
vyos-strongswan-c1343b3278cdf99533b7902744d15969f9d6fdc1.zip
Imported Upstream version 5.0.1
Diffstat (limited to 'src/libcharon/plugins/tnc_ifmap')
-rw-r--r--src/libcharon/plugins/tnc_ifmap/Makefile.in14
-rw-r--r--src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c6
-rw-r--r--src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c77
3 files changed, 52 insertions, 45 deletions
diff --git a/src/libcharon/plugins/tnc_ifmap/Makefile.in b/src/libcharon/plugins/tnc_ifmap/Makefile.in
index 54deb7cd7..5ead4379a 100644
--- a/src/libcharon/plugins/tnc_ifmap/Makefile.in
+++ b/src/libcharon/plugins/tnc_ifmap/Makefile.in
@@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -87,7 +88,7 @@ libstrongswan_tnc_ifmap_la_LINK = $(LIBTOOL) --tag=CC \
@MONOLITHIC_FALSE@am_libstrongswan_tnc_ifmap_la_rpath = -rpath \
@MONOLITHIC_FALSE@ $(plugindir)
@MONOLITHIC_TRUE@am_libstrongswan_tnc_ifmap_la_rpath =
-DEFAULT_INCLUDES = -I.@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
@@ -113,6 +114,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BFDLIB = @BFDLIB@
BTLIB = @BTLIB@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@@ -207,11 +209,14 @@ build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
c_plugins = @c_plugins@
+charon_natt_port = @charon_natt_port@
+charon_plugins = @charon_plugins@
+charon_udp_port = @charon_udp_port@
clearsilver_LIBS = @clearsilver_LIBS@
datadir = @datadir@
datarootdir = @datarootdir@
dbusservicedir = @dbusservicedir@
-default_pkcs11 = @default_pkcs11@
+dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
@@ -228,11 +233,12 @@ imcvdir = @imcvdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+ipsec_script = @ipsec_script@
+ipsec_script_upper = @ipsec_script_upper@
ipsecdir = @ipsecdir@
ipsecgroup = @ipsecgroup@
ipseclibdir = @ipseclibdir@
ipsecuser = @ipsecuser@
-libcharon_plugins = @libcharon_plugins@
libdir = @libdir@
libexecdir = @libexecdir@
linux_headers = @linux_headers@
@@ -248,6 +254,7 @@ mkdir_p = @mkdir_p@
nm_CFLAGS = @nm_CFLAGS@
nm_LIBS = @nm_LIBS@
nm_ca_dir = @nm_ca_dir@
+nm_plugins = @nm_plugins@
oldincludedir = @oldincludedir@
openac_plugins = @openac_plugins@
p_plugins = @p_plugins@
@@ -257,7 +264,6 @@ pdfdir = @pdfdir@
piddir = @piddir@
pki_plugins = @pki_plugins@
plugindir = @plugindir@
-pluto_plugins = @pluto_plugins@
pool_plugins = @pool_plugins@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c
index 4fd33696c..eac285ca3 100644
--- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c
+++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_listener.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Andreas Steffen
+ * Copyright (C) 2011 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@ static bool publish_device_ip_addresses(private_tnc_ifmap_listener_t *this)
bool success = TRUE;
enumerator = hydra->kernel_interface->create_address_enumerator(
- hydra->kernel_interface, FALSE, FALSE);
+ hydra->kernel_interface, ADDR_TYPE_REGULAR);
while (enumerator->enumerate(enumerator, &host))
{
if (!this->ifmap->publish_device_ip(this->ifmap, host))
@@ -87,7 +87,7 @@ static bool reload_metadata(private_tnc_ifmap_listener_t *this)
}
}
enumerator->destroy(enumerator);
-
+
return success;
}
diff --git a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c
index 913cdab12..b13193612 100644
--- a/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c
+++ b/src/libcharon/plugins/tnc_ifmap/tnc_ifmap_soap.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Andreas Steffen
+ * Copyright (C) 2011 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -16,6 +16,7 @@
#include "tnc_ifmap_soap.h"
#include <debug.h>
+#include <daemon.h>
#include <axis2_util.h>
#include <axis2_client.h>
@@ -27,7 +28,7 @@
#define IFMAP_META_NS "http://www.trustedcomputinggroup.org/2010/IFMAP-METADATA/2"
#define IFMAP_LOGFILE "strongswan_ifmap.log"
#define IFMAP_SERVER "https://localhost:8443/"
-
+
typedef struct private_tnc_ifmap_soap_t private_tnc_ifmap_soap_t;
/**
@@ -41,7 +42,7 @@ struct private_tnc_ifmap_soap_t {
tnc_ifmap_soap_t public;
/**
- * Axis2/C environment
+ * Axis2/C environment
*/
axutil_env_t *env;
@@ -155,8 +156,8 @@ METHOD(tnc_ifmap_soap_t, newSession, bool,
/* set PEP and PDP device name (defaults to IF-MAP Publisher ID) */
this->device_name = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-ifmap.device_name",
- this->ifmap_publisher_id);
+ "%s.plugins.tnc-ifmap.device_name",
+ this->ifmap_publisher_id, charon->name);
this->device_name = strdup(this->device_name);
/* free result */
@@ -174,13 +175,13 @@ METHOD(tnc_ifmap_soap_t, purgePublisher, bool,
axiom_attribute_t *attr;
/* build purgePublisher request */
- ns = axiom_namespace_create(this->env, IFMAP_NS, "ifmap");
+ ns = axiom_namespace_create(this->env, IFMAP_NS, "ifmap");
el = axiom_element_create(this->env, NULL, "purgePublisher", ns, &request);
attr = axiom_attribute_create(this->env, "session-id",
- this->session_id, NULL);
+ this->session_id, NULL);
axiom_element_add_attribute(el, this->env, attr, request);
attr = axiom_attribute_create(this->env, "ifmap-publisher-id",
- this->ifmap_publisher_id, NULL);
+ this->ifmap_publisher_id, NULL);
axiom_element_add_attribute(el, this->env, attr, request);
/* send purgePublisher request and receive purgePublisherReceived */
@@ -202,7 +203,7 @@ static axiom_node_t* create_access_request(private_tnc_ifmap_soap_t *this,
el = axiom_element_create(this->env, NULL, "access-request", NULL, &node);
snprintf(buf, BUF_LEN, "%s:%d", this->device_name, id);
- attr = axiom_attribute_create(this->env, "name", buf, NULL);
+ attr = axiom_attribute_create(this->env, "name", buf, NULL);
axiom_element_add_attribute(el, this->env, attr, node);
return node;
@@ -222,7 +223,7 @@ static axiom_node_t* create_identity(private_tnc_ifmap_soap_t *this,
el = axiom_element_create(this->env, NULL, "identity", NULL, &node);
snprintf(buf, BUF_LEN, "%Y", id);
- attr = axiom_attribute_create(this->env, "name", buf, NULL);
+ attr = axiom_attribute_create(this->env, "name", buf, NULL);
axiom_element_add_attribute(el, this->env, attr, node);
switch (id->get_type(id))
@@ -260,7 +261,7 @@ static axiom_node_t* create_identity(private_tnc_ifmap_soap_t *this,
"36906:other", NULL);
axiom_element_add_attribute(el, this->env, attr, node);
}
- attr = axiom_attribute_create(this->env, "type", id_type, NULL);
+ attr = axiom_attribute_create(this->env, "type", id_type, NULL);
axiom_element_add_attribute(el, this->env, attr, node);
return node;
@@ -295,7 +296,7 @@ static axiom_node_t* create_ip_address(private_tnc_ifmap_soap_t *this,
{
written = snprintf(pos, len, "%s%x", first ? "" : ":",
256*address.ptr[i] + address.ptr[i+1]);
- if (written < 0 || written > len)
+ if (written < 0 || written >= len)
{
break;
}
@@ -308,11 +309,11 @@ static axiom_node_t* create_ip_address(private_tnc_ifmap_soap_t *this,
{
snprintf(buf, BUF_LEN, "%H", host);
}
- attr = axiom_attribute_create(this->env, "value", buf, NULL);
+ attr = axiom_attribute_create(this->env, "value", buf, NULL);
axiom_element_add_attribute(el, this->env, attr, node);
attr = axiom_attribute_create(this->env, "type",
- host->get_family(host) == AF_INET ? "IPv4" : "IPv6", NULL);
+ host->get_family(host) == AF_INET ? "IPv4" : "IPv6", NULL);
axiom_element_add_attribute(el, this->env, attr, node);
return node;
@@ -352,7 +353,7 @@ static axiom_node_t* create_metadata(private_tnc_ifmap_soap_t *this,
el = axiom_element_create(this->env, NULL, metadata, ns_meta, &node2);
axiom_node_add_child(node, this->env, node2);
attr = axiom_attribute_create(this->env, "ifmap-cardinality", "singleValue",
- NULL);
+ NULL);
axiom_element_add_attribute(el, this->env, attr, node2);
return node;
@@ -374,7 +375,7 @@ static axiom_node_t* create_capability(private_tnc_ifmap_soap_t *this,
ns_meta = axiom_namespace_create(this->env, IFMAP_META_NS, "meta");
el = axiom_element_create(this->env, NULL, "capability", ns_meta, &node);
attr = axiom_attribute_create(this->env, "ifmap-cardinality", "multiValue",
- NULL);
+ NULL);
axiom_element_add_attribute(el, this->env, attr, node);
el = axiom_element_create(this->env, NULL, "name", NULL, &node2);
@@ -385,7 +386,7 @@ static axiom_node_t* create_capability(private_tnc_ifmap_soap_t *this,
el = axiom_element_create(this->env, NULL, "administrative-domain", NULL, &node2);
axiom_node_add_child(node, this->env, node2);
text = axiom_text_create(this->env, node2, "strongswan", &node3);
-
+
return node;
}
@@ -439,7 +440,7 @@ static axiom_node_t* create_delete_filter(private_tnc_ifmap_soap_t *this,
snprintf(buf, BUF_LEN, "meta:%s[@ifmap-publisher-id='%s']",
metadata, this->ifmap_publisher_id);
- attr = axiom_attribute_create(this->env, "filter", buf, NULL);
+ attr = axiom_attribute_create(this->env, "filter", buf, NULL);
axiom_element_add_attribute(el, this->env, attr, node);
return node;
@@ -506,11 +507,11 @@ METHOD(tnc_ifmap_soap_t, publish_ike_sa, bool,
axiom_node_add_child(node, this->env,
create_device(this));
}
-
+
/**
* update or delete authenticated-as metadata
*/
- if (up)
+ if (up)
{
el = axiom_element_create(this->env, NULL, "update", NULL, &node);
}
@@ -534,7 +535,7 @@ METHOD(tnc_ifmap_soap_t, publish_ike_sa, bool,
/**
* update or delete access-request-ip metadata
*/
- if (up)
+ if (up)
{
el = axiom_element_create(this->env, NULL, "update", NULL, &node);
}
@@ -558,7 +559,7 @@ METHOD(tnc_ifmap_soap_t, publish_ike_sa, bool,
/**
* update or delete authenticated-by metadata
*/
- if (up)
+ if (up)
{
el = axiom_element_create(this->env, NULL, "update", NULL, &node);
}
@@ -605,7 +606,7 @@ METHOD(tnc_ifmap_soap_t, publish_ike_sa, bool,
node = create_delete_filter(this, "capability");
}
axiom_node_add_child(request, this->env, node);
-
+
/* add access-request */
axiom_node_add_child(node, this->env,
create_access_request(this, ike_sa_id));
@@ -688,9 +689,9 @@ METHOD(tnc_ifmap_soap_t, endSession, bool,
axiom_attribute_t *attr;
/* build endSession request */
- ns = axiom_namespace_create(this->env, IFMAP_NS, "ifmap");
+ ns = axiom_namespace_create(this->env, IFMAP_NS, "ifmap");
el = axiom_element_create(this->env, NULL, "endSession", ns, &request);
- attr = axiom_attribute_create(this->env, "session-id", this->session_id, NULL);
+ attr = axiom_attribute_create(this->env, "session-id", this->session_id, NULL);
axiom_element_add_attribute(el, this->env, attr, request);
/* send endSession request and receive end SessionResult */
@@ -705,7 +706,7 @@ METHOD(tnc_ifmap_soap_t, destroy, void,
endSession(this);
free(this->session_id);
free(this->ifmap_publisher_id);
- free(this->device_name);
+ free(this->device_name);
}
if (this->svc_client)
{
@@ -731,20 +732,20 @@ static bool axis2c_init(private_tnc_ifmap_soap_t *this)
/* Getting configuration parameters from strongswan.conf */
client_home = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-ifmap.client_home",
- AXIS2_GETENV("AXIS2C_HOME"));
+ "%s.plugins.tnc-ifmap.client_home",
+ AXIS2_GETENV("AXIS2C_HOME"), charon->name);
server = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-ifmap.server", IFMAP_SERVER);
+ "%s.plugins.tnc-ifmap.server", IFMAP_SERVER, charon->name);
server_cert = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-ifmap.server_cert", NULL);
+ "%s.plugins.tnc-ifmap.server_cert", NULL, charon->name);
key_file = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-ifmap.key_file", NULL);
+ "%s.plugins.tnc-ifmap.key_file", NULL, charon->name);
ssl_passphrase = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-ifmap.ssl_passphrase", NULL);
+ "%s.plugins.tnc-ifmap.ssl_passphrase", NULL, charon->name);
username = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-ifmap.username", NULL);
+ "%s.plugins.tnc-ifmap.username", NULL, charon->name);
password = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-ifmap.password", NULL);
+ "%s.plugins.tnc-ifmap.password", NULL, charon->name);
if (!server_cert)
{
@@ -785,9 +786,9 @@ static bool axis2c_init(private_tnc_ifmap_soap_t *this)
ssl_passphrase);
axis2_options_set_property(options, this->env,
AXIS2_SSL_PASSPHRASE, property);
- }
+ }
}
- else
+ else
{
/* Set up HTTP Basic MAP client authentication */
axis2_options_set_http_auth_info(options, this->env,
@@ -800,14 +801,14 @@ static bool axis2c_init(private_tnc_ifmap_soap_t *this)
/* Set up https transport */
transport_in = axis2_transport_in_desc_create(this->env,
- AXIS2_TRANSPORT_ENUM_HTTPS);
+ 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_transport_out(options, this->env, transport_out);
/* Create the axis2 service client */
this->svc_client = axis2_svc_client_create(this->env, client_home);