summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb/ldb_search.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-10-06 05:24:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:26 -0500
commit5fd031c97daaa1bf09a7ad80550753acd434075f (patch)
tree8221ef256c17f138b11d22d9da26ae95db5618c4 /source4/lib/ldb/ldb_tdb/ldb_search.c
parent92da5aa6b8d5141b22d781442583c9f3ad94d3af (diff)
downloadsamba-5fd031c97daaa1bf09a7ad80550753acd434075f.tar.gz
samba-5fd031c97daaa1bf09a7ad80550753acd434075f.tar.bz2
samba-5fd031c97daaa1bf09a7ad80550753acd434075f.zip
r10753: don't require every ldb module to implement both a search_bytree() and
a search() function, instead each module now only implements the bytree method, and the expression based search is handled generically by the modules code. This makes for more consistency and less code duplication. fixed the tdb backend to handle BASE searches much more efficiently. They now always only lookup one record, regardless of the search expression (This used to be commit 7e44f9153c5578624e2fca04cdc0a00af0fd9eb4)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_search.c')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 574d9485f8..eb89753007 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -95,7 +95,7 @@ static int msg_add_all_elements(struct ldb_module *module, struct ldb_message *r
for (i=0;i<msg->num_elements;i++) {
const struct ldb_attrib_handler *h;
h = ldb_attrib_handler(ldb, msg->elements[i].name);
- if (ldb_dn_is_special(msg->dn) && (h->flags & LDB_ATTR_FLAG_HIDDEN)) {
+ if (h->flags & LDB_ATTR_FLAG_HIDDEN) {
continue;
}
if (msg_add_element(ldb, ret, &msg->elements[i]) != 0) {
@@ -501,17 +501,6 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
if ((base == NULL || base->comp_num == 0) &&
(scope == LDB_SCOPE_BASE || scope == LDB_SCOPE_ONELEVEL)) return -1;
- /* check if we are looking for a simple dn */
- if (scope == LDB_SCOPE_BASE && tree == NULL) {
- return ltdb_search_dn(module, base, attrs, res);
- }
-
- if (tree == NULL) {
- char *err_string = talloc_strdup(module, "expression parse failed");
- if (err_string) ldb_set_errstring(module, err_string);
- return -1;
- }
-
/* it is important that we handle dn queries this way, and not
via a full db search, otherwise ldb is horribly slow */
if (tree->operation == LDB_OP_EQUALITY &&
@@ -549,25 +538,3 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
}
-/*
- search the database with a LDAP-like expression.
- choses a search method
-*/
-int ltdb_search(struct ldb_module *module, const struct ldb_dn *base,
- enum ldb_scope scope, const char *expression,
- const char * const attrs[], struct ldb_message ***res)
-{
- struct ltdb_private *ltdb = module->private_data;
- struct ldb_parse_tree *tree;
- int ret;
-
- if ((base == NULL || base->comp_num == 0) &&
- (scope == LDB_SCOPE_BASE || scope == LDB_SCOPE_ONELEVEL)) return -1;
-
- tree = ldb_parse_tree(ltdb, expression);
-
- ret = ltdb_search_bytree(module, base, scope, tree, attrs, res);
- talloc_free(tree);
- return ret;
-}
-