/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#ifdef BUILD_CDB
#include "dict-private.h"
#include <string.h>
#include <cdb.h>
#include <unistd.h>
#include <fcntl.h>
struct cdb_dict {
char *path;
};
struct cdb_dict_iterate_context {
const char **paths;
unsigned cptr;
char *error;
};
static int
{
/* initialize cdb to 0 (unallocated) */
return -1;
}
#ifdef TINYCDB_VERSION
return -1;
}
#else
#endif
return 0;
}
{
/* we can safely deinit unallocated cdb */
}
static int
const char **error_r)
{
unsigned datalen;
int ret = 0;
char *data;
/* keys and values may be null terminated... */
if (ret > 0)
}
/* ...or not */
if (ret > 0)
}
if (ret <= 0) {
/* something bad with db */
if (ret < 0) {
return -1;
}
/* found nothing */
return 0;
}
return -1;
}
return 1;
}
static struct dict_iterate_context *
enum dict_iterate_flags flags)
{
}
static bool
{
char *data;
unsigned datalen;
int ret;
if (ret < 0)
return FALSE;
}
return FALSE;
}
return TRUE;
}
{
(struct cdb_dict_iterate_context *)_ctx;
char *data;
unsigned datalen;
return FALSE;
/* if it matches any of the paths */
break;
}
}
}
if (!match)
return FALSE;
return TRUE;
return FALSE;
}
return TRUE;
}
const char **error_r)
{
int ret = 0;
(struct cdb_dict_iterate_context *)_ctx;
ret = -1;
}
return ret;
}
.name = "cdb",
{
.init = cdb_dict_init,
}
};
#endif