summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c17
-rw-r--r--source4/dsdb/samdb/ldb_modules/subtree_rename.c18
2 files changed, 18 insertions, 17 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index 6f60b25a4b..5d3663be33 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -405,6 +405,7 @@ static int partition_delete(struct ldb_module *module, struct ldb_request *req)
/* rename */
static int partition_rename(struct ldb_module *module, struct ldb_request *req)
{
+ int i, matched = -1;
/* Find backend */
struct dsdb_control_current_partition *backend, *backend2;
@@ -434,6 +435,22 @@ static int partition_rename(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_AFFECTS_MULTIPLE_DSAS;
}
+ for (i=0; data && data->partitions && data->partitions[i]; i++) {
+ if (ldb_dn_compare_base(req->op.rename.olddn, data->partitions[i]->dn) == 0) {
+ matched = i;
+ }
+ }
+
+ if (matched > 0) {
+ ldb_asprintf_errstring(module->ldb,
+ "Cannot rename from %s to %s, subtree rename would cross partition %s: %s",
+ ldb_dn_get_linearized(req->op.rename.olddn),
+ ldb_dn_get_linearized(req->op.rename.newdn),
+ ldb_dn_get_linearized(data->partitions[matched]->dn),
+ ldb_strerror(LDB_ERR_AFFECTS_MULTIPLE_DSAS));
+ return LDB_ERR_AFFECTS_MULTIPLE_DSAS;
+ }
+
return partition_replicate(module, req, req->op.rename.olddn);
}
diff --git a/source4/dsdb/samdb/ldb_modules/subtree_rename.c b/source4/dsdb/samdb/ldb_modules/subtree_rename.c
index 267892cf58..8f15f9ed05 100644
--- a/source4/dsdb/samdb/ldb_modules/subtree_rename.c
+++ b/source4/dsdb/samdb/ldb_modules/subtree_rename.c
@@ -157,7 +157,6 @@ static int subtree_rename(struct ldb_module *module, struct ldb_request *req)
struct ldb_request *new_req;
struct subtree_rename_context *ac;
int ret;
- struct ldb_search_options_control *search_options;
if (ldb_dn_is_special(req->op.rename.olddn)) { /* do not manipulate our control entries */
return ldb_next_request(module, req);
}
@@ -189,21 +188,6 @@ static int subtree_rename(struct ldb_module *module, struct ldb_request *req)
return ret;
}
- /* We want to find any partitions under this entry. That way,
- * if we try and rename a whole partition, the partitions
- * module should cause us to fail the lot */
- search_options = talloc(ac, struct ldb_search_options_control);
- if (!search_options) {
- ldb_oom(ac->module->ldb);
- return LDB_ERR_OPERATIONS_ERROR;
- }
- search_options->search_options = LDB_SEARCH_OPTION_PHANTOM_ROOT;
-
- ret = ldb_request_add_control(new_req, LDB_CONTROL_SEARCH_OPTIONS_OID, false, search_options);
- if (ret != LDB_SUCCESS) {
- return ret;
- }
-
ac->down_req = talloc_realloc(ac, ac->down_req,
struct ldb_request *, ac->num_requests + 1);
if (!ac->down_req) {
@@ -221,7 +205,7 @@ static int subtree_rename(struct ldb_module *module, struct ldb_request *req)
static int subtree_rename_wait_none(struct ldb_handle *handle) {
struct subtree_rename_context *ac;
- int i, ret;
+ int i, ret = LDB_ERR_OPERATIONS_ERROR;
if (!handle || !handle->private_data) {
return LDB_ERR_OPERATIONS_ERROR;
}