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.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index 48dc8ddd47..7657301f35 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -57,6 +57,8 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
{ "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" },
+ { "input", 'I', POPT_ARG_STRING, &options.input, 0, "Input File", "Input" },
+ { "output", 'O', POPT_ARG_STRING, &options.output, 0, "Output File", "Output" },
{ NULL, 'o', POPT_ARG_STRING, NULL, 'o', "ldb_connect option", "OPTION" },
#ifdef _SAMBA_BUILD_
POPT_COMMON_SAMBA
@@ -149,16 +151,18 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
*ret = options;
/* all utils need some option */
- if (ret->url == NULL) {
- fprintf(stderr, "You must supply a url with -H or with $LDB_URL\n");
- if (usage) usage();
- goto failed;
- }
+ if (ldb) {
+ if (ret->url == NULL) {
+ fprintf(stderr, "You must supply a url with -H or with $LDB_URL\n");
+ if (usage) usage();
+ 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;
+ 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;