From 83fae5f23f3a7929a685bf4e92bb99191bb2abe3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 Sep 2009 20:37:45 -0700 Subject: s4-dsdb: fixed searching for GUID based DNs between partitions --- source4/dsdb/samdb/ldb_modules/extended_dn_in.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'source4/dsdb/samdb') diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_in.c b/source4/dsdb/samdb/ldb_modules/extended_dn_in.c index e6b0220242..89ba7bb04b 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn_in.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn_in.c @@ -255,6 +255,7 @@ static int extended_dn_in_fix(struct ldb_module *module, struct ldb_request *req "wellKnownObjects", NULL }; + bool all_partitions = false; if (!ldb_dn_has_extended(dn)) { /* Move along there isn't anything to see here */ @@ -268,7 +269,7 @@ static int extended_dn_in_fix(struct ldb_module *module, struct ldb_request *req wkguid_val = ldb_dn_get_extended_component(dn, "WKGUID"); if (sid_val) { - /* TODO: do a search over all partitions */ + all_partitions = true; base_dn = ldb_get_default_basedn(ldb_module_get_ctx(module)); base_dn_filter = talloc_asprintf(req, "(objectSid=%s)", ldb_binary_encode(req, *sid_val)); @@ -281,7 +282,7 @@ static int extended_dn_in_fix(struct ldb_module *module, struct ldb_request *req } else if (guid_val) { - /* TODO: do a search over all partitions */ + all_partitions = true; base_dn = ldb_get_default_basedn(ldb_module_get_ctx(module)); base_dn_filter = talloc_asprintf(req, "(objectGUID=%s)", ldb_binary_encode(req, *guid_val)); @@ -360,6 +361,19 @@ static int extended_dn_in_fix(struct ldb_module *module, struct ldb_request *req return LDB_ERR_OPERATIONS_ERROR; } + if (all_partitions) { + struct ldb_search_options_control *control; + control = talloc(down_req, struct ldb_search_options_control); + control->search_options = 2; + ret = ldb_request_add_control(down_req, + LDB_CONTROL_SEARCH_OPTIONS_OID, + true, control); + if (ret != LDB_SUCCESS) { + ldb_oom(ldb_module_get_ctx(module)); + return ret; + } + } + /* perform the search */ return ldb_next_request(module, down_req); } -- cgit