The branch, master has been updated
       via  609b865... s4-dsdb/util: Reorder DSDB_FLAG_* checks
       via  0c4bbb7... s4-dsdb: Implement module switching in 
dsdb_module_search_dn()
       via  62a0f11... s4-source4/dsdb/samdb/ldb_modules/acl.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  02f0c6d... s4-source4/dsdb/samdb/ldb_modules/linked_attributes.c 
Use DSDB_FLAG_NEXT_MODULE flag
       via  0d2116a... s4-source4/dsdb/samdb/ldb_modules/naming_fsmo.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  b18ab82... s4-source4/dsdb/samdb/ldb_modules/operational.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  7694b19... s4-source4/dsdb/samdb/ldb_modules/partition_init.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  b627159... s4-source4/dsdb/samdb/ldb_modules/pdc_fsmo.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  2ee1437... s4-source4/dsdb/samdb/ldb_modules/repl_meta_data.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  d7bcac5... s4-source4/dsdb/samdb/ldb_modules/ridalloc.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  dc72073... s4-source4/dsdb/samdb/ldb_modules/samba_dsdb.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  8c7a6a8... s4-source4/dsdb/samdb/ldb_modules/schema_load.c Use 
DSDB_FLAG_NEXT_MODULE flag
       via  64c31b7... s4-source4/dsdb/samdb/ldb_modules/util.c Use 
DSDB_FLAG_NEXT_MODULE flag
      from  76a084f... s3-winbindd: Fix child logfile handling which broke with 
c67cff0372.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 609b8656910eccbb409b58050c306798be22a078
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 04:06:23 2010 +0300

    s4-dsdb/util: Reorder DSDB_FLAG_* checks
    
    On good thing about having more clear function interfaces
    (and forcing callers to specify clearly what they want)
    is that now I can execute following search:
    git grep DSDB_FLAG_NEXT_MODULE | wc -l
    
    This showed that DSDB_FLAG_NEXT_MODULE flag is about 6 times
    more frequently used than DSDB_FLAG_OWN_MODULE.
    So this should reduce branch prediction by six times
    in this part of the code, right :)

commit 0c4bbb7106cc2d49052eb85f995dc991b578d885
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:31:17 2010 +0300

    s4-dsdb: Implement module switching in dsdb_module_search_dn()
    
    This allows caller to choose from where to start DN search

commit 62a0f11dcbc0dbc7dbb78442d933c0fccee2282b
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:26:03 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/acl.c Use DSDB_FLAG_NEXT_MODULE flag

commit 02f0c6d1ebaee211e1749c14bb351c1eaebf3948
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:25:41 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/linked_attributes.c Use 
DSDB_FLAG_NEXT_MODULE flag

commit 0d2116a42396546eb0de11cac6794d257e5a224e
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:25:28 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/naming_fsmo.c Use DSDB_FLAG_NEXT_MODULE 
flag

commit b18ab826043c16adf5aafdb89e4a57be90ff8acf
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:25:11 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/operational.c Use DSDB_FLAG_NEXT_MODULE 
flag

commit 7694b1964f0e51c5f312ef16b9f4d07d0c273bb2
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:24:59 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/partition_init.c Use 
DSDB_FLAG_NEXT_MODULE flag

commit b62715964a6060c002f0d6ae4ef42d8e296fc582
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:24:15 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/pdc_fsmo.c Use DSDB_FLAG_NEXT_MODULE flag

commit 2ee14378c3b9e46a71b50a37a18ae0bb2705f131
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:23:58 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/repl_meta_data.c Use 
DSDB_FLAG_NEXT_MODULE flag

commit d7bcac5a9f39a325d984269f7e8651870dcb82ab
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:23:43 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/ridalloc.c Use DSDB_FLAG_NEXT_MODULE flag

commit dc720739ab8d966c6d7d5064281740b6b35b77bf
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:23:21 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/samba_dsdb.c Use DSDB_FLAG_NEXT_MODULE 
flag

