summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools/cmdline.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/tools/cmdline.c')
-rw-r--r--source4/lib/ldb/tools/cmdline.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index a7bfac8bb4..1f4a7544a5 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -26,6 +26,9 @@
#include "ldb/include/ldb.h"
#include "ldb/include/ldb_private.h"
#include "ldb/tools/cmdline.h"
+#ifdef _SAMBA_BUILD_
+#include "lib/cmdline/popt_common.h"
+#endif
/*
process command line options
@@ -50,10 +53,20 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
{ "num-records", 0, POPT_ARG_INT, &options.num_records, 0, "number of test records", NULL },
{ "all", 'a', POPT_ARG_NONE, &options.all_records, 0, "dn=*", NULL },
{ "sorted", 'S', POPT_ARG_NONE, &options.sorted, 0, "sort attributes", NULL },
+ { "sasl-mechanism", 0, POPT_ARG_STRING, &options.sasl_mechanism, 0, "choose SASL mechanism", "MECHANISM" },
{ NULL, 'o', POPT_ARG_STRING, NULL, 'o', "ldb_connect option", "OPTION" },
+#ifdef _SAMBA_BUILD_
+ POPT_COMMON_SAMBA
+ POPT_COMMON_CREDENTIALS
+ POPT_COMMON_VERSION
+#endif
POPT_TABLEEND
};
+#ifdef _SAMBA_BUILD_
+ ldbsearch_init_subsystems;
+#endif
+
ret = talloc_zero(ldb, struct ldb_cmdline);
if (ret == NULL) {
ldb_oom(ldb);
@@ -74,6 +87,8 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
options.editor = "vi";
}
+ options.scope = LDB_SCOPE_DEFAULT;
+
pc = poptGetContext(argv[0], argc, argv, popt_options,
POPT_CONTEXT_KEEP_FIRST);
@@ -133,6 +148,12 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
goto failed;
}
+ if (ldb_connect(ldb, ret->url, 0, ret->options) != 0) {
+ fprintf(stderr, "Failed to connect to %s - %s\n",
+ ret->url, ldb_errstring(ldb));
+ goto failed;
+ }
+
return ret;
failed: