summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools/ldbmodify.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/tools/ldbmodify.c')
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c22
1 files changed, 20 insertions, 2 deletions
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");