summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-08-21 14:33:11 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-08-21 14:33:11 +0000
commita2a0f702e632d9219628fc467e1d2e5bde2eab7d (patch)
tree0ae58e84406000fa972df869e5b5d53a0055ad98 /hash.c
parentfbb9d82bb98b950898eaea727e3f0ca584d1f587 (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.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index ea36860..dd27f77 100644
--- a/hash.c
+++ b/hash.c
@@ -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;
+}