diff options
author | Martin Willi <martin@strongswan.org> | 2008-12-05 09:40:50 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-12-05 09:40:50 +0000 |
commit | 876d5c63a31258a99afd5652deb5e4a2a13c3aea (patch) | |
tree | 2c556be6f55e88748fc8965ae11755ccd04add1e | |
parent | c333bb46785698b3be17745eab75e050301e1e2c (diff) | |
download | strongswan-876d5c63a31258a99afd5652deb5e4a2a13c3aea.tar.bz2 strongswan-876d5c63a31258a99afd5652deb5e4a2a13c3aea.tar.xz |
pass identity to release_address(), allows providers to do a lookup by id
-rw-r--r-- | src/charon/config/attributes/attribute_manager.c | 6 | ||||
-rw-r--r-- | src/charon/config/attributes/attribute_manager.h | 3 | ||||
-rw-r--r-- | src/charon/config/attributes/attribute_provider.h | 3 | ||||
-rw-r--r-- | src/charon/plugins/sql/sql_attribute.c | 4 | ||||
-rw-r--r-- | src/charon/plugins/stroke/stroke_attribute.c | 4 | ||||
-rw-r--r-- | src/charon/plugins/unit_tester/tests/test_pool.c | 2 | ||||
-rw-r--r-- | src/charon/sa/ike_sa.c | 2 |
7 files changed, 13 insertions, 11 deletions
diff --git a/src/charon/config/attributes/attribute_manager.c b/src/charon/config/attributes/attribute_manager.c index f162b4e73..b919c4261 100644 --- a/src/charon/config/attributes/attribute_manager.c +++ b/src/charon/config/attributes/attribute_manager.c @@ -74,7 +74,7 @@ static host_t* acquire_address(private_attribute_manager_t *this, * Implementation of attribute_manager_t.release_address. */ static void release_address(private_attribute_manager_t *this, - char *pool, host_t *address) + char *pool, host_t *address, identification_t *id) { enumerator_t *enumerator; attribute_provider_t *current; @@ -83,7 +83,7 @@ static void release_address(private_attribute_manager_t *this, enumerator = this->providers->create_enumerator(this->providers); while (enumerator->enumerate(enumerator, ¤t)) { - if (current->release_address(current, pool, address)) + if (current->release_address(current, pool, address, id)) { break; } @@ -132,7 +132,7 @@ attribute_manager_t *attribute_manager_create() private_attribute_manager_t *this = malloc_thing(private_attribute_manager_t); this->public.acquire_address = (host_t*(*)(attribute_manager_t*, char*, identification_t*,auth_info_t*,host_t*))acquire_address; - this->public.release_address = (void(*)(attribute_manager_t*, char *, host_t*))release_address; + this->public.release_address = (void(*)(attribute_manager_t*, char *, host_t*, identification_t*))release_address; this->public.add_provider = (void(*)(attribute_manager_t*, attribute_provider_t *provider))add_provider; this->public.remove_provider = (void(*)(attribute_manager_t*, attribute_provider_t *provider))remove_provider; this->public.destroy = (void(*)(attribute_manager_t*))destroy; diff --git a/src/charon/config/attributes/attribute_manager.h b/src/charon/config/attributes/attribute_manager.h index 540e054fd..d2b69e02d 100644 --- a/src/charon/config/attributes/attribute_manager.h +++ b/src/charon/config/attributes/attribute_manager.h @@ -50,9 +50,10 @@ struct attribute_manager_t { * * @param pool pool name from which the address was acquired * @param address address to release + * @param id peer identity to get address for */ void (*release_address)(attribute_manager_t *this, - char *pool, host_t *address); + char *pool, host_t *address, identification_t *id); /** * Register an attribute provider to the manager. diff --git a/src/charon/config/attributes/attribute_provider.h b/src/charon/config/attributes/attribute_provider.h index 1712bd188..9810c0354 100644 --- a/src/charon/config/attributes/attribute_provider.h +++ b/src/charon/config/attributes/attribute_provider.h @@ -51,10 +51,11 @@ struct attribute_provider_t { * * @param pool name of the pool this address was acquired from * @param address address to release + * @param id peer ID * @return TRUE if the address has been released by the provider */ bool (*release_address)(attribute_provider_t *this, - char *pool, host_t *address); + char *pool, host_t *address, identification_t *id); }; #endif /* ATTRIBUTE_PROVIDER_H_ @}*/ diff --git a/src/charon/plugins/sql/sql_attribute.c b/src/charon/plugins/sql/sql_attribute.c index 486a432ca..cd6f7c0cd 100644 --- a/src/charon/plugins/sql/sql_attribute.c +++ b/src/charon/plugins/sql/sql_attribute.c @@ -210,7 +210,7 @@ static host_t* acquire_address(private_sql_attribute_t *this, * Implementation of attribute_provider_t.release_address */ static bool release_address(private_sql_attribute_t *this, - char *name, host_t *address) + char *name, host_t *address, identification_t *id) { enumerator_t *enumerator; bool found = FALSE; @@ -264,7 +264,7 @@ sql_attribute_t *sql_attribute_create(database_t *db) time_t now = time(NULL); this->public.provider.acquire_address = (host_t*(*)(attribute_provider_t *this, char*, identification_t *,auth_info_t *, host_t *))acquire_address; - this->public.provider.release_address = (bool(*)(attribute_provider_t *this, char*,host_t *))release_address; + this->public.provider.release_address = (bool(*)(attribute_provider_t *this, char*,host_t *, identification_t*))release_address; this->public.destroy = (void(*)(sql_attribute_t*))destroy; this->db = db; diff --git a/src/charon/plugins/stroke/stroke_attribute.c b/src/charon/plugins/stroke/stroke_attribute.c index 71b56bc8a..031218273 100644 --- a/src/charon/plugins/stroke/stroke_attribute.c +++ b/src/charon/plugins/stroke/stroke_attribute.c @@ -203,7 +203,7 @@ static host_t* acquire_address(private_stroke_attribute_t *this, * Implementation of attribute_provider_t.release_address */ static bool release_address(private_stroke_attribute_t *this, - char *name, host_t *address) + char *name, host_t *address, identification_t *id) { pool_t *pool; bool found = FALSE; @@ -327,7 +327,7 @@ stroke_attribute_t *stroke_attribute_create() private_stroke_attribute_t *this = malloc_thing(private_stroke_attribute_t); this->public.provider.acquire_address = (host_t*(*)(attribute_provider_t *this, char*, identification_t *,auth_info_t *, host_t *))acquire_address; - this->public.provider.release_address = (bool(*)(attribute_provider_t *this, char*,host_t *))release_address; + this->public.provider.release_address = (bool(*)(attribute_provider_t *this, char*,host_t *, identification_t*))release_address; this->public.add_pool = (void(*)(stroke_attribute_t*, stroke_msg_t *msg))add_pool; this->public.del_pool = (void(*)(stroke_attribute_t*, stroke_msg_t *msg))del_pool; this->public.destroy = (void(*)(stroke_attribute_t*))destroy; diff --git a/src/charon/plugins/unit_tester/tests/test_pool.c b/src/charon/plugins/unit_tester/tests/test_pool.c index 40334335d..b11f71704 100644 --- a/src/charon/plugins/unit_tester/tests/test_pool.c +++ b/src/charon/plugins/unit_tester/tests/test_pool.c @@ -60,7 +60,7 @@ static void* testing(void *thread) /* release addresses */ for (i = 0; i < ALLOCS; i++) { - charon->attributes->release_address(charon->attributes, "test", addr[i]); + charon->attributes->release_address(charon->attributes, "test", addr[i], id[i]); } /* cleanup */ diff --git a/src/charon/sa/ike_sa.c b/src/charon/sa/ike_sa.c index 979fe1980..fa04c0427 100644 --- a/src/charon/sa/ike_sa.c +++ b/src/charon/sa/ike_sa.c @@ -2261,7 +2261,7 @@ static void destroy(private_ike_sa_t *this) { charon->attributes->release_address(charon->attributes, this->peer_cfg->get_pool(this->peer_cfg), - this->other_virtual_ip); + this->other_virtual_ip, this->other_id); } this->other_virtual_ip->destroy(this->other_virtual_ip); } |