user-directory.c revision a75d470c9223a75801418fcdda258885c36317e0
/* Copyright (c) 2010-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "array.h"
#include "hash.h"
#include "llist.h"
#include "mail-user-hash.h"
#include "mail-host.h"
#include "user-directory.h"
/* n% of timeout_secs */
#define USER_NEAR_EXPIRING_PERCENTAGE 10
/* but max. of this many secs */
#define USER_NEAR_EXPIRING_MAX 30
struct user_directory_iter {
struct user_directory *dir;
};
struct user_directory {
/* unsigned int username_hash => user */
/* sorted by time */
struct user *prev_insert_pos;
char *username_hash_fmt;
unsigned int timeout_secs;
/* If user's expire time is less than this many seconds away,
don't assume that other directors haven't yet expired it */
unsigned int user_near_expiring_secs;
};
{
struct user_directory_iter *const *iterp;
}
}
{
}
{
return expire_timestamp >= ioloop_time;
}
{
}
unsigned int username_hash)
{
}
static void
{
break;
}
else {
else
}
}
static void
{
break;
}
else {
else
}
}
struct user *
{
/* make sure we don't add timestamps higher than ioloop time */
if (timestamp > ioloop_time)
else {
/* need to insert to correct position. we should get here
only when handshaking. the handshaking USER requests should
come sorted by timestamp. so keep track of the previous
insert position, the next USER should be inserted after
it. */
/* find the position starting from tail */
user);
} else {
user);
}
}
return user;
}
{
}
{
}
}
const char *username)
{
}
{
}
{
return expire_timestamp < ioloop_time;
}
struct user_directory *
{
struct user_directory *dir;
return dir;
}
{
}
struct user_directory_iter *
{
struct user_directory_iter *iter;
return iter;
}
{
return FALSE;
return user;
}
{
struct user_directory_iter *const *iters;
unsigned int i, count;
for (i = 0; i < count; i++) {
break;
}
}
}