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/>.
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
;
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
,
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
;
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
)
79 struct ldb_message_element
*modules_attributes
= ldb_msg_find_element(msg
, "modules");
80 talloc_free(data
->modules
);
81 if (!modules_attributes
) {
85 data
->modules
= talloc_array(data
, struct partition_module
*, modules_attributes
->num_values
+ 1);
88 return LDB_ERR_OPERATIONS_ERROR
;
91 for (i
=0; i
< modules_attributes
->num_values
; i
++) {
94 data
->modules
[i
] = talloc(data
->modules
, struct partition_module
);
95 if (!data
->modules
[i
]) {
97 return LDB_ERR_OPERATIONS_ERROR
;
100 dn_blob
= modules_attributes
->values
[i
];
102 p
= strchr((const char *)dn_blob
.data
, ':');
104 ldb_asprintf_errstring(ldb
,
105 "partition_load_modules: "
106 "invalid form for partition module record (missing ':'): %s", (const char *)dn_blob
.data
);
107 return LDB_ERR_CONSTRAINT_VIOLATION
;
109 /* Now trim off the filename */
110 dn_blob
.length
= ((uint8_t *)p
- dn_blob
.data
);
113 data
->modules
[i
]->modules
= ldb_modules_list_from_string(ldb
, data
->modules
[i
],
116 if (dn_blob
.length
== 1 && dn_blob
.data
[0] == '*') {
117 data
->modules
[i
]->dn
= NULL
;
119 data
->modules
[i
]->dn
= ldb_dn_from_ldb_val(data
->modules
[i
], ldb
, &dn_blob
);
120 if (!data
->modules
[i
]->dn
|| !ldb_dn_validate(data
->modules
[i
]->dn
)) {
121 return LDB_ERR_OPERATIONS_ERROR
;
125 data
->modules
[i
] = NULL
;
129 static int partition_reload_metadata(struct ldb_module
*module
, struct partition_private_data
*data
, TALLOC_CTX
*mem_ctx
, struct ldb_message
**_msg
)
132 struct ldb_message
*msg
;
133 struct ldb_result
*res
;
134 struct ldb_context
*ldb
= ldb_module_get_ctx(module
);
135 const char *attrs
[] = { "partition", "replicateEntries", "modules", NULL
};
136 /* perform search for @PARTITION, looking for module, replicateEntries and ldapBackend */
137 ret
= dsdb_module_search_dn(module
, mem_ctx
, &res
,
138 ldb_dn_new(mem_ctx
, ldb
, DSDB_PARTITION_DN
),
140 if (ret
!= LDB_SUCCESS
) {
146 ret
= partition_load_replicate_dns(ldb
, data
, msg
);
147 if (ret
!= LDB_SUCCESS
) {
151 ret
= partition_load_modules(ldb
, data
, msg
);
152 if (ret
!= LDB_SUCCESS
) {
156 data
->ldapBackend
= talloc_steal(data
, ldb_msg_find_attr_as_string(msg
, "ldapBackend", NULL
));
166 static const char **find_modules_for_dn(struct partition_private_data
*data
, struct ldb_dn
*dn
)
169 struct partition_module
*default_mod
= NULL
;
170 for (i
=0; data
->modules
&& data
->modules
[i
]; i
++) {
171 if (!data
->modules
[i
]->dn
) {
172 default_mod
= data
->modules
[i
];
173 } else if (ldb_dn_compare(dn
, data
->modules
[i
]->dn
) == 0) {
174 return data
->modules
[i
]->modules
;
178 return default_mod
->modules
;
184 static int new_partition_from_dn(struct ldb_context
*ldb
, struct partition_private_data
*data
,
186 struct ldb_dn
*dn
, const char *filename_base
,
187 struct dsdb_partition
**partition
) {
188 const char *backend_url
;
189 struct dsdb_control_current_partition
*ctrl
;
190 struct ldb_module
*backend_module
;
191 const char **modules
;
194 (*partition
) = talloc(mem_ctx
, struct dsdb_partition
);
196 return LDB_ERR_OPERATIONS_ERROR
;
199 (*partition
)->ctrl
= ctrl
= talloc((*partition
), struct dsdb_control_current_partition
);
201 talloc_free(*partition
);
203 return LDB_ERR_OPERATIONS_ERROR
;
206 /* See if an LDAP backend has been specified */
207 if (data
->ldapBackend
) {
208 backend_url
= data
->ldapBackend
;
211 /* the backend LDB is the DN (base64 encoded if not 'plain') followed by .ldb */
214 char *base64_dn
= NULL
;
215 for (p
= filename_base
; *p
; p
++) {
216 /* We have such a strict check because I don't want shell metacharacters in the file name, nor ../ */
217 if (!(isalnum(*p
) || *p
== ' ' || *p
== '=' || *p
== ',')) {
222 filename_base
= base64_dn
= ldb_base64_encode(data
, filename_base
, strlen(filename_base
));
225 backend_path
= samdb_relative_path(ldb
,
229 talloc_free(base64_dn
);
232 ldb_asprintf_errstring(ldb
,
233 "partition_init: unable to determine an relative path for partition: %s", filename_base
);
234 talloc_free(*partition
);
235 return LDB_ERR_OPERATIONS_ERROR
;
237 backend_url
= talloc_asprintf(*partition
, "tdb://%s.ldb",
239 talloc_free(backend_path
);
242 talloc_free(*partition
);
243 return LDB_ERR_OPERATIONS_ERROR
;
247 (*partition
)->backend_url
= backend_url
;
248 ctrl
->version
= DSDB_CONTROL_CURRENT_PARTITION_VERSION
;
249 ctrl
->dn
= talloc_steal(ctrl
, dn
);
251 ret
= ldb_connect_backend(ldb
, backend_url
, NULL
, &backend_module
);
252 if (ret
!= LDB_SUCCESS
) {
255 talloc_steal((*partition
), backend_module
);
257 modules
= find_modules_for_dn(data
, dn
);
260 DEBUG(0, ("Unable to load partition modules for new DN %s, perhaps you need to reprovision? See partition-upgrade.txt for instructions\n", ldb_dn_get_linearized(dn
)));
261 talloc_free(*partition
);
262 return LDB_ERR_CONSTRAINT_VIOLATION
;
264 ret
= ldb_load_modules_list(ldb
, modules
, backend_module
, &(*partition
)->module
);
265 if (ret
!= LDB_SUCCESS
) {
266 ldb_asprintf_errstring(ldb
,
268 "loading backend for %s failed: %s",
269 ldb_dn_get_linearized(dn
), ldb_errstring(ldb
));
270 talloc_free(*partition
);
273 ret
= ldb_init_module_chain(ldb
, (*partition
)->module
);
274 if (ret
!= LDB_SUCCESS
) {
275 ldb_asprintf_errstring(ldb
,
277 "initialising backend for %s failed: %s",
278 ldb_dn_get_linearized(dn
), ldb_errstring(ldb
));
279 talloc_free(*partition
);
283 talloc_steal((*partition
), (*partition
)->module
);
288 /* Tell the rootDSE about the new partition */
289 static int partition_register(struct ldb_context
*ldb
, struct dsdb_control_current_partition
*ctrl
)
291 struct ldb_request
*req
;
294 req
= talloc_zero(NULL
, struct ldb_request
);
297 return LDB_ERR_OPERATIONS_ERROR
;
300 req
->operation
= LDB_REQ_REGISTER_PARTITION
;
301 req
->op
.reg_partition
.dn
= ctrl
->dn
;
302 req
->callback
= ldb_op_default_callback
;
304 ldb_set_timeout(ldb
, req
, 0);
306 req
->handle
= ldb_handle_new(req
, ldb
);
307 if (req
->handle
== NULL
) {
309 return LDB_ERR_OPERATIONS_ERROR
;
312 ret
= ldb_request(ldb
, req
);
313 if (ret
== LDB_SUCCESS
) {
314 ret
= ldb_wait(req
->handle
, LDB_WAIT_ALL
);
316 if (ret
!= LDB_SUCCESS
) {
317 ldb_debug(ldb
, LDB_DEBUG_ERROR
, "partition: Unable to register partition with rootdse!\n");
319 return LDB_ERR_OTHER
;
326 /* Add a newly found partition to the global data */
327 static int add_partition_to_data(struct ldb_context
*ldb
, struct partition_private_data
*data
,
328 struct dsdb_partition
*partition
)
331 /* Count the partitions */
332 for (i
=0; data
->partitions
&& data
->partitions
[i
]; i
++) { /* noop */};
334 /* Add partition to list of partitions */
335 data
->partitions
= talloc_realloc(data
, data
->partitions
, struct dsdb_partition
*, i
+ 2);
336 if (!data
->partitions
) {
338 return LDB_ERR_OPERATIONS_ERROR
;
340 data
->partitions
[i
] = talloc_steal(data
->partitions
, partition
);
341 data
->partitions
[i
+1] = NULL
;
343 /* Sort again (should use binary insert) */
344 qsort(data
->partitions
, i
+1,
345 sizeof(*data
->partitions
), partition_sort_compare
);
347 ret
= partition_register(ldb
, partition
->ctrl
);
348 if (ret
!= LDB_SUCCESS
) {
354 int partition_reload_if_required(struct ldb_module
*module
,
355 struct partition_private_data
*data
)
359 struct ldb_context
*ldb
= ldb_module_get_ctx(module
);
360 struct ldb_message
*msg
;
361 struct ldb_message_element
*partition_attributes
;
365 /* Not initilised yet */
369 mem_ctx
= talloc_new(data
);
372 return LDB_ERR_OPERATIONS_ERROR
;
375 ret
= partition_primary_sequence_number(module
, mem_ctx
, LDB_SEQ_HIGHEST_SEQ
, &seq
);
376 if (ret
!= LDB_SUCCESS
) {
377 talloc_free(mem_ctx
);
380 if (seq
== data
->metadata_seq
) {
381 talloc_free(mem_ctx
);
385 ret
= partition_reload_metadata(module
, data
, mem_ctx
, &msg
);
386 if (ret
!= LDB_SUCCESS
) {
387 talloc_free(mem_ctx
);
391 data
->metadata_seq
= seq
;
393 partition_attributes
= ldb_msg_find_element(msg
, "partition");
395 for (i
=0; partition_attributes
&& i
< partition_attributes
->num_values
; i
++) {
397 bool new_partition
= true;
398 const char *filename_base
= NULL
;
401 struct dsdb_partition
*partition
;
402 struct ldb_module tmp_module
;
403 struct ldb_result
*dn_res
;
404 const char *no_attrs
[] = { NULL
};
406 for (j
=0; data
->partitions
&& data
->partitions
[j
]; j
++) {
407 DATA_BLOB casefold
= data_blob_string_const(ldb_dn_get_casefold(data
->partitions
[j
]->ctrl
->dn
));
408 if (data_blob_cmp(&casefold
, &partition_attributes
->values
[i
]) == 0) {
409 new_partition
= false;
413 if (new_partition
== false) {
417 dn_blob
= partition_attributes
->values
[i
];
419 if (dn_blob
.length
> 4 &&
420 (strncmp((const char *)&dn_blob
.data
[dn_blob
.length
-4], ".ldb", 4) == 0)) {
422 /* Look for DN:filename.ldb */
423 char *p
= strchr((const char *)dn_blob
.data
, ':');
425 ldb_asprintf_errstring(ldb
,
426 "partition_init: invalid DN in attempting to parse old-style partition record: %s", (const char *)dn_blob
.data
);
427 talloc_free(mem_ctx
);
428 return LDB_ERR_CONSTRAINT_VIOLATION
;
432 /* Trim off the .ldb */
433 dn_blob
.data
[dn_blob
.length
-4] = '\0';
435 /* Now trim off the filename */
436 dn_blob
.length
= ((uint8_t *)p
- dn_blob
.data
);
439 dn
= ldb_dn_from_ldb_val(mem_ctx
, ldb
, &dn_blob
);
441 ldb_asprintf_errstring(ldb
,
442 "partition_init: invalid DN in partition record: %s", (const char *)dn_blob
.data
);
443 talloc_free(mem_ctx
);
444 return LDB_ERR_CONSTRAINT_VIOLATION
;
447 if (!filename_base
) {
448 filename_base
= ldb_dn_get_linearized(dn
);
451 /* We call ldb_dn_get_linearized() because the DN in
452 * partition_attributes is already casefolded
453 * correctly. We don't want to mess that up as the
454 * schema isn't loaded yet */
455 ret
= new_partition_from_dn(ldb
, data
, data
->partitions
, dn
,
458 if (ret
!= LDB_SUCCESS
) {
459 talloc_free(mem_ctx
);
463 /* Hack to be able to re-use dsdb_module_search_dn, which calls ldb_next_request(), which needs ->next filled out */
464 tmp_module
= *partition
->module
;
465 tmp_module
.next
= partition
->module
;
467 /* Get the 'correct' case of the partition DNs from the database */
468 ret
= dsdb_module_search_dn(&tmp_module
, data
, &dn_res
,
470 if (ret
== LDB_SUCCESS
) {
471 talloc_free(partition
->ctrl
->dn
);
472 partition
->ctrl
->dn
= talloc_steal(partition
->ctrl
, dn_res
->msgs
[0]->dn
);
474 } else if (ret
!= LDB_ERR_NO_SUCH_OBJECT
) {
475 ldb_asprintf_errstring(ldb
,
476 "Failed to search for partition base %s in new partition at %s: %s",
477 ldb_dn_get_linearized(dn
),
478 partition
->backend_url
,
480 talloc_free(mem_ctx
);
484 ret
= add_partition_to_data(ldb
, data
, partition
);
485 if (ret
!= LDB_SUCCESS
) {
486 talloc_free(mem_ctx
);
491 talloc_free(mem_ctx
);
495 /* Copy the metadata (@OPTIONS etc) for the new partition into the partition */
497 static int new_partition_set_replicated_metadata(struct ldb_context
*ldb
,
498 struct ldb_module
*module
, struct ldb_request
*last_req
,
499 struct partition_private_data
*data
,
500 struct dsdb_partition
*partition
)
503 /* for each replicate, copy from main partition. If we get an error, we report it up the chain */
504 for (i
=0; data
->replicate
&& data
->replicate
[i
]; i
++) {
505 struct ldb_result
*replicate_res
;
506 struct ldb_request
*add_req
;
507 ret
= dsdb_module_search_dn(module
, last_req
, &replicate_res
,
510 if (ret
== LDB_ERR_NO_SUCH_OBJECT
) {
513 if (ret
!= LDB_SUCCESS
) {
514 ldb_asprintf_errstring(ldb
,
515 "Failed to search for %s from " DSDB_PARTITION_DN
516 " replicateEntries for new partition at %s on %s: %s",
517 ldb_dn_get_linearized(data
->replicate
[i
]),
518 partition
->backend_url
,
519 ldb_dn_get_linearized(partition
->ctrl
->dn
),
524 /* Build add request */
525 ret
= ldb_build_add_req(&add_req
, ldb
, replicate_res
,
526 replicate_res
->msgs
[0], NULL
, NULL
,
527 ldb_op_default_callback
, last_req
);
529 if (ret
!= LDB_SUCCESS
) {
530 /* return directly, this is a very unlikely error */
534 ret
= partition_request(partition
->module
, add_req
);
536 if (ret
== LDB_SUCCESS
) {
537 ret
= ldb_wait(add_req
->handle
, LDB_WAIT_ALL
);
544 case LDB_ERR_ENTRY_ALREADY_EXISTS
:
545 /* Handle this case specially - if the
546 * metadata already exists, replace it */
548 struct ldb_request
*del_req
;
550 /* Don't leave a confusing string in the ldb_errstring() */
551 ldb_reset_err_string(ldb
);
552 /* Build del request */
553 ret
= ldb_build_del_req(&del_req
, ldb
, replicate_res
, replicate_res
->msgs
[0]->dn
, NULL
, NULL
,
554 ldb_op_default_callback
, last_req
);
556 if (ret
!= LDB_SUCCESS
) {
557 /* return directly, this is a very unlikely error */
561 ret
= partition_request(partition
->module
, del_req
);
564 if (ret
== LDB_SUCCESS
) {
565 ret
= ldb_wait(del_req
->handle
, LDB_WAIT_ALL
);
567 if (ret
!= LDB_SUCCESS
) {
568 ldb_asprintf_errstring(ldb
,
569 "Failed to delete (for re-add) %s from " DSDB_PARTITION_DN
570 " replicateEntries in new partition at %s on %s: %s",
571 ldb_dn_get_linearized(data
->replicate
[i
]),
572 partition
->backend_url
,
573 ldb_dn_get_linearized(partition
->ctrl
->dn
),
578 /* Build add request */
579 ret
= ldb_build_add_req(&add_req
, ldb
, replicate_res
, replicate_res
->msgs
[0], NULL
, NULL
,
580 ldb_op_default_callback
, last_req
);
582 if (ret
!= LDB_SUCCESS
) {
583 /* return directly, this is a very unlikely error */
587 /* do the add again */
588 ret
= partition_request(partition
->module
, add_req
);
591 if (ret
== LDB_SUCCESS
) {
592 ret
= ldb_wait(add_req
->handle
, LDB_WAIT_ALL
);
595 if (ret
!= LDB_SUCCESS
) {
596 ldb_asprintf_errstring(ldb
,
597 "Failed to add (after delete) %s from " DSDB_PARTITION_DN
598 " replicateEntries to new partition at %s on %s: %s",
599 ldb_dn_get_linearized(data
->replicate
[i
]),
600 partition
->backend_url
,
601 ldb_dn_get_linearized(partition
->ctrl
->dn
),
609 ldb_asprintf_errstring(ldb
,
610 "Failed to add %s from " DSDB_PARTITION_DN
611 " replicateEntries to new partition at %s on %s: %s",
612 ldb_dn_get_linearized(data
->replicate
[i
]),
613 partition
->backend_url
,
614 ldb_dn_get_linearized(partition
->ctrl
->dn
),
620 /* And around again, for the next thing we must merge */
625 /* Extended operation to create a new partition, called when
626 * 'new_partition' detects that one is being added based on it's
628 int partition_create(struct ldb_module
*module
, struct ldb_request
*req
)
631 struct ldb_context
*ldb
= ldb_module_get_ctx(module
);
632 struct ldb_request
*mod_req
, *last_req
= req
;
633 struct ldb_message
*mod_msg
;
634 struct partition_private_data
*data
;
635 struct dsdb_partition
*partition
= NULL
;
636 const char *casefold_dn
;
637 bool new_partition
= false;
639 /* Check if this is already a partition */
641 struct dsdb_create_partition_exop
*ex_op
= talloc_get_type(req
->op
.extended
.data
, struct dsdb_create_partition_exop
);
642 struct ldb_dn
*dn
= ex_op
->new_dn
;
644 data
= talloc_get_type(module
->private_data
, struct partition_private_data
);
646 /* We are not going to create a partition before we are even set up */
647 return LDB_ERR_UNWILLING_TO_PERFORM
;
650 for (i
=0; data
->partitions
&& data
->partitions
[i
]; i
++) {
651 if (ldb_dn_compare(data
->partitions
[i
]->ctrl
->dn
, dn
) == 0) {
652 partition
= data
->partitions
[i
];
657 new_partition
= true;
658 mod_msg
= ldb_msg_new(req
);
661 return LDB_ERR_OPERATIONS_ERROR
;
664 mod_msg
->dn
= ldb_dn_new(mod_msg
, ldb
, DSDB_PARTITION_DN
);
665 ret
= ldb_msg_add_empty(mod_msg
, DSDB_PARTITION_ATTR
, LDB_FLAG_MOD_ADD
, NULL
);
666 if (ret
!= LDB_SUCCESS
) {
670 casefold_dn
= ldb_dn_get_casefold(dn
);
672 ret
= ldb_msg_add_string(mod_msg
, DSDB_PARTITION_ATTR
, casefold_dn
);
673 if (ret
!= LDB_SUCCESS
) {
677 /* Perform modify on @PARTITION record */
678 ret
= ldb_build_mod_req(&mod_req
, ldb
, req
, mod_msg
, NULL
, NULL
,
679 ldb_op_default_callback
, req
);
681 if (ret
!= LDB_SUCCESS
) {
687 ret
= partition_request(module
, mod_req
);
688 if (ret
== LDB_SUCCESS
) {
689 ret
= ldb_wait(mod_req
->handle
, LDB_WAIT_ALL
);
692 if (ret
!= LDB_SUCCESS
) {
696 /* Make a partition structure for this new partition, so we can copy in the template structure */
697 ret
= new_partition_from_dn(ldb
, data
, req
, ldb_dn_copy(req
, dn
), casefold_dn
, &partition
);
698 if (ret
!= LDB_SUCCESS
) {
702 /* Start a transaction on the DB (as it won't be in one being brand new) */
704 struct ldb_module
*next
= partition
->module
;
705 PARTITION_FIND_OP(next
, start_transaction
);
707 ret
= next
->ops
->start_transaction(next
);
708 if (ret
!= LDB_SUCCESS
) {
714 ret
= new_partition_set_replicated_metadata(ldb
, module
, last_req
, data
, partition
);
715 if (ret
!= LDB_SUCCESS
) {
720 ret
= add_partition_to_data(ldb
, data
, partition
);
721 if (ret
!= LDB_SUCCESS
) {
726 /* send request done */
727 return ldb_module_done(req
, NULL
, NULL
, LDB_SUCCESS
);
731 int partition_init(struct ldb_module
*module
)
734 TALLOC_CTX
*mem_ctx
= talloc_new(module
);
736 struct partition_private_data
*data
;
739 return LDB_ERR_OPERATIONS_ERROR
;
742 data
= talloc_zero(mem_ctx
, struct partition_private_data
);
744 return LDB_ERR_OPERATIONS_ERROR
;
747 /* This loads the partitions */
748 ret
= partition_reload_if_required(module
, data
);
749 if (ret
!= LDB_SUCCESS
) {
753 module
->private_data
= talloc_steal(module
, data
);
754 talloc_free(mem_ctx
);
756 ret
= ldb_mod_register_control(module
, LDB_CONTROL_DOMAIN_SCOPE_OID
);
757 if (ret
!= LDB_SUCCESS
) {
758 ldb_debug(ldb_module_get_ctx(module
), LDB_DEBUG_ERROR
,
759 "partition: Unable to register control with rootdse!\n");
760 return LDB_ERR_OPERATIONS_ERROR
;
763 ret
= ldb_mod_register_control(module
, LDB_CONTROL_SEARCH_OPTIONS_OID
);
764 if (ret
!= LDB_SUCCESS
) {
765 ldb_debug(ldb_module_get_ctx(module
), LDB_DEBUG_ERROR
,
766 "partition: Unable to register control with rootdse!\n");
767 return LDB_ERR_OPERATIONS_ERROR
;
770 return ldb_next_init(module
);