auth-request.c revision 826cb2b19f57bb9b6f73018b585bd922e820f9f6
/* Copyright (C) 2002-2005 Timo Sirainen */
#include "common.h"
#include "ioloop.h"
#include "buffer.h"
#include "hash.h"
#include "str.h"
#include "safe-memset.h"
#include "str-sanitize.h"
#include "var-expand.h"
#include "auth-request.h"
#include "auth-client-connection.h"
#include "auth-master-connection.h"
#include "passdb.h"
#include "passdb-blocking.h"
#include "userdb-blocking.h"
#include "passdb-cache.h"
struct auth_request *
{
struct auth_request *request;
return request;
}
{
struct auth_request *auth_request;
return auth_request;
}
{
}
{
}
{
}
{
}
{
return TRUE;
else
return FALSE;
}
{
}
}
}
{
else
return FALSE;
return TRUE;
}
{
}
{
}
enum passdb_result result)
{
if (passdb_cache == NULL)
return;
return;
if (result < 0) {
/* lookup failed. */
if (result == PASSDB_RESULT_USER_UNKNOWN) {
}
return;
}
/* no password given by passdb, cannot cache this */
return;
}
/* save all except the currently given password in cache */
/* cached passwords must have a known scheme */
}
}
if (request->no_failure_delay) {
}
}
struct auth_request *request)
{
const char *cache_key;
/* lookup failed. if we're looking here only because the
request was expired in cache, fallback to using cached
expired record. */
return;
}
}
/* we're proxying - send back the password that was
sent by user (not the password in passdb). */
}
}
if (result != PASSDB_RESULT_OK &&
/* try next passdb. */
return;
}
}
const char *password,
{
enum passdb_result result;
const char *cache_key;
return;
}
}
else {
}
}
const char *credentials,
struct auth_request *request)
{
}
/* lookup failed. if we're looking here only because the
request was expired in cache, fallback to using cached
expired record. */
&credentials, &scheme,
TRUE)) {
request);
return;
}
}
request);
}
{
return;
}
}
else {
}
}
void auth_request_userdb_callback(const char *result,
struct auth_request *request)
{
/* try next userdb. */
return;
}
/* this was actual login attempt */
"user not found from userdb");
}
}
{
else
}
{
unsigned char *p;
if (*username == '\0') {
/* Some PAM plugins go nuts with empty usernames */
*error_r = "Empty username";
return FALSE;
}
} else {
}
*error_r = "Username contains disallowed characters";
return FALSE;
}
}
return TRUE;
}
const char *default_scheme)
{
"Multiple password values not supported");
return;
}
if (*value == '{') {
} else {
}
}
/* update username to be exactly as it's in database */
return;
}
/* don't delay replying to client of the failure */
return;
}
/* user can't actually login - don't keep this
reply for master */
/* we're proxying authentication for this user. send
password back if using plaintext authentication. */
} else {
}
}
static const char *escape_none(const char *str)
{
return str;
}
const struct var_expand_table *
const char *(*escape_func)(const char *))
{
static struct var_expand_table static_tab[] = {
{ 'u', NULL },
{ 'n', NULL },
{ 'd', NULL },
{ 's', NULL },
{ 'h', NULL },
{ 'l', NULL },
{ 'r', NULL },
{ 'p', NULL },
{ '\0', NULL }
};
struct var_expand_table *tab;
if (escape_func == NULL)
/* tab[4] = we have no home dir */
return tab;
}
static const char *
{
#define MAX_LOG_USERNAME_LEN 64
const char *ip;
else {
}
}
}
const char *subsystem,
const char *format, ...)
{
return;
t_push();
t_pop();
}
const char *subsystem,
const char *format, ...)
{
return;
t_push();
t_pop();
}
const char *subsystem,
const char *format, ...)
{
t_push();
t_pop();
}