summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/unity
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2017-05-30 20:59:31 +0200
committerYves-Alexis Perez <corsac@corsac.net>2017-05-30 20:59:31 +0200
commitbba25e2ff6c4a193acb54560ea4417537bd2954e (patch)
tree9e074fe343f9ab6f5ce1e9c5142d9a6cf180fcda /src/libcharon/plugins/unity
parent05ddd767992d68bb38c7f16ece142e8c2e9ae016 (diff)
downloadvyos-strongswan-bba25e2ff6c4a193acb54560ea4417537bd2954e.tar.gz
vyos-strongswan-bba25e2ff6c4a193acb54560ea4417537bd2954e.zip
New upstream version 5.5.3
Diffstat (limited to 'src/libcharon/plugins/unity')
-rw-r--r--src/libcharon/plugins/unity/Makefile.in2
-rw-r--r--src/libcharon/plugins/unity/unity_handler.c39
-rw-r--r--src/libcharon/plugins/unity/unity_provider.c10
3 files changed, 32 insertions, 19 deletions
diff --git a/src/libcharon/plugins/unity/Makefile.in b/src/libcharon/plugins/unity/Makefile.in
index 6811eb737..245bbd471 100644
--- a/src/libcharon/plugins/unity/Makefile.in
+++ b/src/libcharon/plugins/unity/Makefile.in
@@ -357,6 +357,7 @@ docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
fips_mode = @fips_mode@
+fuzz_plugins = @fuzz_plugins@
gtk_CFLAGS = @gtk_CFLAGS@
gtk_LIBS = @gtk_LIBS@
host = @host@
@@ -379,6 +380,7 @@ json_CFLAGS = @json_CFLAGS@
json_LIBS = @json_LIBS@
libdir = @libdir@
libexecdir = @libexecdir@
+libfuzzer = @libfuzzer@
libiptc_CFLAGS = @libiptc_CFLAGS@
libiptc_LIBS = @libiptc_LIBS@
linux_headers = @linux_headers@
diff --git a/src/libcharon/plugins/unity/unity_handler.c b/src/libcharon/plugins/unity/unity_handler.c
index 25e0756b7..4a1478c6d 100644
--- a/src/libcharon/plugins/unity/unity_handler.c
+++ b/src/libcharon/plugins/unity/unity_handler.c
@@ -368,9 +368,12 @@ typedef struct {
} attribute_enumerator_t;
METHOD(enumerator_t, enumerate_attributes, bool,
- attribute_enumerator_t *this, configuration_attribute_type_t *type,
- chunk_t *data)
+ attribute_enumerator_t *this, va_list args)
{
+ configuration_attribute_type_t *type;
+ chunk_t *data;
+
+ VA_ARGS_VGET(args, type, data);
if (this->i < countof(attributes))
{
*type = attributes[this->i++];
@@ -393,7 +396,8 @@ METHOD(attribute_handler_t, create_attribute_enumerator, enumerator_t *,
}
INIT(enumerator,
.public = {
- .enumerate = (void*)_enumerate_attributes,
+ .enumerate = enumerator_enumerate_default,
+ .venumerate = _enumerate_attributes,
.destroy = (void*)free,
},
);
@@ -407,24 +411,27 @@ typedef struct {
ike_sa_id_t *id;
} include_filter_t;
-/**
- * Include enumerator filter function
- */
-static bool include_filter(include_filter_t *data,
- entry_t **entry, traffic_selector_t **ts)
+CALLBACK(include_filter, bool,
+ include_filter_t *data, enumerator_t *orig, va_list args)
{
- if (data->id->equals(data->id, (*entry)->id))
+ entry_t *entry;
+ traffic_selector_t **ts;
+
+ VA_ARGS_VGET(args, ts);
+
+ while (orig->enumerate(orig, &entry))
{
- *ts = (*entry)->ts;
- return TRUE;
+ if (data->id->equals(data->id, entry->id))
+ {
+ *ts = entry->ts;
+ return TRUE;
+ }
}
return FALSE;
}
-/**
- * Destroy include filter data, unlock mutex
- */
-static void destroy_filter(include_filter_t *data)
+CALLBACK(destroy_filter, void,
+ include_filter_t *data)
{
data->mutex->unlock(data->mutex);
free(data);
@@ -442,7 +449,7 @@ METHOD(unity_handler_t, create_include_enumerator, enumerator_t*,
data->mutex->lock(data->mutex);
return enumerator_create_filter(
this->include->create_enumerator(this->include),
- (void*)include_filter, data, (void*)destroy_filter);
+ include_filter, data, destroy_filter);
}
METHOD(unity_handler_t, destroy, void,
diff --git a/src/libcharon/plugins/unity/unity_provider.c b/src/libcharon/plugins/unity/unity_provider.c
index 07f5f9b61..b6a55648e 100644
--- a/src/libcharon/plugins/unity/unity_provider.c
+++ b/src/libcharon/plugins/unity/unity_provider.c
@@ -77,12 +77,15 @@ static void append_ts(bio_writer_t *writer, traffic_selector_t *ts)
}
METHOD(enumerator_t, attribute_enumerate, bool,
- attribute_enumerator_t *this, configuration_attribute_type_t *type,
- chunk_t *attr)
+ attribute_enumerator_t *this, va_list args)
{
+ configuration_attribute_type_t *type;
+ chunk_t *attr;
traffic_selector_t *ts;
bio_writer_t *writer;
+ VA_ARGS_VGET(args, type, attr);
+
if (this->list->get_count(this->list) == 0)
{
return FALSE;
@@ -183,7 +186,8 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
INIT(attr_enum,
.public = {
- .enumerate = (void*)_attribute_enumerate,
+ .enumerate = enumerator_enumerate_default,
+ .venumerate = _attribute_enumerate,
.destroy = _attribute_destroy,
},
.list = list,