summaryrefslogtreecommitdiff
path: root/source4
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
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')
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectguid.c9
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c9
-rw-r--r--source4/lib/ldb/common/ldb.c16
-rw-r--r--source4/lib/ldb/common/ldb_modules.c34
-rw-r--r--source4/lib/ldb/common/ldb_parse.c5
-rw-r--r--source4/lib/ldb/include/ldb_private.h10
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c29
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c51
-rw-r--r--source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c40
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c16
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c35
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c1
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.h3
-rw-r--r--source4/lib/ldb/modules/ldb_map.c37
-rw-r--r--source4/lib/ldb/modules/rdn_name.c13
-rw-r--r--source4/lib/ldb/modules/schema.c8
-rw-r--r--source4/lib/ldb/modules/skel.c7
-rw-r--r--source4/lib/ldb/modules/timestamps.c9
18 files changed, 95 insertions, 237 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c
index bdef4d5147..9e0946b17c 100644
--- a/source4/dsdb/samdb/ldb_modules/objectguid.c
+++ b/source4/dsdb/samdb/ldb_modules/objectguid.c
@@ -38,14 +38,6 @@
#include "librpc/gen_ndr/ndr_misc.h"
#include <time.h>
-static int objectguid_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)
-{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_search\n");
- return ldb_next_search(module, base, scope, expression, attrs, res);
-}
-
static int objectguid_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
enum ldb_scope scope, struct ldb_parse_tree *tree,
const char * const *attrs, struct ldb_message ***res)
@@ -166,7 +158,6 @@ static int objectguid_destructor(void *module_ctx)
static const struct ldb_module_ops objectguid_ops = {
.name = "objectguid",
- .search = objectguid_search,
.search_bytree = objectguid_search_bytree,
.add_record = objectguid_add_record,
.modify_record = objectguid_modify_record,
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 28e56fe0ca..89c9daa924 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -40,14 +40,6 @@
#define SAM_ACCOUNT_NAME_BASE "$000000-000000000000"
-static int samldb_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)
-{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "samldb_search\n");
- return ldb_next_search(module, base, scope, expression, attrs, res);
-}
-
static int samldb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
enum ldb_scope scope, struct ldb_parse_tree *tree,
const char * const *attrs, struct ldb_message ***res)
@@ -602,7 +594,6 @@ static int samldb_destructor(void *module_ctx)
static const struct ldb_module_ops samldb_ops = {
.name = "samldb",
- .search = samldb_search,
.search_bytree = samldb_search_bytree,
.add_record = samldb_add_record,
.modify_record = samldb_modify_record,
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index a743b2f584..29ee323ad4 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -172,13 +172,23 @@ int ldb_search(struct ldb_context *ldb,
const char *expression,
const char * const *attrs, struct ldb_message ***res)
{
- ldb_reset_err_string(ldb);
+ struct ldb_parse_tree *tree;
+ int ret;
+
+ tree = ldb_parse_tree(ldb, expression);
+ if (tree == NULL) {
+ ldb_set_errstring(ldb->modules, talloc_strdup(ldb, "Unable to parse search expression"));
+ return -1;
+ }
+
+ ret = ldb_search_bytree(ldb, base, scope, tree, attrs, res);
+ talloc_free(tree);
- return ldb->modules->ops->search(ldb->modules, base, scope, expression, attrs, res);
+ return ret;
}
/*
- search the database given a LDAP-like search expression
+ search the database given a search tree
return the number of records found, or -1 on error
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 9c536789b9..2885d46b37 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -133,6 +133,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
{ "objectguid", objectguid_module_init },
{ "samldb", samldb_module_init },
{ "samba3sam", ldb_samba3sam_module_init },
+ { "proxy", proxy_module_init },
#endif
{ NULL, NULL }
};
@@ -170,7 +171,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
return -1;
}
if (ret > 1) {
- ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found, bailing out\n");
+ ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found (%d), bailing out\n", ret);
talloc_free(msg);
return -1;
}
@@ -215,6 +216,17 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
/*
helper functions to call the next module in chain
*/
+int ldb_next_search_bytree(struct ldb_module *module,
+ const struct ldb_dn *base,
+ enum ldb_scope scope,
+ struct ldb_parse_tree *tree,
+ const char * const *attrs, struct ldb_message ***res)
+{
+ if (!module->next) {
+ return -1;
+ }
+ return module->next->ops->search_bytree(module->next, base, scope, tree, attrs, res);
+}
int ldb_next_search(struct ldb_module *module,
const struct ldb_dn *base,
@@ -222,24 +234,22 @@ int ldb_next_search(struct ldb_module *module,
const char *expression,
const char * const *attrs, struct ldb_message ***res)
{
+ struct ldb_parse_tree *tree;
+ int ret;
if (!module->next) {
return -1;
}
- return module->next->ops->search(module->next, base, scope, expression, attrs, res);
-}
-
-int ldb_next_search_bytree(struct ldb_module *module,
- const struct ldb_dn *base,
- enum ldb_scope scope,
- struct ldb_parse_tree *tree,
- const char * const *attrs, struct ldb_message ***res)
-{
- if (!module->next) {
+ tree = ldb_parse_tree(module, expression);
+ if (tree == NULL) {
+ ldb_set_errstring(module, talloc_strdup(module, "Unable to parse search expression"));
return -1;
}
- return module->next->ops->search_bytree(module->next, base, scope, tree, attrs, res);
+ ret = module->next->ops->search_bytree(module->next, base, scope, tree, attrs, res);
+ talloc_free(tree);
+ return ret;
}
+
int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *message)
{
if (!module->next) {
diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c
index f43d7a7c7a..95110bfd00 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -620,9 +620,8 @@ static struct ldb_parse_tree *ldb_parse_filter(void *mem_ctx, const char **s)
*/
struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s)
{
- /* allowing NULL makes the _bytree() searches easier */
- if (s == NULL) {
- return NULL;
+ if (s == NULL || *s == 0) {
+ s = "(|(objectClass=*)(dn=*))";
}
while (isspace((unsigned char)*s)) s++;
diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h
index 2a9139df40..9777ad0d92 100644
--- a/source4/lib/ldb/include/ldb_private.h
+++ b/source4/lib/ldb/include/ldb_private.h
@@ -56,8 +56,6 @@ struct ldb_module {
*/
struct ldb_module_ops {
const char *name;
- int (*search)(struct ldb_module *, const struct ldb_dn *, enum ldb_scope,
- const char *, const char * const [], struct ldb_message ***);
int (*search_bytree)(struct ldb_module *, const struct ldb_dn *, enum ldb_scope,
struct ldb_parse_tree *, const char * const [], struct ldb_message ***);
int (*add_record)(struct ldb_module *, const struct ldb_message *);
@@ -126,10 +124,10 @@ typedef struct ldb_module *(*ldb_module_init_function)(struct ldb_context *ldb,
int ldb_load_modules(struct ldb_context *ldb, const char *options[]);
int ldb_next_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);
+ const struct ldb_dn *base,
+ enum ldb_scope scope,
+ const char *expression,
+ const char * const *attrs, struct ldb_message ***res);
int ldb_next_search_bytree(struct ldb_module *module,
const struct ldb_dn *base,
enum ldb_scope scope,
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index 4ff8723d44..ad316bb0a2 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -218,30 +218,6 @@ failed:
/*
- search for matching records
-*/
-static int ildb_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 ildb_private *ildb = module->private_data;
- int ret;
- struct ldb_parse_tree *tree;
-
- if (expression == NULL || expression[0] == '\0') {
- expression = "objectClass=*";
- }
-
- tree = ldb_parse_tree(ildb, expression);
-
- ret = ildb_search_bytree(module, base, scope, tree, attrs, res);
-
- talloc_free(tree);
- return ret;
-}
-
-
-/*
convert a ldb_message structure to a list of ldap_mod structures
ready for ildap_add() or ildap_modify()
*/
@@ -394,7 +370,6 @@ static int ildb_del_trans(struct ldb_module *module)
static const struct ldb_module_ops ildb_ops = {
.name = "ldap",
- .search = ildb_search,
.search_bytree = ildb_search_bytree,
.add_record = ildb_add,
.modify_record = ildb_modify,
@@ -415,7 +390,9 @@ static void ildb_rootdse(struct ldb_module *module)
struct ldb_message **res = NULL;
struct ldb_dn *empty_dn = ldb_dn_new(ildb);
int ret;
- ret = ildb_search(module, empty_dn, LDB_SCOPE_BASE, "dn=dc=rootDSE", NULL, &res);
+ ret = ildb_search_bytree(module, empty_dn, LDB_SCOPE_BASE,
+ ldb_parse_tree(empty_dn, "dn=dc=rootDSE"),
+ NULL, &res);
if (ret == 1) {
ildb->rootDSE = talloc_steal(ildb, res[0]);
}
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
index 1d1dd66e84..268e2b0291 100644
--- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -174,15 +174,16 @@ static int lldb_add_msg_attr(struct ldb_context *ldb,
/*
search for matching records
*/
-static int lldb_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)
+static int lldb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
+ enum ldb_scope scope, struct ldb_parse_tree *tree,
+ const char * const *attrs, struct ldb_message ***res)
{
struct ldb_context *ldb = module->ldb;
struct lldb_private *lldb = module->private_data;
- int count, msg_count;
+ int count, msg_count, ldap_scope;
char *search_base;
LDAPMessage *ldapres, *msg;
+ char *expression;
search_base = ldb_dn_linearize(ldb, base);
if (base == NULL) {
@@ -192,11 +193,25 @@ static int lldb_search(struct ldb_module *module, const struct ldb_dn *base,
return -1;
}
- if (expression == NULL || expression[0] == '\0') {
- expression = "objectClass=*";
+ expression = ldb_filter_from_tree(search_base, tree);
+ if (expression == NULL) {
+ talloc_free(search_base);
+ return -1;
+ }
+
+ switch (scope) {
+ case LDB_SCOPE_BASE:
+ ldap_scope = LDAP_SCOPE_BASE;
+ break;
+ case LDB_SCOPE_ONELEVEL:
+ ldap_scope = LDAP_SCOPE_ONELEVEL;
+ break;
+ default:
+ ldap_scope = LDAP_SCOPE_SUBTREE;
+ break;
}
- lldb->last_rc = ldap_search_s(lldb->ldap, search_base, (int)scope,
+ lldb->last_rc = ldap_search_s(lldb->ldap, search_base, ldap_scope,
expression,
discard_const_p(char *, attrs),
0, &ldapres);
@@ -288,27 +303,6 @@ failed:
/*
- search for matching records using a ldb_parse_tree
-*/
-static int lldb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
- enum ldb_scope scope, struct ldb_parse_tree *tree,
- const char * const *attrs, struct ldb_message ***res)
-{
- struct lldb_private *lldb = module->private_data;
- char *expression;
- int ret;
-
- expression = ldb_filter_from_tree(lldb, tree);
- if (expression == NULL) {
- return -1;
- }
- ret = lldb_search(module, base, scope, expression, attrs, res);
- talloc_free(expression);
- return ret;
-}
-
-
-/*
convert a ldb_message structure to a list of LDAPMod structures
ready for ldap_add() or ldap_modify()
*/
@@ -478,7 +472,6 @@ static int lldb_del_trans(struct ldb_module *module)
static const struct ldb_module_ops lldb_ops = {
.name = "ldap",
- .search = lldb_search,
.search_bytree = lldb_search_bytree,
.add_record = lldb_add,
.modify_record = lldb_modify,
diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
index 052b10f245..1054722178 100644
--- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
+++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
@@ -822,7 +822,7 @@ static int lsqlite3_search_bytree(struct ldb_module * module, const struct ldb_d
int ret, i;
/* create a local ctx */
- local_ctx = talloc_named(lsqlite3, 0, "lsqlite3_search_by_tree local context");
+ local_ctx = talloc_named(lsqlite3, 0, "lsqlite3_search_bytree local context");
if (local_ctx == NULL) {
return -1;
}
@@ -990,43 +990,6 @@ failed:
return -1;
}
-/* search for matching records, by expression */
-static int lsqlite3_search(struct ldb_module * module, const struct ldb_dn *basedn,
- enum ldb_scope scope, const char * expression,
- const char * const *attrs, struct ldb_message *** res)
-{
- struct ldb_parse_tree * tree;
- int ret;
-
- /* Handle tdb specials */
- if (ldb_dn_is_special(basedn)) {
-#warning "handle tdb specials"
- return 0;
- }
-
-#if 0
-/* (|(objectclass=*)(dn=*)) is passed by the command line tool now instead */
- /* Handle the special case of requesting all */
- if (pExpression != NULL && *pExpression == '\0') {
- pExpression = "dn=*";
- }
-#endif
-
- /* Parse the filter expression into a tree we can work with */
- if ((tree = ldb_parse_tree(module->ldb, expression)) == NULL) {
- return -1;
- }
-
- /* Now use the bytree function for the remainder of processing */
- ret = lsqlite3_search_bytree(module, basedn, scope, tree, attrs, res);
-
- /* Free the parse tree */
- talloc_free(tree);
-
- /* All done. */
- return ret;
-}
-
/* add a record */
static int lsqlite3_add(struct ldb_module *module, const struct ldb_message *msg)
@@ -1820,7 +1783,6 @@ destructor(void *p)
*/
static const struct ldb_module_ops lsqlite3_ops = {
.name = "sqlite",
- .search = lsqlite3_search,
.search_bytree = lsqlite3_search_bytree,
.add_record = lsqlite3_add,
.modify_record = lsqlite3_modify,
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index f78d840206..c2a4fb1ea8 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -676,7 +676,8 @@ int ltdb_search_indexed(struct ldb_module *module,
struct dn_list *dn_list;
int ret;
- if (ltdb->cache->indexlist->num_elements == 0) {
+ if (ltdb->cache->indexlist->num_elements == 0 &&
+ scope != LDB_SCOPE_BASE) {
/* no index list? must do full search */
return -1;
}
@@ -686,7 +687,18 @@ int ltdb_search_indexed(struct ldb_module *module,
return -1;
}
- ret = ltdb_index_dn(module, tree, ltdb->cache->indexlist, dn_list);
+ if (scope == LDB_SCOPE_BASE) {
+ /* with BASE searches only one DN can match */
+ char *dn = ldb_dn_linearize(dn_list, base);
+ if (dn == NULL) {
+ return -1;
+ }
+ dn_list->count = 1;
+ dn_list->dn = &dn;
+ ret = 1;
+ } else {
+ ret = ltdb_index_dn(module, tree, ltdb->cache->indexlist, dn_list);
+ }
if (ret == 1) {
/* we've got a candidate list - now filter by the full tree
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;
-}
-
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 701ed602ce..22360ffb1c 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -702,7 +702,6 @@ static int ltdb_del_trans(struct ldb_module *module)
static const struct ldb_module_ops ltdb_ops = {
.name = "tdb",
- .search = ltdb_search,
.search_bytree = ltdb_search_bytree,
.add_record = ltdb_add,
.modify_record = ltdb_modify,
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
index c16db67e1f..2819d865d3 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -83,9 +83,6 @@ int ltdb_add_attr_results(struct ldb_module *module, struct ldb_message *msg,
const char * const attrs[],
int *count,
struct ldb_message ***res);
-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);
int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
enum ldb_scope scope, struct ldb_parse_tree *tree,
const char * const attrs[], struct ldb_message ***res);
diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c
index 1133991ac4..1da1ef661a 100644
--- a/source4/lib/ldb/modules/ldb_map.c
+++ b/source4/lib/ldb/modules/ldb_map.c
@@ -744,9 +744,9 @@ static int map_delete(struct ldb_module *module, const struct ldb_dn *dn)
}
/* search fallback database */
-static int map_search_bytree_fb(struct ldb_module *module, const struct ldb_dn *base,
- enum ldb_scope scope, struct ldb_parse_tree *tree,
- const char * const *attrs, struct ldb_message ***res)
+static int map_search_fb(struct ldb_module *module, const struct ldb_dn *base,
+ enum ldb_scope scope, struct ldb_parse_tree *tree,
+ const char * const *attrs, struct ldb_message ***res)
{
int ret;
struct ldb_parse_tree t_and, t_not, t_present, *childs[2];
@@ -771,7 +771,7 @@ static int map_search_bytree_fb(struct ldb_module *module, const struct ldb_dn *
}
/* Search in the database against which we are mapping */
-static int map_search_bytree_mp(struct ldb_module *module, const struct ldb_dn *base,
+static int map_search_mp(struct ldb_module *module, const struct ldb_dn *base,
enum ldb_scope scope, struct ldb_parse_tree *tree,
const char * const *attrs, struct ldb_message ***res)
{
@@ -869,14 +869,14 @@ static int map_search_bytree_mp(struct ldb_module *module, const struct ldb_dn *
search for matching records using a ldb_parse_tree
*/
static int map_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
- enum ldb_scope scope, struct ldb_parse_tree *tree,
- const char * const *attrs, struct ldb_message ***res)
+ enum ldb_scope scope, struct ldb_parse_tree *tree,
+ const char * const *attrs, struct ldb_message ***res)
{
struct ldb_message **fbres, **mpres = NULL;
int i;
int ret_fb, ret_mp;
- ret_fb = map_search_bytree_fb(module, base, scope, tree, attrs, &fbres);
+ ret_fb = map_search_fb(module, base, scope, tree, attrs, &fbres);
if (ret_fb == -1)
return -1;
@@ -886,7 +886,7 @@ static int map_search_bytree(struct ldb_module *module, const struct ldb_dn *bas
return ret_fb;
}
- ret_mp = map_search_bytree_mp(module, base, scope, tree, attrs, &mpres);
+ ret_mp = map_search_mp(module, base, scope, tree, attrs, &mpres);
if (ret_mp == -1) {
return -1;
}
@@ -901,26 +901,6 @@ static int map_search_bytree(struct ldb_module *module, const struct ldb_dn *bas
return ret_fb + ret_mp;
}
-/*
- search for matching records
-*/
-static int map_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 ldb_parse_tree *tree;
- int ret;
-
- tree = ldb_parse_tree(NULL, expression);
- if (tree == NULL) {
- ldb_set_errstring(module, talloc_strdup(module, "expression parse failed"));
- return -1;
- }
-
- ret = map_search_bytree(module, base, scope, tree, attrs, res);
- talloc_free(tree);
- return ret;
-}
static int msg_contains_objectclass(const struct ldb_message *msg, const char *name)
{
@@ -1270,7 +1250,6 @@ static int map_del_trans(struct ldb_module *module)
static const struct ldb_module_ops map_ops = {
.name = "map",
- .search = map_search,
.search_bytree = map_search_bytree,
.add_record = map_add,
.modify_record = map_modify,
diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c
index 3e3fbd544f..0275952780 100644
--- a/source4/lib/ldb/modules/rdn_name.c
+++ b/source4/lib/ldb/modules/rdn_name.c
@@ -37,17 +37,9 @@
#include "ldb/include/ldb_private.h"
#include <time.h>
-static int rdn_name_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)
-{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_name_search\n");
- return ldb_next_search(module, base, scope, expression, attrs, res);
-}
-
static int rdn_name_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
- enum ldb_scope scope, struct ldb_parse_tree *tree,
- const char * const *attrs, struct ldb_message ***res)
+ enum ldb_scope scope, struct ldb_parse_tree *tree,
+ const char * const *attrs, struct ldb_message ***res)
{
ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_name_search\n");
return ldb_next_search_bytree(module, base, scope, tree, attrs, res);
@@ -241,7 +233,6 @@ static int rdn_name_destructor(void *module_ctx)
static const struct ldb_module_ops rdn_name_ops = {
.name = "rdn_name",
- .search = rdn_name_search,
.search_bytree = rdn_name_search_bytree,
.add_record = rdn_name_add_record,
.modify_record = rdn_name_modify_record,
diff --git a/source4/lib/ldb/modules/schema.c b/source4/lib/ldb/modules/schema.c
index e882f72bd4..7c1753b215 100644
--- a/source4/lib/ldb/modules/schema.c
+++ b/source4/lib/ldb/modules/schema.c
@@ -283,13 +283,6 @@ static int get_attr_list_recursive(struct ldb_module *module, struct schema_stru
}
/* search */
-static int schema_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)
-{
- return ldb_next_search(module, base, scope, expression, attrs, res);
-}
-
static int schema_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
enum ldb_scope scope, struct ldb_parse_tree *tree,
const char * const *attrs, struct ldb_message ***res)
@@ -537,7 +530,6 @@ static int schema_destructor(void *module_ctx)
static const struct ldb_module_ops schema_ops = {
.name = "schema",
- .search = schema_search,
.search_bytree = schema_search_bytree,
.add_record = schema_add_record,
.modify_record = schema_modify_record,
diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c
index 5d14a27a7b..f882a840e1 100644
--- a/source4/lib/ldb/modules/skel.c
+++ b/source4/lib/ldb/modules/skel.c
@@ -43,10 +43,10 @@ struct private_data {
/* search */
static int skel_search(struct ldb_module *module, const struct ldb_dn *base,
- enum ldb_scope scope, const char *expression,
+ enum ldb_scope scope, struct ldb_parse_tree *tree,
const char * const *attrs, struct ldb_message ***res)
{
- return ldb_next_search(module, base, scope, expression, attrs, res);
+ return ldb_next_search(module, base, scope, tree, attrs, res);
}
/* add_record */
@@ -102,8 +102,7 @@ static int skel_destructor(void *module_ctx)
static const struct ldb_module_ops skel_ops = {
.name = "skel",
- .search = skel_search,
- .search_bytree = skel_search_bytree,
+ .search_bytree = skel_search_bytree,
.add_record = skel_add_record,
.modify_record = skel_modify_record,
.delete_record = skel_delete_record,
diff --git a/source4/lib/ldb/modules/timestamps.c b/source4/lib/ldb/modules/timestamps.c
index 01e5c2c37c..5a1e54486a 100644
--- a/source4/lib/ldb/modules/timestamps.c
+++ b/source4/lib/ldb/modules/timestamps.c
@@ -37,14 +37,6 @@
#include "ldb/include/ldb_private.h"
#include <time.h>
-static int timestamps_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)
-{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_search\n");
- return ldb_next_search(module, base, scope, expression, attrs, res);
-}
-
static int timestamps_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
enum ldb_scope scope, struct ldb_parse_tree *tree,
const char * const *attrs, struct ldb_message ***res)
@@ -238,7 +230,6 @@ static int timestamps_destructor(void *module_ctx)
static const struct ldb_module_ops timestamps_ops = {
.name = "timestamps",
- .search = timestamps_search,
.search_bytree = timestamps_search_bytree,
.add_record = timestamps_add_record,
.modify_record = timestamps_modify_record,