diff options
Diffstat (limited to 'source4/lib/ldb/tools')
-rw-r--r-- | source4/lib/ldb/tools/ldbadd.c | 14 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbdel.c | 14 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbedit.c | 14 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbmodify.c | 14 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbrename.c | 14 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbsearch.c | 14 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbtest.c | 14 |
7 files changed, 14 insertions, 84 deletions
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c index d7f890b155..9d19a1db0a 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -34,6 +34,7 @@ #include "includes.h" #include "ldb/include/ldb.h" +#include "ldb/include/ldb_private.h" static int failures; @@ -100,18 +101,7 @@ static int process_file(struct ldb_context *ldb, FILE *f) 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; + options = ldb_options_parse(options, &ldbopts, optarg); break; case 'h': diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c index dc1c734284..29d3b39730 100644 --- a/source4/lib/ldb/tools/ldbdel.c +++ b/source4/lib/ldb/tools/ldbdel.c @@ -34,6 +34,7 @@ #include "includes.h" #include "ldb/include/ldb.h" +#include "ldb/include/ldb_private.h" static int ldb_delete_recursive(struct ldb_context *ldb, const char *dn) { @@ -95,18 +96,7 @@ static void usage(void) 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; + options = ldb_options_parse(options, &ldbopts, optarg); break; case 'h': diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index fd45248c0e..f84d05440f 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -34,6 +34,7 @@ #include "includes.h" #include "ldb/include/ldb.h" +#include "ldb/include/ldb_private.h" static int verbose; @@ -358,18 +359,7 @@ static void usage(void) 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; + options = ldb_options_parse(options, &ldbopts, optarg); break; case 'h': diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c index a660b814da..5fabba57b7 100644 --- a/source4/lib/ldb/tools/ldbmodify.c +++ b/source4/lib/ldb/tools/ldbmodify.c @@ -34,6 +34,7 @@ #include "includes.h" #include "ldb/include/ldb.h" +#include "ldb/include/ldb_private.h" static int failures; @@ -102,18 +103,7 @@ static int process_file(struct ldb_context *ldb, FILE *f) 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; + options = ldb_options_parse(options, &ldbopts, optarg); break; case 'h': diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c index f702cbd7f2..3ee001cf23 100644 --- a/source4/lib/ldb/tools/ldbrename.c +++ b/source4/lib/ldb/tools/ldbrename.c @@ -36,6 +36,7 @@ #include "includes.h" #include "ldb/include/ldb.h" +#include "ldb/include/ldb_private.h" static void usage(void) { @@ -68,18 +69,7 @@ static void usage(void) 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; + options = ldb_options_parse(options, &ldbopts, optarg); break; case 'h': diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 9f6b2f617a..fced589572 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -34,6 +34,7 @@ #include "includes.h" #include "ldb/include/ldb.h" +#include "ldb/include/ldb_private.h" static void usage(void) { @@ -125,18 +126,7 @@ static int do_search(struct ldb_context *ldb, 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; + options = ldb_options_parse(options, &ldbopts, optarg); break; case 'h': diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index f3be8e1e5c..645bc93fd3 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -34,6 +34,7 @@ #include "includes.h" #include "ldb/include/ldb.h" +#include "ldb/include/ldb_private.h" static const char *ldb_url; static const char *base_dn = "ou=Ldb Test,ou=People,o=University of Michigan,c=US"; @@ -387,18 +388,7 @@ static void usage(void) 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; + options = ldb_options_parse(options, &ldbopts, optarg); break; case 'h': |