auth-cache.c revision cdc7e0c3492f8b68699e4d19f0c96ba67f880e48
/* 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 cache_node {
};
struct auth_cache {
struct hash_table *hash;
unsigned int ttl_secs;
unsigned int hit_count, miss_count;
};
char *auth_cache_parse_key(const char *query)
{
char key_seen[256];
query++;
/* @UNSAFE */
}
}
}
return str_free_without_data(str);
}
static void
{
else {
/* unlinking tail */
}
else {
/* unlinking head */
}
}
static void
{
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 struct auth_request *request,
{
struct cache_node *node;
cache->miss_count++;
return NULL;
}
/* TTL expired */
} else {
/* move to head */
}
}
}
const struct auth_request *request,
{
struct cache_node *node;
/* make sure we have enough space */
/* key is already in cache (probably expired), remove it */
}
/* @UNSAFE */
}