userdb-ldap.c revision 834726fa62a1eecf6d2936c1434c613f44b9dfd9
/* Copyright (c) 2003-2010 Dovecot authors, see the included COPYING file */
#include "auth-common.h"
#include "userdb.h"
#include "ioloop.h"
#include "hash.h"
#include "str.h"
#include "var-expand.h"
#include "auth-cache.h"
#include "db-ldap.h"
#include <ldap.h>
#include <stdlib.h>
struct ldap_userdb_module {
struct userdb_module module;
struct ldap_connection *conn;
};
struct userdb_ldap_request {
struct ldap_request_search request;
unsigned int entries;
};
struct userdb_iter_ldap_request {
struct ldap_request_search request;
struct ldap_userdb_iterate_context *ctx;
};
struct ldap_userdb_iterate_context {
struct userdb_iterate_context ctx;
struct userdb_iter_ldap_request request;
struct ldap_connection *conn;
bool continued, in_callback;
};
static void
struct auth_request *auth_request)
{
struct db_ldap_result_iterate_context *ldap_iter;
}
}
static void
struct userdb_ldap_request *urequest,
{
"unknown user");
"user_filter matched multiple objects, aborting");
} else {
}
}
struct ldap_request *request,
{
struct userdb_ldap_request *urequest =
(struct userdb_ldap_request *) request;
struct auth_request *auth_request =
return;
}
/* first entry */
}
}
{
struct ldap_userdb_module *module =
(struct ldap_userdb_module *)_module;
const struct var_expand_table *vars;
struct userdb_ldap_request *request;
str_truncate(str, 0);
"base=%s scope=%s filter=%s fields=%s",
}
struct ldap_request *request,
{
struct userdb_iter_ldap_request *urequest =
(struct userdb_iter_ldap_request *)request;
struct db_ldap_result_iterate_context *ldap_iter;
return;
}
/* the iteration can take a while. reset the request's create time so
it won't be aborted while it's still running */
i_warning("ldap: iterate: "
"Ignoring field not named 'user': %s", name);
continue;
}
}
}
}
static struct userdb_iterate_context *
{
struct ldap_userdb_module *module =
(struct ldap_userdb_module *)userdb;
struct ldap_userdb_iterate_context *ctx;
struct userdb_iter_ldap_request *request;
if (global_auth_settings->debug) {
i_debug("ldap: iterate: base=%s scope=%s filter=%s fields=%s",
}
}
{
struct ldap_userdb_iterate_context *ctx =
(struct ldap_userdb_iterate_context *)_ctx;
if (!ctx->in_callback)
}
{
struct ldap_userdb_iterate_context *ctx =
(struct ldap_userdb_iterate_context *)_ctx;
return ret;
}
static struct userdb_module *
{
struct ldap_userdb_module *module;
struct ldap_connection *conn;
}
{
struct ldap_userdb_module *module =
(struct ldap_userdb_module *)_module;
}
{
struct ldap_userdb_module *module =
(struct ldap_userdb_module *)_module;
}
#ifndef PLUGIN_BUILD
struct userdb_module_interface userdb_ldap =
#else
#endif
{
"ldap",
};
#else
struct userdb_module_interface userdb_ldap = {
.name = "ldap"
};
#endif