summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/stroke
diff options
context:
space:
mode:
authorRené Mayrhofer <rene@mayrhofer.eu.org>2011-05-19 13:41:58 +0200
committerRené Mayrhofer <rene@mayrhofer.eu.org>2011-05-19 13:41:58 +0200
commitb590992f735393c97489fce191e7810eaae4f6d7 (patch)
tree286595c4aa43dbf3d616d816e5fade6ac364771a /src/libcharon/plugins/stroke
parent2fce29055b7b5bc2860d503d1ae822931f80b7aa (diff)
parent0a9d51a49042a68daa15b0c74a2b7f152f52606b (diff)
downloadvyos-strongswan-b590992f735393c97489fce191e7810eaae4f6d7.tar.gz
vyos-strongswan-b590992f735393c97489fce191e7810eaae4f6d7.zip
Merge upstream version 4.5.2
Diffstat (limited to 'src/libcharon/plugins/stroke')
-rw-r--r--src/libcharon/plugins/stroke/Makefile.am5
-rw-r--r--src/libcharon/plugins/stroke/Makefile.in25
-rw-r--r--src/libcharon/plugins/stroke/stroke_ca.c65
-rw-r--r--src/libcharon/plugins/stroke/stroke_config.c79
-rw-r--r--src/libcharon/plugins/stroke/stroke_control.c309
-rw-r--r--src/libcharon/plugins/stroke/stroke_control.h3
-rw-r--r--src/libcharon/plugins/stroke/stroke_cred.c495
-rw-r--r--src/libcharon/plugins/stroke/stroke_list.c112
-rw-r--r--src/libcharon/plugins/stroke/stroke_plugin.c23
-rw-r--r--src/libcharon/plugins/stroke/stroke_socket.c16
10 files changed, 169 insertions, 963 deletions
diff --git a/src/libcharon/plugins/stroke/Makefile.am b/src/libcharon/plugins/stroke/Makefile.am
index 29f680174..e561224e9 100644
--- a/src/libcharon/plugins/stroke/Makefile.am
+++ b/src/libcharon/plugins/stroke/Makefile.am
@@ -21,11 +21,6 @@ libstrongswan_stroke_la_SOURCES = \
stroke_cred.h stroke_cred.c \
stroke_ca.h stroke_ca.c \
stroke_attribute.h stroke_attribute.c \
-<<<<<<< HEAD
- stroke_list.h stroke_list.c \
- stroke_shared_key.h stroke_shared_key.c
-=======
stroke_list.h stroke_list.c
->>>>>>> upstream/4.5.1
libstrongswan_stroke_la_LDFLAGS = -module -avoid-version
diff --git a/src/libcharon/plugins/stroke/Makefile.in b/src/libcharon/plugins/stroke/Makefile.in
index 3649c8ee9..fd859daeb 100644
--- a/src/libcharon/plugins/stroke/Makefile.in
+++ b/src/libcharon/plugins/stroke/Makefile.in
@@ -77,11 +77,7 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES)
libstrongswan_stroke_la_LIBADD =
am_libstrongswan_stroke_la_OBJECTS = stroke_plugin.lo stroke_socket.lo \
stroke_config.lo stroke_control.lo stroke_cred.lo stroke_ca.lo \
-<<<<<<< HEAD
- stroke_attribute.lo stroke_list.lo stroke_shared_key.lo
-=======
stroke_attribute.lo stroke_list.lo
->>>>>>> upstream/4.5.1
libstrongswan_stroke_la_OBJECTS = \
$(am_libstrongswan_stroke_la_OBJECTS)
libstrongswan_stroke_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -227,13 +223,7 @@ includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
ipsecdir = @ipsecdir@
-<<<<<<< HEAD
-ipsecgid = @ipsecgid@
ipsecgroup = @ipsecgroup@
-ipsecuid = @ipsecuid@
-=======
-ipsecgroup = @ipsecgroup@
->>>>>>> upstream/4.5.1
ipsecuser = @ipsecuser@
libcharon_plugins = @libcharon_plugins@
libdir = @libdir@
@@ -254,6 +244,8 @@ nm_ca_dir = @nm_ca_dir@
oldincludedir = @oldincludedir@
openac_plugins = @openac_plugins@
p_plugins = @p_plugins@
+pcsclite_CFLAGS = @pcsclite_CFLAGS@
+pcsclite_LIBS = @pcsclite_LIBS@
pdfdir = @pdfdir@
piddir = @piddir@
pki_plugins = @pki_plugins@
@@ -272,14 +264,12 @@ sbindir = @sbindir@
scepclient_plugins = @scepclient_plugins@
scripts_plugins = @scripts_plugins@
sharedstatedir = @sharedstatedir@
-<<<<<<< HEAD
-=======
soup_CFLAGS = @soup_CFLAGS@
soup_LIBS = @soup_LIBS@
->>>>>>> upstream/4.5.1
srcdir = @srcdir@
strongswan_conf = @strongswan_conf@
sysconfdir = @sysconfdir@
+systemdsystemunitdir = @systemdsystemunitdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
@@ -305,12 +295,7 @@ libstrongswan_stroke_la_SOURCES = \
stroke_cred.h stroke_cred.c \
stroke_ca.h stroke_ca.c \
stroke_attribute.h stroke_attribute.c \
-<<<<<<< HEAD
- stroke_list.h stroke_list.c \
- stroke_shared_key.h stroke_shared_key.c
-=======
stroke_list.h stroke_list.c
->>>>>>> upstream/4.5.1
libstrongswan_stroke_la_LDFLAGS = -module -avoid-version
all: all-am
@@ -403,10 +388,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stroke_cred.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stroke_list.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stroke_plugin.Plo@am__quote@
-<<<<<<< HEAD
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stroke_shared_key.Plo@am__quote@
-=======
->>>>>>> upstream/4.5.1
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stroke_socket.Plo@am__quote@
.c.o:
diff --git a/src/libcharon/plugins/stroke/stroke_ca.c b/src/libcharon/plugins/stroke/stroke_ca.c
index 57126053b..69e13deb9 100644
--- a/src/libcharon/plugins/stroke/stroke_ca.c
+++ b/src/libcharon/plugins/stroke/stroke_ca.c
@@ -113,10 +113,7 @@ static void ca_section_destroy(ca_section_t *this)
this->crl->destroy_function(this->crl, free);
this->ocsp->destroy_function(this->ocsp, free);
this->hashes->destroy_offset(this->hashes, offsetof(identification_t, destroy));
-<<<<<<< HEAD
-=======
this->cert->destroy(this->cert);
->>>>>>> upstream/4.5.1
free(this->certuribase);
free(this->name);
free(this);
@@ -211,16 +208,8 @@ static enumerator_t *create_inner_cdp_hashandurl(ca_section_t *section, cdp_data
return enumerator;
}
-<<<<<<< HEAD
-/**
- * Implementation of credential_set_t.create_cdp_enumerator.
- */
-static enumerator_t *create_cdp_enumerator(private_stroke_ca_t *this,
- certificate_type_t type, identification_t *id)
-=======
METHOD(credential_set_t, create_cdp_enumerator, enumerator_t*,
private_stroke_ca_t *this, certificate_type_t type, identification_t *id)
->>>>>>> upstream/4.5.1
{
cdp_data_t *data;
@@ -244,16 +233,9 @@ METHOD(credential_set_t, create_cdp_enumerator, enumerator_t*,
(type == CERT_X509) ? (void*)create_inner_cdp_hashandurl : (void*)create_inner_cdp,
data, (void*)cdp_data_destroy);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_ca_t.add.
- */
-static void add(private_stroke_ca_t *this, stroke_msg_t *msg)
-=======
METHOD(stroke_ca_t, add, void,
private_stroke_ca_t *this, stroke_msg_t *msg)
->>>>>>> upstream/4.5.1
{
certificate_t *cert;
ca_section_t *ca;
@@ -294,15 +276,8 @@ METHOD(stroke_ca_t, add, void,
}
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_ca_t.del.
- */
-static void del(private_stroke_ca_t *this, stroke_msg_t *msg)
-=======
METHOD(stroke_ca_t, del, void,
private_stroke_ca_t *this, stroke_msg_t *msg)
->>>>>>> upstream/4.5.1
{
enumerator_t *enumerator;
ca_section_t *ca = NULL;
@@ -356,15 +331,8 @@ static void list_uris(linked_list_t *list, char *label, FILE *out)
enumerator->destroy(enumerator);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_ca_t.check_for_hash_and_url.
- */
-static void check_for_hash_and_url(private_stroke_ca_t *this, certificate_t* cert)
-=======
METHOD(stroke_ca_t, check_for_hash_and_url, void,
private_stroke_ca_t *this, certificate_t* cert)
->>>>>>> upstream/4.5.1
{
ca_section_t *section;
enumerator_t *enumerator;
@@ -401,15 +369,8 @@ METHOD(stroke_ca_t, check_for_hash_and_url, void,
hasher->destroy(hasher);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_ca_t.list.
- */
-static void list(private_stroke_ca_t *this, stroke_msg_t *msg, FILE *out)
-=======
METHOD(stroke_ca_t, list, void,
private_stroke_ca_t *this, stroke_msg_t *msg, FILE *out)
->>>>>>> upstream/4.5.1
{
bool first = TRUE;
ca_section_t *section;
@@ -456,15 +417,8 @@ METHOD(stroke_ca_t, list, void,
this->lock->unlock(this->lock);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_ca_t.destroy
- */
-static void destroy(private_stroke_ca_t *this)
-=======
METHOD(stroke_ca_t, destroy, void,
private_stroke_ca_t *this)
->>>>>>> upstream/4.5.1
{
this->sections->destroy_function(this->sections, (void*)ca_section_destroy);
this->lock->destroy(this->lock);
@@ -476,24 +430,6 @@ METHOD(stroke_ca_t, destroy, void,
*/
stroke_ca_t *stroke_ca_create(stroke_cred_t *cred)
{
-<<<<<<< HEAD
- private_stroke_ca_t *this = malloc_thing(private_stroke_ca_t);
-
- this->public.set.create_private_enumerator = (void*)return_null;
- this->public.set.create_cert_enumerator = (void*)return_null;
- this->public.set.create_shared_enumerator = (void*)return_null;
- this->public.set.create_cdp_enumerator = (void*)create_cdp_enumerator;
- this->public.set.cache_cert = (void*)nop;
- this->public.add = (void(*)(stroke_ca_t*, stroke_msg_t *msg))add;
- this->public.del = (void(*)(stroke_ca_t*, stroke_msg_t *msg))del;
- this->public.list = (void(*)(stroke_ca_t*, stroke_msg_t *msg, FILE *out))list;
- this->public.check_for_hash_and_url = (void(*)(stroke_ca_t*, certificate_t*))check_for_hash_and_url;
- this->public.destroy = (void(*)(stroke_ca_t*))destroy;
-
- this->sections = linked_list_create();
- this->lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
- this->cred = cred;
-=======
private_stroke_ca_t *this;
INIT(this,
@@ -515,7 +451,6 @@ stroke_ca_t *stroke_ca_create(stroke_cred_t *cred)
.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
.cred = cred,
);
->>>>>>> upstream/4.5.1
return &this->public;
}
diff --git a/src/libcharon/plugins/stroke/stroke_config.c b/src/libcharon/plugins/stroke/stroke_config.c
index 11822a3bc..2b3164384 100644
--- a/src/libcharon/plugins/stroke/stroke_config.c
+++ b/src/libcharon/plugins/stroke/stroke_config.c
@@ -53,17 +53,8 @@ struct private_stroke_config_t {
stroke_cred_t *cred;
};
-<<<<<<< HEAD
-/**
- * Implementation of backend_t.create_peer_cfg_enumerator.
- */
-static enumerator_t* create_peer_cfg_enumerator(private_stroke_config_t *this,
- identification_t *me,
- identification_t *other)
-=======
METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
private_stroke_config_t *this, identification_t *me, identification_t *other)
->>>>>>> upstream/4.5.1
{
this->mutex->lock(this->mutex);
return enumerator_create_cleaner(this->list->create_enumerator(this->list),
@@ -79,16 +70,8 @@ static bool ike_filter(void *data, peer_cfg_t **in, ike_cfg_t **out)
return TRUE;
}
-<<<<<<< HEAD
-/**
- * Implementation of backend_t.create_ike_cfg_enumerator.
- */
-static enumerator_t* create_ike_cfg_enumerator(private_stroke_config_t *this,
- host_t *me, host_t *other)
-=======
METHOD(backend_t, create_ike_cfg_enumerator, enumerator_t*,
private_stroke_config_t *this, host_t *me, host_t *other)
->>>>>>> upstream/4.5.1
{
this->mutex->lock(this->mutex);
return enumerator_create_filter(this->list->create_enumerator(this->list),
@@ -96,15 +79,8 @@ METHOD(backend_t, create_ike_cfg_enumerator, enumerator_t*,
(void*)this->mutex->unlock);
}
-<<<<<<< HEAD
-/**
- * implements backend_t.get_peer_cfg_by_name.
- */
-static peer_cfg_t *get_peer_cfg_by_name(private_stroke_config_t *this, char *name)
-=======
METHOD(backend_t, get_peer_cfg_by_name, peer_cfg_t*,
private_stroke_config_t *this, char *name)
->>>>>>> upstream/4.5.1
{
enumerator_t *e1, *e2;
peer_cfg_t *current, *found = NULL;
@@ -433,7 +409,7 @@ static auth_cfg_t *build_auth_cfg(private_stroke_config_t *this,
}
else
{
- DBG1(DBG_CFG, "CA certificate %s not found, discarding CA "
+ DBG1(DBG_CFG, "CA certificate \"%s\" not found, discarding CA "
"constraint", ca);
}
}
@@ -453,15 +429,6 @@ static auth_cfg_t *build_auth_cfg(private_stroke_config_t *this,
enumerator->destroy(enumerator);
}
-<<<<<<< HEAD
- /* authentication metod (class, actually) */
- if (streq(auth, "pubkey") ||
- streq(auth, "rsasig") || streq(auth, "rsa") ||
- streq(auth, "ecdsasig") || streq(auth, "ecdsa"))
- {
- cfg->add(cfg, AUTH_RULE_AUTH_CLASS, AUTH_CLASS_PUBKEY);
- build_crl_policy(cfg, local, msg->add_conn.crl_policy);
-=======
/* certificatePolicies */
if (end->cert_policy)
{
@@ -494,7 +461,6 @@ static auth_cfg_t *build_auth_cfg(private_stroke_config_t *this,
{
cfg->add(cfg, AUTH_RULE_ECDSA_STRENGTH, (uintptr_t)strength);
}
->>>>>>> upstream/4.5.1
}
else if (streq(auth, "psk") || streq(auth, "secret"))
{
@@ -858,15 +824,9 @@ static child_cfg_t *build_child_cfg(private_stroke_config_t *this,
child_cfg = child_cfg_create(
msg->add_conn.name, &lifetime,
msg->add_conn.me.updown, msg->add_conn.me.hostaccess,
-<<<<<<< HEAD
- msg->add_conn.mode, dpd, dpd, msg->add_conn.ipcomp,
- msg->add_conn.inactivity, msg->add_conn.reqid,
- &mark_in, &mark_out);
-=======
msg->add_conn.mode, ACTION_NONE, dpd, dpd, msg->add_conn.ipcomp,
msg->add_conn.inactivity, msg->add_conn.reqid,
&mark_in, &mark_out, msg->add_conn.tfc);
->>>>>>> upstream/4.5.1
child_cfg->set_mipv6_options(child_cfg, msg->add_conn.proxy_mode,
msg->add_conn.install_policy);
add_ts(this, &msg->add_conn.me, child_cfg, TRUE);
@@ -877,15 +837,8 @@ static child_cfg_t *build_child_cfg(private_stroke_config_t *this,
return child_cfg;
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_config_t.add.
- */
-static void add(private_stroke_config_t *this, stroke_msg_t *msg)
-=======
METHOD(stroke_config_t, add, void,
private_stroke_config_t *this, stroke_msg_t *msg)
->>>>>>> upstream/4.5.1
{
ike_cfg_t *ike_cfg, *existing_ike;
peer_cfg_t *peer_cfg, *existing;
@@ -945,15 +898,8 @@ METHOD(stroke_config_t, add, void,
}
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_config_t.del.
- */
-static void del(private_stroke_config_t *this, stroke_msg_t *msg)
-=======
METHOD(stroke_config_t, del, void,
private_stroke_config_t *this, stroke_msg_t *msg)
->>>>>>> upstream/4.5.1
{
enumerator_t *enumerator, *children;
peer_cfg_t *peer;
@@ -1004,15 +950,8 @@ METHOD(stroke_config_t, del, void,
}
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_config_t.destroy
- */
-static void destroy(private_stroke_config_t *this)
-=======
METHOD(stroke_config_t, destroy, void,
private_stroke_config_t *this)
->>>>>>> upstream/4.5.1
{
this->list->destroy_offset(this->list, offsetof(peer_cfg_t, destroy));
this->mutex->destroy(this->mutex);
@@ -1024,21 +963,6 @@ METHOD(stroke_config_t, destroy, void,
*/
stroke_config_t *stroke_config_create(stroke_ca_t *ca, stroke_cred_t *cred)
{
-<<<<<<< HEAD
- private_stroke_config_t *this = malloc_thing(private_stroke_config_t);
-
- this->public.backend.create_peer_cfg_enumerator = (enumerator_t*(*)(backend_t*, identification_t *me, identification_t *other))create_peer_cfg_enumerator;
- this->public.backend.create_ike_cfg_enumerator = (enumerator_t*(*)(backend_t*, host_t *me, host_t *other))create_ike_cfg_enumerator;
- this->public.backend.get_peer_cfg_by_name = (peer_cfg_t* (*)(backend_t*,char*))get_peer_cfg_by_name;
- this->public.add = (void(*)(stroke_config_t*, stroke_msg_t *msg))add;
- this->public.del = (void(*)(stroke_config_t*, stroke_msg_t *msg))del;
- this->public.destroy = (void(*)(stroke_config_t*))destroy;
-
- this->list = linked_list_create();
- this->mutex = mutex_create(MUTEX_TYPE_RECURSIVE);
- this->ca = ca;
- this->cred = cred;
-=======
private_stroke_config_t *this;
INIT(this,
@@ -1057,7 +981,6 @@ stroke_config_t *stroke_config_create(stroke_ca_t *ca, stroke_cred_t *cred)
.ca = ca,
.cred = cred,
);
->>>>>>> upstream/4.5.1
return &this->public;
}
diff --git a/src/libcharon/plugins/stroke/stroke_control.c b/src/libcharon/plugins/stroke/stroke_control.c
index 03ba4c305..4943ee670 100644
--- a/src/libcharon/plugins/stroke/stroke_control.c
+++ b/src/libcharon/plugins/stroke/stroke_control.c
@@ -17,11 +17,8 @@
#include <daemon.h>
#include <processing/jobs/delete_ike_sa_job.h>
-<<<<<<< HEAD
-=======
#include <processing/jobs/rekey_ike_sa_job.h>
#include <processing/jobs/rekey_child_sa_job.h>
->>>>>>> upstream/4.5.1
typedef struct private_stroke_control_t private_stroke_control_t;
@@ -95,75 +92,97 @@ static child_cfg_t* get_child_from_peer(peer_cfg_t *peer_cfg, char *name)
return found;
}
-<<<<<<< HEAD
/**
- * Implementation of stroke_control_t.initiate.
+ * call the charon controller to initiate the connection
*/
-static void initiate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
-=======
+static void charon_initiate(peer_cfg_t *peer_cfg, child_cfg_t *child_cfg,
+ stroke_msg_t *msg, FILE *out)
+{
+ if (msg->output_verbosity < 0)
+ {
+ charon->controller->initiate(charon->controller, peer_cfg, child_cfg,
+ NULL, NULL);
+ }
+ else
+ {
+ stroke_log_info_t info = { msg->output_verbosity, out };
+
+ charon->controller->initiate(charon->controller, peer_cfg, child_cfg,
+ (controller_cb_t)stroke_log, &info);
+ }
+}
+
METHOD(stroke_control_t, initiate, void,
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
->>>>>>> upstream/4.5.1
{
+ child_cfg_t *child_cfg = NULL;
peer_cfg_t *peer_cfg;
- child_cfg_t *child_cfg;
- stroke_log_info_t info;
+ enumerator_t *enumerator;
+ bool empty = TRUE;
peer_cfg = charon->backends->get_peer_cfg_by_name(charon->backends,
msg->initiate.name);
- if (peer_cfg == NULL)
+ if (peer_cfg)
{
- DBG1(DBG_CFG, "no config named '%s'\n", msg->initiate.name);
- return;
- }
- if (peer_cfg->get_ike_version(peer_cfg) != 2)
- {
- DBG1(DBG_CFG, "ignoring initiation request for IKEv%d config",
- peer_cfg->get_ike_version(peer_cfg));
- peer_cfg->destroy(peer_cfg);
- return;
- }
+ if (peer_cfg->get_ike_version(peer_cfg) != 2)
+ {
+ DBG1(DBG_CFG, "ignoring initiation request for IKEv%d config",
+ peer_cfg->get_ike_version(peer_cfg));
+ peer_cfg->destroy(peer_cfg);
+ return;
+ }
- child_cfg = get_child_from_peer(peer_cfg, msg->initiate.name);
- if (child_cfg == NULL)
- {
- DBG1(DBG_CFG, "no child config named '%s'\n", msg->initiate.name);
- peer_cfg->destroy(peer_cfg);
- return;
- }
+ child_cfg = get_child_from_peer(peer_cfg, msg->initiate.name);
+ if (child_cfg == NULL)
+ {
+ enumerator = peer_cfg->create_child_cfg_enumerator(peer_cfg);
+ while (enumerator->enumerate(enumerator, &child_cfg))
+ {
+ empty = FALSE;
+ charon_initiate(peer_cfg->get_ref(peer_cfg),
+ child_cfg->get_ref(child_cfg), msg, out);
+ }
+ enumerator->destroy(enumerator);
- if (msg->output_verbosity < 0)
- {
- charon->controller->initiate(charon->controller, peer_cfg, child_cfg,
- NULL, NULL);
+ if (empty)
+ {
+ DBG1(DBG_CFG, "no child config named '%s'", msg->initiate.name);
+ fprintf(out, "no child config named '%s'\n", msg->initiate.name);
+ }
+ peer_cfg->destroy(peer_cfg);
+ return;
+ }
}
else
{
- info.out = out;
- info.level = msg->output_verbosity;
- charon->controller->initiate(charon->controller, peer_cfg, child_cfg,
- (controller_cb_t)stroke_log, &info);
+ enumerator = charon->backends->create_peer_cfg_enumerator(charon->backends,
+ NULL, NULL, NULL, NULL);
+ while (enumerator->enumerate(enumerator, &peer_cfg))
+ {
+ if (peer_cfg->get_ike_version(peer_cfg) != 2)
+ {
+ continue;
+ }
+ child_cfg = get_child_from_peer(peer_cfg, msg->initiate.name);
+ if (child_cfg)
+ {
+ peer_cfg->get_ref(peer_cfg);
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ if (child_cfg == NULL)
+ {
+ DBG1(DBG_CFG, "no config named '%s'", msg->initiate.name);
+ fprintf(out, "no config named '%s'\n", msg->initiate.name);
+ return;
+ }
}
+ charon_initiate(peer_cfg, child_cfg, msg, out);
}
/**
-<<<<<<< HEAD
- * Implementation of stroke_control_t.terminate.
- */
-static void terminate(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
-{
- char *string, *pos = NULL, *name = NULL;
- u_int32_t id = 0;
- bool child, all = FALSE;
- int len;
- ike_sa_t *ike_sa;
- enumerator_t *enumerator;
- linked_list_t *ike_list, *child_list;
- stroke_log_info_t info;
- uintptr_t del;
-
- string = msg->terminate.name;
-=======
* Parse a terminate/rekey specifier
*/
static bool parse_specifier(char *string, u_int32_t *id,
@@ -175,37 +194,15 @@ static bool parse_specifier(char *string, u_int32_t *id,
*id = 0;
*name = NULL;
*all = FALSE;
->>>>>>> upstream/4.5.1
len = strlen(string);
if (len < 1)
{
-<<<<<<< HEAD
- DBG1(DBG_CFG, "error parsing string");
- return;
-=======
return FALSE;
->>>>>>> upstream/4.5.1
}
switch (string[len-1])
{
case '}':
-<<<<<<< HEAD
- child = TRUE;
- pos = strchr(string, '{');
- break;
- case ']':
- child = FALSE;
- pos = strchr(string, '[');
- break;
- default:
- name = string;
- child = FALSE;
- break;
- }
-
- if (name)
-=======
*child = TRUE;
pos = strchr(string, '{');
break;
@@ -220,44 +217,18 @@ static bool parse_specifier(char *string, u_int32_t *id,
}
if (*name)
->>>>>>> upstream/4.5.1
{
/* is a single name */
}
else if (pos == string + len - 2)
{ /* is name[] or name{} */
string[len-2] = '\0';
-<<<<<<< HEAD
- name = string;
-=======
*name = string;
->>>>>>> upstream/4.5.1
}
else
{
if (!pos)
{
-<<<<<<< HEAD
- DBG1(DBG_CFG, "error parsing string");
- return;
- }
- if (*(pos + 1) == '*')
- { /* is name[*] */
- all = TRUE;
- *pos = '\0';
- name = string;
- }
- else
- { /* is name[123] or name{23} */
- id = atoi(pos + 1);
- if (id == 0)
- {
- DBG1(DBG_CFG, "error parsing string");
- return;
- }
- }
- }
-=======
return FALSE;
}
if (*(pos + 1) == '*')
@@ -295,7 +266,6 @@ METHOD(stroke_control_t, terminate, void,
DBG1(DBG_CFG, "error parsing specifier string");
return;
}
->>>>>>> upstream/4.5.1
info.out = out;
info.level = msg->output_verbosity;
@@ -382,13 +352,6 @@ METHOD(stroke_control_t, terminate, void,
child_list->destroy(child_list);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_control_t.terminate_srcip.
- */
-static void terminate_srcip(private_stroke_control_t *this,
- stroke_msg_t *msg, FILE *out)
-=======
METHOD(stroke_control_t, rekey, void,
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
{
@@ -451,7 +414,6 @@ METHOD(stroke_control_t, rekey, void,
METHOD(stroke_control_t, terminate_srcip, void,
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
->>>>>>> upstream/4.5.1
{
enumerator_t *enumerator;
ike_sa_t *ike_sa;
@@ -516,15 +478,8 @@ METHOD(stroke_control_t, terminate_srcip, void,
DESTROY_IF(end);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_control_t.purge_ike
- */
-static void purge_ike(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
-=======
METHOD(stroke_control_t, purge_ike, void,
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
->>>>>>> upstream/4.5.1
{
enumerator_t *enumerator;
iterator_t *iterator;
@@ -561,61 +516,96 @@ METHOD(stroke_control_t, purge_ike, void,
list->destroy(list);
}
-<<<<<<< HEAD
/**
- * Implementation of stroke_control_t.route.
+ * call charon to install a trap
*/
-static void route(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
-=======
+static void charon_route(peer_cfg_t *peer_cfg, child_cfg_t *child_cfg,
+ char *name, FILE *out)
+{
+ if (charon->traps->install(charon->traps, peer_cfg, child_cfg))
+ {
+ fprintf(out, "'%s' routed\n", name);
+ }
+ else
+ {
+ fprintf(out, "routing '%s' failed\n", name);
+ }
+}
+
METHOD(stroke_control_t, route, void,
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
->>>>>>> upstream/4.5.1
{
+ child_cfg_t *child_cfg = NULL;
peer_cfg_t *peer_cfg;
- child_cfg_t *child_cfg;
+ enumerator_t *enumerator;
+ bool empty = TRUE;
peer_cfg = charon->backends->get_peer_cfg_by_name(charon->backends,
msg->route.name);
- if (peer_cfg == NULL)
- {
- fprintf(out, "no config named '%s'\n", msg->route.name);
- return;
- }
- if (peer_cfg->get_ike_version(peer_cfg) != 2)
+ if (peer_cfg)
{
- peer_cfg->destroy(peer_cfg);
- return;
- }
+ if (peer_cfg->get_ike_version(peer_cfg) != 2)
+ {
+ DBG1(DBG_CFG, "ignoring initiation request for IKEv%d config",
+ peer_cfg->get_ike_version(peer_cfg));
+ peer_cfg->destroy(peer_cfg);
+ return;
+ }
- child_cfg = get_child_from_peer(peer_cfg, msg->route.name);
- if (child_cfg == NULL)
- {
- fprintf(out, "no child config named '%s'\n", msg->route.name);
- peer_cfg->destroy(peer_cfg);
- return;
- }
+ child_cfg = get_child_from_peer(peer_cfg, msg->route.name);
+ if (child_cfg == NULL)
+ {
+ enumerator = peer_cfg->create_child_cfg_enumerator(peer_cfg);
+ while (enumerator->enumerate(enumerator, &child_cfg))
+ {
+ empty = FALSE;
+ charon_route(peer_cfg, child_cfg, child_cfg->get_name(child_cfg),
+ out);
+ }
+ enumerator->destroy(enumerator);
- if (charon->traps->install(charon->traps, peer_cfg, child_cfg))
- {
- fprintf(out, "configuration '%s' routed\n", msg->route.name);
+ if (empty)
+ {
+ DBG1(DBG_CFG, "no child config named '%s'", msg->route.name);
+ fprintf(out, "no child config named '%s'\n", msg->route.name);
+ }
+ peer_cfg->destroy(peer_cfg);
+ return;
+ }
}
else
{
- fprintf(out, "routing configuration '%s' failed\n", msg->route.name);
+ enumerator = charon->backends->create_peer_cfg_enumerator(charon->backends,
+ NULL, NULL, NULL, NULL);
+ while (enumerator->enumerate(enumerator, &peer_cfg))
+ {
+ if (peer_cfg->get_ike_version(peer_cfg) != 2)
+ {
+ continue;
+ }
+ child_cfg = get_child_from_peer(peer_cfg, msg->route.name);
+ if (child_cfg)
+ {
+ peer_cfg->get_ref(peer_cfg);
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+
+ if (child_cfg == NULL)
+ {
+ DBG1(DBG_CFG, "no config named '%s'", msg->route.name);
+ fprintf(out, "no config named '%s'\n", msg->route.name);
+ return;
+ }
}
+ charon_route(peer_cfg, child_cfg, msg->route.name, out);
peer_cfg->destroy(peer_cfg);
child_cfg->destroy(child_cfg);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_control_t.unroute.
- */
-static void unroute(private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
-=======
METHOD(stroke_control_t, unroute, void,
private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
->>>>>>> upstream/4.5.1
{
child_sa_t *child_sa;
enumerator_t *enumerator;
@@ -637,15 +627,8 @@ METHOD(stroke_control_t, unroute, void,
fprintf(out, "configuration '%s' not found\n", msg->unroute.name);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_control_t.destroy
- */
-static void destroy(private_stroke_control_t *this)
-=======
METHOD(stroke_control_t, destroy, void,
private_stroke_control_t *this)
->>>>>>> upstream/4.5.1
{
free(this);
}
@@ -655,17 +638,6 @@ METHOD(stroke_control_t, destroy, void,
*/
stroke_control_t *stroke_control_create()
{
-<<<<<<< HEAD
- private_stroke_control_t *this = malloc_thing(private_stroke_control_t);
-
- this->public.initiate = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))initiate;
- this->public.terminate = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))terminate;
- this->public.terminate_srcip = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))terminate_srcip;
- this->public.purge_ike = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))purge_ike;
- this->public.route = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))route;
- this->public.unroute = (void(*)(stroke_control_t*, stroke_msg_t *msg, FILE *out))unroute;
- this->public.destroy = (void(*)(stroke_control_t*))destroy;
-=======
private_stroke_control_t *this;
INIT(this,
@@ -680,7 +652,6 @@ stroke_control_t *stroke_control_create()
.destroy = _destroy,
},
);
->>>>>>> upstream/4.5.1
return &this->public;
}
diff --git a/src/libcharon/plugins/stroke/stroke_control.h b/src/libcharon/plugins/stroke/stroke_control.h
index e4d67023a..869aab3d3 100644
--- a/src/libcharon/plugins/stroke/stroke_control.h
+++ b/src/libcharon/plugins/stroke/stroke_control.h
@@ -54,8 +54,6 @@ struct stroke_control_t {
void (*terminate_srcip)(stroke_control_t *this, stroke_msg_t *msg, FILE *out);
/**
-<<<<<<< HEAD
-=======
* Rekey a connection.
*
* @param msg stroke message
@@ -63,7 +61,6 @@ struct stroke_control_t {
void (*rekey)(stroke_control_t *this, stroke_msg_t *msg, FILE *out);
/**
->>>>>>> upstream/4.5.1
* Delete IKE_SAs without a CHILD_SA.
*
* @param msg stroke message
diff --git a/src/libcharon/plugins/stroke/stroke_cred.c b/src/libcharon/plugins/stroke/stroke_cred.c
index 6d9440778..baf02a6da 100644
--- a/src/libcharon/plugins/stroke/stroke_cred.c
+++ b/src/libcharon/plugins/stroke/stroke_cred.c
@@ -1,9 +1,5 @@
/*
-<<<<<<< HEAD
- * Copyright (C) 2008 Tobias Brunner
-=======
* Copyright (C) 2008-2010 Tobias Brunner
->>>>>>> upstream/4.5.1
* Copyright (C) 2008 Martin Willi
* Hochschule fuer Technik Rapperswil
*
@@ -29,10 +25,6 @@
#include <unistd.h>
#include "stroke_cred.h"
-<<<<<<< HEAD
-#include "stroke_shared_key.h"
-=======
->>>>>>> upstream/4.5.1
#include <credentials/certificates/x509.h>
#include <credentials/certificates/crl.h>
@@ -71,30 +63,9 @@ struct private_stroke_cred_t {
stroke_cred_t public;
/**
-<<<<<<< HEAD
- * list of trusted peer/signer/CA certificates (certificate_t)
- */
- linked_list_t *certs;
-
- /**
- * list of shared secrets (private_shared_key_t)
- */
- linked_list_t *shared;
-
- /**
- * list of private keys (private_key_t)
- */
- linked_list_t *private;
-
- /**
- * read-write lock to lists
- */
- rwlock_t *lock;
-=======
* credentials
*/
mem_cred_t *creds;
->>>>>>> upstream/4.5.1
/**
* cache CRLs to disk?
@@ -103,240 +74,6 @@ struct private_stroke_cred_t {
};
/**
-<<<<<<< HEAD
- * data to pass to various filters
- */
-typedef struct {
- private_stroke_cred_t *this;
- identification_t *id;
- certificate_type_t cert;
- key_type_t key;
-} id_data_t;
-
-/**
- * destroy id enumerator data and unlock list
- */
-static void id_data_destroy(id_data_t *data)
-{
- data->this->lock->unlock(data->this->lock);
- free(data);
-}
-
-/**
- * filter function for private key enumerator
- */
-static bool private_filter(id_data_t *data,
- private_key_t **in, private_key_t **out)
-{
- private_key_t *key;
-
- key = *in;
- if (data->key == KEY_ANY || data->key == key->get_type(key))
- {
- if (data->id == NULL)
- {
- *out = key;
- return TRUE;
- }
- if (key->has_fingerprint(key, data->id->get_encoding(data->id)))
- {
- *out = key;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * Implements credential_set_t.create_private_enumerator
- */
-static enumerator_t* create_private_enumerator(private_stroke_cred_t *this,
- key_type_t type, identification_t *id)
-{
- id_data_t *data;
-
- data = malloc_thing(id_data_t);
- data->this = this;
- data->id = id;
- data->key = type;
-
- this->lock->read_lock(this->lock);
- return enumerator_create_filter(this->private->create_enumerator(this->private),
- (void*)private_filter, data,
- (void*)id_data_destroy);
-}
-
-/**
- * filter function for certs enumerator
- */
-static bool certs_filter(id_data_t *data, certificate_t **in, certificate_t **out)
-{
- public_key_t *public;
- certificate_t *cert = *in;
-
- if (data->cert != CERT_ANY && data->cert != cert->get_type(cert))
- {
- return FALSE;
- }
- if (data->id == NULL || cert->has_subject(cert, data->id))
- {
- *out = *in;
- return TRUE;
- }
-
- public = cert->get_public_key(cert);
- if (public)
- {
- if (data->key == KEY_ANY || data->key != public->get_type(public))
- {
- if (public->has_fingerprint(public, data->id->get_encoding(data->id)))
- {
- public->destroy(public);
- *out = *in;
- return TRUE;
- }
- }
- public->destroy(public);
- }
- return FALSE;
-}
-
-/**
- * Implements credential_set_t.create_cert_enumerator
- */
-static enumerator_t* create_cert_enumerator(private_stroke_cred_t *this,
- certificate_type_t cert, key_type_t key,
- identification_t *id, bool trusted)
-{
- id_data_t *data;
-
- if (trusted && (cert == CERT_X509_CRL || cert == CERT_X509_AC))
- {
- return NULL;
- }
- data = malloc_thing(id_data_t);
- data->this = this;
- data->id = id;
- data->cert = cert;
- data->key = key;
-
- this->lock->read_lock(this->lock);
- return enumerator_create_filter(this->certs->create_enumerator(this->certs),
- (void*)certs_filter, data,
- (void*)id_data_destroy);
-}
-
-typedef struct {
- private_stroke_cred_t *this;
- identification_t *me;
- identification_t *other;
- shared_key_type_t type;
-} shared_data_t;
-
-/**
- * free shared key enumerator data and unlock list
- */
-static void shared_data_destroy(shared_data_t *data)
-{
- data->this->lock->unlock(data->this->lock);
- free(data);
-}
-
-/**
- * filter function for certs enumerator
- */
-static bool shared_filter(shared_data_t *data,
- stroke_shared_key_t **in, shared_key_t **out,
- void **unused1, id_match_t *me,
- void **unused2, id_match_t *other)
-{
- id_match_t my_match = ID_MATCH_NONE, other_match = ID_MATCH_NONE;
- stroke_shared_key_t *stroke = *in;
- shared_key_t *shared = &stroke->shared;
-
- if (data->type != SHARED_ANY && shared->get_type(shared) != data->type)
- {
- return FALSE;
- }
-
- if (data->me)
- {
- my_match = stroke->has_owner(stroke, data->me);
- }
- if (data->other)
- {
- other_match = stroke->has_owner(stroke, data->other);
- }
- if ((data->me || data->other) && (!my_match && !other_match))
- {
- return FALSE;
- }
- *out = shared;
- if (me)
- {
- *me = my_match;
- }
- if (other)
- {
- *other = other_match;
- }
- return TRUE;
-}
-
-/**
- * Implements credential_set_t.create_shared_enumerator
- */
-static enumerator_t* create_shared_enumerator(private_stroke_cred_t *this,
- shared_key_type_t type, identification_t *me,
- identification_t *other)
-{
- shared_data_t *data = malloc_thing(shared_data_t);
-
- data->this = this;
- data->me = me;
- data->other = other;
- data->type = type;
- this->lock->read_lock(this->lock);
- return enumerator_create_filter(this->shared->create_enumerator(this->shared),
- (void*)shared_filter, data,
- (void*)shared_data_destroy);
-}
-
-/**
- * Add a certificate to chain
- */
-static certificate_t* add_cert(private_stroke_cred_t *this, certificate_t *cert)
-{
- certificate_t *current;
- enumerator_t *enumerator;
- bool new = TRUE;
-
- this->lock->read_lock(this->lock);
- enumerator = this->certs->create_enumerator(this->certs);
- while (enumerator->enumerate(enumerator, (void**)&current))
- {
- if (current->equals(current, cert))
- {
- /* cert already in queue */
- cert->destroy(cert);
- cert = current;
- new = FALSE;
- break;
- }
- }
- enumerator->destroy(enumerator);
-
- if (new)
- {
- this->certs->insert_last(this->certs, cert);
- }
- this->lock->unlock(this->lock);
- return cert;
-}
-
-/**
-=======
->>>>>>> upstream/4.5.1
* Implementation of stroke_cred_t.load_ca.
*/
static certificate_t* load_ca(private_stroke_cred_t *this, char *filename)
@@ -368,92 +105,12 @@ static certificate_t* load_ca(private_stroke_cred_t *this, char *filename)
cert->destroy(cert);
return NULL;
}
-<<<<<<< HEAD
- return (certificate_t*)add_cert(this, cert);
-=======
return this->creds->add_cert_ref(this->creds, TRUE, cert);
->>>>>>> upstream/4.5.1
}
return NULL;
}
/**
-<<<<<<< HEAD
- * Add X.509 CRL to chain
- */
-static bool add_crl(private_stroke_cred_t *this, crl_t* crl)
-{
- certificate_t *current, *cert = &crl->certificate;
- enumerator_t *enumerator;
- bool new = TRUE, found = FALSE;
-
- this->lock->write_lock(this->lock);
- enumerator = this->certs->create_enumerator(this->certs);
- while (enumerator->enumerate(enumerator, (void**)&current))
- {
- if (current->get_type(current) == CERT_X509_CRL)
- {
- crl_t *crl_c = (crl_t*)current;
- chunk_t authkey = crl->get_authKeyIdentifier(crl);
- chunk_t authkey_c = crl_c->get_authKeyIdentifier(crl_c);
-
- /* if compare authorityKeyIdentifiers if available */
- if (authkey.ptr && authkey_c.ptr && chunk_equals(authkey, authkey_c))
- {
- found = TRUE;
- }
- else
- {
- identification_t *issuer = cert->get_issuer(cert);
- identification_t *issuer_c = current->get_issuer(current);
-
- /* otherwise compare issuer distinguished names */
- if (issuer->equals(issuer, issuer_c))
- {
- found = TRUE;
- }
- }
- if (found)
- {
- new = crl_is_newer(crl, crl_c);
- if (new)
- {
- this->certs->remove_at(this->certs, enumerator);
- }
- else
- {
- cert->destroy(cert);
- }
- break;
- }
- }
- }
- enumerator->destroy(enumerator);
-
- if (new)
- {
- this->certs->insert_last(this->certs, cert);
- }
- this->lock->unlock(this->lock);
- return new;
-}
-
-/**
- * Add X.509 attribute certificate to chain
- */
-static bool add_ac(private_stroke_cred_t *this, ac_t* ac)
-{
- certificate_t *cert = &ac->certificate;
-
- this->lock->write_lock(this->lock);
- this->certs->insert_last(this->certs, cert);
- this->lock->unlock(this->lock);
- return TRUE;
-}
-
-/**
-=======
->>>>>>> upstream/4.5.1
* Implementation of stroke_cred_t.load_peer.
*/
static certificate_t* load_peer(private_stroke_cred_t *this, char *filename)
@@ -476,17 +133,10 @@ static certificate_t* load_peer(private_stroke_cred_t *this, char *filename)
BUILD_END);
if (cert)
{
-<<<<<<< HEAD
- cert = add_cert(this, cert);
- DBG1(DBG_CFG, " loaded certificate \"%Y\" from '%s'",
- cert->get_subject(cert), filename);
- return cert->get_ref(cert);
-=======
cert = this->creds->add_cert_ref(this->creds, TRUE, cert);
DBG1(DBG_CFG, " loaded certificate \"%Y\" from '%s'",
cert->get_subject(cert), filename);
return cert;
->>>>>>> upstream/4.5.1
}
DBG1(DBG_CFG, " loading certificate from '%s' failed", filename);
return NULL;
@@ -541,13 +191,8 @@ static void load_certdir(private_stroke_cred_t *this, char *path,
}
else
{
-<<<<<<< HEAD
- DBG1(DBG_CFG, " loaded ca certificate \"%Y\" from '%s'",
- cert->get_subject(cert), file);
-=======
DBG1(DBG_CFG, " loaded ca certificate \"%Y\" "
"from '%s'", cert->get_subject(cert), file);
->>>>>>> upstream/4.5.1
}
}
else
@@ -575,11 +220,7 @@ static void load_certdir(private_stroke_cred_t *this, char *path,
}
if (cert)
{
-<<<<<<< HEAD
- add_cert(this, cert);
-=======
this->creds->add_cert(this->creds, TRUE, cert);
->>>>>>> upstream/4.5.1
}
break;
case CERT_X509_CRL:
@@ -589,11 +230,7 @@ static void load_certdir(private_stroke_cred_t *this, char *path,
BUILD_END);
if (cert)
{
-<<<<<<< HEAD
- add_crl(this, (crl_t*)cert);
-=======
this->creds->add_crl(this->creds, (crl_t*)cert);
->>>>>>> upstream/4.5.1
DBG1(DBG_CFG, " loaded crl from '%s'", file);
}
else
@@ -608,11 +245,7 @@ static void load_certdir(private_stroke_cred_t *this, char *path,
BUILD_END);
if (cert)
{
-<<<<<<< HEAD
- add_ac(this, (ac_t*)cert);
-=======
this->creds->add_cert(this->creds, FALSE, cert);
->>>>>>> upstream/4.5.1
DBG1(DBG_CFG, " loaded attribute certificate from '%s'",
file);
}
@@ -640,18 +273,14 @@ static void cache_cert(private_stroke_cred_t *this, certificate_t *cert)
crl_t *crl = (crl_t*)cert;
cert->get_ref(cert);
-<<<<<<< HEAD
- if (add_crl(this, crl))
-=======
if (this->creds->add_crl(this->creds, crl))
->>>>>>> upstream/4.5.1
{
char buf[BUF_LEN];
chunk_t chunk, hex;
chunk = crl->get_authKeyIdentifier(crl);
hex = chunk_to_hex(chunk, NULL, FALSE);
- snprintf(buf, sizeof(buf), "%s/%s.crl", CRL_DIR, hex);
+ snprintf(buf, sizeof(buf), "%s/%s.crl", CRL_DIR, hex.ptr);
free(hex.ptr);
if (cert->get_encoding(cert, CERT_ASN1_DER, &chunk))
@@ -889,7 +518,7 @@ static bool load_pin(private_stroke_cred_t *this, chunk_t line, int line_nr,
DBG1(DBG_CFG, "line %d: expected %%smartcard specifier", line_nr);
return FALSE;
}
- snprintf(smartcard, sizeof(smartcard), "%.*s", sc.len, sc.ptr);
+ snprintf(smartcard, sizeof(smartcard), "%.*s", (int)sc.len, sc.ptr);
smartcard[sizeof(smartcard) - 1] = '\0';
/* parse slot and key id. Three formats are supported:
@@ -907,7 +536,7 @@ static bool load_pin(private_stroke_cred_t *this, chunk_t line, int line_nr,
return FALSE;
}
*pos = '\0';
- strcpy(keyid, pos + 1);
+ strncpy(keyid, pos + 1, sizeof(keyid));
format = SC_FORMAT_SLOT_MODULE_KEYID;
}
else if (sscanf(smartcard, "%%smartcard%u:%s", &slot, keyid) == 2)
@@ -965,10 +594,6 @@ static bool load_pin(private_stroke_cred_t *this, chunk_t line, int line_nr,
}
/* unlock: smartcard needs the pin and potentially calls public set */
-<<<<<<< HEAD
- this->lock->unlock(this->lock);
-=======
->>>>>>> upstream/4.5.1
switch (format)
{
case SC_FORMAT_SLOT_MODULE_KEYID:
@@ -990,10 +615,6 @@ static bool load_pin(private_stroke_cred_t *this, chunk_t line, int line_nr,
BUILD_PKCS11_KEYID, chunk, BUILD_END);
break;
}
-<<<<<<< HEAD
- this->lock->write_lock(this->lock);
-=======
->>>>>>> upstream/4.5.1
if (mem)
{
lib->credmgr->remove_local_set(lib->credmgr, &mem->set);
@@ -1008,11 +629,7 @@ static bool load_pin(private_stroke_cred_t *this, chunk_t line, int line_nr,
if (key)
{
DBG1(DBG_CFG, " loaded private key from %.*s", sc.len, sc.ptr);
-<<<<<<< HEAD
- this->private->insert_last(this->private, key);
-=======
this->creds->add_key(this->creds, key);
->>>>>>> upstream/4.5.1
}
return TRUE;
}
@@ -1043,13 +660,13 @@ static bool load_private(private_stroke_cred_t *this, chunk_t line, int line_nr,
if (*filename.ptr == '/')
{
/* absolute path name */
- snprintf(path, sizeof(path), "%.*s", filename.len, filename.ptr);
+ snprintf(path, sizeof(path), "%.*s", (int)filename.len, filename.ptr);
}
else
{
/* relative path name */
snprintf(path, sizeof(path), "%s/%.*s", PRIVATE_KEY_DIR,
- filename.len, filename.ptr);
+ (int)filename.len, filename.ptr);
}
/* check for optional passphrase */
@@ -1083,16 +700,8 @@ static bool load_private(private_stroke_cred_t *this, chunk_t line, int line_nr,
cb = callback_cred_create_shared((void*)passphrase_cb, &pp_data);
lib->credmgr->add_local_set(lib->credmgr, &cb->set);
-<<<<<<< HEAD
- /* unlock, as the builder might ask for a secret */
- this->lock->unlock(this->lock);
key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, key_type,
BUILD_FROM_FILE, path, BUILD_END);
- this->lock->write_lock(this->lock);
-=======
- key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, key_type,
- BUILD_FROM_FILE, path, BUILD_END);
->>>>>>> upstream/4.5.1
lib->credmgr->remove_local_set(lib->credmgr, &cb->set);
cb->destroy(cb);
@@ -1108,16 +717,8 @@ static bool load_private(private_stroke_cred_t *this, chunk_t line, int line_nr,
mem->add_shared(mem, shared, NULL);
lib->credmgr->add_local_set(lib->credmgr, &mem->set);
-<<<<<<< HEAD
- /* unlock, as the builder might ask for a secret */
- this->lock->unlock(this->lock);
- key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, key_type,
- BUILD_FROM_FILE, path, BUILD_END);
- this->lock->write_lock(this->lock);
-=======
key = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, key_type,
BUILD_FROM_FILE, path, BUILD_END);
->>>>>>> upstream/4.5.1
lib->credmgr->remove_local_set(lib->credmgr, &mem->set);
mem->destroy(mem);
@@ -1126,11 +727,7 @@ static bool load_private(private_stroke_cred_t *this, chunk_t line, int line_nr,
{
DBG1(DBG_CFG, " loaded %N private key from '%s'",
key_type_names, key->get_type(key), path);
-<<<<<<< HEAD
- this->private->insert_last(this->private, key);
-=======
this->creds->add_key(this->creds, key);
->>>>>>> upstream/4.5.1
}
else
{
@@ -1145,12 +742,8 @@ static bool load_private(private_stroke_cred_t *this, chunk_t line, int line_nr,
static bool load_shared(private_stroke_cred_t *this, chunk_t line, int line_nr,
shared_key_type_t type, chunk_t ids)
{
-<<<<<<< HEAD
- stroke_shared_key_t *shared_key;
-=======
shared_key_t *shared_key;
linked_list_t *owners;
->>>>>>> upstream/4.5.1
chunk_t secret = chunk_empty;
bool any = TRUE;
@@ -1160,20 +753,12 @@ static bool load_shared(private_stroke_cred_t *this, chunk_t line, int line_nr,
DBG1(DBG_CFG, "line %d: malformed secret: %s", line_nr, ugh);
return FALSE;
}
-<<<<<<< HEAD
- shared_key = stroke_shared_key_create(type, secret);
-=======
shared_key = shared_key_create(type, secret);
->>>>>>> upstream/4.5.1
DBG1(DBG_CFG, " loaded %N secret for %s", shared_key_type_names, type,
ids.len > 0 ? (char*)ids.ptr : "%any");
DBG4(DBG_CFG, " secret: %#B", &secret);
-<<<<<<< HEAD
- this->shared->insert_last(this->shared, shared_key);
-=======
owners = linked_list_create();
->>>>>>> upstream/4.5.1
while (ids.len > 0)
{
chunk_t id;
@@ -1183,6 +768,8 @@ static bool load_shared(private_stroke_cred_t *this, chunk_t line, int line_nr,
if (ugh != NULL)
{
DBG1(DBG_CFG, "line %d: %s", line_nr, ugh);
+ shared_key->destroy(shared_key);
+ owners->destroy_offset(owners, offsetof(identification_t, destroy));
return FALSE;
}
if (id.len == 0)
@@ -1199,25 +786,15 @@ static bool load_shared(private_stroke_cred_t *this, chunk_t line, int line_nr,
continue;
}
-<<<<<<< HEAD
- shared_key->add_owner(shared_key, peer_id);
-=======
owners->insert_last(owners, peer_id);
->>>>>>> upstream/4.5.1
any = FALSE;
}
if (any)
{
-<<<<<<< HEAD
- shared_key->add_owner(shared_key,
- identification_create_from_encoding(ID_ANY, chunk_empty));
- }
-=======
owners->insert_last(owners,
identification_create_from_encoding(ID_ANY, chunk_empty));
}
this->creds->add_shared_list(this->creds, shared_key, owners);
->>>>>>> upstream/4.5.1
return TRUE;
}
@@ -1229,11 +806,6 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
{
int line_nr = 0, fd;
chunk_t src, line;
-<<<<<<< HEAD
- private_key_t *private;
- shared_key_t *shared;
-=======
->>>>>>> upstream/4.5.1
struct stat sb;
void *addr;
@@ -1262,25 +834,8 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
src = chunk_create(addr, sb.st_size);
if (level == 0)
-<<<<<<< HEAD
- {
- this->lock->write_lock(this->lock);
-
- /* flush secrets on non-recursive invocation */
- while (this->shared->remove_last(this->shared,
- (void**)&shared) == SUCCESS)
- {
- shared->destroy(shared);
- }
- while (this->private->remove_last(this->private,
- (void**)&private) == SUCCESS)
- {
- private->destroy(private);
- }
-=======
{ /* flush secrets on non-recursive invocation */
this->creds->clear_secrets(this->creds);
->>>>>>> upstream/4.5.1
}
while (fetchline(&src, &line))
@@ -1321,7 +876,8 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
DBG1(DBG_CFG, "include pattern too long, ignored");
continue;
}
- snprintf(pattern, sizeof(pattern), "%.*s", line.len, line.ptr);
+ snprintf(pattern, sizeof(pattern), "%.*s",
+ (int)line.len, line.ptr);
}
else
{ /* use directory of current file if relative */
@@ -1335,16 +891,12 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
continue;
}
snprintf(pattern, sizeof(pattern), "%s/%.*s",
- dir, line.len, line.ptr);
+ dir, (int)line.len, line.ptr);
free(dir);
}
if (glob(pattern, GLOB_ERR, NULL, &buf) != 0)
{
DBG1(DBG_CFG, "expanding file expression '%s' failed", pattern);
-<<<<<<< HEAD
- globfree(&buf);
-=======
->>>>>>> upstream/4.5.1
}
else
{
@@ -1412,13 +964,6 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
break;
}
}
-<<<<<<< HEAD
- if (level == 0)
- {
- this->lock->unlock(this->lock);
- }
-=======
->>>>>>> upstream/4.5.1
munmap(addr, sb.st_size);
close(fd);
}
@@ -1497,15 +1042,8 @@ static void reread(private_stroke_cred_t *this, stroke_msg_t *msg, FILE *prompt)
*/
static void destroy(private_stroke_cred_t *this)
{
-<<<<<<< HEAD
- this->certs->destroy_offset(this->certs, offsetof(certificate_t, destroy));
- this->shared->destroy_offset(this->shared, offsetof(shared_key_t, destroy));
- this->private->destroy_offset(this->private, offsetof(private_key_t, destroy));
- this->lock->destroy(this->lock);
-=======
lib->credmgr->remove_set(lib->credmgr, &this->creds->set);
this->creds->destroy(this->creds);
->>>>>>> upstream/4.5.1
free(this);
}
@@ -1516,15 +1054,9 @@ stroke_cred_t *stroke_cred_create()
{
private_stroke_cred_t *this = malloc_thing(private_stroke_cred_t);
-<<<<<<< HEAD
- this->public.set.create_private_enumerator = (void*)create_private_enumerator;
- this->public.set.create_cert_enumerator = (void*)create_cert_enumerator;
- this->public.set.create_shared_enumerator = (void*)create_shared_enumerator;
-=======
this->public.set.create_private_enumerator = (void*)return_null;
this->public.set.create_cert_enumerator = (void*)return_null;
this->public.set.create_shared_enumerator = (void*)return_null;
->>>>>>> upstream/4.5.1
this->public.set.create_cdp_enumerator = (void*)return_null;
this->public.set.cache_cert = (void*)cache_cert;
this->public.reread = (void(*)(stroke_cred_t*, stroke_msg_t *msg, FILE*))reread;
@@ -1533,15 +1065,8 @@ stroke_cred_t *stroke_cred_create()
this->public.cachecrl = (void(*)(stroke_cred_t*, bool enabled))cachecrl;
this->public.destroy = (void(*)(stroke_cred_t*))destroy;
-<<<<<<< HEAD
- this->certs = linked_list_create();
- this->shared = linked_list_create();
- this->private = linked_list_create();
- this->lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
-=======
this->creds = mem_cred_create();
lib->credmgr->add_set(lib->credmgr, &this->creds->set);
->>>>>>> upstream/4.5.1
load_certs(this);
load_secrets(this, SECRETS_FILE, 0, NULL);
diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c
index 9c71b2cd2..6c42f8f8a 100644
--- a/src/libcharon/plugins/stroke/stroke_list.c
+++ b/src/libcharon/plugins/stroke/stroke_list.c
@@ -388,15 +388,8 @@ static void log_auth_cfgs(FILE *out, peer_cfg_t *peer_cfg, bool local)
enumerator->destroy(enumerator);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_list_t.status.
- */
-static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bool all)
-=======
METHOD(stroke_list_t, status, void,
private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bool all)
->>>>>>> upstream/4.5.1
{
enumerator_t *enumerator, *children;
ike_cfg_t *ike_cfg;
@@ -409,7 +402,8 @@ METHOD(stroke_list_t, status, void,
if (all)
{
peer_cfg_t *peer_cfg;
- char *plugin, *pool;
+ plugin_t *plugin;
+ char *pool;
host_t *host;
u_int32_t dpd;
time_t since, now;
@@ -438,7 +432,7 @@ METHOD(stroke_list_t, status, void,
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
while (enumerator->enumerate(enumerator, &plugin))
{
- fprintf(out, "%s ", plugin);
+ fprintf(out, "%s ", plugin->get_name(plugin));
}
enumerator->destroy(enumerator);
fprintf(out, "\n");
@@ -761,11 +755,7 @@ static void stroke_list_certs(linked_list_t *list, char *label,
enumerator_t *enumerator;
identification_t *altName;
bool first_altName = TRUE;
-<<<<<<< HEAD
- int pathlen;
-=======
u_int pathlen;
->>>>>>> upstream/4.5.1
chunk_t serial, authkey;
time_t notBefore, notAfter;
public_key_t *public;
@@ -845,17 +835,10 @@ static void stroke_list_certs(linked_list_t *list, char *label,
}
/* list optional pathLenConstraint */
-<<<<<<< HEAD
- pathlen = x509->get_pathLenConstraint(x509);
- if (pathlen != X509_NO_PATH_LEN_CONSTRAINT)
- {
- fprintf(out, " pathlen: %d\n", pathlen);
-=======
pathlen = x509->get_constraint(x509, X509_PATH_LEN);
if (pathlen != X509_NO_CONSTRAINT)
{
fprintf(out, " pathlen: %u\n", pathlen);
->>>>>>> upstream/4.5.1
}
/* list optional ipAddrBlocks */
@@ -995,13 +978,10 @@ static void stroke_list_crls(linked_list_t *list, bool utc, FILE *out)
{
fprintf(out, " serial: %#B\n", &chunk);
}
-<<<<<<< HEAD
-=======
if (crl->is_delta_crl(crl, &chunk))
{
fprintf(out, " delta for: %#B\n", &chunk);
}
->>>>>>> upstream/4.5.1
/* count the number of revoked certificates */
{
@@ -1083,8 +1063,6 @@ static void stroke_list_ocsp(linked_list_t* list, bool utc, FILE *out)
}
/**
-<<<<<<< HEAD
-=======
* Print the name of an algorithm plus the name of the plugin that registered it
*/
static void print_alg(FILE *out, int *len, enum_name_t *alg_names, int alg_type,
@@ -1092,19 +1070,18 @@ static void print_alg(FILE *out, int *len, enum_name_t *alg_names, int alg_type,
{
char alg_name[BUF_LEN];
int alg_name_len;
-
+
alg_name_len = sprintf(alg_name, " %N[%s]", alg_names, alg_type, plugin_name);
if (*len + alg_name_len > CRYPTO_MAX_ALG_LINE)
{
fprintf(out, "\n ");
- *len = 13;
+ *len = 13;
}
fprintf(out, "%s", alg_name);
*len += alg_name_len;
}
/**
->>>>>>> upstream/4.5.1
* List of registered cryptographical algorithms
*/
static void list_algs(FILE *out)
@@ -1115,51 +1092,6 @@ static void list_algs(FILE *out)
hash_algorithm_t hash;
pseudo_random_function_t prf;
diffie_hellman_group_t group;
-<<<<<<< HEAD
-
- fprintf(out, "\n");
- fprintf(out, "List of registered IKEv2 Algorithms:\n");
- fprintf(out, "\n encryption: ");
- enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &encryption))
- {
- fprintf(out, "%N ", encryption_algorithm_names, encryption);
- }
- enumerator->destroy(enumerator);
- fprintf(out, "\n integrity: ");
- enumerator = lib->crypto->create_signer_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &integrity))
- {
- fprintf(out, "%N ", integrity_algorithm_names, integrity);
- }
- enumerator->destroy(enumerator);
- fprintf(out, "\n aead: ");
- enumerator = lib->crypto->create_aead_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &encryption))
- {
- fprintf(out, "%N ", encryption_algorithm_names, encryption);
- }
- enumerator->destroy(enumerator);
- fprintf(out, "\n hasher: ");
- enumerator = lib->crypto->create_hasher_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &hash))
- {
- fprintf(out, "%N ", hash_algorithm_names, hash);
- }
- enumerator->destroy(enumerator);
- fprintf(out, "\n prf: ");
- enumerator = lib->crypto->create_prf_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &prf))
- {
- fprintf(out, "%N ", pseudo_random_function_names, prf);
- }
- enumerator->destroy(enumerator);
- fprintf(out, "\n dh-group: ");
- enumerator = lib->crypto->create_dh_enumerator(lib->crypto);
- while (enumerator->enumerate(enumerator, &group))
- {
- fprintf(out, "%N ", diffie_hellman_group_names, group);
-=======
rng_quality_t quality;
const char *plugin_name;
int len;
@@ -1220,21 +1152,13 @@ static void list_algs(FILE *out)
while (enumerator->enumerate(enumerator, &quality, &plugin_name))
{
print_alg(out, &len, rng_quality_names, quality, plugin_name);
->>>>>>> upstream/4.5.1
}
enumerator->destroy(enumerator);
fprintf(out, "\n");
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_list_t.list.
- */
-static void list(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out)
-=======
METHOD(stroke_list_t, list, void,
private_stroke_list_t *this, stroke_msg_t *msg, FILE *out)
->>>>>>> upstream/4.5.1
{
linked_list_t *cert_list = NULL;
@@ -1337,15 +1261,8 @@ static void pool_leases(private_stroke_list_t *this, FILE *out, char *pool,
}
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_list_t.leases
- */
-static void leases(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out)
-=======
METHOD(stroke_list_t, leases, void,
private_stroke_list_t *this, stroke_msg_t *msg, FILE *out)
->>>>>>> upstream/4.5.1
{
enumerator_t *enumerator;
u_int size, offline, online;
@@ -1382,15 +1299,8 @@ METHOD(stroke_list_t, leases, void,
DESTROY_IF(address);
}
-<<<<<<< HEAD
-/**
- * Implementation of stroke_list_t.destroy
- */
-static void destroy(private_stroke_list_t *this)
-=======
METHOD(stroke_list_t, destroy, void,
private_stroke_list_t *this)
->>>>>>> upstream/4.5.1
{
free(this);
}
@@ -1400,17 +1310,6 @@ METHOD(stroke_list_t, destroy, void,
*/
stroke_list_t *stroke_list_create(stroke_attribute_t *attribute)
{
-<<<<<<< HEAD
- private_stroke_list_t *this = malloc_thing(private_stroke_list_t);
-
- this->public.list = (void(*)(stroke_list_t*, stroke_msg_t *msg, FILE *out))list;
- this->public.status = (void(*)(stroke_list_t*, stroke_msg_t *msg, FILE *out,bool))status;
- this->public.leases = (void(*)(stroke_list_t*, stroke_msg_t *msg, FILE *out))leases;
- this->public.destroy = (void(*)(stroke_list_t*))destroy;
-
- this->uptime = time_monotonic(NULL);
- this->attribute = attribute;
-=======
private_stroke_list_t *this;
INIT(this,
@@ -1424,7 +1323,6 @@ stroke_list_t *stroke_list_create(stroke_attribute_t *attribute)
.uptime = time_monotonic(NULL),
.attribute = attribute,
);
->>>>>>> upstream/4.5.1
return &this->public;
}
diff --git a/src/libcharon/plugins/stroke/stroke_plugin.c b/src/libcharon/plugins/stroke/stroke_plugin.c
index 81274b599..2884db4bf 100644
--- a/src/libcharon/plugins/stroke/stroke_plugin.c
+++ b/src/libcharon/plugins/stroke/stroke_plugin.c
@@ -36,15 +36,14 @@ struct private_stroke_plugin_t {
stroke_socket_t *socket;
};
-<<<<<<< HEAD
-/**
- * Implementation of stroke_plugin_t.destroy
- */
-static void destroy(private_stroke_plugin_t *this)
-=======
+METHOD(plugin_t, get_name, char*,
+ private_stroke_plugin_t *this)
+{
+ return "stroke";
+}
+
METHOD(plugin_t, destroy, void,
private_stroke_plugin_t *this)
->>>>>>> upstream/4.5.1
{
this->socket->destroy(this->socket);
free(this);
@@ -55,25 +54,19 @@ METHOD(plugin_t, destroy, void,
*/
plugin_t *stroke_plugin_create()
{
-<<<<<<< HEAD
- private_stroke_plugin_t *this = malloc_thing(private_stroke_plugin_t);
-
- this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
-
- this->socket = stroke_socket_create();
-=======
private_stroke_plugin_t *this;
INIT(this,
.public = {
.plugin = {
+ .get_name = _get_name,
+ .reload = (void*)return_false,
.destroy = _destroy,
},
},
.socket = stroke_socket_create(),
);
->>>>>>> upstream/4.5.1
if (this->socket == NULL)
{
free(this);
diff --git a/src/libcharon/plugins/stroke/stroke_socket.c b/src/libcharon/plugins/stroke/stroke_socket.c
index e9ed86d09..88d0270d8 100644
--- a/src/libcharon/plugins/stroke/stroke_socket.c
+++ b/src/libcharon/plugins/stroke/stroke_socket.c
@@ -122,7 +122,7 @@ static void pop_string(stroke_msg_t *msg, char **string)
/* check for sanity of string pointer and string */
if (string < (char**)msg ||
- string > (char**)msg + sizeof(stroke_msg_t) ||
+ string > (char**)((char*)msg + sizeof(stroke_msg_t)) ||
(unsigned long)*string < (unsigned long)((char*)msg->buffer - (char*)msg) ||
(unsigned long)*string > msg->length)
{
@@ -151,10 +151,7 @@ static void pop_end(stroke_msg_t *msg, const char* label, stroke_end_t *end)
pop_string(msg, &end->ca);
pop_string(msg, &end->ca2);
pop_string(msg, &end->groups);
-<<<<<<< HEAD
-=======
pop_string(msg, &end->cert_policy);
->>>>>>> upstream/4.5.1
pop_string(msg, &end->updown);
DBG2(DBG_CFG, " %s=%s", label, end->address);
@@ -250,8 +247,6 @@ static void stroke_terminate_srcip(private_stroke_socket_t *this,
}
/**
-<<<<<<< HEAD
-=======
* rekey a connection by name/id
*/
static void stroke_rekey(private_stroke_socket_t *this, stroke_msg_t *msg, FILE *out)
@@ -263,7 +258,6 @@ static void stroke_rekey(private_stroke_socket_t *this, stroke_msg_t *msg, FILE
}
/**
->>>>>>> upstream/4.5.1
* route a policy (install SPD entries)
*/
static void stroke_route(private_stroke_socket_t *this, stroke_msg_t *msg, FILE *out)
@@ -366,8 +360,6 @@ static void stroke_purge(private_stroke_socket_t *this,
{
lib->credmgr->flush_cache(lib->credmgr, CERT_X509_OCSP_RESPONSE);
}
-<<<<<<< HEAD
-=======
if (msg->purge.flags & PURGE_CRLS)
{
lib->credmgr->flush_cache(lib->credmgr, CERT_X509_CRL);
@@ -376,7 +368,6 @@ static void stroke_purge(private_stroke_socket_t *this,
{
lib->credmgr->flush_cache(lib->credmgr, CERT_X509);
}
->>>>>>> upstream/4.5.1
if (msg->purge.flags & PURGE_IKE)
{
this->control->purge_ike(this->control, msg, out);
@@ -405,7 +396,7 @@ static void stroke_export(private_stroke_socket_t *this,
{
if (cert->get_encoding(cert, CERT_PEM, &encoded))
{
- fprintf(out, "%.*s", encoded.len, encoded.ptr);
+ fprintf(out, "%.*s", (int)encoded.len, encoded.ptr);
free(encoded.ptr);
}
}
@@ -539,12 +530,9 @@ static job_requeue_t process(stroke_job_context_t *ctx)
case STR_TERMINATE_SRCIP:
stroke_terminate_srcip(this, msg, out);
break;
-<<<<<<< HEAD
-=======
case STR_REKEY:
stroke_rekey(this, msg, out);
break;
->>>>>>> upstream/4.5.1
case STR_STATUS:
stroke_status(this, msg, out, FALSE);
break;