dict-ldap.c revision 788810ad6d657e75f33640815f04722de0fd0cfd
/* Copyright (c) 2016-2017 Dovecot authors, see the included COPYING memcached */
#include "lib.h"
#include "array.h"
#include "module-dir.h"
#include "str.h"
#include "istream.h"
#include "ostream.h"
#include "var-expand.h"
#include "connection.h"
#include "llist.h"
#include "ldap-client.h"
#include "dict.h"
#include "dict-private.h"
#include "dict-ldap-settings.h"
struct ldap_dict;
struct dict_ldap_op {
const struct dict_ldap_map *map;
unsigned long txid;
struct dict_lookup_result res;
void *callback_ctx;
};
struct ldap_dict {
struct dict_ldap_settings *set;
const char *uri;
const char *username;
const char *base_dn;
enum ldap_scope scope;
struct ldap_client *client;
unsigned long last_txid;
unsigned int pending;
};
static
static bool
{
const char *path_start = path;
if (*pat == '$') {
/* variable */
pat++;
if (*pat == '\0') {
/* pattern ended with this variable,
it'll match the rest of the path */
if (partial_ok) {
/* iterating - the last field never
matches fully. if there's a trailing
'/', drop it. */
pat--;
} else {
}
} else {
}
return TRUE;
}
/* pattern matches until the next '/' in path */
if (p != NULL) {
path = p;
} else {
/* no '/' anymore, but it'll still match a
partial */
pat++;
}
pat++;
path++;
} else {
return FALSE;
}
}
if (*pat == '\0')
return *path == '\0';
else if (!partial_ok)
return FALSE;
else {
/* partial matches must end with '/'. */
return FALSE;
/* if we're not recursing, there should be only one $variable
left. */
if (recurse)
return TRUE;
}
}
static const struct dict_ldap_map *
{
const struct dict_ldap_map *maps;
unsigned int i, count;
for (i = 0; i < count; i++) {
return &maps[i];
}
return NULL;
}
static
{
struct ldap_client_settings set;
}
static bool
{
struct var_expand_table entry;
if (priv) {
} else {
}
struct var_expand_table entry;
}
return FALSE;
}
return TRUE;
}
static
const struct dict_settings *set,
{
pool_unref(&pool);
return -1;
}
pool_unref(&pool);
return -1;
}
return 0;
}
static
{
}
{
do {
}
{
}
static
{
}
static void
{
struct ldap_search_iterator *iter;
const struct ldap_entry *entry;
if (ldap_result_has_failed(result)) {
} else {
/* try extract value */
} else {
}
}
}
pool_unref(&pool);
}
static int
{
struct dict_lookup_result res;
return -1;
}
}
/*
static
struct dict_iterate_context *ldap_dict_iterate_init(struct dict *dict,
const char *const *paths,
enum dict_iterate_flags flags)
{
return NULL;
}
static
bool ldap_dict_iterate(struct dict_iterate_context *ctx,
const char **key_r, const char **value_r)
{
return FALSE;
}
static
int ldap_dict_iterate_deinit(struct dict_iterate_context *ctx)
{
return -1;
}
static
struct dict_transaction_context ldap_dict_transaction_init(struct dict *dict);
static
int ldap_dict_transaction_commit(struct dict_transaction_context *ctx,
bool async,
dict_transaction_commit_callback_t *callback,
void *context);
static
void ldap_dict_transaction_rollback(struct dict_transaction_context *ctx);
static
void ldap_dict_set(struct dict_transaction_context *ctx,
const char *key, const char *value);
static
void ldap_dict_unset(struct dict_transaction_context *ctx,
const char *key);
static
void ldap_dict_atomic_inc(struct dict_transaction_context *ctx,
const char *key, long long diff);
*/
static
{
struct ldap_search_input input;
struct dict_ldap_op *op;
const char *error;
/* key needs to be transformed into something else */
const char *attributes[2] = {0, 0};
/* build lookup */
if (!ldap_dict_build_query(ctx, map, &values, strncmp(key, DICT_PATH_PRIVATE, strlen(DICT_PATH_PRIVATE))==0, query, &error)) {
pool_unref(&oppool);
}
} else {
pool_unref(&oppool);
}
}
struct dict dict_driver_ldap = {
.name = "ldap",
{
.init = ldap_dict_init,
.wait = ldap_dict_wait,
}
};
void dict_ldap_deinit(void);
{
}
void dict_ldap_deinit(void)
{
}
const char *dict_ldap_plugin_dependencies[] = { NULL };