aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/dhcp/dhcp_provider.c2
-rw-r--r--src/libcharon/plugins/stroke/stroke_attribute.c4
-rw-r--r--src/libcharon/sa/ikev1/tasks/mode_config.c11
-rw-r--r--src/libcharon/sa/ikev2/tasks/ike_config.c11
-rw-r--r--src/libhydra/attributes/attribute_manager.c12
-rw-r--r--src/libhydra/attributes/attribute_manager.h5
-rw-r--r--src/libhydra/attributes/attribute_provider.h5
-rw-r--r--src/libhydra/plugins/attr/attr_provider.c2
-rw-r--r--src/libhydra/plugins/attr_sql/sql_attribute.c16
9 files changed, 42 insertions, 26 deletions
diff --git a/src/libcharon/plugins/dhcp/dhcp_provider.c b/src/libcharon/plugins/dhcp/dhcp_provider.c
index 705063493..3d72b4435 100644
--- a/src/libcharon/plugins/dhcp/dhcp_provider.c
+++ b/src/libcharon/plugins/dhcp/dhcp_provider.c
@@ -129,7 +129,7 @@ METHOD(attribute_provider_t, release_address, bool,
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_dhcp_provider_t *this, char *pool, identification_t *id,
+ private_dhcp_provider_t *this, linked_list_t *pools, identification_t *id,
linked_list_t *vips)
{
dhcp_transaction_t *transaction = NULL;
diff --git a/src/libcharon/plugins/stroke/stroke_attribute.c b/src/libcharon/plugins/stroke/stroke_attribute.c
index cec6334ed..3e012230a 100644
--- a/src/libcharon/plugins/stroke/stroke_attribute.c
+++ b/src/libcharon/plugins/stroke/stroke_attribute.c
@@ -148,8 +148,8 @@ static bool attr_filter(void *lock, host_t **in,
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_stroke_attribute_t *this, char *pool, identification_t *id,
- linked_list_t *vips)
+ private_stroke_attribute_t *this, linked_list_t *pools,
+ identification_t *id, linked_list_t *vips)
{
ike_sa_t *ike_sa;
peer_cfg_t *peer_cfg;
diff --git a/src/libcharon/sa/ikev1/tasks/mode_config.c b/src/libcharon/sa/ikev1/tasks/mode_config.c
index 6b8ed079b..ecf2e627a 100644
--- a/src/libcharon/sa/ikev1/tasks/mode_config.c
+++ b/src/libcharon/sa/ikev1/tasks/mode_config.c
@@ -326,7 +326,7 @@ METHOD(task_t, build_r, status_t,
cp_payload_t *cp = NULL;
peer_cfg_t *config;
identification_t *id;
- linked_list_t *vips;
+ linked_list_t *vips, *pools;
char *pool;
id = this->ike_sa->get_other_eap_id(this->ike_sa);
@@ -365,8 +365,14 @@ METHOD(task_t, build_r, status_t,
{
vips->insert_last(vips, vip);
}
+ pools = linked_list_create();
+ /* TODO: use list of all pools */
+ if (pool)
+ {
+ pools->insert_last(pools, pool);
+ }
enumerator = hydra->attributes->create_responder_enumerator(
- hydra->attributes, pool, id, vips);
+ hydra->attributes, pools, id, vips);
while (enumerator->enumerate(enumerator, &type, &value))
{
if (!cp)
@@ -381,6 +387,7 @@ METHOD(task_t, build_r, status_t,
}
enumerator->destroy(enumerator);
vips->destroy(vips);
+ pools->destroy(pools);
if (cp)
{
diff --git a/src/libcharon/sa/ikev2/tasks/ike_config.c b/src/libcharon/sa/ikev2/tasks/ike_config.c
index f3c0c2ffc..d0e0285c2 100644
--- a/src/libcharon/sa/ikev2/tasks/ike_config.c
+++ b/src/libcharon/sa/ikev2/tasks/ike_config.c
@@ -338,7 +338,7 @@ METHOD(task_t, build_r, status_t,
cp_payload_t *cp = NULL;
peer_cfg_t *config;
identification_t *id;
- linked_list_t *vips;
+ linked_list_t *vips, *pools;
char *pool;
id = this->ike_sa->get_other_eap_id(this->ike_sa);
@@ -381,8 +381,14 @@ METHOD(task_t, build_r, status_t,
{
vips->insert_last(vips, vip);
}
+ pools = linked_list_create();
+ /* TODO: use list of all pools */
+ if (pool)
+ {
+ pools->insert_last(pools, pool);
+ }
enumerator = hydra->attributes->create_responder_enumerator(
- hydra->attributes, pool, id, vips);
+ hydra->attributes, pools, id, vips);
while (enumerator->enumerate(enumerator, &type, &value))
{
if (!cp)
@@ -397,6 +403,7 @@ METHOD(task_t, build_r, status_t,
}
enumerator->destroy(enumerator);
vips->destroy(vips);
+ pools->destroy(pools);
if (cp)
{
diff --git a/src/libhydra/attributes/attribute_manager.c b/src/libhydra/attributes/attribute_manager.c
index b1c2c9555..a2ee773bd 100644
--- a/src/libhydra/attributes/attribute_manager.c
+++ b/src/libhydra/attributes/attribute_manager.c
@@ -51,8 +51,8 @@ struct private_attribute_manager_t {
* Data to pass to enumerator filters
*/
typedef struct {
- /** attribute group pool */
- char *pool;
+ /** attribute group pools */
+ linked_list_t *pools;
/** server/peer identity */
identification_t *id;
/** requesting/assigned virtual IPs */
@@ -117,18 +117,18 @@ METHOD(attribute_manager_t, release_address, bool,
static enumerator_t *responder_enum_create(attribute_provider_t *provider,
enum_data_t *data)
{
- return provider->create_attribute_enumerator(provider, data->pool,
+ return provider->create_attribute_enumerator(provider, data->pools,
data->id, data->vips);
}
METHOD(attribute_manager_t, create_responder_enumerator, enumerator_t*,
- private_attribute_manager_t *this, char *pool, identification_t *id,
- linked_list_t *vips)
+ private_attribute_manager_t *this, linked_list_t *pools,
+ identification_t *id, linked_list_t *vips)
{
enum_data_t *data;
INIT(data,
- .pool = pool,
+ .pools = pools,
.id = id,
.vips = vips,
);
diff --git a/src/libhydra/attributes/attribute_manager.h b/src/libhydra/attributes/attribute_manager.h
index 385580e56..8bc80ca11 100644
--- a/src/libhydra/attributes/attribute_manager.h
+++ b/src/libhydra/attributes/attribute_manager.h
@@ -62,13 +62,14 @@ struct attribute_manager_t {
/**
* Create an enumerator over attributes to hand out to a peer.
*
- * @param pool pool name to get attributes from
+ * @param pool list of pools names (char*) to query attributes from
* @param id peer identity to hand out attributes to
* @param vip list of virtual IPs (host_t*) to assign to peer
* @return enumerator (configuration_attribute_type_t, chunk_t)
*/
enumerator_t* (*create_responder_enumerator)(attribute_manager_t *this,
- char *pool, identification_t *id, linked_list_t *vips);
+ linked_list_t *pool, identification_t *id,
+ linked_list_t *vips);
/**
* Register an attribute provider to the manager.
diff --git a/src/libhydra/attributes/attribute_provider.h b/src/libhydra/attributes/attribute_provider.h
index 104e5ca29..327135ffe 100644
--- a/src/libhydra/attributes/attribute_provider.h
+++ b/src/libhydra/attributes/attribute_provider.h
@@ -57,13 +57,14 @@ struct attribute_provider_t {
/**
* Create an enumerator over attributes to hand out to a peer.
*
- * @param pool pool name to get attributes from
+ * @param pool list of pools names (char*) to query attributes from
* @param id peer ID
* @param vip list of virtual IPs (host_t*) to assign to peer
* @return enumerator (configuration_attribute_type_t, chunk_t)
*/
enumerator_t* (*create_attribute_enumerator)(attribute_provider_t *this,
- char *pool, identification_t *id, linked_list_t *vips);
+ linked_list_t *pools, identification_t *id,
+ linked_list_t *vips);
};
#endif /** ATTRIBUTE_PROVIDER_H_ @}*/
diff --git a/src/libhydra/plugins/attr/attr_provider.c b/src/libhydra/plugins/attr/attr_provider.c
index f81f643b0..673c72116 100644
--- a/src/libhydra/plugins/attr/attr_provider.c
+++ b/src/libhydra/plugins/attr/attr_provider.c
@@ -77,7 +77,7 @@ static bool attr_enum_filter(void *null, attribute_entry_t **in,
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_attr_provider_t *this, char *pool,
+ private_attr_provider_t *this, linked_list_t *pools,
identification_t *id, linked_list_t *vips)
{
if (vips->get_count(vips))
diff --git a/src/libhydra/plugins/attr_sql/sql_attribute.c b/src/libhydra/plugins/attr_sql/sql_attribute.c
index b0f8c166d..e5a4cdc5e 100644
--- a/src/libhydra/plugins/attr_sql/sql_attribute.c
+++ b/src/libhydra/plugins/attr_sql/sql_attribute.c
@@ -339,14 +339,14 @@ METHOD(attribute_provider_t, release_address, bool,
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_sql_attribute_t *this, char *names, identification_t *id,
+ private_sql_attribute_t *this, linked_list_t *pools, identification_t *id,
linked_list_t *vips)
{
enumerator_t *attr_enumerator = NULL;
if (vips->get_count(vips))
{
- enumerator_t *names_enumerator;
+ enumerator_t *pool_enumerator;
u_int count;
char *name;
@@ -357,8 +357,8 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
{
u_int identity = get_identity(this, id);
- names_enumerator = enumerator_create_token(names, ",", " ");
- while (names_enumerator->enumerate(names_enumerator, &name))
+ pool_enumerator = pools->create_enumerator(pools);
+ while (pool_enumerator->enumerate(pool_enumerator, &name))
{
u_int attr_pool = get_attr_pool(this, name);
if (!attr_pool)
@@ -385,14 +385,14 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
DESTROY_IF(attr_enumerator);
attr_enumerator = NULL;
}
- names_enumerator->destroy(names_enumerator);
+ pool_enumerator->destroy(pool_enumerator);
}
/* in a second step check for attributes that match name */
if (!attr_enumerator)
{
- names_enumerator = enumerator_create_token(names, ",", " ");
- while (names_enumerator->enumerate(names_enumerator, &name))
+ pool_enumerator = pools->create_enumerator(pools);
+ while (pool_enumerator->enumerate(pool_enumerator, &name))
{
u_int attr_pool = get_attr_pool(this, name);
if (!attr_pool)
@@ -419,7 +419,7 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
DESTROY_IF(attr_enumerator);
attr_enumerator = NULL;
}
- names_enumerator->destroy(names_enumerator);
+ pool_enumerator->destroy(pool_enumerator);
}
this->db->execute(this->db, NULL, "END TRANSACTION");