diff options
Diffstat (limited to 'source4/lib/ldb/tools')
-rw-r--r-- | source4/lib/ldb/tools/ldbadd.c | 22 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbdel.c | 22 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbedit.c | 22 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbmodify.c | 22 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbrename.c | 22 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbsearch.c | 23 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbtest.c | 22 |
7 files changed, 140 insertions, 15 deletions
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c index 9383197ed0..6d04800502 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -83,16 +83,34 @@ static int process_file(struct ldb_context *ldb, FILE *f) struct ldb_context *ldb; int count=0; const char *ldb_url; + const char **options = NULL; + int ldbopts; int opt, i; ldb_url = getenv("LDB_URL"); - while ((opt = getopt(argc, argv, "hH:")) != EOF) { + ldbopts = 0; + while ((opt = getopt(argc, argv, "hH:o:")) != EOF) { switch (opt) { case 'H': ldb_url = optarg; break; + case 'o': + ldbopts++; + if (options == NULL) { + options = (const char **)malloc(sizeof(char *) * (ldbopts + 1)); + } else { + options = (const char **)realloc(options, sizeof(char *) * (ldbopts + 1)); + if (options == NULL) { + fprintf(stderr, "Out of memory!\n"); + exit(-1); + } + } + options[ldbopts - 1] = optarg; + options[ldbopts] = NULL; + break; + case 'h': default: usage(); @@ -108,7 +126,7 @@ static int process_file(struct ldb_context *ldb, FILE *f) argc -= optind; argv += optind; - ldb = ldb_connect(ldb_url, 0, NULL); + ldb = ldb_connect(ldb_url, 0, options); if (!ldb) { perror("ldb_connect"); diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c index d36db5429a..42dc9c19d8 100644 --- a/source4/lib/ldb/tools/ldbdel.c +++ b/source4/lib/ldb/tools/ldbdel.c @@ -72,13 +72,16 @@ static void usage(void) int main(int argc, char * const argv[]) { struct ldb_context *ldb; + const char **options = NULL; + int ldbopts; int ret, i; const char *ldb_url; int opt, recursive=0; ldb_url = getenv("LDB_URL"); - while ((opt = getopt(argc, argv, "hH:r")) != EOF) { + ldbopts = 0; + while ((opt = getopt(argc, argv, "hH:ro:")) != EOF) { switch (opt) { case 'H': ldb_url = optarg; @@ -88,6 +91,21 @@ static void usage(void) recursive=1; break; + case 'o': + ldbopts++; + if (options == NULL) { + options = (const char **)malloc(sizeof(char *) * (ldbopts + 1)); + } else { + options = (const char **)realloc(options, sizeof(char *) * (ldbopts + 1)); + if (options == NULL) { + fprintf(stderr, "Out of memory!\n"); + exit(-1); + } + } + options[ldbopts - 1] = optarg; + options[ldbopts] = NULL; + break; + case 'h': default: usage(); @@ -108,7 +126,7 @@ static void usage(void) exit(1); } - ldb = ldb_connect(ldb_url, 0, NULL); + ldb = ldb_connect(ldb_url, 0, options); if (!ldb) { perror("ldb_connect"); exit(1); diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index b97c40ff1a..fc3b28872e 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -304,6 +304,8 @@ static void usage(void) const char *expression = NULL; const char *ldb_url; const char *basedn = NULL; + const char **options = NULL; + int ldbopts; int opt; enum ldb_scope scope = LDB_SCOPE_SUBTREE; const char *editor; @@ -321,7 +323,8 @@ static void usage(void) editor = "vi"; } - while ((opt = getopt(argc, argv, "hab:e:H:s:v")) != EOF) { + ldbopts = 0; + while ((opt = getopt(argc, argv, "hab:e:H:s:vo:")) != EOF) { switch (opt) { case 'b': basedn = optarg; @@ -353,6 +356,21 @@ static void usage(void) verbose++; break; + case 'o': + ldbopts++; + if (options == NULL) { + options = (const char **)malloc(sizeof(char *) * (ldbopts + 1)); + } else { + options = (const char **)realloc(options, sizeof(char *) * (ldbopts + 1)); + if (options == NULL) { + fprintf(stderr, "Out of memory!\n"); + exit(-1); + } + } + options[ldbopts - 1] = optarg; + options[ldbopts] = NULL; + break; + case 'h': default: usage(); @@ -381,7 +399,7 @@ static void usage(void) attrs = (const char * const *)argv; } - ldb = ldb_connect(ldb_url, 0, NULL); + ldb = ldb_connect(ldb_url, 0, options); if (!ldb) { perror("ldb_connect"); diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c index b6ca2993ce..823855ff1e 100644 --- a/source4/lib/ldb/tools/ldbmodify.c +++ b/source4/lib/ldb/tools/ldbmodify.c @@ -85,16 +85,34 @@ static int process_file(struct ldb_context *ldb, FILE *f) struct ldb_context *ldb; int count=0; const char *ldb_url; + const char **options = NULL; + int ldbopts; int opt, i; ldb_url = getenv("LDB_URL"); - while ((opt = getopt(argc, argv, "hH:")) != EOF) { + ldbopts = 0; + while ((opt = getopt(argc, argv, "hH:o:")) != EOF) { switch (opt) { case 'H': ldb_url = optarg; break; + case 'o': + ldbopts++; + if (options == NULL) { + options = (const char **)malloc(sizeof(char *) * (ldbopts + 1)); + } else { + options = (const char **)realloc(options, sizeof(char *) * (ldbopts + 1)); + if (options == NULL) { + fprintf(stderr, "Out of memory!\n"); + exit(-1); + } + } + options[ldbopts - 1] = optarg; + options[ldbopts] = NULL; + break; + case 'h': default: usage(); @@ -110,7 +128,7 @@ static int process_file(struct ldb_context *ldb, FILE *f) argc -= optind; argv += optind; - ldb = ldb_connect(ldb_url, 0, NULL); + ldb = ldb_connect(ldb_url, 0, options); if (!ldb) { perror("ldb_connect"); diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c index 3bc3c95208..3e47e17b17 100644 --- a/source4/lib/ldb/tools/ldbrename.c +++ b/source4/lib/ldb/tools/ldbrename.c @@ -51,16 +51,34 @@ static void usage(void) { struct ldb_context *ldb; const char *ldb_url; + const char **options = NULL; + int ldbopts; int opt, ret; ldb_url = getenv("LDB_URL"); - while ((opt = getopt(argc, argv, "hH:")) != EOF) { + ldbopts = 0; + while ((opt = getopt(argc, argv, "hH:o:")) != EOF) { switch (opt) { case 'H': ldb_url = optarg; break; + case 'o': + ldbopts++; + if (options == NULL) { + options = (const char **)malloc(sizeof(char *) * (ldbopts + 1)); + } else { + options = (const char **)realloc(options, sizeof(char *) * (ldbopts + 1)); + if (options == NULL) { + fprintf(stderr, "Out of memory!\n"); + exit(-1); + } + } + options[ldbopts - 1] = optarg; + options[ldbopts] = NULL; + break; + case 'h': default: usage(); @@ -76,7 +94,7 @@ static void usage(void) argc -= optind; argv += optind; - ldb = ldb_connect(ldb_url, 0, NULL); + ldb = ldb_connect(ldb_url, 0, options); if (!ldb) { perror("ldb_connect"); diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 137299d89b..1e7bb1ce4c 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -89,13 +89,15 @@ static int do_search(struct ldb_context *ldb, const char * const * attrs = NULL; const char *ldb_url; const char *basedn = NULL; - int opt; + const char **options = NULL; + int opt, ldbopts; enum ldb_scope scope = LDB_SCOPE_SUBTREE; int interactive = 0, ret=0; ldb_url = getenv("LDB_URL"); - while ((opt = getopt(argc, argv, "b:H:s:hi")) != EOF) { + ldbopts = 0; + while ((opt = getopt(argc, argv, "b:H:s:o:hi")) != EOF) { switch (opt) { case 'b': basedn = optarg; @@ -119,6 +121,21 @@ static int do_search(struct ldb_context *ldb, interactive = 1; break; + case 'o': + ldbopts++; + if (options == NULL) { + options = (const char **)malloc(sizeof(char *) * (ldbopts + 1)); + } else { + options = (const char **)realloc(options, sizeof(char *) * (ldbopts + 1)); + if (options == NULL) { + fprintf(stderr, "Out of memory!\n"); + exit(-1); + } + } + options[ldbopts - 1] = optarg; + options[ldbopts] = NULL; + break; + case 'h': default: usage(); @@ -143,7 +160,7 @@ static int do_search(struct ldb_context *ldb, attrs = (const char * const *)(argv+1); } - ldb = ldb_connect(ldb_url, 0, NULL); + ldb = ldb_connect(ldb_url, 0, options); if (!ldb) { perror("ldb_connect"); exit(1); diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index e25a7cbcd6..5d90dc797d 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -358,13 +358,16 @@ static void usage(void) int main(int argc, char * const argv[]) { struct ldb_context *ldb; + const char **options = NULL; + int ldbopts; int opt; int nrecords = 5000; int nsearches = 2000; ldb_url = getenv("LDB_URL"); - while ((opt = getopt(argc, argv, "hH:r:s:b:")) != EOF) { + ldbopts = 0; + while ((opt = getopt(argc, argv, "hH:r:s:b:o:")) != EOF) { switch (opt) { case 'H': ldb_url = optarg; @@ -382,6 +385,21 @@ static void usage(void) nsearches = atoi(optarg); break; + case 'o': + ldbopts++; + if (options == NULL) { + options = (const char **)malloc(sizeof(char *) * (ldbopts + 1)); + } else { + options = (const char **)realloc(options, sizeof(char *) * (ldbopts + 1)); + if (options == NULL) { + fprintf(stderr, "Out of memory!\n"); + exit(-1); + } + } + options[ldbopts - 1] = optarg; + options[ldbopts] = NULL; + break; + case 'h': default: usage(); @@ -397,7 +415,7 @@ static void usage(void) argc -= optind; argv += optind; - ldb = ldb_connect(ldb_url, 0, NULL); + ldb = ldb_connect(ldb_url, 0, options); if (!ldb) { perror("ldb_connect"); |