summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-10-31 03:56:13 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:47 +0100
commit464dd2ada160002a888e3b2dd17cf0072fbcedf3 (patch)
treef7f0003baaf0bb238c590c3585b578797e9733aa /source4/dsdb/samdb
parentdbb3c74464d84ff2b7bf1f98daa9db3db7d50734 (diff)
downloadsamba-464dd2ada160002a888e3b2dd17cf0072fbcedf3.tar.gz
samba-464dd2ada160002a888e3b2dd17cf0072fbcedf3.tar.bz2
samba-464dd2ada160002a888e3b2dd17cf0072fbcedf3.zip
r25761: Rename to be a DN to be a child of itself wasn't being checked for.
This prevents CN=test,dc=samba,dc=example,dc=com being renamed into CN=test2,cn=test,dc=samba,dc=example,dc=com Andrew Bartlett (This used to be commit 958a92ed0c6bee19d8b86df7c66330d2bba23e46)
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/subtree_rename.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/subtree_rename.c b/source4/dsdb/samdb/ldb_modules/subtree_rename.c
index 72857cb864..5c28723391 100644
--- a/source4/dsdb/samdb/ldb_modules/subtree_rename.c
+++ b/source4/dsdb/samdb/ldb_modules/subtree_rename.c
@@ -163,6 +163,14 @@ static int subtree_rename(struct ldb_module *module, struct ldb_request *req)
return ldb_next_request(module, req);
}
+ /* Firstly ensure we are not trying to rename it to be a child of itself */
+ if ((ldb_dn_compare_base(req->op.rename.olddn, req->op.rename.newdn) == 0)
+ && (ldb_dn_compare(req->op.rename.olddn, req->op.rename.newdn) != 0)) {
+ ldb_asprintf_errstring(module->ldb, "Cannot rename %s to be a child of itself",
+ ldb_dn_get_linearized(req->op.rename.olddn));
+ return LDB_ERR_UNWILLING_TO_PERFORM;
+ }
+
/* This gets complex: We need to:
- Do a search for all entires under this entry
- Wait for these results to appear