summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-09 12:37:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:51 -0500
commit55fa62be31c9027d84be0e4caad3ee59d78ca1b0 (patch)
treeb46e3106b29a2b10bad4198ed40dce18b13d1579 /source4/lib
parenta765d3692fd6583ca98fea7907af4aa934dfc68c (diff)
downloadsamba-55fa62be31c9027d84be0e4caad3ee59d78ca1b0.tar.gz
samba-55fa62be31c9027d84be0e4caad3ee59d78ca1b0.tar.bz2
samba-55fa62be31c9027d84be0e4caad3ee59d78ca1b0.zip
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)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/tools/ldbedit.c11
1 files 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 <options> <expression>\n");
+ printf("Usage: ldbedit <options> <expression> <attributes ...>\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));