summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools/cmdline.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-08-18 15:02:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:33:32 -0500
commit3e4c4cff2177af33efdb15f03a1bbcb639505cee (patch)
tree852723e443ca41ef6b1d91dd3c11224eddebbd48 /source4/lib/ldb/tools/cmdline.c
parenta8d51f87620a688a286603766cbb7edb2b7c6e60 (diff)
downloadsamba-3e4c4cff2177af33efdb15f03a1bbcb639505cee.tar.gz
samba-3e4c4cff2177af33efdb15f03a1bbcb639505cee.tar.bz2
samba-3e4c4cff2177af33efdb15f03a1bbcb639505cee.zip
r9391: Convert all the code to use struct ldb_dn to ohandle ldap like distinguished names
Provide more functions to handle DNs in this form (This used to be commit 692e35b7797e39533dd2a1c4b63d9da30f1eb5ba)
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;