From 400a56d6dd2f02569a626f4507ec06fa49cf0839 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 22 Dec 2006 07:04:06 +0000 Subject: r20315: Implement the server side of DsGetDomainControllerInfo. This is a supprisingly complex call... It turns out that the in/out parameter 'level' is not in/out, but set seperatly by the server-side code from r->req.req1.level. This commit also breaks out some common code from samldb into samdb. Andrew Bartlett (This used to be commit 2eb9e6445c64840399171f4f56b1e43786dbcfa7) --- source4/dsdb/samdb/ldb_modules/samldb.c | 37 +-------------------------------- 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules') diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 26560c361e..1c1ff0ea6e 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -184,41 +184,6 @@ static int samldb_allocate_next_rid(struct ldb_module *module, TALLOC_CTX *mem_c return ret; } -/* Find a domain object in the parents of a particular DN. */ -static struct ldb_dn *samldb_search_domain(struct ldb_module *module, TALLOC_CTX *mem_ctx, struct ldb_dn *dn) -{ - TALLOC_CTX *local_ctx; - struct ldb_dn *sdn; - struct ldb_result *res = NULL; - int ret = 0; - const char *attrs[] = { NULL }; - - local_ctx = talloc_new(mem_ctx); - if (local_ctx == NULL) return NULL; - - sdn = ldb_dn_copy(local_ctx, dn); - do { - ret = ldb_search(module->ldb, sdn, LDB_SCOPE_BASE, - "(|(objectClass=domain)(objectClass=builtinDomain))", attrs, &res); - if (ret == LDB_SUCCESS) { - talloc_steal(local_ctx, res); - if (res->count == 1) { - break; - } - } - } while ((sdn = ldb_dn_get_parent(local_ctx, sdn))); - - if (ret != LDB_SUCCESS || res->count != 1) { - talloc_free(local_ctx); - return NULL; - } - - talloc_steal(mem_ctx, sdn); - talloc_free(local_ctx); - - return sdn; -} - /* search the domain related to the provided dn allocate a new RID for the domain return the new sid string @@ -235,7 +200,7 @@ static int samldb_get_new_sid(struct ldb_module *module, /* get the domain component part of the provided dn */ - dom_dn = samldb_search_domain(module, mem_ctx, obj_dn); + dom_dn = samdb_search_for_parent_domain(module->ldb, mem_ctx, obj_dn); if (dom_dn == NULL) { ldb_asprintf_errstring(module->ldb, "Invalid dn (%s) not child of a domain object!\n", -- cgit