has_rsa_private_key() must also be protected by keys_mutex

This commit is contained in:
Andreas Steffen
2007-08-10 12:10:36 +00:00
parent c045d90a8e
commit 8f687a7591
@@ -382,8 +382,10 @@ static bool has_rsa_private_key(private_local_credential_store_t *this, rsa_publ
{ {
bool found = FALSE; bool found = FALSE;
rsa_private_key_t *current; rsa_private_key_t *current;
iterator_t *iterator;
iterator_t *iterator = this->private_keys->create_iterator(this->private_keys, TRUE); pthread_mutex_lock(&(this->keys_mutex));
iterator = this->private_keys->create_iterator(this->private_keys, TRUE);
while (iterator->iterate(iterator, (void**)&current)) while (iterator->iterate(iterator, (void**)&current))
{ {
@@ -394,6 +396,7 @@ static bool has_rsa_private_key(private_local_credential_store_t *this, rsa_publ
} }
} }
iterator->destroy(iterator); iterator->destroy(iterator);
pthread_mutex_unlock(&(this->keys_mutex));
return found; return found;
} }