s4:dsdb - substitute the "show_deleted" with the "show_recycled" control
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 19 Sep 2010 20:20:08 +0000 (22:20 +0200)
committerMatthias Dieter Wallnöfer <mdw@sn-devel-104.sn.samba.org>
Sun, 3 Oct 2010 15:23:18 +0000 (15:23 +0000)
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>
12 files changed:
source4/dsdb/common/util.c
source4/dsdb/kcc/kcc_deleted.c
source4/dsdb/samdb/ldb_modules/acl.c
source4/dsdb/samdb/ldb_modules/acl_util.c
source4/dsdb/samdb/ldb_modules/extended_dn_store.c
source4/dsdb/samdb/ldb_modules/linked_attributes.c
source4/dsdb/samdb/ldb_modules/objectclass.c
source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
source4/dsdb/samdb/ldb_modules/operational.c
source4/dsdb/samdb/ldb_modules/repl_meta_data.c
source4/dsdb/samdb/ldb_modules/util.c
source4/rpc_server/drsuapi/drsutil.c

index 7bfb99581f085a5cbf544eff6a1cb6a804595415..523dd8ef8e3afdd76f588871c2547a44a309781a 100644 (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;
index 118952a143e52075be2cdb72d33977ca3bae1dd1..1726fa4f318a2f18893c6866ef05274bec7533af 100644 (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",
index 2781b4cae502cf518318d0a079adcd25d7c5d15a..149c6b105efff31770b412d94593b5f6cef88f41 100644 (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",
index 6873e56abda45226cdd73fe52f471e682c9fefc5..6c41602a8246fb954e5548e783902c50dee4efdd 100644 (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) {
index 15af268a8fc554042a9703f1e8b81f0057703958..fafe51132fb0be11b545e5d2c82cb82156d3fde2 100644 (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;
index b09d0cb148d203f2b5e08f550ee935aab5ecb024..25596f020f579def83aab25a0747ec976a19f276 100644 (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;
        }
index 11d61af44661dbdd311c9c0a98bb4e47e80e964f..82c4144f228899e539e16059fbc7705d2f9ddb55 100644 (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;
index 2f43cc2416c26c53a47d847217769ab19d1bf024..2024a33d5558f81a0ddd56db16424fef8469dd4f 100644 (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);
index 72feacfc1af98b4d74a3d8de0b01abfbf1146672..687597da32b61decd61873b25562882af3f4bb6d 100644 (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*/
index 037dec8aab58db0ef372d8608cbc21e03f448bc1..fdb194104fc434f6e53e13406163d229945eb51c 100644 (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));
index b64b934aeb2b0d42ff40d5e7ad68c795588c8f0a..74825a5a4b107ac16b422b001f36cb5670a235f0 100644 (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",
index c65d43496575a1c2307e27347574adcf130340a2..ca2d3863c5c66a12a49622b61097facaf6ec0088 100644 (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;
        }