Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4779:fc291a997b03 HEAD
Add auth_cache_remove() function which will be used by OTP code to evict
old entries from auth cache. Patch by Andrey Panin.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 08 Nov 2006 21:13:32 +0200 |
parents | 055deed128b7 |
children | 11001523027f |
files | src/auth/auth-cache.c src/auth/auth-cache.h |
diffstat | 2 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-cache.c Wed Nov 08 21:12:42 2006 +0200 +++ b/src/auth/auth-cache.c Wed Nov 08 21:13:32 2006 +0200 @@ -228,3 +228,22 @@ cache->size_left -= alloc_size; hash_insert(cache->hash, node->data, node); } + +void auth_cache_remove(struct auth_cache *cache, + const struct auth_request *request, + const char *key) +{ + string_t *str; + struct auth_cache_node *node; + + str = t_str_new(256); + var_expand(str, key, + auth_request_get_var_expand_table(request, + auth_request_str_escape)); + + node = hash_lookup(cache->hash, str_c(str)); + if (node == NULL) + return; + + auth_cache_node_destroy(cache, node); +}
--- a/src/auth/auth-cache.h Wed Nov 08 21:12:42 2006 +0200 +++ b/src/auth/auth-cache.h Wed Nov 08 21:13:32 2006 +0200 @@ -41,4 +41,9 @@ const struct auth_request *request, const char *key, const char *value, bool last_success); +/* Remove key from cache */ +void auth_cache_remove(struct auth_cache *cache, + const struct auth_request *request, + const char *key); + #endif