bool move_op = false;
bool rename_op = false;
- /* Skip the checks if old and new DN are the same or if we relax */
+ /* Skip the checks if old and new DN are the same, or if we have the
+ * relax control specified or if the returned objects is already
+ * deleted and needs only to be moved for consistency. */
if (ldb_dn_compare(olddn, newdn) == 0) {
return LDB_SUCCESS;
if (ldb_request_get_control(ac->req, LDB_CONTROL_RELAX_OID) != NULL) {
return LDB_SUCCESS;
}
+ if (ldb_msg_find_attr_as_bool(msg, "isDeleted", false)) {
+ return LDB_SUCCESS;
+ }
/* Objects under CN=System */
{
struct ldb_context *ldb;
static const char * const attrs[] = { "objectClass", "systemFlags",
- NULL };
+ "isDeleted", NULL };
struct ldb_request *search_req;
struct subtree_rename_context *ac;
int ret;
return ret;
}
+ ret = ldb_request_add_control(search_req, LDB_CONTROL_SHOW_RECYCLED_OID,
+ true, NULL);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
return ldb_next_request(module, search_req);
}