return ret;
}
+ /*
+ * Take a copy of the options.
+ */
+ ldb->options = ldb_options_copy(ldb, options);
+ if (ldb->options == NULL && options != NULL) {
+ ldb_oom(ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
ret = ldb_module_connect_backend(ldb, url, options, &ldb->modules);
if (ret != LDB_SUCCESS) {
return ret;
return NULL;
}
+
+const char **ldb_options_copy(TALLOC_CTX *ctx, const char *options[])
+{
+
+ size_t num_options = 0;
+ const char **copy = NULL;
+ size_t i = 0;
+
+ if (options == NULL) {
+ return copy;
+ }
+
+ for (i=0; options[i]; i++) {
+ num_options++;
+ }
+
+ copy = talloc_zero_array(ctx, const char *, num_options + 1);
+ if (copy == NULL) {
+ return copy;
+ }
+
+ for (i=0; options[i]; i++) {
+ copy[i] = talloc_strdup(copy, options[i]);
+ if (copy[i] == NULL) {
+ TALLOC_FREE(copy);
+ return copy;
+ }
+ }
+ return copy;
+}
char *partial_debug;
struct poptOption *popt_options;
+
+ /*
+ * The ldb options passed to ldb_connect
+ * A NULL terminated array of zero terminated strings
+ */
+ const char **options;
};
/* The following definitions come from lib/ldb/common/ldb.c */
const char *ldb_options_find(struct ldb_context *ldb, const char *options[],
const char *option_name);
+const char **ldb_options_copy(TALLOC_CTX *ctx, const char *options[]);
/* The following definitions come from lib/ldb/common/ldb_ldif.c */