diff options
author | Tobias Brunner <tobias@strongswan.org> | 2010-10-22 11:05:10 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2010-10-26 09:58:13 +0200 |
commit | 71711b67b404ac399ba63943d268e55605844ebd (patch) | |
tree | 0a0dfb8a864496813f88193ebefa6ba0638c7ab8 /src | |
parent | 1f2c32835519b31ac5a30c95de2102086dec3cf8 (diff) | |
download | strongswan-71711b67b404ac399ba63943d268e55605844ebd.tar.bz2 strongswan-71711b67b404ac399ba63943d268e55605844ebd.tar.xz |
pluto: Locking fixed in cert_add.
Diffstat (limited to 'src')
-rw-r--r-- | src/pluto/certs.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/pluto/certs.c b/src/pluto/certs.c index a9179c449..e866022df 100644 --- a/src/pluto/certs.c +++ b/src/pluto/certs.c @@ -74,20 +74,21 @@ void cert_free(cert_t *cert) cert_t* cert_add(cert_t *cert) { certificate_t *certificate = cert->cert; - cert_t *c = certs; + cert_t *c; - while (c != NULL) + lock_certs_and_keys("cert_add"); + + for (c = certs; c != NULL; c = c->next) { - if (certificate->equals(certificate, c->cert)) /* already in chain, free cert */ - { + if (certificate->equals(certificate, c->cert)) + { /* already in chain, free cert */ + unlock_certs_and_keys("cert_add"); cert_free(cert); return c; } - c = c->next; } /* insert new cert at the root of the chain */ - lock_certs_and_keys("cert_add"); cert->next = certs; certs = cert; DBG(DBG_CONTROL | DBG_PARSING, |