From 18f3e5113ae18e120770ba93b0d36a7b176b0c52 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 16 Jun 2010 12:01:10 +1000 Subject: 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 --- source4/dsdb/samdb/ldb_modules/linked_attributes.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'source4') 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; } -- cgit