2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan Metzmacher 2004
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "ldap_server/ldap_server.h"
23 #include "lib/util/dlinklist.h"
24 #include "libcli/ldap/ldap.h"
25 #include "lib/ldb/include/ldb.h"
26 #include "lib/ldb/include/ldb_errors.h"
27 #include "lib/db_wrap.h"
29 #define VALID_DN_SYNTAX(dn,i) do {\
31 return NT_STATUS_NO_MEMORY;\
32 } else if ((dn)->comp_num < (i)) {\
33 result = LDAP_INVALID_DN_SYNTAX;\
34 errstr = "Invalid DN (" #i " components needed for '" #dn "')";\
39 static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstring)
41 *errstring = ldb_errstring(ldb);
48 connect to the sam database
50 NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn)
52 conn->ldb = ldb_wrap_connect(conn, lp_sam_url(), conn->session_info,
53 NULL, conn->global_catalog ? LDB_FLG_RDONLY : 0, NULL);
54 if (conn->ldb == NULL) {
55 return NT_STATUS_INTERNAL_DB_CORRUPTION;
57 ldb_set_opaque(conn->ldb, "server_credentials", conn->server_credentials);
59 if (conn->global_catalog) {
60 ldb_set_opaque(conn->ldb, "global_catalog", (void *)(-1));
66 struct ldapsrv_reply *ldapsrv_init_reply(struct ldapsrv_call *call, uint8_t type)
68 struct ldapsrv_reply *reply;
70 reply = talloc(call, struct ldapsrv_reply);
74 reply->msg = talloc(reply, struct ldap_message);
75 if (reply->msg == NULL) {
80 reply->msg->messageid = call->request->messageid;
81 reply->msg->type = type;
82 reply->msg->controls = NULL;
87 void ldapsrv_queue_reply(struct ldapsrv_call *call, struct ldapsrv_reply *reply)
89 DLIST_ADD_END(call->replies, reply, struct ldapsrv_reply *);
92 NTSTATUS ldapsrv_unwilling(struct ldapsrv_call *call, int error)
94 struct ldapsrv_reply *reply;
95 struct ldap_ExtendedResponse *r;
97 DEBUG(10,("Unwilling type[%d] id[%d]\n", call->request->type, call->request->messageid));
99 reply = ldapsrv_init_reply(call, LDAP_TAG_ExtendedResponse);
101 return NT_STATUS_NO_MEMORY;
104 r = &reply->msg->r.ExtendedResponse;
105 r->response.resultcode = error;
106 r->response.dn = NULL;
107 r->response.errormessage = NULL;
108 r->response.referral = NULL;
112 ldapsrv_queue_reply(call, reply);
116 static int ldapsrv_SearchCallback(struct ldb_context *ldb, void *context, struct ldb_reply *ares)
118 struct ldb_result *res;
121 if (!context || !ares) {
122 DEBUG(3, ("NULL Context or Ares in ldapsrv_SearchCallback"));
123 return LDB_ERR_OPERATIONS_ERROR;
126 res = talloc_get_type(context, struct ldb_result);
128 if (ares->type == LDB_REPLY_ENTRY) {
129 res->msgs = talloc_realloc(res, res->msgs, struct ldb_message *, res->count + 2);
134 res->msgs[res->count + 1] = NULL;
136 res->msgs[res->count] = talloc_steal(res->msgs, ares->message);
137 if (! res->msgs[res->count]) {
144 if (ares->type == LDB_REPLY_REFERRAL) {
146 for (n = 0; res->refs[n]; n++) /*noop*/ ;
151 res->refs = talloc_realloc(res, res->refs, char *, n + 2);
156 res->refs[n] = talloc_steal(res->refs, ares->referral);
157 res->refs[n + 1] = NULL;
160 if (ares->controls) {
161 res->controls = talloc_steal(res, ares->controls);
162 if (! res->controls) {
172 return LDB_ERR_OPERATIONS_ERROR;
175 static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
177 struct ldap_SearchRequest *req = &call->request->r.SearchRequest;
178 struct ldap_SearchResEntry *ent;
179 struct ldap_Result *done;
180 struct ldapsrv_reply *ent_r, *done_r;
182 struct ldb_context *samdb = talloc_get_type(call->conn->ldb, struct ldb_context);
183 struct ldb_dn *basedn;
184 struct ldb_result *res = NULL;
185 struct ldb_request *lreq;
186 enum ldb_scope scope = LDB_SCOPE_DEFAULT;
187 const char **attrs = NULL;
188 const char *errstr = NULL;
189 int success_limit = 1;
194 DEBUG(10, ("SearchRequest"));
195 DEBUGADD(10, (" basedn: %s", req->basedn));
196 DEBUGADD(10, (" filter: %s\n", ldb_filter_from_tree(call, req->tree)));
198 local_ctx = talloc_new(call);
199 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
201 basedn = ldb_dn_explode(local_ctx, req->basedn);
202 VALID_DN_SYNTAX(basedn, 0);
204 DEBUG(10, ("SearchRequest: basedn: [%s]\n", req->basedn));
205 DEBUG(10, ("SearchRequest: filter: [%s]\n", ldb_filter_from_tree(call, req->tree)));
207 switch (req->scope) {
208 case LDAP_SEARCH_SCOPE_BASE:
209 DEBUG(10,("SearchRequest: scope: [BASE]\n"));
210 scope = LDB_SCOPE_BASE;
213 case LDAP_SEARCH_SCOPE_SINGLE:
214 DEBUG(10,("SearchRequest: scope: [ONE]\n"));
215 scope = LDB_SCOPE_ONELEVEL;
218 case LDAP_SEARCH_SCOPE_SUB:
219 DEBUG(10,("SearchRequest: scope: [SUB]\n"));
220 scope = LDB_SCOPE_SUBTREE;
225 if (req->num_attributes >= 1) {
226 attrs = talloc_array(samdb, const char *, req->num_attributes+1);
227 NT_STATUS_HAVE_NO_MEMORY(attrs);
229 for (i=0; i < req->num_attributes; i++) {
230 DEBUG(10,("SearchRequest: attrs: [%s]\n",req->attributes[i]));
231 attrs[i] = req->attributes[i];
236 DEBUG(5,("ldb_request dn=%s filter=%s\n",
237 req->basedn, ldb_filter_from_tree(call, req->tree)));
239 lreq = talloc(local_ctx, struct ldb_request);
240 NT_STATUS_HAVE_NO_MEMORY(lreq);
242 res = talloc_zero(local_ctx, struct ldb_result);
243 NT_STATUS_HAVE_NO_MEMORY(res);
245 lreq->operation = LDB_SEARCH;
246 lreq->op.search.base = basedn;
247 lreq->op.search.scope = scope;
248 lreq->op.search.tree = req->tree;
249 lreq->op.search.attrs = attrs;
251 lreq->controls = call->request->controls;
254 lreq->callback = ldapsrv_SearchCallback;
256 /* Copy the timeout from the incoming call */
257 ldb_set_timeout(samdb, lreq, req->timelimit);
259 ldb_ret = ldb_request(samdb, lreq);
261 if (ldb_ret != LDB_SUCCESS) {
265 ldb_ret = ldb_wait(lreq->handle, LDB_WAIT_ALL);
267 if (ldb_ret == LDB_SUCCESS) {
268 for (i = 0; i < res->count; i++) {
269 ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry);
270 NT_STATUS_HAVE_NO_MEMORY(ent_r);
272 ent = &ent_r->msg->r.SearchResultEntry;
273 ent->dn = ldb_dn_linearize(ent_r, res->msgs[i]->dn);
274 ent->num_attributes = 0;
275 ent->attributes = NULL;
276 if (res->msgs[i]->num_elements == 0) {
279 ent->num_attributes = res->msgs[i]->num_elements;
280 ent->attributes = talloc_array(ent_r, struct ldb_message_element, ent->num_attributes);
281 NT_STATUS_HAVE_NO_MEMORY(ent->attributes);
282 for (j=0; j < ent->num_attributes; j++) {
283 ent->attributes[j].name = talloc_steal(ent->attributes, res->msgs[i]->elements[j].name);
284 ent->attributes[j].num_values = 0;
285 ent->attributes[j].values = NULL;
286 if (req->attributesonly && (res->msgs[i]->elements[j].num_values == 0)) {
289 ent->attributes[j].num_values = res->msgs[i]->elements[j].num_values;
290 ent->attributes[j].values = res->msgs[i]->elements[j].values;
291 talloc_steal(ent->attributes, res->msgs[i]->elements[j].values);
294 ldapsrv_queue_reply(call, ent_r);
299 done_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultDone);
300 NT_STATUS_HAVE_NO_MEMORY(done_r);
302 done = &done_r->msg->r.SearchResultDone;
304 done->referral = NULL;
307 } else if (ldb_ret == LDB_SUCCESS) {
308 if (res->count >= success_limit) {
309 DEBUG(10,("SearchRequest: results: [%d]\n", res->count));
310 result = LDAP_SUCCESS;
312 } else if (res->count == 0) {
313 DEBUG(10,("SearchRequest: no results\n"));
314 result = LDAP_NO_SUCH_OBJECT;
315 errstr = ldb_errstring(samdb);
318 done_r->msg->controls = res->controls;
319 talloc_steal(done_r, res->controls);
322 DEBUG(10,("SearchRequest: error\n"));
323 result = map_ldb_error(samdb, ldb_ret, &errstr);
326 done->resultcode = result;
327 done->errormessage = (errstr?talloc_strdup(done_r, errstr):NULL);
329 talloc_free(local_ctx);
331 ldapsrv_queue_reply(call, done_r);
335 static NTSTATUS ldapsrv_ModifyRequest(struct ldapsrv_call *call)
337 struct ldap_ModifyRequest *req = &call->request->r.ModifyRequest;
338 struct ldap_Result *modify_result;
339 struct ldapsrv_reply *modify_reply;
341 struct ldb_context *samdb = call->conn->ldb;
342 struct ldb_message *msg = NULL;
344 const char *errstr = NULL;
345 int result = LDAP_SUCCESS;
349 DEBUG(10, ("ModifyRequest"));
350 DEBUGADD(10, (" dn: %s", req->dn));
352 local_ctx = talloc_named(call, 0, "ModifyRequest local memory context");
353 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
355 dn = ldb_dn_explode(local_ctx, req->dn);
356 VALID_DN_SYNTAX(dn, 1);
358 DEBUG(10, ("ModifyRequest: dn: [%s]\n", req->dn));
360 msg = talloc(local_ctx, struct ldb_message);
361 NT_STATUS_HAVE_NO_MEMORY(msg);
364 msg->private_data = NULL;
365 msg->num_elements = 0;
366 msg->elements = NULL;
368 if (req->num_mods > 0) {
369 msg->num_elements = req->num_mods;
370 msg->elements = talloc_array(msg, struct ldb_message_element, req->num_mods);
371 NT_STATUS_HAVE_NO_MEMORY(msg->elements);
373 for (i=0; i < msg->num_elements; i++) {
374 msg->elements[i].name = discard_const_p(char, req->mods[i].attrib.name);
375 msg->elements[i].num_values = 0;
376 msg->elements[i].values = NULL;
378 switch (req->mods[i].type) {
380 result = LDAP_PROTOCOL_ERROR;
381 errstr = "Invalid LDAP_MODIFY_* type";
383 case LDAP_MODIFY_ADD:
384 msg->elements[i].flags = LDB_FLAG_MOD_ADD;
386 case LDAP_MODIFY_DELETE:
387 msg->elements[i].flags = LDB_FLAG_MOD_DELETE;
389 case LDAP_MODIFY_REPLACE:
390 msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
394 msg->elements[i].num_values = req->mods[i].attrib.num_values;
395 if (msg->elements[i].num_values > 0) {
396 msg->elements[i].values = talloc_array(msg, struct ldb_val, msg->elements[i].num_values);
397 NT_STATUS_HAVE_NO_MEMORY(msg->elements[i].values);
399 for (j=0; j < msg->elements[i].num_values; j++) {
400 if (!(req->mods[i].attrib.values[j].length > 0)) {
402 errstr = "Empty attribute values are not allowed";
405 msg->elements[i].values[j].length = req->mods[i].attrib.values[j].length;
406 msg->elements[i].values[j].data = req->mods[i].attrib.values[j].data;
412 errstr = "No mods are not allowed";
417 modify_reply = ldapsrv_init_reply(call, LDAP_TAG_ModifyResponse);
418 NT_STATUS_HAVE_NO_MEMORY(modify_reply);
420 if (result == LDAP_SUCCESS) {
421 ldb_ret = ldb_modify(samdb, msg);
422 result = map_ldb_error(samdb, ldb_ret, &errstr);
425 modify_result = &modify_reply->msg->r.AddResponse;
426 modify_result->dn = NULL;
427 modify_result->resultcode = result;
428 modify_result->errormessage = (errstr?talloc_strdup(modify_reply, errstr):NULL);
429 modify_result->referral = NULL;
431 talloc_free(local_ctx);
433 ldapsrv_queue_reply(call, modify_reply);
438 static NTSTATUS ldapsrv_AddRequest(struct ldapsrv_call *call)
440 struct ldap_AddRequest *req = &call->request->r.AddRequest;
441 struct ldap_Result *add_result;
442 struct ldapsrv_reply *add_reply;
444 struct ldb_context *samdb = call->conn->ldb;
445 struct ldb_message *msg = NULL;
447 const char *errstr = NULL;
448 int result = LDAP_SUCCESS;
452 DEBUG(10, ("AddRequest"));
453 DEBUGADD(10, (" dn: %s", req->dn));
455 local_ctx = talloc_named(call, 0, "AddRequest local memory context");
456 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
458 dn = ldb_dn_explode(local_ctx, req->dn);
459 VALID_DN_SYNTAX(dn,1);
461 DEBUG(10, ("AddRequest: dn: [%s]\n", req->dn));
463 msg = talloc(local_ctx, struct ldb_message);
464 NT_STATUS_HAVE_NO_MEMORY(msg);
467 msg->private_data = NULL;
468 msg->num_elements = 0;
469 msg->elements = NULL;
471 if (req->num_attributes > 0) {
472 msg->num_elements = req->num_attributes;
473 msg->elements = talloc_array(msg, struct ldb_message_element, msg->num_elements);
474 NT_STATUS_HAVE_NO_MEMORY(msg->elements);
476 for (i=0; i < msg->num_elements; i++) {
477 msg->elements[i].name = discard_const_p(char, req->attributes[i].name);
478 msg->elements[i].flags = 0;
479 msg->elements[i].num_values = 0;
480 msg->elements[i].values = NULL;
482 if (req->attributes[i].num_values > 0) {
483 msg->elements[i].num_values = req->attributes[i].num_values;
484 msg->elements[i].values = talloc_array(msg, struct ldb_val, msg->elements[i].num_values);
485 NT_STATUS_HAVE_NO_MEMORY(msg->elements[i].values);
487 for (j=0; j < msg->elements[i].num_values; j++) {
488 if (!(req->attributes[i].values[j].length > 0)) {
490 errstr = "Empty attribute values are not allowed";
493 msg->elements[i].values[j].length = req->attributes[i].values[j].length;
494 msg->elements[i].values[j].data = req->attributes[i].values[j].data;
498 errstr = "No attribute values are not allowed";
504 errstr = "No attributes are not allowed";
509 add_reply = ldapsrv_init_reply(call, LDAP_TAG_AddResponse);
510 NT_STATUS_HAVE_NO_MEMORY(add_reply);
512 if (result == LDAP_SUCCESS) {
513 ldb_ret = ldb_add(samdb, msg);
514 result = map_ldb_error(samdb, ldb_ret, &errstr);
517 add_result = &add_reply->msg->r.AddResponse;
518 add_result->dn = NULL;
519 add_result->resultcode = result;
520 add_result->errormessage = (errstr?talloc_strdup(add_reply,errstr):NULL);
521 add_result->referral = NULL;
523 talloc_free(local_ctx);
525 ldapsrv_queue_reply(call, add_reply);
530 static NTSTATUS ldapsrv_DelRequest(struct ldapsrv_call *call)
532 struct ldap_DelRequest *req = &call->request->r.DelRequest;
533 struct ldap_Result *del_result;
534 struct ldapsrv_reply *del_reply;
536 struct ldb_context *samdb = call->conn->ldb;
538 const char *errstr = NULL;
539 int result = LDAP_SUCCESS;
542 DEBUG(10, ("DelRequest"));
543 DEBUGADD(10, (" dn: %s", req->dn));
545 local_ctx = talloc_named(call, 0, "DelRequest local memory context");
546 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
548 dn = ldb_dn_explode(local_ctx, req->dn);
549 VALID_DN_SYNTAX(dn,1);
551 DEBUG(10, ("DelRequest: dn: [%s]\n", req->dn));
554 del_reply = ldapsrv_init_reply(call, LDAP_TAG_DelResponse);
555 NT_STATUS_HAVE_NO_MEMORY(del_reply);
557 if (result == LDAP_SUCCESS) {
558 ldb_ret = ldb_delete(samdb, dn);
559 result = map_ldb_error(samdb, ldb_ret, &errstr);
562 del_result = &del_reply->msg->r.DelResponse;
563 del_result->dn = NULL;
564 del_result->resultcode = result;
565 del_result->errormessage = (errstr?talloc_strdup(del_reply,errstr):NULL);
566 del_result->referral = NULL;
568 talloc_free(local_ctx);
570 ldapsrv_queue_reply(call, del_reply);
574 static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call)
576 struct ldap_ModifyDNRequest *req = &call->request->r.ModifyDNRequest;
577 struct ldap_Result *modifydn;
578 struct ldapsrv_reply *modifydn_r;
580 struct ldb_context *samdb = call->conn->ldb;
581 struct ldb_dn *olddn, *newdn, *newrdn;
582 struct ldb_dn *parentdn = NULL;
583 const char *errstr = NULL;
584 int result = LDAP_SUCCESS;
587 DEBUG(10, ("ModifyDNRequrest"));
588 DEBUGADD(10, (" dn: %s", req->dn));
589 DEBUGADD(10, (" newrdn: %s", req->newrdn));
591 local_ctx = talloc_named(call, 0, "ModifyDNRequest local memory context");
592 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
594 olddn = ldb_dn_explode(local_ctx, req->dn);
595 VALID_DN_SYNTAX(olddn, 2);
597 newrdn = ldb_dn_explode(local_ctx, req->newrdn);
598 VALID_DN_SYNTAX(newrdn, 1);
600 DEBUG(10, ("ModifyDNRequest: olddn: [%s]\n", req->dn));
601 DEBUG(10, ("ModifyDNRequest: newrdn: [%s]\n", req->newrdn));
603 /* we can't handle the rename if we should not remove the old dn */
604 if (!req->deleteolddn) {
605 result = LDAP_UNWILLING_TO_PERFORM;
606 errstr = "Old RDN must be deleted";
610 if (newrdn->comp_num > 1) {
611 result = LDAP_NAMING_VIOLATION;
612 errstr = "Error new RDN invalid";
616 if (req->newsuperior) {
617 parentdn = ldb_dn_explode(local_ctx, req->newsuperior);
618 VALID_DN_SYNTAX(parentdn, 0);
619 DEBUG(10, ("ModifyDNRequest: newsuperior: [%s]\n", req->newsuperior));
621 if (parentdn->comp_num < 1) {
622 result = LDAP_AFFECTS_MULTIPLE_DSAS;
623 errstr = "Error new Superior DN invalid";
629 parentdn = ldb_dn_get_parent(local_ctx, olddn);
630 NT_STATUS_HAVE_NO_MEMORY(parentdn);
633 newdn = ldb_dn_make_child(local_ctx, ldb_dn_get_rdn(local_ctx, newrdn), parentdn);
634 NT_STATUS_HAVE_NO_MEMORY(newdn);
637 modifydn_r = ldapsrv_init_reply(call, LDAP_TAG_ModifyDNResponse);
638 NT_STATUS_HAVE_NO_MEMORY(modifydn_r);
640 if (result == LDAP_SUCCESS) {
641 ldb_ret = ldb_rename(samdb, olddn, newdn);
642 result = map_ldb_error(samdb, ldb_ret, &errstr);
645 modifydn = &modifydn_r->msg->r.ModifyDNResponse;
647 modifydn->resultcode = result;
648 modifydn->errormessage = (errstr?talloc_strdup(modifydn_r,errstr):NULL);
649 modifydn->referral = NULL;
651 talloc_free(local_ctx);
653 ldapsrv_queue_reply(call, modifydn_r);
657 static NTSTATUS ldapsrv_CompareRequest(struct ldapsrv_call *call)
659 struct ldap_CompareRequest *req = &call->request->r.CompareRequest;
660 struct ldap_Result *compare;
661 struct ldapsrv_reply *compare_r;
663 struct ldb_context *samdb = call->conn->ldb;
664 struct ldb_result *res = NULL;
666 const char *attrs[1];
667 const char *errstr = NULL;
668 const char *filter = NULL;
669 int result = LDAP_SUCCESS;
672 DEBUG(10, ("CompareRequest"));
673 DEBUGADD(10, (" dn: %s", req->dn));
675 local_ctx = talloc_named(call, 0, "CompareRequest local_memory_context");
676 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
678 dn = ldb_dn_explode(local_ctx, req->dn);
679 VALID_DN_SYNTAX(dn, 1);
681 DEBUG(10, ("CompareRequest: dn: [%s]\n", req->dn));
682 filter = talloc_asprintf(local_ctx, "(%s=%*s)", req->attribute,
683 (int)req->value.length, req->value.data);
684 NT_STATUS_HAVE_NO_MEMORY(filter);
686 DEBUGADD(10, ("CompareRequest: attribute: [%s]\n", filter));
691 compare_r = ldapsrv_init_reply(call, LDAP_TAG_CompareResponse);
692 NT_STATUS_HAVE_NO_MEMORY(compare_r);
694 if (result == LDAP_SUCCESS) {
695 ldb_ret = ldb_search(samdb, dn, LDB_SCOPE_BASE, filter, attrs, &res);
696 talloc_steal(samdb, res);
697 if (ldb_ret != LDB_SUCCESS) {
698 result = map_ldb_error(samdb, ldb_ret, &errstr);
699 DEBUG(10,("CompareRequest: error: %s\n", errstr));
700 } else if (res->count == 0) {
701 DEBUG(10,("CompareRequest: doesn't matched\n"));
702 result = LDAP_COMPARE_FALSE;
704 } else if (res->count == 1) {
705 DEBUG(10,("CompareRequest: matched\n"));
706 result = LDAP_COMPARE_TRUE;
708 } else if (res->count > 1) {
710 errstr = "too many objects match";
711 DEBUG(10,("CompareRequest: %d results: %s\n", res->count, errstr));
715 compare = &compare_r->msg->r.CompareResponse;
717 compare->resultcode = result;
718 compare->errormessage = (errstr?talloc_strdup(compare_r,errstr):NULL);
719 compare->referral = NULL;
721 talloc_free(local_ctx);
723 ldapsrv_queue_reply(call, compare_r);
727 static NTSTATUS ldapsrv_AbandonRequest(struct ldapsrv_call *call)
729 /* struct ldap_AbandonRequest *req = &call->request.r.AbandonRequest;*/
730 DEBUG(10, ("AbandonRequest\n"));
734 NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
736 switch(call->request->type) {
737 case LDAP_TAG_BindRequest:
738 return ldapsrv_BindRequest(call);
739 case LDAP_TAG_UnbindRequest:
740 return ldapsrv_UnbindRequest(call);
741 case LDAP_TAG_SearchRequest:
742 return ldapsrv_SearchRequest(call);
743 case LDAP_TAG_ModifyRequest:
744 return ldapsrv_ModifyRequest(call);
745 case LDAP_TAG_AddRequest:
746 return ldapsrv_AddRequest(call);
747 case LDAP_TAG_DelRequest:
748 return ldapsrv_DelRequest(call);
749 case LDAP_TAG_ModifyDNRequest:
750 return ldapsrv_ModifyDNRequest(call);
751 case LDAP_TAG_CompareRequest:
752 return ldapsrv_CompareRequest(call);
753 case LDAP_TAG_AbandonRequest:
754 return ldapsrv_AbandonRequest(call);
755 case LDAP_TAG_ExtendedRequest:
756 return ldapsrv_ExtendedRequest(call);
758 return ldapsrv_unwilling(call, 2);