>From a7e9b33f85b1dc506d47a119b963bb3c0f64fe0f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 17 Sep 2013 15:28:32 -0700 Subject: [PATCH] dsdb-repl_meta_data: Do not re-delete the Deleted Objects DN during replication We need to ensure we do not re-delete the Deleted Objects DN during replication. It itself not entirely a deleted object, but has isDeleted set. Andrew Bartlett --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index c0d54e3..ad8dbc8 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -4655,7 +4655,21 @@ static int replmd_replicated_apply_next(struct replmd_replicated_request *ar) */ static int replmd_replicated_apply_isDeleted(struct replmd_replicated_request *ar) { - if (ar->isDeleted) { + struct ldb_dn *deleted_objects_dn; + struct ldb_message *msg = ar->objs->objects[ar->index_current].msg; + /* + * The Deleted Object containter is a bit of a special object + * it will *always* have the isDeleted attribute but never the + * isRecycled one even if recycle-bin is enabled or if the FL >=2K8R2 + * Also we must *NOT* remove attributes. + * That's why we skip the redeletion of it. + */ + int ret = dsdb_get_deleted_objects_dn(ldb_module_get_ctx(ar->module), + msg, msg->dn, + &deleted_objects_dn); + if (ar->isDeleted &&(ret != LDB_SUCCESS || + ldb_dn_compare(msg->dn, deleted_objects_dn) != 0)) + { /* * Do a delete here again, so that if there is * anything local that conflicts with this @@ -4669,11 +4683,9 @@ static int replmd_replicated_apply_isDeleted(struct replmd_replicated_request *a */ /* This has been updated to point to the DN we eventually did the modify on */ - struct ldb_message *msg = ar->objs->objects[ar->index_current].msg; struct ldb_request *del_req; struct ldb_result *res; - int ret; TALLOC_CTX *tmp_ctx = talloc_new(ar); if (!tmp_ctx) { -- 1.8.1.2