diff options
author | Tobias Brunner <tobias@strongswan.org> | 2010-11-22 13:31:07 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2010-12-03 18:00:00 +0100 |
commit | 75827463fa9a4961f9c151e09da2cb4329dd38d1 (patch) | |
tree | 62813ca60d67c2e2089acf72556ced24a1292e40 | |
parent | 5b2d9f24f57ee4aa12c122552dd58fc476772ee8 (diff) | |
download | strongswan-75827463fa9a4961f9c151e09da2cb4329dd38d1.tar.bz2 strongswan-75827463fa9a4961f9c151e09da2cb4329dd38d1.tar.xz |
Insert certificates and secrets at the front of the lists.
As the lookup is also from front to back, certificates added later are
now found first, which is useful in case of e.g. "reread cacerts".
-rw-r--r-- | src/libstrongswan/credentials/sets/mem_cred.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libstrongswan/credentials/sets/mem_cred.c b/src/libstrongswan/credentials/sets/mem_cred.c index 1a1f086c0..c58475d38 100644 --- a/src/libstrongswan/credentials/sets/mem_cred.c +++ b/src/libstrongswan/credentials/sets/mem_cred.c @@ -155,9 +155,9 @@ static certificate_t *add_cert_internal(private_mem_cred_t *this, bool trusted, { certificate_t *cached; this->lock->write_lock(this->lock); - if (this->untrusted->find_last(this->untrusted, - (linked_list_match_t)certificate_equals, - (void**)&cached, cert) == SUCCESS) + if (this->untrusted->find_first(this->untrusted, + (linked_list_match_t)certificate_equals, + (void**)&cached, cert) == SUCCESS) { cert->destroy(cert); cert = cached->get_ref(cached); @@ -166,9 +166,9 @@ static certificate_t *add_cert_internal(private_mem_cred_t *this, bool trusted, { if (trusted) { - this->trusted->insert_last(this->trusted, cert->get_ref(cert)); + this->trusted->insert_first(this->trusted, cert->get_ref(cert)); } - this->untrusted->insert_last(this->untrusted, cert->get_ref(cert)); + this->untrusted->insert_first(this->untrusted, cert->get_ref(cert)); } this->lock->unlock(this->lock); return cert; @@ -240,7 +240,7 @@ METHOD(mem_cred_t, add_crl, bool, if (new) { - this->untrusted->insert_last(this->untrusted, cert); + this->untrusted->insert_first(this->untrusted, cert); } this->lock->unlock(this->lock); return new; @@ -303,7 +303,7 @@ METHOD(mem_cred_t, add_key, void, private_mem_cred_t *this, private_key_t *key) { this->lock->write_lock(this->lock); - this->keys->insert_last(this->keys, key); + this->keys->insert_first(this->keys, key); this->lock->unlock(this->lock); } @@ -438,7 +438,7 @@ METHOD(mem_cred_t, add_shared_list, void, ); this->lock->write_lock(this->lock); - this->shared->insert_last(this->shared, entry); + this->shared->insert_first(this->shared, entry); this->lock->unlock(this->lock); } @@ -455,7 +455,7 @@ METHOD(mem_cred_t, add_shared, void, id = va_arg(args, identification_t*); if (id) { - owners->insert_last(owners, id); + owners->insert_first(owners, id); } } while (id); |