ldb_module_set_next: void (struct ldb_module *, struct ldb_module *)
ldb_module_set_private: void (struct ldb_module *, void *)
ldb_modules_hook: int (struct ldb_context *, enum ldb_module_hook_type)
-ldb_modules_list_from_string: const char **(struct ldb_context *, TALLOC_CTX *, const char *)
+ldb_modules_list_from_string: char **(struct ldb_context *, TALLOC_CTX *, const char *)
ldb_modules_load: int (const char *, const char *)
ldb_msg_add: int (struct ldb_message *, const struct ldb_message_element *, int)
ldb_msg_add_empty: int (struct ldb_message *, const char *, int, struct ldb_message_element **)
/* modules are called in inverse order on the stack.
Lets place them as an admin would think the right order is.
Modules order is important */
-const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *string)
+char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *string)
{
char **modules = NULL;
- const char **m;
char *modstr, *p;
unsigned int i;
if (modstr[0] == '\0') {
modules[0] = NULL;
- m = (const char **)modules;
- return m;
+ return modules;
}
i = 0;
while ((p = strrchr(modstr, ',')) != NULL) {
*p = '\0';
p++;
- modules[i] = p;
+ modules[i] = talloc_strdup(modules, p);
+ if (modules[i] == NULL) {
+ ldb_debug(ldb, LDB_DEBUG_FATAL, "Out of Memory in ldb_modules_list_from_string()");
+ talloc_free(modules);
+ return NULL;
+ }
i++;
modules = talloc_realloc(mem_ctx, modules, char *, i + 2);
}
}
- modules[i] = modstr;
-
+ modules[i] = talloc_strdup(modules, modstr);
+ if (modules[i] == NULL) {
+ ldb_debug(ldb, LDB_DEBUG_FATAL, "Out of Memory in ldb_modules_list_from_string()");
+ talloc_free(modules);
+ return NULL;
+ }
modules[i + 1] = NULL;
- m = (const char **)modules;
-
- return m;
+ talloc_free(modstr);
+ return modules;
}
static struct backends_list_entry {
int ldb_load_modules(struct ldb_context *ldb, const char *options[])
{
const char *modules_string;
- const char **modules = NULL;
+ char **modules = NULL;
int ret;
TALLOC_CTX *mem_ctx = talloc_new(ldb);
if (!mem_ctx) {
/* modules are called in inverse order on the stack.
Lets place them as an admin would think the right order is.
Modules order is important */
-const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *string);
+char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *string);
/*
return the current ldb flags LDB_FLG_*
/* The following definitions come from lib/ldb/common/ldb_modules.c */
-const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *string);
int ldb_load_modules(struct ldb_context *ldb, const char *options[]);
struct ldb_val ldb_binary_decode(TALLOC_CTX *mem_ctx, const char *str);