diff options
author | Martin Willi <martin@revosec.ch> | 2012-09-11 10:41:11 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-09-11 16:18:28 +0200 |
commit | 594c58e1118e496eadd284647755b16b74665337 (patch) | |
tree | 743e0f33a01beffab57e363fe1e154944c63dd01 /src/libcharon/plugins/unit_tester/tests/test_pool.c | |
parent | dc7b79d8a5c8104001bba4c52a8b3716a0cf6d88 (diff) | |
download | strongswan-594c58e1118e496eadd284647755b16b74665337.tar.bz2 strongswan-594c58e1118e496eadd284647755b16b74665337.tar.xz |
Pass the full list of pools to acquire_address, enumerate in providers
If the provider has access to the full pool list, it can enumerate
them twice, for example to search for existing leases first, and
only search for new leases in a second step.
Fixes lease enumeration in attr-sql using multiple pools.
Diffstat (limited to 'src/libcharon/plugins/unit_tester/tests/test_pool.c')
-rw-r--r-- | src/libcharon/plugins/unit_tester/tests/test_pool.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcharon/plugins/unit_tester/tests/test_pool.c b/src/libcharon/plugins/unit_tester/tests/test_pool.c index a68246fff..f67353dff 100644 --- a/src/libcharon/plugins/unit_tester/tests/test_pool.c +++ b/src/libcharon/plugins/unit_tester/tests/test_pool.c @@ -27,6 +27,7 @@ static void* testing(void *thread) int i; host_t *addr[ALLOCS]; identification_t *id[ALLOCS]; + linked_list_t *pools; /* prepare identities */ for (i = 0; i < ALLOCS; i++) @@ -37,17 +38,23 @@ static void* testing(void *thread) id[i] = identification_create_from_string(buf); } + pools = linked_list_create(); + pools->insert_last(pools, "test"); + /* allocate addresses */ for (i = 0; i < ALLOCS; i++) { addr[i] = hydra->attributes->acquire_address(hydra->attributes, - "test", id[i], NULL); + pools, id[i], NULL); if (!addr[i]) { + pools->destroy(pools); return (void*)FALSE; } } + pools->destroy(pools); + /* release addresses */ for (i = 0; i < ALLOCS; i++) { |