From 844b736a1dd05159850ccc28eee1b3e625489139 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 19 Nov 2012 06:59:33 +0100 Subject: s4:dsdb/objectclass: do helper searches AS_SYSTEM and with SHOW_RECYCLED Note that SHOW_RECYCLED implies SHOW_DELETED. Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- source4/dsdb/samdb/ldb_modules/objectclass.c | 34 +++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c index 074360086f..590927a7aa 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass.c @@ -351,6 +351,13 @@ static int objectclass_add(struct ldb_module *module, struct ldb_request *req) return ret; } + ret = dsdb_request_add_controls(search_req, + DSDB_FLAG_AS_SYSTEM | + DSDB_SEARCH_SHOW_RECYCLED); + if (ret != LDB_SUCCESS) { + return ret; + } + ac->step_fn = objectclass_do_add; return ldb_next_request(ac->module, search_req); @@ -797,6 +804,13 @@ static int oc_modify_callback(struct ldb_request *req, struct ldb_reply *ares) return ldb_module_done(ac->req, NULL, NULL, ret); } + ret = dsdb_request_add_controls(search_req, + DSDB_FLAG_AS_SYSTEM | + DSDB_SEARCH_SHOW_RECYCLED); + if (ret != LDB_SUCCESS) { + return ldb_module_done(ac->req, NULL, NULL, ret); + } + ac->step_fn = objectclass_do_mod; ret = ldb_next_request(ac->module, search_req); @@ -1021,9 +1035,9 @@ static int objectclass_rename(struct ldb_module *module, struct ldb_request *req /* 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_RECYCLED_OID, - false, NULL); - + ret = dsdb_request_add_controls(search_req, + DSDB_FLAG_AS_SYSTEM | + DSDB_SEARCH_SHOW_RECYCLED); if (ret != LDB_SUCCESS) { return ret; } @@ -1071,6 +1085,13 @@ static int objectclass_do_rename(struct oc_context *ac) return ret; } + ret = dsdb_request_add_controls(search_req, + DSDB_FLAG_AS_SYSTEM | + DSDB_SEARCH_SHOW_RECYCLED); + if (ret != LDB_SUCCESS) { + return ret; + } + ac->step_fn = objectclass_do_rename2; return ldb_next_request(ac->module, search_req); @@ -1251,6 +1272,13 @@ static int objectclass_delete(struct ldb_module *module, struct ldb_request *req return ret; } + ret = dsdb_request_add_controls(search_req, + DSDB_FLAG_AS_SYSTEM | + DSDB_SEARCH_SHOW_RECYCLED); + if (ret != LDB_SUCCESS) { + return ret; + } + ac->step_fn = objectclass_do_delete; return ldb_next_request(ac->module, search_req); -- cgit