commit 8c7a6a8dc77fa239aca2283583d3fc858cfb8505
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:22:28 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/schema_load.c Use DSDB_FLAG_NEXT_MODULE 
flag

commit 64c31b7e0ae2085658ad8f5df7791b0343239276
Author: Kamen Mazdrashki <kame...@samba.org>
Date:   Tue Jul 6 03:22:09 2010 +0300

    s4-source4/dsdb/samdb/ldb_modules/util.c Use DSDB_FLAG_NEXT_MODULE flag

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/samdb/ldb_modules/acl.c               |   17 ++++--
 source4/dsdb/samdb/ldb_modules/linked_attributes.c |    5 +-
 source4/dsdb/samdb/ldb_modules/naming_fsmo.c       |    3 +-
 source4/dsdb/samdb/ldb_modules/operational.c       |   10 ++-
 source4/dsdb/samdb/ldb_modules/partition_init.c    |    9 ++-
 source4/dsdb/samdb/ldb_modules/pdc_fsmo.c          |    3 +-
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c    |   10 ++-
 source4/dsdb/samdb/ldb_modules/ridalloc.c          |    9 ++-
 source4/dsdb/samdb/ldb_modules/samba_dsdb.c        |    6 +-
 source4/dsdb/samdb/ldb_modules/schema_load.c       |    3 +-
 source4/dsdb/samdb/ldb_modules/util.c              |   67 +++++++++++--------
 11 files changed, 91 insertions(+), 51 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/acl.c 
b/source4/dsdb/samdb/ldb_modules/acl.c
index 1d5e805..2b0b19c 100644
--- a/source4/dsdb/samdb/ldb_modules/acl.c
+++ b/source4/dsdb/samdb/ldb_modules/acl.c
@@ -108,7 +108,9 @@ int dsdb_module_check_access_on_dn(struct ldb_module 
*module,
                return ldb_operr(ldb);
        }
        ret = dsdb_module_search_dn(module, mem_ctx, &acl_res, dn,
-                                   acl_attrs, DSDB_SEARCH_SHOW_DELETED);
+                                   acl_attrs,
+                                   DSDB_FLAG_NEXT_MODULE |
+                                   DSDB_SEARCH_SHOW_DELETED);
        if (ret != LDB_SUCCESS) {
                DEBUG(10,("access_check: failed to find object %s\n", 
ldb_dn_get_linearized(dn)));
                return ret;
@@ -158,7 +160,8 @@ static int acl_module_init(struct ldb_module *module)
 
        ret = dsdb_module_search_dn(module, mem_ctx, &res,
                                    ldb_dn_new(mem_ctx, ldb, "@KLUDGEACL"),
-                                   attrs, 0);
+                                   attrs,
+                                   DSDB_FLAG_NEXT_MODULE);
        if (ret != LDB_SUCCESS) {
                goto done;
        }
