passdb-cache.c revision 6135260095e1704ed6edff9d00bdfc043c11429c
/* Copyright (c) 2004-2014 Dovecot authors, see the included COPYING file */
#include "auth-common.h"
#include "restrict-process-size.h"
#include "password-scheme.h"
#include "passdb.h"
#include "passdb-cache.h"
#include <stdlib.h>
static void
{
const char *p;
/* hide the password */
}
}
const char *password,
{
struct auth_cache_node *node;
int ret;
bool expired, neg_expired;
return FALSE;
/* value = password \t ... */
&expired, &neg_expired);
"cache expired");
return FALSE;
}
if (*value == '\0') {
/* negative cache entry */
return TRUE;
}
if (*cached_pw == '\0') {
/* NULL password */
"Cached NULL password access");
ret = 1;
} else {
/* a) the last authentication was successful. assume
that the password was changed and cache is expired.
b) negative TTL reached, use it for password
mismatches too. */
return FALSE;
}
}
/* save the extra_fields only after we know we're using the
cached data */
return TRUE;
}
const char *key, const char **password_r,
const char **scheme_r,
enum passdb_result *result_r,
bool use_expired)
{
struct auth_cache_node *node;
bool expired, neg_expired;
if (passdb_cache == NULL)
return FALSE;
&expired, &neg_expired);
"cache expired");
return FALSE;
}
if (*value == '\0') {
/* negative cache entry */
*password_r = NULL;
return TRUE;
}
return TRUE;
}
{
return;
if (restrict_get_process_size(&limit) == 0 &&
i_warning("auth_cache_size (%luM) is higher than "
"process VSZ limit (%luM)",
}
}
void passdb_cache_deinit(void)
{
if (passdb_cache != NULL)
}