-/*
- refresh a RID Set object for the specified DC
- also returns the first RID for the new pool
- */
-static int ridalloc_refresh_rid_set_ntds(struct ldb_module *module,
- struct ldb_dn *rid_manager_dn,
- struct ldb_dn *ntds_dn, uint64_t *new_pool)
-{
- TALLOC_CTX *tmp_ctx = talloc_new(module);
- struct ldb_dn *server_dn, *machine_dn, *rid_set_dn;
- struct ldb_context *ldb = ldb_module_get_ctx(module);
- int ret;
-
- /* grab a pool from the RID Manager object */
- ret = ridalloc_rid_manager_allocate(module, rid_manager_dn, new_pool);
- if (ret != LDB_SUCCESS) {
- talloc_free(tmp_ctx);
- return ret;
- }
-
- server_dn = ldb_dn_get_parent(tmp_ctx, ntds_dn);
- if (!server_dn) {
- talloc_free(tmp_ctx);
- return ldb_module_oom(module);
- }
-
- ret = dsdb_module_reference_dn(module, tmp_ctx, server_dn, "serverReference", &machine_dn);
- if (ret != LDB_SUCCESS) {
- ldb_asprintf_errstring(ldb, "Failed to find serverReference in %s - %s",
- ldb_dn_get_linearized(server_dn), ldb_errstring(ldb));
- talloc_free(tmp_ctx);
- return ret;
- }
-
- ret = dsdb_module_reference_dn(module, tmp_ctx, machine_dn, "rIDSetReferences", &rid_set_dn);
- if (ret != LDB_SUCCESS) {
- ldb_asprintf_errstring(ldb, "Failed to find rIDSetReferences in %s - %s",
- ldb_dn_get_linearized(machine_dn), ldb_errstring(ldb));
- talloc_free(tmp_ctx);
- return ret;
- }
-
- ret = dsdb_module_set_integer(module, rid_set_dn, "rIDAllocationPool", *new_pool);
- if (ret != LDB_SUCCESS) {
- ldb_asprintf_errstring(ldb, "Failed to modify RID Set object %s - %s",
- ldb_dn_get_linearized(rid_set_dn), ldb_errstring(ldb));
- talloc_free(tmp_ctx);
- return ret;
- }
-
- talloc_free(tmp_ctx);
- return LDB_SUCCESS;
-}
-
-