Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
[ira/wip.git] / source4 / dsdb / samdb / ldb_modules / extended_dn_out.c
1 /* 
2    ldb database library
3
4    Copyright (C) Simo Sorce 2005-2008
5    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2007-2008
6
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.
11    
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.
16    
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/>.
19 */
20
21 /*
22  *  Name: ldb
23  *
24  *  Component: ldb extended dn control module
25  *
26  *  Description: this module builds a special dn for returned search
27  *  results, and fixes some other aspects of the result (returned case issues)
28  *  values.
29  *
30  *  Authors: Simo Sorce
31  *           Andrew Bartlett
32  */
33
34 #include "includes.h"
35 #include "ldb/include/ldb.h"
36 #include "ldb/include/ldb_errors.h"
37 #include "ldb/include/ldb_module.h"
38 #include "librpc/gen_ndr/ndr_misc.h"
39 #include "librpc/ndr/libndr.h"
40 #include "dsdb/samdb/samdb.h"
41
42 struct extended_dn_out_private {
43         bool dereference;
44         bool normalise;
45         struct dsdb_openldap_dereference_control *dereference_control;
46 };
47
48 static bool is_attr_in_list(const char * const * attrs, const char *attr)
49 {
50         int i;
51
52         for (i = 0; attrs[i]; i++) {
53                 if (ldb_attr_cmp(attrs[i], attr) == 0)
54                         return true;
55         }
56
57         return false;
58 }
59
60 static char **copy_attrs(void *mem_ctx, const char * const * attrs)
61 {
62         char **nattrs;
63         int i, num;
64
65         for (num = 0; attrs[num]; num++);
66
67         nattrs = talloc_array(mem_ctx, char *, num + 1);
68         if (!nattrs) return NULL;
69
70         for(i = 0; i < num; i++) {
71                 nattrs[i] = talloc_strdup(nattrs, attrs[i]);
72                 if (!nattrs[i]) {
73                         talloc_free(nattrs);
74                         return NULL;
75                 }
76         }
77         nattrs[i] = NULL;
78
79         return nattrs;
80 }
81
82 static bool add_attrs(void *mem_ctx, char ***attrs, const char *attr)
83 {
84         char **nattrs;
85         int num;
86
87         for (num = 0; (*attrs)[num]; num++);
88
89         nattrs = talloc_realloc(mem_ctx, *attrs, char *, num + 2);
90         if (!nattrs) return false;
91
92         *attrs = nattrs;
93
94         nattrs[num] = talloc_strdup(nattrs, attr);
95         if (!nattrs[num]) return false;
96
97         nattrs[num + 1] = NULL;
98
99         return true;
100 }
101
102 /* Fix the DN so that the relative attribute names are in upper case so that the DN:
103    cn=Adminstrator,cn=users,dc=samba,dc=example,dc=com becomes
104    CN=Adminstrator,CN=users,DC=samba,DC=example,DC=com
105 */
106
107
108 static int fix_dn(struct ldb_dn *dn) 
109 {
110         int i, ret;
111         char *upper_rdn_attr;
112
113         for (i=0; i < ldb_dn_get_comp_num(dn); i++) {
114                 /* We need the attribute name in upper case */
115                 upper_rdn_attr = strupper_talloc(dn,
116                                                  ldb_dn_get_component_name(dn, i));
117                 if (!upper_rdn_attr) {
118                         return LDB_ERR_OPERATIONS_ERROR;
119                 }
120                 
121                 /* And replace it with CN=foo (we need the attribute in upper case */
122                 ret = ldb_dn_set_component(dn, i, upper_rdn_attr,
123                                            *ldb_dn_get_component_val(dn, i));
124                 talloc_free(upper_rdn_attr);
125                 if (ret != LDB_SUCCESS) {
126                         return ret;
127                 }
128         }
129         return LDB_SUCCESS;
130 }
131
132 /* Inject the extended DN components, so the DN cn=Adminstrator,cn=users,dc=samba,dc=example,dc=com becomes
133    <GUID=541203ae-f7d6-47ef-8390-bfcf019f9583>;<SID=S-1-5-21-4177067393-1453636373-93818737-500>;cn=Adminstrator,cn=users,dc=samba,dc=example,dc=com */
134
135 static int inject_extended_dn_out(struct ldb_reply *ares,
136                                   struct ldb_context *ldb,
137                                   int type,
138                                   bool remove_guid,
139                                   bool remove_sid)
140 {
141         int ret;
142         const DATA_BLOB *guid_blob;
143         const DATA_BLOB *sid_blob;
144
145         guid_blob = ldb_msg_find_ldb_val(ares->message, "objectGUID");
146         sid_blob = ldb_msg_find_ldb_val(ares->message, "objectSID");
147
148         if (!guid_blob) {
149                 ldb_set_errstring(ldb, "Did not find objectGUID to inject into extended DN");
150                 return LDB_ERR_OPERATIONS_ERROR;
151         }
152
153         ret = ldb_dn_set_extended_component(ares->message->dn, "GUID", guid_blob);
154         if (ret != LDB_SUCCESS) {
155                 return ret;
156         }
157         if (sid_blob) {
158                 ret = ldb_dn_set_extended_component(ares->message->dn, "SID", sid_blob);
159                 if (ret != LDB_SUCCESS) {
160                         return ret;
161                 }
162         }
163
164         if (remove_guid) {
165                 ldb_msg_remove_attr(ares->message, "objectGUID");
166         }
167
168         if (sid_blob && remove_sid) {
169                 ldb_msg_remove_attr(ares->message, "objectSID");
170         }
171
172         return LDB_SUCCESS;
173 }
174
175 static int handle_dereference(struct ldb_dn *dn,
176                               struct dsdb_openldap_dereference_result **dereference_attrs, 
177                               const char *attr, const DATA_BLOB *val)
178 {
179         const struct ldb_val *entryUUIDblob, *sid_blob;
180         struct ldb_message fake_msg; /* easier to use routines that expect an ldb_message */
181         int j;
182         
183         fake_msg.num_elements = 0;
184                         
185         /* Look for this attribute in the returned control */
186         for (j = 0; dereference_attrs && dereference_attrs[j]; j++) {
187                 struct ldb_val source_dn = data_blob_string_const(dereference_attrs[j]->dereferenced_dn);
188                 if (ldb_attr_cmp(dereference_attrs[j]->source_attribute, attr) == 0
189                     && data_blob_cmp(&source_dn, val) == 0) {
190                         fake_msg.num_elements = dereference_attrs[j]->num_attributes;
191                         fake_msg.elements = dereference_attrs[j]->attributes;
192                         break;
193                 }
194         }
195         if (!fake_msg.num_elements) {
196                 return LDB_SUCCESS;
197         }
198         /* Look for an OpenLDAP entryUUID */
199         
200         entryUUIDblob = ldb_msg_find_ldb_val(&fake_msg, "entryUUID");
201         if (entryUUIDblob) {
202                 NTSTATUS status;
203                 enum ndr_err_code ndr_err;
204                 
205                 struct ldb_val guid_blob;
206                 struct GUID guid;
207                 
208                 status = GUID_from_data_blob(entryUUIDblob, &guid);
209                 
210                 if (!NT_STATUS_IS_OK(status)) {
211                         return LDB_ERR_INVALID_DN_SYNTAX;
212                 }
213                 ndr_err = ndr_push_struct_blob(&guid_blob, NULL, NULL, &guid,
214                                                (ndr_push_flags_fn_t)ndr_push_GUID);
215                 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
216                         return LDB_ERR_INVALID_DN_SYNTAX;
217                 }
218                 
219                 ldb_dn_set_extended_component(dn, "GUID", &guid_blob);
220         }
221         
222         sid_blob = ldb_msg_find_ldb_val(&fake_msg, "objectSID");
223         
224         /* Look for the objectSID */
225         if (sid_blob) {
226                 ldb_dn_set_extended_component(dn, "SID", sid_blob);
227         }
228         return LDB_SUCCESS;
229 }
230
231 /* search */
232 struct extended_search_context {
233         struct ldb_module *module;
234         const struct dsdb_schema *schema;
235         struct ldb_request *req;
236         bool inject;
237         bool remove_guid;
238         bool remove_sid;
239         int extended_type;
240 };
241
242 static int extended_callback(struct ldb_request *req, struct ldb_reply *ares)
243 {
244         struct extended_search_context *ac;
245         struct ldb_control *control;
246         struct dsdb_openldap_dereference_result_control *dereference_control = NULL;
247         int ret, i, j;
248         struct ldb_message *msg = ares->message;
249         struct extended_dn_out_private *p;
250
251         ac = talloc_get_type(req->context, struct extended_search_context);
252         p = talloc_get_type(ldb_module_get_private(ac->module), struct extended_dn_out_private);
253
254         if (!ares) {
255                 return ldb_module_done(ac->req, NULL, NULL,
256                                         LDB_ERR_OPERATIONS_ERROR);
257         }
258         if (ares->error != LDB_SUCCESS) {
259                 return ldb_module_done(ac->req, ares->controls,
260                                         ares->response, ares->error);
261         }
262
263         switch (ares->type) {
264         case LDB_REPLY_REFERRAL:
265                 return ldb_module_send_referral(ac->req, ares->referral);
266
267         case LDB_REPLY_DONE:
268                 return ldb_module_done(ac->req, ares->controls,
269                                         ares->response, LDB_SUCCESS);
270         case LDB_REPLY_ENTRY:
271                 break;
272         }
273
274         if (p && p->normalise) {
275                 ret = fix_dn(ares->message->dn);
276                 if (ret != LDB_SUCCESS) {
277                         return ldb_module_done(ac->req, NULL, NULL, ret);
278                 }
279         }
280                         
281         if (ac->inject) {
282                 /* for each record returned post-process to add any derived
283                    attributes that have been asked for */
284                 ret = inject_extended_dn_out(ares, ldb_module_get_ctx(ac->module),
285                                              ac->extended_type, ac->remove_guid,
286                                              ac->remove_sid);
287                 if (ret != LDB_SUCCESS) {
288                         return ldb_module_done(ac->req, NULL, NULL, ret);
289                 }
290         }
291
292         if ((p && p->normalise) || ac->inject) {
293                 const struct ldb_val *val = ldb_msg_find_ldb_val(ares->message, "distinguishedName");
294                 if (val) {
295                         ldb_msg_remove_attr(ares->message, "distinguishedName");
296                         if (ac->inject) {
297                                 ret = ldb_msg_add_steal_string(ares->message, "distinguishedName", 
298                                                                ldb_dn_get_extended_linearized(ares->message, ares->message->dn, ac->extended_type));
299                         } else {
300                                 ret = ldb_msg_add_string(ares->message, "distinguishedName", 
301                                                          ldb_dn_get_linearized(ares->message->dn));
302                         }
303                         if (ret != LDB_SUCCESS) {
304                                 ldb_oom(ldb_module_get_ctx(ac->module));
305                                 return LDB_ERR_OPERATIONS_ERROR;
306                         }
307                 }
308         }
309
310         if (p && p->dereference) {
311                 control = ldb_reply_get_control(ares, DSDB_OPENLDAP_DEREFERENCE_CONTROL);
312         
313                 if (control && control->data) {
314                         dereference_control = talloc_get_type(control->data, struct dsdb_openldap_dereference_result_control);
315                 }
316         }
317
318         /* Walk the retruned elements (but only if we have a schema to interpret the list with) */
319         for (i = 0; ac->schema && i < msg->num_elements; i++) {
320                 const struct dsdb_attribute *attribute;
321                 attribute = dsdb_attribute_by_lDAPDisplayName(ac->schema, msg->elements[i].name);
322                 if (!attribute) {
323                         continue;
324                 }
325
326                 if (p->normalise) {
327                         /* If we are also in 'normalise' mode, then
328                          * fix the attribute names to be in the
329                          * correct case */
330                         msg->elements[i].name = talloc_strdup(msg->elements, attribute->lDAPDisplayName);
331                         if (!msg->elements[i].name) {
332                                 ldb_oom(ldb_module_get_ctx(ac->module));
333                                 return ldb_module_done(ac->req, NULL, NULL, LDB_ERR_OPERATIONS_ERROR);
334                         }
335                 }
336
337                 /* distinguishedName has been dealt with above */
338                 if (ldb_attr_cmp(msg->elements[i].name, "distinguishedName") == 0) {
339                         continue;
340                 }
341
342                 /* Look to see if this attributeSyntax is a DN */
343                 if (strcmp(attribute->attributeSyntax_oid, "2.5.5.1") != 0 &&
344                     strcmp(attribute->attributeSyntax_oid, "2.5.5.7") != 0) {
345                         continue;
346                 }
347
348                 for (j = 0; j < msg->elements[i].num_values; j++) {
349                         const char *dn_str;
350                         struct ldb_dn *dn = ldb_dn_from_ldb_val(ac, ldb_module_get_ctx(ac->module), &msg->elements[i].values[j]);
351                         if (!dn || !ldb_dn_validate(dn)) {
352                                 return ldb_module_done(ac->req, NULL, NULL, LDB_ERR_INVALID_DN_SYNTAX);
353                         }
354
355                         if (p->normalise) {
356                                 ret = fix_dn(dn);
357                                 if (ret != LDB_SUCCESS) {
358                                         return ldb_module_done(ac->req, NULL, NULL, ret);
359                                 }
360                         }
361                         
362                         /* If we are running in dereference mode (such
363                          * as against OpenLDAP) then the DN in the msg
364                          * above does not contain the extended values,
365                          * and we need to look in the dereference
366                          * result */
367
368                         /* Look for this value in the attribute */
369
370                         if (dereference_control) {
371                                 ret = handle_dereference(dn, 
372                                                          dereference_control->attributes,
373                                                          msg->elements[i].name,
374                                                          &msg->elements[i].values[j]);
375                                 if (ret != LDB_SUCCESS) {
376                                         return ldb_module_done(ac->req, NULL, NULL, ret);
377                                 }
378                         }
379                         
380                         if (!ac->inject) {
381                                 dn_str = talloc_steal(msg->elements[i].values, 
382                                                       ldb_dn_get_linearized(dn));
383                         } else {
384                                 dn_str = talloc_steal(msg->elements[i].values, 
385                                                       ldb_dn_get_extended_linearized(msg->elements[i].values, 
386                                                                                      dn, ac->extended_type));
387                         }
388                         if (!dn_str) {
389                                 ldb_oom(ldb_module_get_ctx(ac->module));
390                                 return ldb_module_done(ac->req, NULL, NULL, LDB_ERR_OPERATIONS_ERROR);
391                         }
392                         msg->elements[i].values[j] = data_blob_string_const(dn_str);
393                         talloc_free(dn);
394                 }
395         }
396         return ldb_module_send_entry(ac->req, msg, ares->controls);
397 }
398
399
400 static int extended_dn_out_search(struct ldb_module *module, struct ldb_request *req)
401 {
402         struct ldb_control *control;
403         struct ldb_control *storage_format_control;
404         struct ldb_extended_dn_control *extended_ctrl = NULL;
405         struct ldb_control **saved_controls;
406         struct extended_search_context *ac;
407         struct ldb_request *down_req;
408         char **new_attrs;
409         const char * const *const_attrs;
410         int ret;
411
412         struct extended_dn_out_private *p = talloc_get_type(ldb_module_get_private(module), struct extended_dn_out_private);
413
414         /* check if there's an extended dn control */
415         control = ldb_request_get_control(req, LDB_CONTROL_EXTENDED_DN_OID);
416         if (control && control->data) {
417                 extended_ctrl = talloc_get_type(control->data, struct ldb_extended_dn_control);
418                 if (!extended_ctrl) {
419                         return LDB_ERR_PROTOCOL_ERROR;
420                 }
421         }
422
423         /* Look to see if, as we are in 'store DN+GUID+SID' mode, the
424          * client is after the storage format (to fill in linked
425          * attributes) */
426         storage_format_control = ldb_request_get_control(req, DSDB_CONTROL_DN_STORAGE_FORMAT_OID);
427         if (!control && storage_format_control && storage_format_control->data) {
428                 extended_ctrl = talloc_get_type(storage_format_control->data, struct ldb_extended_dn_control);
429                 if (!extended_ctrl) {
430                         ldb_set_errstring(ldb_module_get_ctx(module), "extended_dn_out: extended_ctrl was of the wrong data type");
431                         return LDB_ERR_PROTOCOL_ERROR;
432                 }
433         }
434
435         ac = talloc_zero(req, struct extended_search_context);
436         if (ac == NULL) {
437                 ldb_oom(ldb_module_get_ctx(module));
438                 return LDB_ERR_OPERATIONS_ERROR;
439         }
440
441         ac->module = module;
442         ac->schema = dsdb_get_schema(ldb_module_get_ctx(module));
443         ac->req = req;
444         ac->inject = false;
445         ac->remove_guid = false;
446         ac->remove_sid = false;
447         
448         const_attrs = req->op.search.attrs;
449
450         /* We only need to do special processing if we were asked for
451          * the extended DN, or we are 'store DN+GUID+SID'
452          * (!dereference) mode.  (This is the normal mode for LDB on
453          * tdb). */
454         if (control || (storage_format_control && p && !p->dereference)) {
455                 ac->inject = true;
456                 if (extended_ctrl) {
457                         ac->extended_type = extended_ctrl->type;
458                 } else {
459                         ac->extended_type = 0;
460                 }
461
462                 /* check if attrs only is specified, in that case check wether we need to modify them */
463                 if (req->op.search.attrs && !is_attr_in_list(req->op.search.attrs, "*")) {
464                         if (! is_attr_in_list(req->op.search.attrs, "objectGUID")) {
465                                 ac->remove_guid = true;
466                         }
467                         if (! is_attr_in_list(req->op.search.attrs, "objectSID")) {
468                                 ac->remove_sid = true;
469                         }
470                         if (ac->remove_guid || ac->remove_sid) {
471                                 new_attrs = copy_attrs(ac, req->op.search.attrs);
472                                 if (new_attrs == NULL) {
473                                         ldb_oom(ldb_module_get_ctx(module));
474                                         return LDB_ERR_OPERATIONS_ERROR;
475                                 }
476
477                                 if (ac->remove_guid) {
478                                         if (!add_attrs(ac, &new_attrs, "objectGUID"))
479                                                 return LDB_ERR_OPERATIONS_ERROR;
480                                 }
481                                 if (ac->remove_sid) {
482                                         if (!add_attrs(ac, &new_attrs, "objectSID"))
483                                                 return LDB_ERR_OPERATIONS_ERROR;
484                                 }
485                                 const_attrs = (const char * const *)new_attrs;
486                         }
487                 }
488         }
489
490         ret = ldb_build_search_req_ex(&down_req,
491                                       ldb_module_get_ctx(module), ac,
492                                       req->op.search.base,
493                                       req->op.search.scope,
494                                       req->op.search.tree,
495                                       const_attrs,
496                                       req->controls,
497                                       ac, extended_callback,
498                                       req);
499         if (ret != LDB_SUCCESS) {
500                 return ret;
501         }
502
503         /* Remove extended DN and storage format controls */
504
505         if (control) {
506                 /* save it locally and remove it from the list */
507                 /* we do not need to replace them later as we
508                  * are keeping the original req intact */
509                 if (!save_controls(control, down_req, &saved_controls)) {
510                         return LDB_ERR_OPERATIONS_ERROR;
511                 }
512         }
513
514         if (storage_format_control) {
515                 /* save it locally and remove it from the list */
516                 /* we do not need to replace them later as we
517                  * are keeping the original req intact */
518                 if (!save_controls(storage_format_control, down_req, &saved_controls)) {
519                         return LDB_ERR_OPERATIONS_ERROR;
520                 }
521         }
522
523         /* Add in dereference control, if we were asked to, we are
524          * using the 'dereference' mode (such as with an OpenLDAP
525          * backend) and have the control prepared */
526         if (control && p && p->dereference && p->dereference_control) {
527                 ret = ldb_request_add_control(down_req,
528                                               DSDB_OPENLDAP_DEREFERENCE_CONTROL,
529                                               false, p->dereference_control);
530                 if (ret != LDB_SUCCESS) {
531                         return ret;
532                 }
533         }
534
535         /* perform the search */
536         return ldb_next_request(module, down_req);
537 }
538
539 static int extended_dn_out_ldb_init(struct ldb_module *module)
540 {
541         int ret;
542
543         struct extended_dn_out_private *p = talloc(module, struct extended_dn_out_private);
544
545         ldb_module_set_private(module, p);
546
547         if (!p) {
548                 ldb_oom(ldb_module_get_ctx(module));
549                 return LDB_ERR_OPERATIONS_ERROR;
550         }
551
552         p->dereference = false;
553         p->normalise = false;
554
555         ret = ldb_mod_register_control(module, LDB_CONTROL_EXTENDED_DN_OID);
556         if (ret != LDB_SUCCESS) {
557                 ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_ERROR,
558                         "extended_dn_out: Unable to register control with rootdse!\n");
559                 return LDB_ERR_OPERATIONS_ERROR;
560         }
561
562         return ldb_next_init(module);
563 }
564
565 static int extended_dn_out_dereference_init(struct ldb_module *module)
566 {
567         int ret, i = 0;
568         struct extended_dn_out_private *p = talloc_zero(module, struct extended_dn_out_private);
569         struct dsdb_openldap_dereference_control *dereference_control;
570         struct dsdb_attribute *cur;
571
572         struct dsdb_schema *schema;
573
574         ldb_module_set_private(module, p);
575
576         if (!p) {
577                 ldb_oom(ldb_module_get_ctx(module));
578                 return LDB_ERR_OPERATIONS_ERROR;
579         }
580
581         p->dereference = true;
582
583         /* At the moment, servers that need dereference also need the
584          * DN and attribute names to be normalised */
585         p->normalise = true;
586
587         ret = ldb_mod_register_control(module, LDB_CONTROL_EXTENDED_DN_OID);
588         if (ret != LDB_SUCCESS) {
589                 ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_ERROR,
590                         "extended_dn_out: Unable to register control with rootdse!\n");
591                 return LDB_ERR_OPERATIONS_ERROR;
592         }
593
594         ret = ldb_next_init(module);
595
596         if (ret != LDB_SUCCESS) {
597                 return ret;
598         }
599
600         schema = dsdb_get_schema(ldb_module_get_ctx(module));
601         if (!schema) {
602                 /* No schema on this DB (yet) */
603                 return LDB_SUCCESS;
604         }
605
606         p->dereference_control = dereference_control
607                 = talloc_zero(p, struct dsdb_openldap_dereference_control);
608
609         if (!p->dereference_control) {
610                 ldb_oom(ldb_module_get_ctx(module));
611                 return LDB_ERR_OPERATIONS_ERROR;
612         }
613         
614         for (cur = schema->attributes; cur; cur = cur->next) {
615                 static const char *attrs[] = {
616                         "entryUUID",
617                         "objectSID",
618                         NULL
619                 };
620
621                 if (strcmp(cur->syntax->attributeSyntax_oid, "2.5.5.1") != 0 &&
622                     strcmp(cur->syntax->attributeSyntax_oid, "2.5.5.7") != 0) {
623                         continue;
624                 }
625                 dereference_control->dereference
626                         = talloc_realloc(p, dereference_control->dereference,
627                                          struct dsdb_openldap_dereference *, i + 2);
628                 if (!dereference_control) {
629                         ldb_oom(ldb_module_get_ctx(module));
630                         return LDB_ERR_OPERATIONS_ERROR;
631                 }
632                 dereference_control->dereference[i] = talloc(dereference_control->dereference,  
633                                          struct dsdb_openldap_dereference);
634                 if (!dereference_control->dereference[i]) {
635                         ldb_oom(ldb_module_get_ctx(module));
636                         return LDB_ERR_OPERATIONS_ERROR;
637                 }
638                 dereference_control->dereference[i]->source_attribute = cur->lDAPDisplayName;
639                 dereference_control->dereference[i]->dereference_attribute = attrs;
640                 i++;
641                 dereference_control->dereference[i] = NULL;
642         }
643         return LDB_SUCCESS;
644 }
645
646 _PUBLIC_ const struct ldb_module_ops ldb_extended_dn_out_ldb_module_ops = {
647         .name              = "extended_dn_out_ldb",
648         .search            = extended_dn_out_search,
649         .init_context      = extended_dn_out_ldb_init,
650 };
651
652
653 _PUBLIC_ const struct ldb_module_ops ldb_extended_dn_out_dereference_module_ops = {
654         .name              = "extended_dn_out_dereference",
655         .search            = extended_dn_out_search,
656         .init_context      = extended_dn_out_dereference_init,
657 };