@@ -849,7 +852,8 @@ static int acl_modify(struct ldb_module *module, struct 
ldb_request *req)
                return ldb_next_request(module, req);
        }
        ret = dsdb_module_search_dn(module, tmp_ctx, &acl_res, 
req->op.mod.message->dn,
-                                   acl_attrs, 0);
+                                   acl_attrs,
+                                   DSDB_FLAG_NEXT_MODULE);
 
        if (ret != LDB_SUCCESS) {
                goto fail;
@@ -1080,7 +1084,9 @@ static int acl_rename(struct ldb_module *module, struct 
ldb_request *req)
        ldb = ldb_module_get_ctx(module);
 
        ret = dsdb_module_search_dn(module, req, &acl_res, req->op.rename.olddn,
-                                   acl_attrs, DSDB_SEARCH_SHOW_DELETED);
+                                   acl_attrs,
+                                   DSDB_FLAG_NEXT_MODULE |
+                                   DSDB_SEARCH_SHOW_DELETED);
        /* we sould be able to find the parent */
        if (ret != LDB_SUCCESS) {
                DEBUG(10,("acl: failed to find object %s\n",
@@ -1230,7 +1236,8 @@ static int acl_search_callback(struct ldb_request *req, 
struct ldb_reply *ares)
                    || ac->allowedAttributesEffective
                    || ac->sDRightsEffective) {
                        ret = dsdb_module_search_dn(ac->module, ac, &acl_res, 
ares->message->dn, 
-                                                   acl_attrs, 0);
+                                                   acl_attrs,
+                                                   DSDB_FLAG_NEXT_MODULE);
                        if (ret != LDB_SUCCESS) {
                                return ldb_module_done(ac->req, NULL, NULL, 
ret);
                        }
diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c 
b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
index 67ae236..29f9d0d 100644
--- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c
+++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
@@ -620,6 +620,7 @@ static int linked_attributes_fix_links(struct ldb_module 
*module,
 
                ret = dsdb_module_search_dn(module, tmp_ctx, &res, dsdb_dn->dn,
                                            attrs,
+                                           DSDB_FLAG_NEXT_MODULE |
                                            DSDB_SEARCH_SHOW_DELETED |
                                            
DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT |
                                            DSDB_SEARCH_REVEAL_INTERNALS);
@@ -712,7 +713,9 @@ static int linked_attributes_rename(struct ldb_module 
*module, struct ldb_reques
           - modify the target linked attributes with the new DN
        */
        ret = dsdb_module_search_dn(module, req, &res, req->op.rename.olddn,
-                                   NULL, DSDB_SEARCH_SHOW_DELETED);
+                                   NULL,
+                                   DSDB_FLAG_NEXT_MODULE |
+                                   DSDB_SEARCH_SHOW_DELETED);
        if (ret != LDB_SUCCESS) {
                return ret;
        }
diff --git a/source4/dsdb/samdb/ldb_modules/naming_fsmo.c 
b/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
index 5023657..3f4c892 100644
--- a/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
@@ -66,7 +66,8 @@ static int naming_fsmo_init(struct ldb_module *module)
 
        ret = dsdb_module_search_dn(module, mem_ctx, &naming_res,
                                    naming_dn,
-                                   naming_attrs, 0);
+                                   naming_attrs,
+                                   DSDB_FLAG_NEXT_MODULE);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                ldb_debug(ldb, LDB_DEBUG_WARNING,
                          "naming_fsmo_init: no partitions dn present: (skip 
loading of naming contexts details)\n");
diff --git a/source4/dsdb/samdb/ldb_modules/operational.c 
b/source4/dsdb/samdb/ldb_modules/operational.c
index 03502d3..c1da400 100644
--- a/source4/dsdb/samdb/ldb_modules/operational.c
+++ b/source4/dsdb/samdb/ldb_modules/operational.c
@@ -212,7 +212,9 @@ static int construct_parent_guid(struct ldb_module *module,
                return LDB_SUCCESS;
        }
 
-       ret = dsdb_module_search_dn(module, msg, &res, parent_dn, attrs, 
DSDB_SEARCH_SHOW_DELETED);
+       ret = dsdb_module_search_dn(module, msg, &res, parent_dn, attrs,
+                                   DSDB_FLAG_NEXT_MODULE |
+                                   DSDB_SEARCH_SHOW_DELETED);
        talloc_free(parent_dn);
 
        /* if there is no parent for this object, then return */
@@ -323,7 +325,8 @@ static int construct_msds_isrodc_with_server_dn(struct 
ldb_module *module,
                return ldb_operr(ldb_module_get_ctx(module));
        }
 
-       ret = dsdb_module_search_dn(module, msg, &res, server_dn, attr_obj_cat, 
0);
+       ret = dsdb_module_search_dn(module, msg, &res, server_dn, attr_obj_cat,
+                                   DSDB_FLAG_NEXT_MODULE);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                DEBUG(4,(__location__ ": Can't get objectCategory for %s \n",
                                         ldb_dn_get_linearized(server_dn)));
@@ -350,7 +353,8 @@ static int construct_msds_isrodc_with_computer_dn(struct 
ldb_module *module,
        int ret;
        struct ldb_dn *server_dn;
 
-       ret = dsdb_module_search_dn(module, msg, &res, msg->dn, attr, 0);
+       ret = dsdb_module_search_dn(module, msg, &res, msg->dn, attr,
+                                   DSDB_FLAG_NEXT_MODULE);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                DEBUG(4,(__location__ ": Can't get serverReferenceBL for %s \n",
                         ldb_dn_get_linearized(msg->dn)));
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c 
b/source4/dsdb/samdb/ldb_modules/partition_init.c
index 99d2f1d..87c2543 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -136,7 +136,8 @@ static int partition_reload_metadata(struct ldb_module 
*module, struct partition
        /* perform search for @PARTITION, looking for module, replicateEntries 
and ldapBackend */
        ret = dsdb_module_search_dn(module, mem_ctx, &res, 
                                    ldb_dn_new(mem_ctx, ldb, DSDB_PARTITION_DN),
-                                   attrs, 0);
+                                   attrs,
+                                   DSDB_FLAG_NEXT_MODULE);
        if (ret != LDB_SUCCESS) {
                return ret;
        }
@@ -499,7 +500,8 @@ int partition_reload_if_required(struct ldb_module *module,
 
                /* Get the 'correct' case of the partition DNs from the 
database */
                ret = dsdb_module_search_dn(partition->module, data, &dn_res, 
-                                           dn, no_attrs, 0);
+                                           dn, no_attrs,
+                                           DSDB_FLAG_NEXT_MODULE);
                if (ret == LDB_SUCCESS) {
                        talloc_free(partition->ctrl->dn);
                        partition->ctrl->dn = talloc_steal(partition->ctrl, 
dn_res->msgs[0]->dn);
@@ -540,7 +542,8 @@ static int new_partition_set_replicated_metadata(struct 
ldb_context *ldb,
                struct ldb_request *add_req;
                ret = dsdb_module_search_dn(module, last_req, &replicate_res, 
                                            data->replicate[i],
-                                           NULL, 0);
+                                           NULL,
+                                           DSDB_FLAG_NEXT_MODULE);
                if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                        continue;
                }
diff --git a/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c 
b/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
index 2d45ae2..9bf49da 100644
--- a/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
@@ -65,7 +65,8 @@ static int pdc_fsmo_init(struct ldb_module *module)
 
        ret = dsdb_module_search_dn(module, mem_ctx, &pdc_res,
                                    pdc_dn, 
-                                   pdc_attrs, 0);
+                                   pdc_attrs,
+                                   DSDB_FLAG_NEXT_MODULE);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                ldb_debug(ldb, LDB_DEBUG_WARNING,
                          "pdc_fsmo_init: no domain object present: (skip 
loading of domain details)\n");
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c 
b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 8668b5e..90af17f 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -1117,7 +1117,8 @@ static int replmd_update_rpmd(struct ldb_module *module,
         * replmd_update_rpmd_element()
         */
        ret = dsdb_module_search_dn(module, msg, &res, msg->dn, attrs,
-                                   DSDB_SEARCH_SHOW_DELETED |
+                                   DSDB_FLAG_NEXT_MODULE |
+                                   DSDB_SEARCH_SHOW_DELETED |
                                    DSDB_SEARCH_SHOW_EXTENDED_DN |
                                    DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT |
                                    DSDB_SEARCH_REVEAL_INTERNALS);
@@ -1970,7 +1971,8 @@ static int replmd_modify_handle_linked_attribs(struct 
ldb_module *module,
        }
 
        ret = dsdb_module_search_dn(module, msg, &res, msg->dn, NULL,
-                                   DSDB_SEARCH_SHOW_DELETED |
+                                   DSDB_FLAG_NEXT_MODULE |
+                                   DSDB_SEARCH_SHOW_DELETED |
                                    DSDB_SEARCH_REVEAL_INTERNALS |
                                    DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT);
        if (ret != LDB_SUCCESS) {
@@ -2407,7 +2409,8 @@ static int replmd_delete(struct ldb_module *module, 
struct ldb_request *req)
        /* we need the complete msg off disk, so we can work out which
           attributes need to be removed */
        ret = dsdb_module_search_dn(module, tmp_ctx, &res, old_dn, NULL,
-                                   DSDB_SEARCH_SHOW_DELETED |
+                                   DSDB_FLAG_NEXT_MODULE |
+                                   DSDB_SEARCH_SHOW_DELETED |
                                    DSDB_SEARCH_REVEAL_INTERNALS |
                                    DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT);
        if (ret != LDB_SUCCESS) {
@@ -2527,6 +2530,7 @@ static int replmd_delete(struct ldb_module *module, 
struct ldb_request *req)
        /* we need the storage form of the parent GUID */
        ret = dsdb_module_search_dn(module, tmp_ctx, &parent_res,
                                    ldb_dn_get_parent(tmp_ctx, old_dn), NULL,
+                                   DSDB_FLAG_NEXT_MODULE |
                                    DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT |
                                    DSDB_SEARCH_REVEAL_INTERNALS|
                                    DSDB_SEARCH_SHOW_DELETED);
diff --git a/source4/dsdb/samdb/ldb_modules/ridalloc.c 
b/source4/dsdb/samdb/ldb_modules/ridalloc.c
index 55636d1..91d48ba 100644
--- a/source4/dsdb/samdb/ldb_modules/ridalloc.c
+++ b/source4/dsdb/samdb/ldb_modules/ridalloc.c
@@ -107,7 +107,8 @@ static int ridalloc_rid_manager_allocate(struct ldb_module 
*module, struct ldb_d
        struct ldb_context *ldb = ldb_module_get_ctx(module);
        const unsigned alloc_size = 500;
 
-       ret = dsdb_module_search_dn(module, tmp_ctx, &res, rid_manager_dn, 
attrs, 0);
+       ret = dsdb_module_search_dn(module, tmp_ctx, &res, rid_manager_dn,
+                                   attrs, DSDB_FLAG_NEXT_MODULE);
        if (ret != LDB_SUCCESS) {
                ldb_asprintf_errstring(ldb, "Failed to find rIDAvailablePool in 
%s - %s",
                                       ldb_dn_get_linearized(rid_manager_dn), 
ldb_errstring(ldb));
@@ -449,7 +450,8 @@ int ridalloc_allocate_rid(struct ldb_module *module, 
uint32_t *rid)
                return ret;
        }
 
-       ret = dsdb_module_search_dn(module, tmp_ctx, &res, rid_set_dn, attrs, 
0);
+       ret = dsdb_module_search_dn(module, tmp_ctx, &res, rid_set_dn,
+                                   attrs, DSDB_FLAG_NEXT_MODULE);
        if (ret != LDB_SUCCESS) {
                ldb_asprintf_errstring(ldb, __location__ ": No RID Set %s",
                                       ldb_dn_get_linearized(rid_set_dn));
@@ -623,7 +625,8 @@ int ridalloc_allocate_rid_pool_fsmo(struct ldb_module 
*module, struct dsdb_fsmo_
                struct ldb_result *res;
                uint64_t alloc_pool;
 
-               ret = dsdb_module_search_dn(module, tmp_ctx, &res, rid_set_dn, 
attrs, 0);
+               ret = dsdb_module_search_dn(module, tmp_ctx, &res, rid_set_dn,
+                                           attrs, DSDB_FLAG_NEXT_MODULE);
                if (ret != LDB_SUCCESS) {
                        ldb_asprintf_errstring(ldb, __location__ ": No RID Set 
%s",
                                               
ldb_dn_get_linearized(rid_set_dn));
diff --git a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c 
b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
index 09990b0..392e215 100644
--- a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
+++ b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
@@ -58,7 +58,8 @@ static int read_at_rootdse_record(struct ldb_context *ldb, 
struct ldb_module *mo
                return ldb_oom(ldb);
        }
 
-       ret = dsdb_module_search_dn(module, tmp_ctx, &rootdse_res, rootdse_dn, 
rootdse_attrs, 0);
+       ret = dsdb_module_search_dn(module, tmp_ctx, &rootdse_res, rootdse_dn,
+                                   rootdse_attrs, DSDB_FLAG_NEXT_MODULE);
        if (ret != LDB_SUCCESS) {
                talloc_free(tmp_ctx);
                return ret;
@@ -233,7 +234,8 @@ static int samba_dsdb_init(struct ldb_module *module)
                }                                               \
        } while (0)
 
-       ret = dsdb_module_search_dn(module, tmp_ctx, &res, samba_dsdb_dn, 
samba_dsdb_attrs, 0);
+       ret = dsdb_module_search_dn(module, tmp_ctx, &res, samba_dsdb_dn,
+                                   samba_dsdb_attrs, DSDB_FLAG_NEXT_MODULE);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                backendType = "ldb";
                serverRole = "domain controller";
diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c 
b/source4/dsdb/samdb/ldb_modules/schema_load.c
index dc3b060..1542018 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_load.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_load.c
@@ -172,7 +172,8 @@ static int dsdb_schema_from_db(struct ldb_module *module, 
struct ldb_dn *schema_
         * setup the prefix mappings and schema info
         */
        ret = dsdb_module_search_dn(module, tmp_ctx, &schema_res,
-                                   schema_dn, schema_attrs, 0);
+                                   schema_dn, schema_attrs,
+                                   DSDB_FLAG_NEXT_MODULE);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                ldb_reset_err_string(ldb);
                ldb_debug(ldb, LDB_DEBUG_WARNING,
diff --git a/source4/dsdb/samdb/ldb_modules/util.c 
b/source4/dsdb/samdb/ldb_modules/util.c
index 639b0df..bf260f9 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -71,7 +71,16 @@ int dsdb_module_search_dn(struct ldb_module *module,
                return ret;
        }
 
-       ret = ldb_next_request(module, req);
+       /* Run the new request */
+       if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) {
+               ret = ldb_next_request(module, req);
+       } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) {
+               ret = ldb_request(ldb_module_get_ctx(module), req);
+       } else {
+               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
+               SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE);
+               ret = ops->modify(module, req);
+       }
        if (ret == LDB_SUCCESS) {
                ret = ldb_wait(req->handle, LDB_WAIT_ALL);
        }
@@ -153,14 +162,14 @@ int dsdb_module_search(struct ldb_module *module,
                return ret;
        }
 
-       if (dsdb_flags & DSDB_FLAG_OWN_MODULE) {
-               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
-               ret = ops->search(module, req);
+       if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) {
+               ret = ldb_next_request(module, req);
        } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) {
                ret = ldb_request(ldb_module_get_ctx(module), req);
        } else {
-               SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE);
-               ret = ldb_next_request(module, req);
+               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
+               SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE);
+               ret = ops->search(module, req);
        }
        if (ret == LDB_SUCCESS) {
                ret = ldb_wait(req->handle, LDB_WAIT_ALL);
@@ -225,7 +234,8 @@ int dsdb_module_guid_by_dn(struct ldb_module *module, 
struct ldb_dn *dn, struct
        NTSTATUS status;
 
        ret = dsdb_module_search_dn(module, tmp_ctx, &res, dn, attrs,
-                                   DSDB_SEARCH_SHOW_DELETED|
+                                   DSDB_FLAG_NEXT_MODULE |
+                                   DSDB_SEARCH_SHOW_DELETED |
                                    DSDB_SEARCH_SHOW_EXTENDED_DN);
        if (ret != LDB_SUCCESS) {
                ldb_asprintf_errstring(ldb_module_get_ctx(module), "Failed to 
find GUID for %s",
@@ -282,14 +292,14 @@ int dsdb_module_modify(struct ldb_module *module,
        }
 
        /* Run the new request */
-       if (dsdb_flags & DSDB_FLAG_OWN_MODULE) {
-               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
-               ret = ops->modify(module, mod_req);
+       if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) {
+               ret = ldb_next_request(module, mod_req);
        } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) {
                ret = ldb_request(ldb_module_get_ctx(module), mod_req);
        } else {
-               SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE);
-               ret = ldb_next_request(module, mod_req);
+               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
+               SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE);
+               ret = ops->modify(module, mod_req);
        }
        if (ret == LDB_SUCCESS) {
                ret = ldb_wait(mod_req->handle, LDB_WAIT_ALL);
@@ -340,14 +350,14 @@ int dsdb_module_rename(struct ldb_module *module,
        }
 
        /* Run the new request */
-       if (dsdb_flags & DSDB_FLAG_OWN_MODULE) {
-               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
-               ret = ops->rename(module, req);
+       if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) {
+               ret = ldb_next_request(module, req);
        } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) {
                ret = ldb_request(ldb_module_get_ctx(module), req);
        } else {
-               SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE);
-               ret = ldb_next_request(module, req);
+               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
+               SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE);
+               ret = ops->rename(module, req);
        }
        if (ret == LDB_SUCCESS) {
                ret = ldb_wait(req->handle, LDB_WAIT_ALL);
@@ -395,14 +405,14 @@ int dsdb_module_add(struct ldb_module *module,
        }
 
        /* Run the new request */
-       if (dsdb_flags & DSDB_FLAG_OWN_MODULE) {
-               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
-               ret = ops->add(module, req);
+       if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) {
+               ret = ldb_next_request(module, req);
        } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) {
                ret = ldb_request(ldb_module_get_ctx(module), req);
        } else {
-               SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE);
-               ret = ldb_next_request(module, req);
+               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
+               SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE);
+               ret = ops->add(module, req);
        }
        if (ret == LDB_SUCCESS) {
                ret = ldb_wait(req->handle, LDB_WAIT_ALL);
@@ -450,14 +460,14 @@ int dsdb_module_del(struct ldb_module *module,
        }
 
        /* Run the new request */
-       if (dsdb_flags & DSDB_FLAG_OWN_MODULE) {
-               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
-               ret = ops->del(module, req);
+       if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) {
+               ret = ldb_next_request(module, req);
        } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) {
                ret = ldb_request(ldb_module_get_ctx(module), req);
        } else {
-               SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE);
-               ret = ldb_next_request(module, req);
+               const struct ldb_module_ops *ops = ldb_module_get_ops(module);
+               SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE);
+               ret = ops->del(module, req);
        }
        if (ret == LDB_SUCCESS) {
                ret = ldb_wait(req->handle, LDB_WAIT_ALL);
@@ -596,7 +606,8 @@ int dsdb_module_reference_dn(struct ldb_module *module, 
TALLOC_CTX *mem_ctx, str
        attrs[0] = attribute;
        attrs[1] = NULL;
 
-       ret = dsdb_module_search_dn(module, mem_ctx, &res, base, attrs, 0);
+       ret = dsdb_module_search_dn(module, mem_ctx, &res, base, attrs,
+                                   DSDB_FLAG_NEXT_MODULE);
        if (ret != LDB_SUCCESS) {
                return ret;
        }


-- 
Samba Shared Repository

Reply via email to