From e3081b92c16198332f5242a0395701ddfa7392e5 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sun, 19 Sep 2010 22:20:08 +0200 Subject: s4:dsdb - substitute the "show_deleted" with the "show_recycled" control We intend to see always all objects with the "show_deleted" control specified. To see also recycled objects (beginning with 2008_R2 function level) we need to use the new "show_recycled" control. As far as I see this is only internal code and therefore we don't run into problems if we do substitute it. Signed-off-by: Andrew Bartlett --- source4/dsdb/common/util.c | 9 ++++++--- source4/dsdb/kcc/kcc_deleted.c | 2 +- source4/dsdb/samdb/ldb_modules/acl.c | 2 +- source4/dsdb/samdb/ldb_modules/acl_util.c | 4 ++-- source4/dsdb/samdb/ldb_modules/extended_dn_store.c | 2 +- source4/dsdb/samdb/ldb_modules/linked_attributes.c | 4 ++-- source4/dsdb/samdb/ldb_modules/objectclass.c | 5 +++-- source4/dsdb/samdb/ldb_modules/objectclass_attrs.c | 2 +- source4/dsdb/samdb/ldb_modules/operational.c | 4 ++-- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 16 +++++++++------- source4/dsdb/samdb/ldb_modules/util.c | 4 ++-- 11 files changed, 30 insertions(+), 24 deletions(-) (limited to 'source4/dsdb') diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 7bfb99581f..523dd8ef8e 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -2516,7 +2516,8 @@ int dsdb_find_guid_attr_by_dn(struct ldb_context *ldb, attrs[0] = attribute; attrs[1] = NULL; - ret = dsdb_search_dn(ldb, tmp_ctx, &res, dn, attrs, DSDB_SEARCH_SHOW_DELETED); + ret = dsdb_search_dn(ldb, tmp_ctx, &res, dn, attrs, + DSDB_SEARCH_SHOW_RECYCLED); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret; @@ -2590,7 +2591,8 @@ int dsdb_find_sid_by_dn(struct ldb_context *ldb, ZERO_STRUCTP(sid); - ret = dsdb_search_dn(ldb, tmp_ctx, &res, dn, attrs, DSDB_SEARCH_SHOW_DELETED); + ret = dsdb_search_dn(ldb, tmp_ctx, &res, dn, attrs, + DSDB_SEARCH_SHOW_RECYCLED); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret; @@ -3272,7 +3274,8 @@ int dsdb_wellknown_dn(struct ldb_context *samdb, TALLOC_CTX *mem_ctx, return ldb_operr(samdb); } - ret = dsdb_search_dn(samdb, tmp_ctx, &res, dn, attrs, DSDB_SEARCH_SHOW_DELETED); + ret = dsdb_search_dn(samdb, tmp_ctx, &res, dn, attrs, + DSDB_SEARCH_SHOW_RECYCLED); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret; diff --git a/source4/dsdb/kcc/kcc_deleted.c b/source4/dsdb/kcc/kcc_deleted.c index 118952a143..1726fa4f31 100644 --- a/source4/dsdb/kcc/kcc_deleted.c +++ b/source4/dsdb/kcc/kcc_deleted.c @@ -71,7 +71,7 @@ NTSTATUS kccsrv_check_deleted(struct kccsrv_service *s, TALLOC_CTX *mem_ctx) continue; } ret = dsdb_search(s->samdb, do_dn, &res, do_dn, LDB_SCOPE_ONELEVEL, attrs, - DSDB_SEARCH_SHOW_DELETED, NULL); + DSDB_SEARCH_SHOW_RECYCLED, NULL); if (ret != LDB_SUCCESS) { DEBUG(1,(__location__ ": Failed to search for deleted objects in %s\n", diff --git a/source4/dsdb/samdb/ldb_modules/acl.c b/source4/dsdb/samdb/ldb_modules/acl.c index 2781b4cae5..149c6b105e 100644 --- a/source4/dsdb/samdb/ldb_modules/acl.c +++ b/source4/dsdb/samdb/ldb_modules/acl.c @@ -887,7 +887,7 @@ static int acl_rename(struct ldb_module *module, struct ldb_request *req) ret = dsdb_module_search_dn(module, req, &acl_res, req->op.rename.olddn, acl_attrs, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED); + DSDB_SEARCH_SHOW_RECYCLED); /* we sould be able to find the parent */ if (ret != LDB_SUCCESS) { DEBUG(10,("acl: failed to find object %s\n", diff --git a/source4/dsdb/samdb/ldb_modules/acl_util.c b/source4/dsdb/samdb/ldb_modules/acl_util.c index 6873e56abd..6c41602a82 100644 --- a/source4/dsdb/samdb/ldb_modules/acl_util.c +++ b/source4/dsdb/samdb/ldb_modules/acl_util.c @@ -73,7 +73,7 @@ int dsdb_module_check_access_on_dn(struct ldb_module *module, ret = dsdb_module_search_dn(module, mem_ctx, &acl_res, dn, acl_attrs, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED); + DSDB_SEARCH_SHOW_RECYCLED); if (ret != LDB_SUCCESS) { DEBUG(0,("access_check: failed to find object %s\n", ldb_dn_get_linearized(dn))); return ret; @@ -108,7 +108,7 @@ int dsdb_module_check_access_on_guid(struct ldb_module *module, ret = dsdb_module_search(module, mem_ctx, &acl_res, NULL, LDB_SCOPE_SUBTREE, acl_attrs, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED, + DSDB_SEARCH_SHOW_RECYCLED, "objectGUID=%s", GUID_string(mem_ctx, guid)); if (ret != LDB_SUCCESS || acl_res->count == 0) { diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_store.c b/source4/dsdb/samdb/ldb_modules/extended_dn_store.c index 15af268a8f..fafe51132f 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn_store.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn_store.c @@ -276,7 +276,7 @@ static int extended_store_replace(struct extended_dn_context *ac, } ret = dsdb_request_add_controls(os->search_req, - DSDB_SEARCH_SHOW_DELETED|DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT); + DSDB_SEARCH_SHOW_RECYCLED|DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT); if (ret != LDB_SUCCESS) { talloc_free(os); return ret; diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c index b09d0cb148..25596f020f 100644 --- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c +++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c @@ -622,7 +622,7 @@ static int linked_attributes_fix_links(struct ldb_module *module, ret = dsdb_module_search_dn(module, tmp_ctx, &res, dsdb_dn->dn, attrs, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SHOW_RECYCLED | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT | DSDB_SEARCH_REVEAL_INTERNALS); if (ret != LDB_SUCCESS) { @@ -716,7 +716,7 @@ static int linked_attributes_rename(struct ldb_module *module, struct ldb_reques ret = dsdb_module_search_dn(module, req, &res, req->op.rename.olddn, NULL, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED); + DSDB_SEARCH_SHOW_RECYCLED); if (ret != LDB_SUCCESS) { return ret; } diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c index 11d61af446..82c4144f22 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass.c @@ -1154,10 +1154,11 @@ static int objectclass_rename(struct ldb_module *module, struct ldb_request *req return ret; } - /* we have to add the show deleted control, as otherwise DRS + /* we have to add the show recycled control, as otherwise DRS deletes will be refused as we will think the target parent does not exist */ - ret = ldb_request_add_control(search_req, LDB_CONTROL_SHOW_DELETED_OID, false, NULL); + ret = ldb_request_add_control(search_req, LDB_CONTROL_SHOW_RECYCLED_OID, + false, NULL); if (ret != LDB_SUCCESS) { return ret; diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c index 2f43cc2416..2024a33d55 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c @@ -349,7 +349,7 @@ static int oc_op_callback(struct ldb_request *req, struct ldb_reply *ares) return ldb_module_done(ac->req, NULL, NULL, ret); } - ret = ldb_request_add_control(search_req, LDB_CONTROL_SHOW_DELETED_OID, + ret = ldb_request_add_control(search_req, LDB_CONTROL_SHOW_RECYCLED_OID, true, NULL); if (ret != LDB_SUCCESS) { return ldb_module_done(ac->req, NULL, NULL, ret); diff --git a/source4/dsdb/samdb/ldb_modules/operational.c b/source4/dsdb/samdb/ldb_modules/operational.c index 72feacfc1a..687597da32 100644 --- a/source4/dsdb/samdb/ldb_modules/operational.c +++ b/source4/dsdb/samdb/ldb_modules/operational.c @@ -209,7 +209,7 @@ static int construct_parent_guid(struct ldb_module *module, /* determine if the object is NC by instance type */ ret = dsdb_module_search_dn(module, msg, &res, msg->dn, attrs, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED); + DSDB_SEARCH_SHOW_RECYCLED); instanceType = ldb_msg_find_attr_as_uint(res->msgs[0], "instanceType", 0); @@ -228,7 +228,7 @@ static int construct_parent_guid(struct ldb_module *module, } ret = dsdb_module_search_dn(module, msg, &parent_res, parent_dn, attrs2, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED); + DSDB_SEARCH_SHOW_RECYCLED); talloc_free(parent_dn); /* not NC, so the object should have a parent*/ diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 037dec8aab..fdb194104f 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -1177,7 +1177,7 @@ static int replmd_update_rpmd(struct ldb_module *module, ret = dsdb_module_search_dn(module, msg, &res, msg->dn, attrs2, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SHOW_RECYCLED | DSDB_SEARCH_SHOW_EXTENDED_DN | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT | DSDB_SEARCH_REVEAL_INTERNALS); @@ -1210,7 +1210,7 @@ static int replmd_update_rpmd(struct ldb_module *module, */ ret = dsdb_module_search_dn(module, msg, &res, msg->dn, attrs, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SHOW_RECYCLED | DSDB_SEARCH_SHOW_EXTENDED_DN | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT | DSDB_SEARCH_REVEAL_INTERNALS); @@ -2053,7 +2053,7 @@ static int replmd_modify_handle_linked_attribs(struct ldb_module *module, ret = dsdb_module_search_dn(module, msg, &res, msg->dn, NULL, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SHOW_RECYCLED | DSDB_SEARCH_REVEAL_INTERNALS | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT); if (ret != LDB_SUCCESS) { @@ -2491,7 +2491,7 @@ static int replmd_delete(struct ldb_module *module, struct ldb_request *req) attributes need to be removed */ ret = dsdb_module_search_dn(module, tmp_ctx, &res, old_dn, NULL, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SHOW_RECYCLED | DSDB_SEARCH_REVEAL_INTERNALS | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT); if (ret != LDB_SUCCESS) { @@ -2629,7 +2629,7 @@ static int replmd_delete(struct ldb_module *module, struct ldb_request *req) DSDB_FLAG_NEXT_MODULE | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT | DSDB_SEARCH_REVEAL_INTERNALS| - DSDB_SEARCH_SHOW_DELETED); + DSDB_SEARCH_SHOW_RECYCLED); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret; @@ -3278,7 +3278,9 @@ static int replmd_replicated_apply_next(struct replmd_replicated_request *ar) replmd_replicated_apply_search_callback, ar->req); LDB_REQ_SET_LOCATION(search_req); - ret = ldb_request_add_control(search_req, LDB_CONTROL_SHOW_DELETED_OID, true, NULL); + + ret = ldb_request_add_control(search_req, LDB_CONTROL_SHOW_RECYCLED_OID, + true, NULL); if (ret != LDB_SUCCESS) { return ret; } @@ -3878,7 +3880,7 @@ linked_attributes[0]: ret = dsdb_module_search(module, tmp_ctx, &res, NULL, LDB_SCOPE_SUBTREE, attrs, DSDB_FLAG_NEXT_MODULE | DSDB_SEARCH_SEARCH_ALL_PARTITIONS | - DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SHOW_RECYCLED | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT | DSDB_SEARCH_REVEAL_INTERNALS, "objectGUID=%s", GUID_string(tmp_ctx, &la->identifier->guid)); diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index b64b934aeb..74825a5a4b 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -200,7 +200,7 @@ int dsdb_module_dn_by_guid(struct ldb_module *module, TALLOC_CTX *mem_ctx, ret = dsdb_module_search(module, tmp_ctx, &res, NULL, LDB_SCOPE_SUBTREE, attrs, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SHOW_RECYCLED | DSDB_SEARCH_SEARCH_ALL_PARTITIONS | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT, "objectGUID=%s", GUID_string(tmp_ctx, guid)); @@ -238,7 +238,7 @@ int dsdb_module_guid_by_dn(struct ldb_module *module, struct ldb_dn *dn, struct ret = dsdb_module_search_dn(module, tmp_ctx, &res, dn, attrs, DSDB_FLAG_NEXT_MODULE | - DSDB_SEARCH_SHOW_DELETED | + DSDB_SEARCH_SHOW_RECYCLED | DSDB_SEARCH_SHOW_EXTENDED_DN); if (ret != LDB_SUCCESS) { ldb_asprintf_errstring(ldb_module_get_ctx(module), "Failed to find GUID for %s", -- cgit