userdb-ldap.c revision 71513ad16144a595ef3bd02058318784250c88ef
/* Copyright (C) 2003 Timo Sirainen */
#include "config.h"
#ifdef USERDB_LDAP
#include "common.h"
#include "str.h"
#include "var-expand.h"
#include "db-ldap.h"
#include "userdb.h"
#include <ldap.h>
#include <stdlib.h>
/* using posixAccount */
#define DEFAULT_ATTRIBUTES "uid,homeDirectory,,,uidNumber,gidNumber"
enum ldap_user_attr {
ATTR_VIRTUAL_USER = 0,
};
struct userdb_ldap_connection {
struct ldap_connection *conn;
unsigned int *attrs;
char **attr_names;
};
struct userdb_ldap_request {
struct ldap_request request;
struct auth_request *auth_request;
};
static struct userdb_ldap_connection *userdb_ldap_conn;
struct userdb_ldap_connection *conn,
{
enum ldap_user_attr i;
for (i = 0; i < ATTR_COUNT; i++) {
break;
}
if (i == ATTR_COUNT) {
i_error("ldap(%s): Unknown attribute '%s'",
return;
}
case ATTR_VIRTUAL_USER:
break;
case ATTR_HOME:
break;
case ATTR_MAIL:
break;
case ATTR_SYSTEM_USER:
break;
case ATTR_UID_NUMBER:
break;
case ATTR_GID_NUMBER:
break;
case ATTR_COUNT:
break;
}
}
{
struct userdb_ldap_request *urequest =
(struct userdb_ldap_request *) request;
int ret;
if (ret != LDAP_SUCCESS) {
i_error("ldap(%s): ldap_search() failed: %s",
return;
}
i_error("ldap(%s): Authenticated user not found",
}
return;
}
t_push();
}
}
i_error("ldap(%s): No username in reply",
i_error("ldap(%s): uidNumber not set and no default given in "
i_error("ldap(%s): gidNumber not set and no default given in "
i_error("ldap(%s): Multiple replies found for user",
} else {
t_pop();
return;
}
/* error */
t_pop();
}
{
struct userdb_ldap_request *request;
const char *filter;
} else {
ldap_escape));
}
if (verbose_debug) {
i_info("ldap(%s): base=%s scope=%s filter=%s fields=%s",
strarray_join((const char **)
}
}
static void userdb_ldap_preinit(const char *args)
{
struct ldap_connection *conn;
}
{
}
static void userdb_ldap_deinit(void)
{
}
struct userdb_module userdb_ldap = {
"ldap",
};
#endif