auth-cache.c revision 3e077925c47a7a18d5f7f266179f5f82862bf81e
/* Copyright (C) 2004 Timo Sirainen */
#include "common.h"
#include "lib-signals.h"
#include "hash.h"
#include "str.h"
#include "strescape.h"
#include "var-expand.h"
#include "auth-request.h"
#include "auth-cache.h"
#include <time.h>
struct auth_cache {
struct hash_table *hash;
unsigned int ttl_secs;
unsigned int hit_count, miss_count;
};
{
char key_seen[256];
query++;
/* @UNSAFE */
}
}
}
return str_free_without_data(&str);
}
static void
{
else {
/* unlinking tail */
}
else {
/* unlinking head */
}
}
static void
struct auth_cache_node *node)
{
else
}
static void
{
}
{
i_info("SIGHUP received, clearing cache");
}
{
unsigned int total_count;
i_info("Authentication cache hits %u/%u (%u%%)",
/* reset hit counter */
}
{
struct auth_cache *cache;
return cache;
}
{
}
{
}
const char *
bool *expired_r)
{
struct auth_cache_node *node;
/* %! is prepended automatically. it contains the passdb ID number. */
cache->miss_count++;
return NULL;
}
/* TTL expired */
} else {
/* move to head */
}
}
}
const struct auth_request *request,
{
struct auth_cache_node *node;
/* %! is prepended automatically. it contains the passdb ID number. */
alloc_size = sizeof(struct auth_cache_node) -
/* make sure we have enough space */
/* key is already in cache (probably expired), remove it */
}
/* @UNSAFE */
}