r10753: don't require every ldb module to implement both a search_bytree() and
authorAndrew Tridgell <tridge@samba.org>
Thu, 6 Oct 2005 05:24:46 +0000 (05:24 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:39:26 +0000 (13:39 -0500)
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)

18 files changed:
source4/dsdb/samdb/ldb_modules/objectguid.c
source4/dsdb/samdb/ldb_modules/samldb.c
source4/lib/ldb/common/ldb.c
source4/lib/ldb/common/ldb_modules.c
source4/lib/ldb/common/ldb_parse.c
source4/lib/ldb/include/ldb_private.h
source4/lib/ldb/ldb_ildap/ldb_ildap.c
source4/lib/ldb/ldb_ldap/ldb_ldap.c
source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
source4/lib/ldb/ldb_tdb/ldb_index.c
source4/lib/ldb/ldb_tdb/ldb_search.c
source4/lib/ldb/ldb_tdb/ldb_tdb.c
source4/lib/ldb/ldb_tdb/ldb_tdb.h
source4/lib/ldb/modules/ldb_map.c
source4/lib/ldb/modules/rdn_name.c
source4/lib/ldb/modules/schema.c
source4/lib/ldb/modules/skel.c
source4/lib/ldb/modules/timestamps.c

index bdef4d51478167f46cff8e6de2df72f09265075d..9e0946b17c83e8d278b104da04c9e24a10fef59d 100644 (file)
 #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,
index 28e56fe0cace48f6b65a0ea9c86b8e302f95b3b1..89c9daa924035b6376c4ca74eb698635d9f5d9ec 100644 (file)
 
 #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,
index a743b2f5844ba7f63f263a03f1e97a921931d247..29ee323ad4cdd4a7d355b73069cc34c3f78853e6 100644 (file)
@@ -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
 
index 9c536789b98fe084ae0deca2f3d330a9c24cbd48..2885d46b372f3106a3d0e359df5f90c11657b88e 100644 (file)
@@ -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) {
index f43d7a7c7a1f170b96e38038e7e9fe528ba876fe..95110bfd00d88fc14ab658aec7edb5ecd990e0f2 100644 (file)
@@ -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++;
index 2a9139df406898cf18202b2caca79fbc69f33816..9777ad0d92f45d70b9971e7ca5d7c41f7f5dd81b 100644 (file)
@@ -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,
index 4ff8723d4434e606c3a14f879e7674bdd11fb40d..ad316bb0a2e2f9f5945d4a83b46c3c7090435cf9 100644 (file)
@@ -217,30 +217,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]);
        }
index 1d1dd66e84f0254e6ee200f0d1500f7b697e7086..268e2b0291fe70545bf86dc06c8ec80e2c06f727 100644 (file)
@@ -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);
@@ -287,27 +302,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,
index 052b10f2459facd80254f3a99075a83796e72dbc..1054722178345a1a99328db2212308062b42c24b 100644 (file)
@@ -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,
index f78d840206e9ed36ab5a0c4686670659b8354434..c2a4fb1ea8e74dccae13c428362493c58f09fa4c 100644 (file)
@@ -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
index 574d9485f8fc552473c34c7c5d7ef55fe48e9204..eb8975300716b4e59a617ef35ddbb1fac047448b 100644 (file)
@@ -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;
-}
-
index 701ed602cec94694d5db277eb658843cc83c3924..22360ffb1c57ecc1862a2b911d6bfd081beae3f2 100644 (file)
@@ -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,
index c16db67e1f8f7567c7ab5a36a519f8a384ee492a..2819d865d3db9b25d7c01ebc47582791cfa7de85 100644 (file)
@@ -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);
index 1133991ac442cfe711dfcb67ea8a844792dfaf53..1da1ef661a1803de0fe9343409056a52bd25e758 100644 (file)
@@ -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,
index 3e3fbd544f29f6945869a8fc805a76c5060f107e..0275952780c805cdf2d63c640a118d168044a708 100644 (file)
 #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,
index e882f72bd495e8b903fafe07444f4d20b897a033..7c1753b215742ba9716ca6d2c2517ece92f03d6b 100644 (file)
@@ -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,
index 5d14a27a7b68fb4c620e6ec78169a9419386665f..f882a840e1994d63c3cab7e3c5e2f65dd446bbd5 100644 (file)
@@ -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,
index 01e5c2c37cc6b6f8728c93fa83f164d928703b57..5a1e54486a1307da7d06582390f0bb28885194f4 100644 (file)
 #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,