[dovecot-cvs] dovecot/src/auth auth-cache.c,1.3,1.4
cras at dovecot.org
cras at dovecot.org
Sat Nov 6 22:23:16 EET 2004
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv9029/auth
Modified Files:
auth-cache.c
Log Message:
SIGHUP now clears cache.
Index: auth-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-cache.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- auth-cache.c 5 Nov 2004 00:56:52 -0000 1.3
+++ auth-cache.c 6 Nov 2004 20:23:13 -0000 1.4
@@ -1,6 +1,7 @@
/* Copyright (C) 2004 Timo Sirainen */
#include "common.h"
+#include "lib-signals.h"
#include "hash.h"
#include "str.h"
#include "strescape.h"
@@ -23,6 +24,7 @@
size_t size_left;
unsigned int ttl_secs;
+ unsigned int hup_count;
};
char *auth_cache_parse_key(const char *query)
@@ -90,6 +92,7 @@
struct auth_cache *cache;
cache = i_new(struct auth_cache, 1);
+ cache->hup_count = lib_signal_hup_count;
cache->hash = hash_create(default_pool, default_pool, 0, str_hash,
(hash_cmp_callback_t *)strcmp);
cache->size_left = max_size;
@@ -109,6 +112,8 @@
while (cache->tail != NULL)
auth_cache_node_destroy(cache, cache->tail);
hash_clear(cache->hash, FALSE);
+
+ cache->hup_count = lib_signal_hup_count;
}
const char *auth_cache_lookup(struct auth_cache *cache,
@@ -116,7 +121,13 @@
const char *key)
{
string_t *str;
- struct cache_node *node;
+ struct cache_node *node;
+
+ if (cache->hup_count != lib_signal_hup_count) {
+ /* SIGHUP received - clear cache */
+ auth_cache_clear(cache);
+ return NULL;
+ }
str = t_str_new(256);
var_expand(str, key,
More information about the dovecot-cvs
mailing list