summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/linked_attributes.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-06-16 12:01:10 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-06-16 12:05:31 +1000
commit18f3e5113ae18e120770ba93b0d36a7b176b0c52 (patch)
tree783bae04887a7998d2c63127ad09a2b797b89447 /source4/dsdb/samdb/ldb_modules/linked_attributes.c
parent0687a0c9dc3804e34a64f64f064fbbadb3e72ad5 (diff)
downloadsamba-18f3e5113ae18e120770ba93b0d36a7b176b0c52.tar.gz
samba-18f3e5113ae18e120770ba93b0d36a7b176b0c52.tar.bz2
samba-18f3e5113ae18e120770ba93b0d36a7b176b0c52.zip
s4:dsdb Allow renames with (now removed) linked attributes
It is important to allow the rename, even if we just have one-way links, as this happens on deleted objects, which have the backlinks alredy removed by repl_meta_data. Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/linked_attributes.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/linked_attributes.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
index d2a435ef50..c21fda5135 100644
--- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c
+++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
@@ -641,9 +641,17 @@ static int linked_attributes_fix_links(struct ldb_module *module,
}
msg = res->msgs[0];
- if (msg->num_elements != 1 ||
- ldb_attr_cmp(msg->elements[0].name, target->lDAPDisplayName) != 0) {
- ldb_set_errstring(ldb, "Bad msg elements in linked_attributes_fix_links");
+ if (msg->num_elements == 0) {
+ /* Forward link without backlink remaining - nothing to do here */
+ continue;
+ } else if (msg->num_elements != 1) {
+ ldb_asprintf_errstring(ldb, "Bad msg elements - got %u elements, expected one element to be returned in linked_attributes_fix_links for %s",
+ msg->num_elements, ldb_dn_get_linearized(msg->dn));
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ if (ldb_attr_cmp(msg->elements[0].name, target->lDAPDisplayName) != 0) {
+ ldb_asprintf_errstring(ldb, "Bad returned attribute in linked_attributes_fix_links: got %s, expected %s for %s", msg->elements[0].name, target->lDAPDisplayName, ldb_dn_get_linearized(msg->dn));
talloc_free(tmp_ctx);
return LDB_ERR_OPERATIONS_ERROR;
}