diff options
author | venaas <venaas> | 2008-08-21 14:33:11 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2008-08-21 14:33:11 +0000 |
commit | a2a0f702e632d9219628fc467e1d2e5bde2eab7d (patch) | |
tree | 0ae58e84406000fa972df869e5b5d53a0055ad98 /hash.c | |
parent | fbb9d82bb98b950898eaea727e3f0ca584d1f587 (diff) |
made dtls server do proper certificate matching
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@356 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -92,3 +92,25 @@ void *hash_read(struct hash *h, void *key, uint32_t keylen) { pthread_mutex_unlock(&h->mutex); return NULL; } + +/* extracts entry from hash */ +void *hash_extract(struct hash *h, void *key, uint32_t keylen) { + struct list_node *ln; + struct entry *e; + + if (!h) + return 0; + pthread_mutex_lock(&h->mutex); + for (ln = list_first(h->hashlist); ln; ln = list_next(ln)) { + e = (struct entry *)ln->data; + if (e->keylen == keylen && !memcmp(e->key, key, keylen)) { + free(e->key); + list_removedata(h->hashlist, e); + free(e); + pthread_mutex_unlock(&h->mutex); + return e->data; + } + } + pthread_mutex_unlock(&h->mutex); + return NULL; +} |