diff options
author | Derrell Lipman <derrell@samba.org> | 2005-06-04 17:13:43 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:35 -0500 |
commit | a1ba224107fbcf6f8a9a3091f42cde2a0c47f85e (patch) | |
tree | 0d29cea6db75b6318f9645def992a7a840a369bf /source4/lib/ldb/tools | |
parent | 5296bd1b5107f321de0dc9b3a9c3f6ac5a4861f0 (diff) | |
download | samba-a1ba224107fbcf6f8a9a3091f42cde2a0c47f85e.tar.gz samba-a1ba224107fbcf6f8a9a3091f42cde2a0c47f85e.tar.bz2 samba-a1ba224107fbcf6f8a9a3091f42cde2a0c47f85e.zip |
r7276: - moved static tdb function ltdb_dn_fold() into common/ so that it can be
called from multiple backends. (ldb_sqlite3 needs it too.) Added parameter
for a callback function that determines whether an attribute needs case
folding.
- begin to prepare for sqlite3 in build process
- work-in-progress updates, on ldb_sqlite3
(This used to be commit a80bced0b96ffb655559a43cf7f4d7a34deb5a7d)
Diffstat (limited to 'source4/lib/ldb/tools')
-rw-r--r-- | source4/lib/ldb/tools/ldbsearch.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 3e6e7d7feb..26bd198d1d 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -48,6 +48,7 @@ static void usage(void) printf(" -s base|sub|one choose search scope\n"); printf(" -b basedn choose baseDN\n"); printf(" -i read search expressions from stdin\n"); + printf(" -S sort returned attributes\n"); printf(" -o options pass options like modules to activate\n"); printf(" e.g: -o modules:timestamps\n"); exit(1); @@ -56,6 +57,7 @@ static void usage(void) static int do_search(struct ldb_context *ldb, const char *basedn, int scope, + int sort_attribs, const char *expression, const char * const *attrs) { @@ -77,6 +79,15 @@ static int do_search(struct ldb_context *ldb, ldif.changetype = LDB_CHANGETYPE_NONE; ldif.msg = msgs[i]; + if (sort_attribs) { + /* + * Ensure attributes are always returned in the same + * order. For testing, this makes comparison of old + * vs. new much easier. + */ + ldb_msg_sort_elements(ldif.msg); + } + ldb_ldif_write_file(ldb, stdout, &ldif); } @@ -100,7 +111,7 @@ static int do_search(struct ldb_context *ldb, const char **options = NULL; int opt, ldbopts; enum ldb_scope scope = LDB_SCOPE_SUBTREE; - int interactive = 0, ret=0; + int interactive = 0, sort_attribs=0, ret=0; ldb_url = getenv("LDB_URL"); @@ -129,6 +140,10 @@ static int do_search(struct ldb_context *ldb, interactive = 1; break; + case 'S': + sort_attribs = 1; + break; + case 'o': options = ldb_options_parse(options, &ldbopts, optarg); break; @@ -168,12 +183,12 @@ static int do_search(struct ldb_context *ldb, if (interactive) { char line[1024]; while (fgets(line, sizeof(line), stdin)) { - if (do_search(ldb, basedn, scope, line, attrs) == -1) { + if (do_search(ldb, basedn, scope, sort_attribs, line, attrs) == -1) { ret = -1; } } } else { - ret = do_search(ldb, basedn, scope, argv[0], attrs); + ret = do_search(ldb, basedn, scope, sort_attribs, argv[0], attrs); } talloc_free(ldb); |