s4:partition LDB module - fill in parent requests for inheriting the flags
[nivanova/samba-autobuild/.git] / source4 / dsdb / samdb / ldb_modules / partition.c
index 244b67950f1f4c0c3e53a576d5b482754cf013aa..6cf670937e60c5207d83becf01be7a2ecd1c154b 100644 (file)
@@ -149,7 +149,7 @@ static int partition_req_callback(struct ldb_request *req,
        if (partition_ctrl && (ac->num_requests == 1 || ares->type == LDB_REPLY_ENTRY)) {
                /* If we didn't fan this request out to mulitple partitions,
                 * or this is an individual search result, we can
-                * deterministily tell the caller what partition this was
+                * deterministically tell the caller what partition this was
                 * written to (repl_meta_data likes to know) */
                ret = ldb_reply_add_control(ares,
                                            DSDB_CONTROL_CURRENT_PARTITION_OID,
@@ -398,6 +398,8 @@ static int partition_replicate(struct ldb_module *module, struct ldb_request *re
        struct dsdb_partition *partition;
        struct partition_private_data *data = talloc_get_type(ldb_module_get_private(module),
                                                              struct partition_private_data);
+
+       /* if we aren't initialised yet go further */
        if (!data || !data->partitions) {
                return ldb_next_request(module, req);
        }
@@ -468,8 +470,9 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
        unsigned int i, j;
        int ret;
        bool domain_scope = false, phantom_root = false;
-       
-       ret = partition_reload_if_required(module, data);
+
+       /* see if we are still up-to-date */
+       ret = partition_reload_if_required(module, data, req);
        if (ret != LDB_SUCCESS) {
                return ret;
        }
@@ -724,7 +727,7 @@ static int partition_start_trans(struct ldb_module *module)
                return ret;
        }
 
-       ret = partition_reload_if_required(module, data);
+       ret = partition_reload_if_required(module, data, NULL);
        if (ret != LDB_SUCCESS) {
                return ret;
        }
@@ -973,7 +976,7 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
                                                     NULL,
                                                     res,
                                                     ldb_extended_default_callback,
-                                                    NULL);
+                                                    req);
                        LDB_REQ_SET_LOCATION(treq);
                        if (ret != LDB_SUCCESS) {
                                talloc_free(res);
@@ -1031,7 +1034,7 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
                                             NULL,
                                             res,
                                             ldb_extended_default_callback,
-                                            NULL);
+                                            req);
                LDB_REQ_SET_LOCATION(treq);
                if (ret != LDB_SUCCESS) {
                        talloc_free(res);
@@ -1076,7 +1079,7 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
                                                     NULL,
                                                     res,
                                                     ldb_extended_default_callback,
-                                                    NULL);
+                                                    req);
                        LDB_REQ_SET_LOCATION(treq);
                        if (ret != LDB_SUCCESS) {
                                talloc_free(res);
@@ -1169,7 +1172,7 @@ static int partition_extended(struct ldb_module *module, struct ldb_request *req
                return ldb_next_request(module, req);
        }
 
-       ret = partition_reload_if_required(module, data);
+       ret = partition_reload_if_required(module, data, req);
        if (ret != LDB_SUCCESS) {
                return ret;
        }