From 55fa62be31c9027d84be0e4caad3ee59d78ca1b0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 May 2004 12:37:35 +0000 Subject: r609: allow ldbedit to take a list of attributes to edit, just like ldbsearch. This allows you to edit the description of all users using something like: ldbedit 'objectclass=user' description and not get overwhelmed with fields. It also allows you to edit HIDDEN attributes by specifying them explicitly (This used to be commit dd83d39de23cdf8c574005829972dae8dc6bee6a) --- source4/lib/ldb/tools/ldbedit.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index debe06c231..7e41702422 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -260,7 +260,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun static void usage(void) { - printf("Usage: ldbedit \n"); + printf("Usage: ldbedit \n"); printf("Options:\n"); printf(" -H ldb_url choose the database (or $LDB_URL)\n"); printf(" -s base|sub|one choose search scope\n"); @@ -281,6 +281,7 @@ static void usage(void) int opt; enum ldb_scope scope = LDB_SCOPE_SUBTREE; const char *editor; + const char * const * attrs = NULL; ldb_url = getenv("LDB_URL"); @@ -342,6 +343,12 @@ static void usage(void) usage(); } expression = argv[0]; + argc--; + argv++; + } + + if (argc > 0) { + attrs = (const char * const *)argv; } ldb = ldb_connect(ldb_url, 0, NULL); @@ -353,7 +360,7 @@ static void usage(void) ldb_set_debug_stderr(ldb); - ret = ldb_search(ldb, basedn, scope, expression, NULL, &msgs); + ret = ldb_search(ldb, basedn, scope, expression, attrs, &msgs); if (ret == -1) { printf("search failed - %s\n", ldb_errstring(ldb)); -- cgit