summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/partition.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-10-24 04:32:24 +0200
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:24 +0100
commit5cfa7732023e38b262b681efdb07c6d9f7d14cd7 (patch)
tree8a549b5853f00d339462b8fa4f4f080f82214c96 /source4/dsdb/samdb/ldb_modules/partition.c
parent45c3d150d5c7658bddec9334b4c176b1ffb8a8fb (diff)
downloadsamba-5cfa7732023e38b262b681efdb07c6d9f7d14cd7.tar.gz
samba-5cfa7732023e38b262b681efdb07c6d9f7d14cd7.tar.bz2
samba-5cfa7732023e38b262b681efdb07c6d9f7d14cd7.zip
r25710: Finally fix subtree renames. Untested code is broken code and in this
case an oddity of the javascript caused the test to 'pass'. For the same oddity, we have a failure in ldb's handling of spaces in DNs. We need to resolve that too. Andrew Bartlett (This used to be commit e8cbac1a46f4d3b083e6bb5a509ef1ba47bebff1)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/partition.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c17
1 files changed, 17 insertions, 0 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);
}