1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

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 <abartlet@samba.org>
This commit is contained in:
Matthias Dieter Wallnöfer 2010-09-19 22:20:08 +02:00 committed by Matthias Dieter Wallnöfer
parent 46282da011
commit e3081b92c1
12 changed files with 31 additions and 25 deletions

View File

@ -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;

View File

@ -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",

View File

@ -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",

View File

@ -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) {

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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*/

View File

@ -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));

View File

@ -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",

View File

@ -65,7 +65,7 @@ int drsuapi_search_with_extended_dn(struct ldb_context *ldb,
return ret;
}
ret = ldb_request_add_control(req, LDB_CONTROL_SHOW_DELETED_OID, true, NULL);
ret = ldb_request_add_control(req, LDB_CONTROL_SHOW_RECYCLED_OID, true, NULL);
if (ret != LDB_SUCCESS) {
return ret;
}