summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/uci
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/plugins/uci')
-rw-r--r--src/libcharon/plugins/uci/Makefile.in2
-rw-r--r--src/libcharon/plugins/uci/uci_config.c16
-rw-r--r--src/libcharon/plugins/uci/uci_creds.c10
-rw-r--r--src/libcharon/plugins/uci/uci_parser.c17
4 files changed, 29 insertions, 16 deletions
diff --git a/src/libcharon/plugins/uci/Makefile.in b/src/libcharon/plugins/uci/Makefile.in
index 64b4bca24..46f4e4f85 100644
--- a/src/libcharon/plugins/uci/Makefile.in
+++ b/src/libcharon/plugins/uci/Makefile.in
@@ -356,6 +356,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@
@@ -378,6 +379,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/uci/uci_config.c b/src/libcharon/plugins/uci/uci_config.c
index e0578fe9b..dcd4ae348 100644
--- a/src/libcharon/plugins/uci/uci_config.c
+++ b/src/libcharon/plugins/uci/uci_config.c
@@ -118,11 +118,12 @@ static u_int create_rekey(char *string)
}
METHOD(enumerator_t, peer_enumerator_enumerate, bool,
- peer_enumerator_t *this, peer_cfg_t **cfg)
+ peer_enumerator_t *this, va_list args)
{
char *name, *ike_proposal, *esp_proposal, *ike_rekey, *esp_rekey;
char *local_id, *local_addr, *local_net;
char *remote_id, *remote_addr, *remote_net;
+ peer_cfg_t **cfg;
child_cfg_t *child_cfg;
ike_cfg_t *ike_cfg;
auth_cfg_t *auth;
@@ -145,6 +146,8 @@ METHOD(enumerator_t, peer_enumerator_enumerate, bool,
.mode = MODE_TUNNEL,
};
+ VA_ARGS_VGET(args, cfg);
+
/* defaults */
name = "unnamed";
local_id = NULL;
@@ -212,7 +215,8 @@ METHOD(backend_t, create_peer_cfg_enumerator, enumerator_t*,
INIT(e,
.public = {
- .enumerate = (void*)_peer_enumerator_enumerate,
+ .enumerate = enumerator_enumerate_default,
+ .venumerate = _peer_enumerator_enumerate,
.destroy = _peer_enumerator_destroy,
},
.inner = this->parser->create_section_enumerator(this->parser,
@@ -241,10 +245,13 @@ typedef struct {
} ike_enumerator_t;
METHOD(enumerator_t, ike_enumerator_enumerate, bool,
- ike_enumerator_t *this, ike_cfg_t **cfg)
+ ike_enumerator_t *this, va_list args)
{
+ ike_cfg_t **cfg;
char *local_addr, *remote_addr, *ike_proposal;
+ VA_ARGS_VGET(args, cfg);
+
/* defaults */
local_addr = "0.0.0.0";
remote_addr = "0.0.0.0";
@@ -282,7 +289,8 @@ METHOD(backend_t, create_ike_cfg_enumerator, enumerator_t*,
INIT(e,
.public = {
- .enumerate = (void*)_ike_enumerator_enumerate,
+ .enumerate = enumerator_enumerate_default,
+ .venumerate = _ike_enumerator_enumerate,
.destroy = _ike_enumerator_destroy,
},
.inner = this->parser->create_section_enumerator(this->parser,
diff --git a/src/libcharon/plugins/uci/uci_creds.c b/src/libcharon/plugins/uci/uci_creds.c
index f5d5ace70..404a3e39f 100644
--- a/src/libcharon/plugins/uci/uci_creds.c
+++ b/src/libcharon/plugins/uci/uci_creds.c
@@ -52,12 +52,15 @@ typedef struct {
} shared_enumerator_t;
METHOD(enumerator_t, shared_enumerator_enumerate, bool,
- shared_enumerator_t *this, shared_key_t **key, id_match_t *me,
- id_match_t *other)
+ shared_enumerator_t *this, va_list args)
{
+ shared_key_t **key;
+ id_match_t *me, *other;
char *local_id, *remote_id, *psk;
identification_t *local, *remote;
+ VA_ARGS_VGET(args, key, me, other);
+
while (TRUE)
{
/* defaults */
@@ -126,7 +129,8 @@ METHOD(credential_set_t, create_shared_enumerator, enumerator_t*,
INIT(e,
.public = {
- .enumerate = (void*)_shared_enumerator_enumerate,
+ .enumerate = enumerator_enumerate_default,
+ .venumerate = _shared_enumerator_enumerate,
.destroy = _shared_enumerator_destroy,
},
.me = me,
diff --git a/src/libcharon/plugins/uci/uci_parser.c b/src/libcharon/plugins/uci/uci_parser.c
index 2429e9e44..e847dd393 100644
--- a/src/libcharon/plugins/uci/uci_parser.c
+++ b/src/libcharon/plugins/uci/uci_parser.c
@@ -58,11 +58,10 @@ typedef struct {
} section_enumerator_t;
METHOD(enumerator_t, section_enumerator_enumerate, bool,
- section_enumerator_t *this, ...)
+ section_enumerator_t *this, va_list args)
{
struct uci_element *element;
char **value;
- va_list args;
int i;
if (&this->current->list == this->list)
@@ -70,8 +69,6 @@ METHOD(enumerator_t, section_enumerator_enumerate, bool,
return FALSE;
}
- va_start(args, this);
-
value = va_arg(args, char**);
if (value)
{
@@ -96,7 +93,6 @@ METHOD(enumerator_t, section_enumerator_enumerate, bool,
*value = uci_to_option(element)->value;
}
}
- va_end(args);
this->current = list_to_element(this->current->list.next);
return TRUE;
@@ -124,7 +120,13 @@ METHOD(uci_parser_t, create_section_enumerator, enumerator_t*,
i++;
}
va_end(args);
- e = malloc(sizeof(section_enumerator_t) + sizeof(char*) * i);
+ INIT_EXTRA(e, sizeof(char*) * i,
+ .public = {
+ .enumerate = enumerator_enumerate_default,
+ .venumerate = _section_enumerator_enumerate,
+ .destroy = _section_enumerator_destroy,
+ },
+ );
i = 0;
va_start(args, this);
do
@@ -134,9 +136,6 @@ METHOD(uci_parser_t, create_section_enumerator, enumerator_t*,
while (e->keywords[i++]);
va_end(args);
- e->public.enumerate = (void*)_section_enumerator_enumerate;
- e->public.destroy = _section_enumerator_destroy;
-
/* load uci context */
e->ctx = uci_alloc_context();
if (uci_load(e->ctx, this->package, &e->package) != UCI_OK)