s4:dsdb Make the 'relative path' code in partitions handle tdb://
[Samba.git] / source4 / dsdb / samdb / ldb_modules / partition_init.c
blob421169d371ba61afe3d462af54fdb7e6d29a6cae
1 /*
2 Partitions ldb module
4 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2006
5 Copyright (C) Stefan Metzmacher <metze@samba.org> 2007
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 * Name: ldb
24 * Component: ldb partitions module
26 * Description: Implement LDAP partitions
28 * Author: Andrew Bartlett
29 * Author: Stefan Metzmacher
32 #include "dsdb/samdb/ldb_modules/partition.h"
33 static int partition_sort_compare(const void *v1, const void *v2)
35 const struct dsdb_partition *p1;
36 const struct dsdb_partition *p2;
38 p1 = *((struct dsdb_partition * const*)v1);
39 p2 = *((struct dsdb_partition * const*)v2);
41 return ldb_dn_compare(p1->ctrl->dn, p2->ctrl->dn);
44 /* Load the list of DNs that we must replicate to all partitions */
45 static int partition_load_replicate_dns(struct ldb_context *ldb, struct partition_private_data *data, struct ldb_message *msg)
47 struct ldb_message_element *replicate_attributes = ldb_msg_find_element(msg, "replicateEntries");
49 talloc_free(data->replicate);
50 if (!replicate_attributes) {
51 data->replicate = NULL;
52 } else {
53 int i;
54 data->replicate = talloc_array(data, struct ldb_dn *, replicate_attributes->num_values + 1);
55 if (!data->replicate) {
56 return LDB_ERR_OPERATIONS_ERROR;
59 for (i=0; i < replicate_attributes->num_values; i++) {
60 data->replicate[i] = ldb_dn_from_ldb_val(data->replicate, ldb, &replicate_attributes->values[i]);
61 if (!ldb_dn_validate(data->replicate[i])) {
62 ldb_asprintf_errstring(ldb,
63 "partition_init: "
64 "invalid DN in partition replicate record: %s",
65 replicate_attributes->values[i].data);
66 return LDB_ERR_CONSTRAINT_VIOLATION;
69 data->replicate[i] = NULL;
71 return LDB_SUCCESS;
74 /* Load the list of modules for the partitions */
75 static int partition_load_modules(struct ldb_context *ldb,
76 struct partition_private_data *data, struct ldb_message *msg)
78 int i;
79 struct ldb_message_element *modules_attributes = ldb_msg_find_element(msg, "modules");
80 talloc_free(data->modules);
81 if (!modules_attributes) {
82 return LDB_SUCCESS;
85 data->modules = talloc_array(data, struct partition_module *, modules_attributes->num_values + 1);
86 if (!data->modules) {
87 ldb_oom(ldb);
88 return LDB_ERR_OPERATIONS_ERROR;
91 for (i=0; i < modules_attributes->num_values; i++) {
92 char *base;
93 char *p;
95 data->modules[i] = talloc(data->modules, struct partition_module);
96 if (!data->modules[i]) {
97 ldb_oom(ldb);
98 return LDB_ERR_OPERATIONS_ERROR;
101 base = talloc_strdup(data->partitions, (char *)modules_attributes->values[i].data);
102 p = strchr(base, ':');
103 if (!p) {
104 ldb_asprintf_errstring(ldb,
105 "partition_load_modules: "
106 "invalid form for partition module record (missing ':'): %s", base);
107 return LDB_ERR_CONSTRAINT_VIOLATION;
109 p[0] = '\0';
110 p++;
111 data->modules[i]->modules = ldb_modules_list_from_string(ldb, data->modules[i],
114 if (strcmp(base, "*") == 0) {
115 data->modules[i]->dn = NULL;
116 } else {
117 data->modules[i]->dn = ldb_dn_new(data->modules[i], ldb, base);
118 if (!data->modules[i]->dn || !ldb_dn_validate(data->modules[i]->dn)) {
119 return LDB_ERR_OPERATIONS_ERROR;
123 data->modules[i] = NULL;
124 return LDB_SUCCESS;
127 static int partition_reload_metadata(struct ldb_module *module, struct partition_private_data *data, TALLOC_CTX *mem_ctx, struct ldb_message **_msg)
129 int ret;
130 struct ldb_message *msg;
131 struct ldb_result *res;
132 struct ldb_context *ldb = ldb_module_get_ctx(module);
133 const char *attrs[] = { "partition", "replicateEntries", "modules", NULL };
134 /* perform search for @PARTITION, looking for module, replicateEntries and ldapBackend */
135 ret = dsdb_module_search_dn(module, mem_ctx, &res,
136 ldb_dn_new(mem_ctx, ldb, DSDB_PARTITION_DN),
137 attrs);
138 if (ret != LDB_SUCCESS) {
139 return ret;
142 msg = res->msgs[0];
144 ret = partition_load_replicate_dns(ldb, data, msg);
145 if (ret != LDB_SUCCESS) {
146 return ret;
149 ret = partition_load_modules(ldb, data, msg);
150 if (ret != LDB_SUCCESS) {
151 return ret;
154 data->ldapBackend = talloc_steal(data, ldb_msg_find_attr_as_string(msg, "ldapBackend", NULL));
155 if (_msg) {
156 *_msg = msg;
157 } else {
158 talloc_free(msg);
161 return LDB_SUCCESS;
164 static const char **find_modules_for_dn(struct partition_private_data *data, struct ldb_dn *dn)
166 int i;
167 struct partition_module *default_mod = NULL;
168 for (i=0; data->modules && data->modules[i]; i++) {
169 if (!data->modules[i]->dn) {
170 default_mod = data->modules[i];
171 } else if (ldb_dn_compare(dn, data->modules[i]->dn) == 0) {
172 return data->modules[i]->modules;
175 if (default_mod) {
176 return default_mod->modules;
177 } else {
178 return NULL;
182 static int new_partition_from_dn(struct ldb_context *ldb, struct partition_private_data *data,
183 TALLOC_CTX *mem_ctx,
184 struct ldb_dn *dn, const char *casefold_dn,
185 struct dsdb_partition **partition) {
186 const char *backend_url;
187 struct dsdb_control_current_partition *ctrl;
188 struct ldb_module *backend_module;
189 const char **modules;
190 int ret;
192 (*partition) = talloc(mem_ctx, struct dsdb_partition);
193 if (!*partition) {
194 return LDB_ERR_OPERATIONS_ERROR;
197 (*partition)->ctrl = ctrl = talloc((*partition), struct dsdb_control_current_partition);
198 if (!ctrl) {
199 talloc_free(*partition);
200 ldb_oom(ldb);
201 return LDB_ERR_OPERATIONS_ERROR;
204 /* See if an LDAP backend has been specified */
205 if (data->ldapBackend) {
206 backend_url = data->ldapBackend;
207 } else {
209 /* the backend LDB is the DN (base64 encoded if not 'plain') followed by .ldb */
210 const char *p;
211 char *backend_path;
212 char *base64_dn = NULL;
213 for (p = casefold_dn; *p; p++) {
214 /* We have such a strict check because I don't want shell metacharacters in the file name, nor ../ */
215 if (!(isalnum(*p) || *p == ' ' || *p == '=' || *p == ',')) {
216 break;
219 if (*p) {
220 casefold_dn = base64_dn = ldb_base64_encode(data, casefold_dn, strlen(casefold_dn));
223 backend_path = samdb_relative_path(ldb,
224 *partition,
225 casefold_dn);
226 if (base64_dn) {
227 talloc_free(base64_dn);
229 if (!backend_path) {
230 ldb_asprintf_errstring(ldb,
231 "partition_init: unable to determine an relative path for partition: %s", casefold_dn);
232 talloc_free(*partition);
233 return LDB_ERR_OPERATIONS_ERROR;
235 backend_url = talloc_asprintf(*partition, "tdb://%s.ldb",
236 backend_path);
237 talloc_free(backend_path);
238 if (!backend_url) {
239 ldb_oom(ldb);
240 talloc_free(*partition);
241 return LDB_ERR_OPERATIONS_ERROR;
245 (*partition)->backend_url = backend_url;
246 ctrl->version = DSDB_CONTROL_CURRENT_PARTITION_VERSION;
247 ctrl->dn = talloc_steal(ctrl, dn);
249 ret = ldb_connect_backend(ldb, backend_url, NULL, &backend_module);
250 if (ret != LDB_SUCCESS) {
251 return ret;
253 talloc_steal((*partition), backend_module);
255 modules = find_modules_for_dn(data, dn);
257 ret = ldb_load_modules_list(ldb, modules, backend_module, &(*partition)->module);
258 if (ret != LDB_SUCCESS) {
259 ldb_asprintf_errstring(ldb,
260 "partition_init: "
261 "loading backend for %s failed: %s",
262 ldb_dn_get_linearized(dn), ldb_errstring(ldb));
263 talloc_free(*partition);
264 return ret;
266 ret = ldb_init_module_chain(ldb, (*partition)->module);
267 if (ret != LDB_SUCCESS) {
268 ldb_asprintf_errstring(ldb,
269 "partition_init: "
270 "initialising backend for %s failed: %s",
271 ldb_dn_get_linearized(dn), ldb_errstring(ldb));
272 talloc_free(*partition);
273 return ret;
276 talloc_steal((*partition), (*partition)->module);
278 return ret;
281 /* Tell the rootDSE about the new partition */
282 static int partition_register(struct ldb_context *ldb, struct dsdb_control_current_partition *ctrl)
284 struct ldb_request *req;
285 int ret;
287 req = talloc_zero(NULL, struct ldb_request);
288 if (req == NULL) {
289 ldb_oom(ldb);
290 return LDB_ERR_OPERATIONS_ERROR;
293 req->operation = LDB_REQ_REGISTER_PARTITION;
294 req->op.reg_partition.dn = ctrl->dn;
295 req->callback = ldb_op_default_callback;
297 ldb_set_timeout(ldb, req, 0);
299 req->handle = ldb_handle_new(req, ldb);
300 if (req->handle == NULL) {
301 talloc_free(req);
302 return LDB_ERR_OPERATIONS_ERROR;
305 ret = ldb_request(ldb, req);
306 if (ret == LDB_SUCCESS) {
307 ret = ldb_wait(req->handle, LDB_WAIT_ALL);
309 if (ret != LDB_SUCCESS) {
310 ldb_debug(ldb, LDB_DEBUG_ERROR, "partition: Unable to register partition with rootdse!\n");
311 talloc_free(req);
312 return LDB_ERR_OTHER;
314 talloc_free(req);
316 return LDB_SUCCESS;
319 /* Add a newly found partition to the global data */
320 static int add_partition_to_data(struct ldb_context *ldb, struct partition_private_data *data,
321 struct dsdb_partition *partition)
323 int i, ret;
324 /* Count the partitions */
325 for (i=0; data->partitions && data->partitions[i]; i++) { /* noop */};
327 /* Add partition to list of partitions */
328 data->partitions = talloc_realloc(data, data->partitions, struct dsdb_partition *, i + 2);
329 if (!data->partitions) {
330 ldb_oom(ldb);
331 return LDB_ERR_OPERATIONS_ERROR;
333 data->partitions[i] = talloc_steal(data->partitions, partition);
334 data->partitions[i+1] = NULL;
336 /* Sort again (should use binary insert) */
337 qsort(data->partitions, i+1,
338 sizeof(*data->partitions), partition_sort_compare);
340 ret = partition_register(ldb, partition->ctrl);
341 if (ret != LDB_SUCCESS) {
342 return ret;
344 return LDB_SUCCESS;
347 int partition_reload_if_required(struct ldb_module *module,
348 struct partition_private_data *data)
351 uint64_t seq;
352 int ret, i;
353 struct ldb_context *ldb = ldb_module_get_ctx(module);
354 struct ldb_message *msg;
355 struct ldb_message_element *partition_attributes;
356 TALLOC_CTX *mem_ctx = talloc_new(data);
357 if (!data) {
358 /* Not initilised yet */
359 return LDB_SUCCESS;
361 if (!mem_ctx) {
362 ldb_oom(ldb);
363 return LDB_ERR_OPERATIONS_ERROR;
365 ret = partition_primary_sequence_number(module, mem_ctx, LDB_SEQ_HIGHEST_SEQ, &seq);
366 if (ret != LDB_SUCCESS) {
367 talloc_free(mem_ctx);
368 return ret;
370 if (seq == data->metadata_seq) {
371 talloc_free(mem_ctx);
372 return LDB_SUCCESS;
375 ret = partition_reload_metadata(module, data, mem_ctx, &msg);
376 if (ret != LDB_SUCCESS) {
377 talloc_free(mem_ctx);
378 return ret;
381 data->metadata_seq = seq;
383 partition_attributes = ldb_msg_find_element(msg, "partition");
385 for (i=0; partition_attributes && i < partition_attributes->num_values; i++) {
386 int j;
387 bool new_partition = true;
388 DATA_BLOB dn_blob;
389 struct ldb_dn *dn;
390 struct dsdb_partition *partition;
391 for (j=0; data->partitions && data->partitions[j]; j++) {
392 DATA_BLOB casefold = data_blob_string_const(ldb_dn_get_casefold(data->partitions[j]->ctrl->dn));
393 if (data_blob_cmp(&casefold, &partition_attributes->values[i]) == 0) {
394 new_partition = false;
395 break;
398 if (new_partition == false) {
399 continue;
402 dn_blob = partition_attributes->values[i];
404 dn = ldb_dn_from_ldb_val(mem_ctx, ldb, &dn_blob);
405 if (!dn) {
406 ldb_asprintf_errstring(ldb,
407 "partition_init: invalid DN in partition record: %s", (const char *)dn_blob.data);
408 talloc_free(mem_ctx);
409 return LDB_ERR_CONSTRAINT_VIOLATION;
412 if (dn_blob.length > 4 &&
413 (strncmp((const char *)&dn_blob.data[dn_blob.length-4], ".ldb", 4) == 0) &&
414 (ldb_dn_compare_base(ldb_get_default_basedn(ldb), dn) != 0)) {
415 ldb_asprintf_errstring(ldb,
416 "partition_init: invalid DN in partition record: %s is not under %s. Perhaps an old " DSDB_PARTITION_DN " format?",
417 (const char *)dn_blob.data,
418 ldb_dn_get_linearized(ldb_get_default_basedn(ldb)));
419 DEBUG(0, ("Unable to load partitions, invalid DN %s found, perhaps you need to reprovision? See partition-upgrade.txt for instructions\n",
420 (const char *)dn_blob.data));
421 talloc_free(mem_ctx);
422 return LDB_ERR_CONSTRAINT_VIOLATION;
425 /* We call ldb_dn_get_linearized() because the DN in
426 * partition_attributes is already casefolded
427 * correctly. We don't want to mess that up as the
428 * schema isn't loaded yet */
429 ret = new_partition_from_dn(ldb, data, data->partitions, dn,
430 ldb_dn_get_linearized(dn),
431 &partition);
432 if (ret != LDB_SUCCESS) {
433 talloc_free(mem_ctx);
434 return ret;
437 ret = add_partition_to_data(ldb, data, partition);
438 if (ret != LDB_SUCCESS) {
439 talloc_free(mem_ctx);
440 return ret;
444 talloc_free(mem_ctx);
445 return LDB_SUCCESS;
448 /* Copy the metadata (@OPTIONS etc) for the new partition into the partition */
450 static int new_partition_set_replicated_metadata(struct ldb_context *ldb,
451 struct ldb_module *module, struct ldb_request *last_req,
452 struct partition_private_data *data,
453 struct dsdb_partition *partition)
455 int i, ret;
456 /* for each replicate, copy from main partition. If we get an error, we report it up the chain */
457 for (i=0; data->replicate && data->replicate[i]; i++) {
458 struct ldb_result *replicate_res;
459 struct ldb_request *add_req;
460 ret = dsdb_module_search_dn(module, last_req, &replicate_res,
461 data->replicate[i],
462 NULL);
463 if (ret == LDB_ERR_NO_SUCH_OBJECT) {
464 continue;
466 if (ret != LDB_SUCCESS) {
467 ldb_asprintf_errstring(ldb,
468 "Failed to search for %s from " DSDB_PARTITION_DN
469 " replicateEntries for new partition at %s on %s: %s",
470 ldb_dn_get_linearized(data->replicate[i]),
471 partition->backend_url,
472 ldb_dn_get_linearized(partition->ctrl->dn),
473 ldb_errstring(ldb));
474 return ret;
477 /* Build add request */
478 ret = ldb_build_add_req(&add_req, ldb, replicate_res,
479 replicate_res->msgs[0], NULL, NULL,
480 ldb_op_default_callback, last_req);
481 last_req = add_req;
482 if (ret != LDB_SUCCESS) {
483 /* return directly, this is a very unlikely error */
484 return ret;
486 /* do request */
487 ret = partition_request(partition->module, add_req);
488 /* wait */
489 if (ret == LDB_SUCCESS) {
490 ret = ldb_wait(add_req->handle, LDB_WAIT_ALL);
493 switch (ret) {
494 case LDB_SUCCESS:
495 break;
497 case LDB_ERR_ENTRY_ALREADY_EXISTS:
498 /* Handle this case specially - if the
499 * metadata already exists, replace it */
501 struct ldb_request *del_req;
503 /* Don't leave a confusing string in the ldb_errstring() */
504 ldb_reset_err_string(ldb);
505 /* Build del request */
506 ret = ldb_build_del_req(&del_req, ldb, replicate_res, replicate_res->msgs[0]->dn, NULL, NULL,
507 ldb_op_default_callback, last_req);
508 last_req = del_req;
509 if (ret != LDB_SUCCESS) {
510 /* return directly, this is a very unlikely error */
511 return ret;
513 /* do request */
514 ret = partition_request(partition->module, del_req);
516 /* wait */
517 if (ret == LDB_SUCCESS) {
518 ret = ldb_wait(del_req->handle, LDB_WAIT_ALL);
520 if (ret != LDB_SUCCESS) {
521 ldb_asprintf_errstring(ldb,
522 "Failed to delete (for re-add) %s from " DSDB_PARTITION_DN
523 " replicateEntries in new partition at %s on %s: %s",
524 ldb_dn_get_linearized(data->replicate[i]),
525 partition->backend_url,
526 ldb_dn_get_linearized(partition->ctrl->dn),
527 ldb_errstring(ldb));
528 return ret;
531 /* Build add request */
532 ret = ldb_build_add_req(&add_req, ldb, replicate_res, replicate_res->msgs[0], NULL, NULL,
533 ldb_op_default_callback, last_req);
534 last_req = add_req;
535 if (ret != LDB_SUCCESS) {
536 /* return directly, this is a very unlikely error */
537 return ret;
540 /* do the add again */
541 ret = partition_request(partition->module, add_req);
543 /* wait */
544 if (ret == LDB_SUCCESS) {
545 ret = ldb_wait(add_req->handle, LDB_WAIT_ALL);
548 if (ret != LDB_SUCCESS) {
549 ldb_asprintf_errstring(ldb,
550 "Failed to add (after delete) %s from " DSDB_PARTITION_DN
551 " replicateEntries to new partition at %s on %s: %s",
552 ldb_dn_get_linearized(data->replicate[i]),
553 partition->backend_url,
554 ldb_dn_get_linearized(partition->ctrl->dn),
555 ldb_errstring(ldb));
556 return ret;
558 break;
560 default:
562 ldb_asprintf_errstring(ldb,
563 "Failed to add %s from " DSDB_PARTITION_DN
564 " replicateEntries to new partition at %s on %s: %s",
565 ldb_dn_get_linearized(data->replicate[i]),
566 partition->backend_url,
567 ldb_dn_get_linearized(partition->ctrl->dn),
568 ldb_errstring(ldb));
569 return ret;
573 /* And around again, for the next thing we must merge */
575 return LDB_SUCCESS;
578 /* Extended operation to create a new partition, called when
579 * 'new_partition' detects that one is being added based on it's
580 * instanceType */
581 int partition_create(struct ldb_module *module, struct ldb_request *req)
583 int i, ret;
584 struct ldb_context *ldb = ldb_module_get_ctx(module);
585 struct ldb_request *mod_req, *last_req = req;
586 struct ldb_message *mod_msg;
587 struct partition_private_data *data;
588 struct dsdb_partition *partition = NULL;
589 const char *casefold_dn;
590 bool new_partition = false;
592 /* Check if this is already a partition */
594 struct dsdb_create_partition_exop *ex_op = talloc_get_type(req->op.extended.data, struct dsdb_create_partition_exop);
595 struct ldb_dn *dn = ex_op->new_dn;
597 data = talloc_get_type(module->private_data, struct partition_private_data);
598 if (!data) {
599 /* We are not going to create a partition before we are even set up */
600 return LDB_ERR_UNWILLING_TO_PERFORM;
603 for (i=0; data->partitions && data->partitions[i]; i++) {
604 if (ldb_dn_compare(data->partitions[i]->ctrl->dn, dn) == 0) {
605 partition = data->partitions[i];
609 if (!partition) {
610 new_partition = true;
611 mod_msg = ldb_msg_new(req);
612 if (!mod_msg) {
613 ldb_oom(ldb);
614 return LDB_ERR_OPERATIONS_ERROR;
617 mod_msg->dn = ldb_dn_new(mod_msg, ldb, DSDB_PARTITION_DN);
618 ret = ldb_msg_add_empty(mod_msg, DSDB_PARTITION_ATTR, LDB_FLAG_MOD_ADD, NULL);
619 if (ret != LDB_SUCCESS) {
620 return ret;
623 casefold_dn = ldb_dn_get_casefold(dn);
625 ret = ldb_msg_add_string(mod_msg, DSDB_PARTITION_ATTR, casefold_dn);
626 if (ret != LDB_SUCCESS) {
627 return ret;
630 /* Perform modify on @PARTITION record */
631 ret = ldb_build_mod_req(&mod_req, ldb, req, mod_msg, NULL, NULL,
632 ldb_op_default_callback, req);
634 if (ret != LDB_SUCCESS) {
635 return ret;
638 last_req = mod_req;
640 ret = partition_request(module, mod_req);
641 if (ret == LDB_SUCCESS) {
642 ret = ldb_wait(mod_req->handle, LDB_WAIT_ALL);
645 if (ret != LDB_SUCCESS) {
646 return ret;
649 /* Make a partition structure for this new partition, so we can copy in the template structure */
650 ret = new_partition_from_dn(ldb, data, req, ldb_dn_copy(req, dn), casefold_dn, &partition);
651 if (ret != LDB_SUCCESS) {
652 return ret;
655 /* Start a transaction on the DB (as it won't be in one being brand new) */
657 struct ldb_module *next = partition->module;
658 PARTITION_FIND_OP(next, start_transaction);
660 ret = next->ops->start_transaction(next);
661 if (ret != LDB_SUCCESS) {
662 return ret;
667 ret = new_partition_set_replicated_metadata(ldb, module, last_req, data, partition);
668 if (ret != LDB_SUCCESS) {
669 return ret;
672 if (new_partition) {
673 ret = add_partition_to_data(ldb, data, partition);
674 if (ret != LDB_SUCCESS) {
675 return ret;
679 /* send request done */
680 return ldb_module_done(req, NULL, NULL, LDB_SUCCESS);
684 int partition_init(struct ldb_module *module)
686 int ret;
687 TALLOC_CTX *mem_ctx = talloc_new(module);
689 struct partition_private_data *data;
691 if (!mem_ctx) {
692 return LDB_ERR_OPERATIONS_ERROR;
695 data = talloc_zero(mem_ctx, struct partition_private_data);
696 if (data == NULL) {
697 return LDB_ERR_OPERATIONS_ERROR;
700 /* This loads the partitions */
701 ret = partition_reload_if_required(module, data);
702 if (ret != LDB_SUCCESS) {
703 return ret;
706 ret = ldb_mod_register_control(module, LDB_CONTROL_DOMAIN_SCOPE_OID);
707 if (ret != LDB_SUCCESS) {
708 ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_ERROR,
709 "partition: Unable to register control with rootdse!\n");
710 return LDB_ERR_OPERATIONS_ERROR;
713 ret = ldb_mod_register_control(module, LDB_CONTROL_SEARCH_OPTIONS_OID);
714 if (ret != LDB_SUCCESS) {
715 ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_ERROR,
716 "partition: Unable to register control with rootdse!\n");
717 return LDB_ERR_OPERATIONS_ERROR;
720 module->private_data = talloc_steal(module, data);
722 talloc_free(mem_ctx);
723 return ldb_next_init(module);