/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
#include "auth-common.h"
#include "array.h"
#include "istream.h"
#include "str.h"
#include "json-parser.h"
#include "settings.h"
#include "dict.h"
#include "auth-request.h"
#include "auth-worker-client.h"
#include "db-dict.h"
#include <stddef.h>
enum dict_settings_section {
};
struct dict_settings_parser_ctx {
};
struct db_dict_iter_key {
bool used;
const char *value;
};
struct db_dict_value_iter {
unsigned int field_idx;
unsigned int object_idx;
const char *error;
};
{ 0, NULL, 0 }
};
.default_pass_scheme = "MD5",
.iterate_prefix = "",
.iterate_disable = FALSE,
.passdb_objects = "",
.userdb_objects = ""
};
{ 0, NULL, 0 }
};
.key = "",
.format = "value",
};
{
return conn;
}
return NULL;
}
static bool
struct dict_settings_parser_ctx *ctx,
const char **error_r)
{
/* key passdb { key=<value> format=json }
passdb_objects = passdb */
return TRUE;
}
/* key userdb { key=<value> format=json }
userdb_objects = userdb */
return TRUE;
}
return TRUE;
*error_r = "Deprecated value_format must be 'json'";
return FALSE;
}
return FALSE;
}
struct dict_settings_parser_ctx *ctx)
{
return NULL;
return error;
return NULL;
return NULL;
}
i_unreached();
}
struct dict_settings_parser_ctx *ctx,
const char **errormsg)
{
} else {
return FALSE;
}
}
return TRUE;
}
*errormsg = "Nested sections not supported";
return FALSE;
}
*errormsg = "Key section is missing name";
return FALSE;
}
*errormsg = "Key section names must not contain '.'";
return FALSE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
*errormsg = "Unknown section";
return FALSE;
}
static void
{
const char *const *tmp;
i_fatal("dict: passdb_objects refers to key %s, "
"which doesn't exist", *tmp);
}
i_fatal("dict: passdb_objects refers to key %s, "
"but it's in value-only format", *tmp);
}
}
i_fatal("dict: userdb_objects refers to key %s, "
"which doesn't exist", *tmp);
}
i_fatal("dict: userdb_objects refers to key %s, "
"but it's in value-only format", *tmp);
}
}
}
{
const char *error;
return conn;
}
if (*config_path == '\0')
i_fatal("dict: Configuration file path not given");
connections = conn;
return conn;
}
{
return;
}
static struct db_dict_iter_key *
{
return key;
}
return NULL;
}
{
const char *p, *name;
if (*p != '%') {
p++;
continue;
}
if (size == 0) {
/* broken %variable ending too early */
break;
}
p += idx;
}
p += size;
}
}
}
{
}
}
static int
const struct db_dict_iter_key *k2)
{
}
{
const char *error;
int ret;
/* sort the keys so that we'll first lookup the keys without
default value. if their lookup fails, the user doesn't exist. */
continue;
if (ret > 0) {
} else if (ret < 0) {
return -1;
"Lookup: %s not found, using default value %s",
} else {
return 0;
}
}
return 1;
}
struct auth_request *auth_request,
struct db_dict_value_iter **iter_r)
{
int ret;
/* figure out what keys we need to lookup, and lookup them */
const char *error;
pool_unref(&pool);
return -1;
}
}
T_BEGIN {
} T_END;
if (ret <= 0) {
pool_unref(&pool);
return ret;
}
return 1;
}
static bool
{
const char *value;
return FALSE;
if (type != JSON_TYPE_OBJECT_KEY) {
return FALSE;
}
if (*value == '\0') {
return FALSE;
}
str_truncate(tmpstr, 0);
return FALSE;
}
if (type == JSON_TYPE_OBJECT) {
return FALSE;
}
return TRUE;
}
static void
{
}
static bool
{
return FALSE;
i_unreached();
}
i_unreached();
}
static int
const char **value_r,
const char **error_r ATTR_UNUSED)
{
return 1;
return 1;
return 1;
*value_r = "";
break;
}
}
return 1;
}
i_unreached();
}
{
{ "dict", db_dict_field_find },
};
const char *error;
"Failed to expand %s=%s: %s",
return FALSE;
}
return TRUE;
}
const char **error_r)
{
}
}