From: Andrew Bartlett Date: Mon, 21 Mar 2016 23:07:27 +0000 (+1300) Subject: repl_meta_data: Do rename before deleted object cleanup X-Git-Tag: tdb-1.3.10~1025 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=01043fc5f549b61cf3e203cb660e3235d48184c0;p=thirdparty%2Fsamba.git repl_meta_data: Do rename before deleted object cleanup Following from the lesson of subtree_rename, do the rename first, as this is more likely to fail for some reason Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Wed Jun 1 14:01:36 CEST 2016 on sn-devel-144 --- diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index f65cc655c79..c0c8de54d2e 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -3495,14 +3495,6 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request * */ - ret = dsdb_module_modify(module, msg, DSDB_FLAG_OWN_MODULE, req); - if (ret != LDB_SUCCESS) { - ldb_asprintf_errstring(ldb, "replmd_delete: Failed to modify object %s in delete - %s", - ldb_dn_get_linearized(old_dn), ldb_errstring(ldb)); - talloc_free(tmp_ctx); - return ret; - } - /* * No matter what has happned with other renames, try again to * get this to be under the deleted DN. @@ -3518,6 +3510,15 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request talloc_free(tmp_ctx); return ret; } + msg->dn = new_dn; + } + + ret = dsdb_module_modify(module, msg, DSDB_FLAG_OWN_MODULE, req); + if (ret != LDB_SUCCESS) { + ldb_asprintf_errstring(ldb, "replmd_delete: Failed to modify object %s in delete - %s", + ldb_dn_get_linearized(old_dn), ldb_errstring(ldb)); + talloc_free(tmp_ctx); + return ret; } talloc_free(tmp_ctx);