s4:dsdb Remove partition_extended_schema_update_now
[ira/wip.git] / source4 / dsdb / samdb / ldb_modules / partition.c
index 64ec798e4c4b62fc134c252096758cb36a66c4da..c6f6f6a5f32e73e79d50c5b604e451e7998e9983 100644 (file)
@@ -158,7 +158,7 @@ static int partition_req_callback(struct ldb_request *req,
        struct partition_context *ac;
        struct ldb_module *module;
        struct ldb_request *nreq;
-       int ret, i;
+       int ret;
        struct partition_private_data *data;
        struct ldb_control *partition_ctrl;
 
@@ -203,21 +203,6 @@ static int partition_req_callback(struct ldb_request *req,
                        return ldb_module_done(ac->req, NULL, NULL,
                                                LDB_ERR_OPERATIONS_ERROR);
                }
-               for (i=0; data && data->partitions && data->partitions[i]; i++) {
-                       if (ldb_dn_compare(ares->message->dn, data->partitions[i]->ctrl->dn) == 0) {
-                               struct ldb_control *part_control;
-                               /* this is a partition root message - make
-                                  sure it isn't one of our fake root
-                                  entries from a parent partition */
-                               part_control = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
-                               if (part_control && part_control->data != data->partitions[i]->ctrl) {
-                                       DEBUG(6,(__location__ ": Discarding partition mount object %s\n",
-                                                ldb_dn_get_linearized(ares->message->dn)));
-                                       talloc_free(ares);
-                                       return LDB_SUCCESS;
-                               }
-                       }
-               }
                
                return ldb_module_send_entry(ac->req, ares->message, ares->controls);
 
@@ -705,6 +690,9 @@ static int partition_start_trans(struct ldb_module *module)
                        return ret;
                }
        }
+
+       data->in_transaction++;
+
        return LDB_SUCCESS;
 }
 
@@ -752,6 +740,12 @@ static int partition_end_trans(struct ldb_module *module)
                }
        }
 
+       if (data->in_transaction == 0) {
+               DEBUG(0,("partition end transaction mismatch\n"));
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
+       data->in_transaction--;
+
        return ldb_next_end_trans(module);
 }
 
@@ -771,6 +765,12 @@ static int partition_del_trans(struct ldb_module *module)
                }
        }       
 
+       if (data->in_transaction == 0) {
+               DEBUG(0,("partition del transaction mismatch\n"));
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
+       data->in_transaction--;
+
        ret = ldb_next_del_trans(module);
        if (ret != LDB_SUCCESS) {
                final_ret = ret;
@@ -1072,52 +1072,6 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
        return ldb_module_done(req, NULL, ext, LDB_SUCCESS);
 }
 
-static int partition_extended_schema_update_now(struct ldb_module *module, struct ldb_request *req)
-{
-       struct dsdb_partition *partition;
-       struct partition_private_data *data;
-       struct ldb_dn *schema_dn;
-       struct partition_context *ac;
-       int ret;
-
-       schema_dn = talloc_get_type(req->op.extended.data, struct ldb_dn);
-       if (!schema_dn) {
-               ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_FATAL, "partition_extended: invalid extended data\n");
-               return LDB_ERR_PROTOCOL_ERROR;
-       }
-
-       data = talloc_get_type(module->private_data, struct partition_private_data);
-       if (!data) {
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-       
-       partition = find_partition( data, schema_dn, req);
-       if (!partition) {
-               return ldb_next_request(module, req);
-       }
-
-       ac = partition_init_ctx(module, req);
-       if (!ac) {
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-
-       /* we need to add a control but we never touch the original request */
-       ret = partition_prep_request(ac, partition);
-       if (ret != LDB_SUCCESS) {
-               return ret;
-       }
-
-       /* fire the first one */
-       ret = partition_call_first(ac);
-
-       if (ret != LDB_SUCCESS){
-               return ret;
-       }
-
-       return ldb_request_done(req, ret);
-}
-
-
 /* extended */
 static int partition_extended(struct ldb_module *module, struct ldb_request *req)
 {
@@ -1143,11 +1097,6 @@ static int partition_extended(struct ldb_module *module, struct ldb_request *req
                return partition_create(module, req);
        }
 
-       /* forward schemaUpdateNow operation to schema_fsmo module*/
-       if (strcmp(req->op.extended.oid, DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID) == 0) {
-               return partition_extended_schema_update_now( module, req );
-       }       
-
        /* 
         * as the extended operation has no dn
         * we need to send it to all partitions