diff options
author | Derrell Lipman <derrell@samba.org> | 2005-06-09 14:50:32 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:53 -0500 |
commit | ee3f4b12d22459405372e1c72efe3079a052601d (patch) | |
tree | 7a86b841d35426fa047ee0e9397e243696bacd38 /source4/lib/ldb/tools | |
parent | c63c28f5bd46e4a03e1cdd12b78934c0b88635a8 (diff) | |
download | samba-ee3f4b12d22459405372e1c72efe3079a052601d.tar.gz samba-ee3f4b12d22459405372e1c72efe3079a052601d.tar.bz2 samba-ee3f4b12d22459405372e1c72efe3079a052601d.zip |
r7438: work in progress
(This used to be commit 2fc5343f0637ef3109b079dbc33d6cf4e58c8d5e)
Diffstat (limited to 'source4/lib/ldb/tools')
-rw-r--r-- | source4/lib/ldb/tools/ldbsearch.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 26bd198d1d..4bf9db8d90 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -54,6 +54,12 @@ static void usage(void) exit(1); } +static int do_compare_msg(struct ldb_message **el1, + struct ldb_message **el2) +{ + return ldb_dn_cmp((*el1)->dn, (*el2)->dn); +} + static int do_search(struct ldb_context *ldb, const char *basedn, int scope, @@ -72,6 +78,11 @@ static int do_search(struct ldb_context *ldb, printf("# returned %d records\n", ret); + if (sort_attribs) { + qsort(msgs, ret, sizeof(struct ldb_message *), + (comparison_fn_t)do_compare_msg); + } + for (i=0;i<ret;i++) { struct ldb_ldif ldif; printf("# record %d\n", i+1); @@ -116,7 +127,7 @@ static int do_search(struct ldb_context *ldb, ldb_url = getenv("LDB_URL"); ldbopts = 0; - while ((opt = getopt(argc, argv, "b:H:s:o:hi")) != EOF) { + while ((opt = getopt(argc, argv, "b:H:s:o:hiS")) != EOF) { switch (opt) { case 'b': basedn = optarg; |