summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools/ldbsearch.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-08-25 06:41:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:44 -0500
commita2ca0b5e3cf2e1ac485f7046d67de9fc4e5171f9 (patch)
tree65039aa5160301d151c09b92e626f3bda8bbfc04 /source4/lib/ldb/tools/ldbsearch.c
parent6a4794452fdfffac4d9b1c6fc95bcb475f62b68c (diff)
downloadsamba-a2ca0b5e3cf2e1ac485f7046d67de9fc4e5171f9.tar.gz
samba-a2ca0b5e3cf2e1ac485f7046d67de9fc4e5171f9.tar.bz2
samba-a2ca0b5e3cf2e1ac485f7046d67de9fc4e5171f9.zip
r17821: changed ldb_search() and the ldbsearch command line utility to
automatically work out the basedn when basedn==NULL. The basedn is fetched from the rootDSE defaultNamingContext value (if there is one) This means we don't have to have the defaultNamingContext logic in lots of places. It makes a lot of sense to me to have basedn==NULL mean "use the default, as given by the database" Note that explicitly specifing a basedn of '' is not the same thing, and will not trigger this code The baseDN is cached in a ldb opaque, so we only have to fetch it once (This used to be commit 5d1b66b68fc517ce684f75e466ed5f25e46857d5)
Diffstat (limited to 'source4/lib/ldb/tools/ldbsearch.c')
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index 6bbd9e2f74..f151164559 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -218,6 +218,10 @@ static int do_search(struct ldb_context *ldb,
sctx->entries = 0;
sctx->refs = 0;
+ if (basedn == NULL) {
+ basedn = ldb_auto_basedn(ldb);
+ }
+
req->operation = LDB_SEARCH;
req->op.search.base = basedn;
req->op.search.scope = options->scope;