diff options
Diffstat (limited to 'source4/lib/ldb/tools/ldbedit.c')
-rw-r--r-- | source4/lib/ldb/tools/ldbedit.c | 22 |
1 files changed, 20 insertions, 2 deletions
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"); |