Migrate all enumerators to venumerate() interface change
This commit is contained in:
@@ -112,15 +112,15 @@ static bool fetch_cert(wrapper_enumerator_t *enumerator,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* enumerate function for wrapper_enumerator_t
|
||||
*/
|
||||
static bool enumerate(wrapper_enumerator_t *this, certificate_t **cert)
|
||||
METHOD(enumerator_t, enumerate, bool,
|
||||
wrapper_enumerator_t *this, va_list args)
|
||||
{
|
||||
auth_rule_t rule;
|
||||
certificate_t *current;
|
||||
certificate_t *current, **cert;
|
||||
public_key_t *public;
|
||||
|
||||
VA_ARGS_VGET(args, cert);
|
||||
|
||||
while (this->inner->enumerate(this->inner, &rule, ¤t))
|
||||
{
|
||||
if (rule == AUTH_HELPER_IM_HASH_URL ||
|
||||
@@ -164,10 +164,8 @@ static bool enumerate(wrapper_enumerator_t *this, certificate_t **cert)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* destroy function for wrapper_enumerator_t
|
||||
*/
|
||||
static void wrapper_enumerator_destroy(wrapper_enumerator_t *this)
|
||||
METHOD(enumerator_t, wrapper_enumerator_destroy, void,
|
||||
wrapper_enumerator_t *this)
|
||||
{
|
||||
this->inner->destroy(this->inner);
|
||||
free(this);
|
||||
@@ -183,14 +181,18 @@ METHOD(credential_set_t, create_enumerator, enumerator_t*,
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
enumerator = malloc_thing(wrapper_enumerator_t);
|
||||
enumerator->auth = this->auth;
|
||||
enumerator->cert = cert;
|
||||
enumerator->key = key;
|
||||
enumerator->id = id;
|
||||
enumerator->inner = this->auth->create_enumerator(this->auth);
|
||||
enumerator->public.enumerate = (void*)enumerate;
|
||||
enumerator->public.destroy = (void*)wrapper_enumerator_destroy;
|
||||
INIT(enumerator,
|
||||
.public = {
|
||||
.enumerate = enumerator_enumerate_default,
|
||||
.venumerate = _enumerate,
|
||||
.destroy = _wrapper_enumerator_destroy,
|
||||
},
|
||||
.auth = this->auth,
|
||||
.cert = cert,
|
||||
.key = key,
|
||||
.id = id,
|
||||
.inner = this->auth->create_enumerator(this->auth),
|
||||
);
|
||||
return &enumerator->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +60,12 @@ typedef struct {
|
||||
} shared_enumerator_t;
|
||||
|
||||
METHOD(enumerator_t, shared_enumerate, bool,
|
||||
shared_enumerator_t *this, shared_key_t **out,
|
||||
id_match_t *match_me, id_match_t *match_other)
|
||||
shared_enumerator_t *this, va_list args)
|
||||
{
|
||||
shared_key_t **out;
|
||||
id_match_t *match_me, *match_other;
|
||||
|
||||
VA_ARGS_VGET(args, out, match_me, match_other);
|
||||
DESTROY_IF(this->current);
|
||||
this->current = this->this->cb.shared(this->this->data, this->type,
|
||||
this->me, this->other, match_me, match_other);
|
||||
@@ -89,7 +92,8 @@ METHOD(credential_set_t, create_shared_enumerator, enumerator_t*,
|
||||
|
||||
INIT(enumerator,
|
||||
.public = {
|
||||
.enumerate = (void*)_shared_enumerate,
|
||||
.enumerate = enumerator_enumerate_default,
|
||||
.venumerate = _shared_enumerate,
|
||||
.destroy = _shared_destroy,
|
||||
},
|
||||
.this = this,
|
||||
|
||||
@@ -252,13 +252,14 @@ typedef struct {
|
||||
int locked;
|
||||
} cert_enumerator_t;
|
||||
|
||||
/**
|
||||
* filter function for certs enumerator
|
||||
*/
|
||||
static bool cert_enumerate(cert_enumerator_t *this, certificate_t **out)
|
||||
METHOD(enumerator_t, cert_enumerate, bool,
|
||||
cert_enumerator_t *this, va_list args)
|
||||
{
|
||||
public_key_t *public;
|
||||
relation_t *rel;
|
||||
certificate_t **out;
|
||||
|
||||
VA_ARGS_VGET(args, out);
|
||||
|
||||
if (this->locked >= 0)
|
||||
{
|
||||
@@ -311,10 +312,8 @@ static bool cert_enumerate(cert_enumerator_t *this, certificate_t **out)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clean up enumeration data
|
||||
*/
|
||||
static void cert_enumerator_destroy(cert_enumerator_t *this)
|
||||
METHOD(enumerator_t, cert_enumerator_destroy, void,
|
||||
cert_enumerator_t *this)
|
||||
{
|
||||
relation_t *rel;
|
||||
|
||||
@@ -336,16 +335,19 @@ METHOD(credential_set_t, create_enumerator, enumerator_t*,
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
enumerator = malloc_thing(cert_enumerator_t);
|
||||
enumerator->public.enumerate = (void*)cert_enumerate;
|
||||
enumerator->public.destroy = (void*)cert_enumerator_destroy;
|
||||
enumerator->cert = cert;
|
||||
enumerator->key = key;
|
||||
enumerator->id = id;
|
||||
enumerator->relations = this->relations;
|
||||
enumerator->index = -1;
|
||||
enumerator->locked = -1;
|
||||
|
||||
INIT(enumerator,
|
||||
.public = {
|
||||
.enumerate = enumerator_enumerate_default,
|
||||
.venumerate = _cert_enumerate,
|
||||
.destroy = _cert_enumerator_destroy,
|
||||
},
|
||||
.cert = cert,
|
||||
.key = key,
|
||||
.id = id,
|
||||
.relations = this->relations,
|
||||
.index = -1,
|
||||
.locked = -1,
|
||||
);
|
||||
return &enumerator->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,14 +49,15 @@ typedef struct {
|
||||
identification_t *id;
|
||||
} wrapper_enumerator_t;
|
||||
|
||||
/**
|
||||
* enumerate function wrapper_enumerator_t
|
||||
*/
|
||||
static bool enumerate(wrapper_enumerator_t *this, certificate_t **cert)
|
||||
METHOD(enumerator_t, enumerate, bool,
|
||||
wrapper_enumerator_t *this, va_list args)
|
||||
{
|
||||
certificate_t *current;
|
||||
certificate_t *current, **cert;
|
||||
public_key_t *public;
|
||||
|
||||
|
||||
VA_ARGS_VGET(args, cert);
|
||||
|
||||
while (this->inner->enumerate(this->inner, ¤t))
|
||||
{
|
||||
if (this->cert != CERT_ANY && this->cert != current->get_type(current))
|
||||
@@ -85,10 +86,8 @@ static bool enumerate(wrapper_enumerator_t *this, certificate_t **cert)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* destroy function for wrapper_enumerator_t
|
||||
*/
|
||||
static void enumerator_destroy(wrapper_enumerator_t *this)
|
||||
METHOD(enumerator_t, enumerator_destroy, void,
|
||||
wrapper_enumerator_t *this)
|
||||
{
|
||||
this->inner->destroy(this->inner);
|
||||
free(this);
|
||||
@@ -105,13 +104,17 @@ METHOD(credential_set_t, create_enumerator, enumerator_t*,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
enumerator = malloc_thing(wrapper_enumerator_t);
|
||||
enumerator->cert = cert;
|
||||
enumerator->key = key;
|
||||
enumerator->id = id;
|
||||
enumerator->inner = this->response->create_cert_enumerator(this->response);
|
||||
enumerator->public.enumerate = (void*)enumerate;
|
||||
enumerator->public.destroy = (void*)enumerator_destroy;
|
||||
INIT(enumerator,
|
||||
.public = {
|
||||
.enumerate = enumerator_enumerate_default,
|
||||
.venumerate = _enumerate,
|
||||
.destroy = _enumerator_destroy,
|
||||
},
|
||||
.cert = cert,
|
||||
.key = key,
|
||||
.id = id,
|
||||
.inner = this->response->create_cert_enumerator(this->response),
|
||||
);
|
||||
return &enumerator->public;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user