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 3 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, see <http://www.gnu.org/licenses/>.
21 #include "ldap_server/ldap_server.h"
22 #include "lib/util/dlinklist.h"
23 #include "libcli/ldap/ldap.h"
24 #include "lib/ldb/include/ldb.h"
25 #include "lib/ldb/include/ldb_errors.h"
26 #include "lib/ldb_wrap.h"
27 #include "auth/credentials/credentials.h"
28 #include "auth/gensec/gensec.h"
29 #include "param/param.h"
31 #define VALID_DN_SYNTAX(dn,i) do {\
33 return NT_STATUS_NO_MEMORY;\
34 } else if ( ! ldb_dn_validate(dn)) {\
35 result = LDAP_INVALID_DN_SYNTAX;\
36 errstr = "Invalid DN format";\
38 } else if (ldb_dn_get_comp_num(dn) < (i)) {\
39 result = LDAP_INVALID_DN_SYNTAX;\
40 errstr = "Invalid DN (" #i " components needed for '" #dn "')";\
45 static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstring)
47 *errstring = ldb_errstring(ldb);
54 connect to the sam database
56 NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn)
58 conn->ldb = ldb_wrap_connect(conn,
60 lp_sam_url(global_loadparm), conn->session_info,
61 NULL, conn->global_catalog ? LDB_FLG_RDONLY : 0, NULL);
62 if (conn->ldb == NULL) {
63 return NT_STATUS_INTERNAL_DB_CORRUPTION;
66 if (conn->server_credentials) {
67 char **sasl_mechs = NULL;
68 struct gensec_security_ops **backends = gensec_security_all();
69 struct gensec_security_ops **ops
70 = gensec_use_kerberos_mechs(conn, backends, conn->server_credentials);
72 for (i = 0; ops && ops[i]; i++) {
73 if (ops[i]->sasl_name && ops[i]->server_start) {
74 char *sasl_name = talloc_strdup(conn, ops[i]->sasl_name);
77 return NT_STATUS_NO_MEMORY;
79 sasl_mechs = talloc_realloc(conn, sasl_mechs, char *, j + 2);
81 return NT_STATUS_NO_MEMORY;
83 sasl_mechs[j] = sasl_name;
84 talloc_steal(sasl_mechs, sasl_name);
85 sasl_mechs[j+1] = NULL;
90 ldb_set_opaque(conn->ldb, "supportedSASLMechanims", sasl_mechs);
96 struct ldapsrv_reply *ldapsrv_init_reply(struct ldapsrv_call *call, uint8_t type)
98 struct ldapsrv_reply *reply;
100 reply = talloc(call, struct ldapsrv_reply);
104 reply->msg = talloc(reply, struct ldap_message);
105 if (reply->msg == NULL) {
110 reply->msg->messageid = call->request->messageid;
111 reply->msg->type = type;
112 reply->msg->controls = NULL;
117 void ldapsrv_queue_reply(struct ldapsrv_call *call, struct ldapsrv_reply *reply)
119 DLIST_ADD_END(call->replies, reply, struct ldapsrv_reply *);
122 static NTSTATUS ldapsrv_unwilling(struct ldapsrv_call *call, int error)
124 struct ldapsrv_reply *reply;
125 struct ldap_ExtendedResponse *r;
127 DEBUG(10,("Unwilling type[%d] id[%d]\n", call->request->type, call->request->messageid));
129 reply = ldapsrv_init_reply(call, LDAP_TAG_ExtendedResponse);
131 return NT_STATUS_NO_MEMORY;
134 r = &reply->msg->r.ExtendedResponse;
135 r->response.resultcode = error;
136 r->response.dn = NULL;
137 r->response.errormessage = NULL;
138 r->response.referral = NULL;
142 ldapsrv_queue_reply(call, reply);
146 static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
148 struct ldap_SearchRequest *req = &call->request->r.SearchRequest;
149 struct ldap_SearchResEntry *ent;
150 struct ldap_Result *done;
151 struct ldapsrv_reply *ent_r, *done_r;
153 struct ldb_context *samdb = talloc_get_type(call->conn->ldb, struct ldb_context);
154 struct ldb_dn *basedn;
155 struct ldb_result *res = NULL;
156 struct ldb_request *lreq;
157 enum ldb_scope scope = LDB_SCOPE_DEFAULT;
158 const char **attrs = NULL;
159 const char *scope_str, *errstr = NULL;
160 int success_limit = 1;
165 DEBUG(10, ("SearchRequest"));
166 DEBUGADD(10, (" basedn: %s", req->basedn));
167 DEBUGADD(10, (" filter: %s\n", ldb_filter_from_tree(call, req->tree)));
169 local_ctx = talloc_new(call);
170 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
172 basedn = ldb_dn_new(local_ctx, samdb, req->basedn);
173 VALID_DN_SYNTAX(basedn, 0);
175 DEBUG(10, ("SearchRequest: basedn: [%s]\n", req->basedn));
176 DEBUG(10, ("SearchRequest: filter: [%s]\n", ldb_filter_from_tree(call, req->tree)));
178 switch (req->scope) {
179 case LDAP_SEARCH_SCOPE_BASE:
181 scope = LDB_SCOPE_BASE;
184 case LDAP_SEARCH_SCOPE_SINGLE:
186 scope = LDB_SCOPE_ONELEVEL;
189 case LDAP_SEARCH_SCOPE_SUB:
191 scope = LDB_SCOPE_SUBTREE;
195 result = LDAP_PROTOCOL_ERROR;
196 errstr = "Invalid scope";
199 DEBUG(10,("SearchRequest: scope: [%s]\n", scope_str));
201 if (req->num_attributes >= 1) {
202 attrs = talloc_array(local_ctx, const char *, req->num_attributes+1);
203 NT_STATUS_HAVE_NO_MEMORY(attrs);
205 for (i=0; i < req->num_attributes; i++) {
206 DEBUG(10,("SearchRequest: attrs: [%s]\n",req->attributes[i]));
207 attrs[i] = req->attributes[i];
212 DEBUG(5,("ldb_request %s dn=%s filter=%s\n",
213 scope_str, req->basedn, ldb_filter_from_tree(call, req->tree)));
215 lreq = talloc(local_ctx, struct ldb_request);
216 NT_STATUS_HAVE_NO_MEMORY(lreq);
218 res = talloc_zero(local_ctx, struct ldb_result);
219 NT_STATUS_HAVE_NO_MEMORY(res);
221 lreq->operation = LDB_SEARCH;
222 lreq->op.search.base = basedn;
223 lreq->op.search.scope = scope;
224 lreq->op.search.tree = req->tree;
225 lreq->op.search.attrs = attrs;
227 lreq->controls = call->request->controls;
229 if (call->conn->global_catalog) {
230 struct ldb_control *search_control = ldb_request_get_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID);
232 struct ldb_search_options_control *search_options = NULL;
233 if (search_control) {
234 search_options = talloc_get_type(search_control->data, struct ldb_search_options_control);
235 search_options->search_options |= LDB_SEARCH_OPTION_PHANTOM_ROOT;
237 search_options = talloc(lreq, struct ldb_search_options_control);
238 NT_STATUS_HAVE_NO_MEMORY(search_options);
239 search_options->search_options = LDB_SEARCH_OPTION_PHANTOM_ROOT;
240 ldb_request_add_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID, false, search_options);
245 lreq->callback = ldb_search_default_callback;
247 /* Copy the timeout from the incoming call */
248 ldb_set_timeout(samdb, lreq, req->timelimit);
250 ldb_ret = ldb_request(samdb, lreq);
252 if (ldb_ret != LDB_SUCCESS) {
256 ldb_ret = ldb_wait(lreq->handle, LDB_WAIT_ALL);
258 if (ldb_ret == LDB_SUCCESS) {
259 for (i = 0; i < res->count; i++) {
260 ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry);
261 NT_STATUS_HAVE_NO_MEMORY(ent_r);
263 ent = &ent_r->msg->r.SearchResultEntry;
264 ent->dn = ldb_dn_alloc_linearized(ent_r, res->msgs[i]->dn);
265 ent->num_attributes = 0;
266 ent->attributes = NULL;
267 if (res->msgs[i]->num_elements == 0) {
270 ent->num_attributes = res->msgs[i]->num_elements;
271 ent->attributes = talloc_array(ent_r, struct ldb_message_element, ent->num_attributes);
272 NT_STATUS_HAVE_NO_MEMORY(ent->attributes);
273 for (j=0; j < ent->num_attributes; j++) {
274 ent->attributes[j].name = talloc_steal(ent->attributes, res->msgs[i]->elements[j].name);
275 ent->attributes[j].num_values = 0;
276 ent->attributes[j].values = NULL;
277 if (req->attributesonly && (res->msgs[i]->elements[j].num_values == 0)) {
280 ent->attributes[j].num_values = res->msgs[i]->elements[j].num_values;
281 ent->attributes[j].values = res->msgs[i]->elements[j].values;
282 talloc_steal(ent->attributes, res->msgs[i]->elements[j].values);
285 ldapsrv_queue_reply(call, ent_r);
290 done_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultDone);
291 NT_STATUS_HAVE_NO_MEMORY(done_r);
293 done = &done_r->msg->r.SearchResultDone;
295 done->referral = NULL;
298 } else if (ldb_ret == LDB_SUCCESS) {
299 if (res->count >= success_limit) {
300 DEBUG(10,("SearchRequest: results: [%d]\n", res->count));
301 result = LDAP_SUCCESS;
305 done_r->msg->controls = res->controls;
306 talloc_steal(done_r, res->controls);
309 DEBUG(10,("SearchRequest: error\n"));
310 result = map_ldb_error(samdb, ldb_ret, &errstr);
313 done->resultcode = result;
314 done->errormessage = (errstr?talloc_strdup(done_r, errstr):NULL);
316 talloc_free(local_ctx);
318 ldapsrv_queue_reply(call, done_r);
322 static NTSTATUS ldapsrv_ModifyRequest(struct ldapsrv_call *call)
324 struct ldap_ModifyRequest *req = &call->request->r.ModifyRequest;
325 struct ldap_Result *modify_result;
326 struct ldapsrv_reply *modify_reply;
328 struct ldb_context *samdb = call->conn->ldb;
329 struct ldb_message *msg = NULL;
331 const char *errstr = NULL;
332 int result = LDAP_SUCCESS;
336 DEBUG(10, ("ModifyRequest"));
337 DEBUGADD(10, (" dn: %s", req->dn));
339 local_ctx = talloc_named(call, 0, "ModifyRequest local memory context");
340 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
342 dn = ldb_dn_new(local_ctx, samdb, req->dn);
343 VALID_DN_SYNTAX(dn, 1);
345 DEBUG(10, ("ModifyRequest: dn: [%s]\n", req->dn));
347 msg = talloc(local_ctx, struct ldb_message);
348 NT_STATUS_HAVE_NO_MEMORY(msg);
351 msg->num_elements = 0;
352 msg->elements = NULL;
354 if (req->num_mods > 0) {
355 msg->num_elements = req->num_mods;
356 msg->elements = talloc_array(msg, struct ldb_message_element, req->num_mods);
357 NT_STATUS_HAVE_NO_MEMORY(msg->elements);
359 for (i=0; i < msg->num_elements; i++) {
360 msg->elements[i].name = discard_const_p(char, req->mods[i].attrib.name);
361 msg->elements[i].num_values = 0;
362 msg->elements[i].values = NULL;
364 switch (req->mods[i].type) {
366 result = LDAP_PROTOCOL_ERROR;
367 errstr = "Invalid LDAP_MODIFY_* type";
369 case LDAP_MODIFY_ADD:
370 msg->elements[i].flags = LDB_FLAG_MOD_ADD;
372 case LDAP_MODIFY_DELETE:
373 msg->elements[i].flags = LDB_FLAG_MOD_DELETE;
375 case LDAP_MODIFY_REPLACE:
376 msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
380 msg->elements[i].num_values = req->mods[i].attrib.num_values;
381 if (msg->elements[i].num_values > 0) {
382 msg->elements[i].values = talloc_array(msg->elements, struct ldb_val,
383 msg->elements[i].num_values);
384 NT_STATUS_HAVE_NO_MEMORY(msg->elements[i].values);
386 for (j=0; j < msg->elements[i].num_values; j++) {
387 if (!(req->mods[i].attrib.values[j].length > 0)) {
389 errstr = "Empty attribute values are not allowed";
392 msg->elements[i].values[j].length = req->mods[i].attrib.values[j].length;
393 msg->elements[i].values[j].data = req->mods[i].attrib.values[j].data;
399 errstr = "No mods are not allowed";
404 modify_reply = ldapsrv_init_reply(call, LDAP_TAG_ModifyResponse);
405 NT_STATUS_HAVE_NO_MEMORY(modify_reply);
407 if (result == LDAP_SUCCESS) {
408 ldb_ret = ldb_modify(samdb, msg);
409 result = map_ldb_error(samdb, ldb_ret, &errstr);
412 modify_result = &modify_reply->msg->r.AddResponse;
413 modify_result->dn = NULL;
414 modify_result->resultcode = result;
415 modify_result->errormessage = (errstr?talloc_strdup(modify_reply, errstr):NULL);
416 modify_result->referral = NULL;
418 talloc_free(local_ctx);
420 ldapsrv_queue_reply(call, modify_reply);
425 static NTSTATUS ldapsrv_AddRequest(struct ldapsrv_call *call)
427 struct ldap_AddRequest *req = &call->request->r.AddRequest;
428 struct ldap_Result *add_result;
429 struct ldapsrv_reply *add_reply;
431 struct ldb_context *samdb = call->conn->ldb;
432 struct ldb_message *msg = NULL;
434 const char *errstr = NULL;
435 int result = LDAP_SUCCESS;
439 DEBUG(10, ("AddRequest"));
440 DEBUGADD(10, (" dn: %s", req->dn));
442 local_ctx = talloc_named(call, 0, "AddRequest local memory context");
443 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
445 dn = ldb_dn_new(local_ctx, samdb, req->dn);
446 VALID_DN_SYNTAX(dn,1);
448 DEBUG(10, ("AddRequest: dn: [%s]\n", req->dn));
450 msg = talloc(local_ctx, struct ldb_message);
451 NT_STATUS_HAVE_NO_MEMORY(msg);
454 msg->num_elements = 0;
455 msg->elements = NULL;
457 if (req->num_attributes > 0) {
458 msg->num_elements = req->num_attributes;
459 msg->elements = talloc_array(msg, struct ldb_message_element, msg->num_elements);
460 NT_STATUS_HAVE_NO_MEMORY(msg->elements);
462 for (i=0; i < msg->num_elements; i++) {
463 msg->elements[i].name = discard_const_p(char, req->attributes[i].name);
464 msg->elements[i].flags = 0;
465 msg->elements[i].num_values = 0;
466 msg->elements[i].values = NULL;
468 if (req->attributes[i].num_values > 0) {
469 msg->elements[i].num_values = req->attributes[i].num_values;
470 msg->elements[i].values = talloc_array(msg->elements, struct ldb_val,
471 msg->elements[i].num_values);
472 NT_STATUS_HAVE_NO_MEMORY(msg->elements[i].values);
474 for (j=0; j < msg->elements[i].num_values; j++) {
475 if (!(req->attributes[i].values[j].length > 0)) {
477 errstr = "Empty attribute values are not allowed";
480 msg->elements[i].values[j].length = req->attributes[i].values[j].length;
481 msg->elements[i].values[j].data = req->attributes[i].values[j].data;
485 errstr = "No attribute values are not allowed";
491 errstr = "No attributes are not allowed";
496 add_reply = ldapsrv_init_reply(call, LDAP_TAG_AddResponse);
497 NT_STATUS_HAVE_NO_MEMORY(add_reply);
499 if (result == LDAP_SUCCESS) {
500 ldb_ret = ldb_add(samdb, msg);
501 result = map_ldb_error(samdb, ldb_ret, &errstr);
504 add_result = &add_reply->msg->r.AddResponse;
505 add_result->dn = NULL;
506 add_result->resultcode = result;
507 add_result->errormessage = (errstr?talloc_strdup(add_reply,errstr):NULL);
508 add_result->referral = NULL;
510 talloc_free(local_ctx);
512 ldapsrv_queue_reply(call, add_reply);
517 static NTSTATUS ldapsrv_DelRequest(struct ldapsrv_call *call)
519 struct ldap_DelRequest *req = &call->request->r.DelRequest;
520 struct ldap_Result *del_result;
521 struct ldapsrv_reply *del_reply;
523 struct ldb_context *samdb = call->conn->ldb;
525 const char *errstr = NULL;
526 int result = LDAP_SUCCESS;
529 DEBUG(10, ("DelRequest"));
530 DEBUGADD(10, (" dn: %s", req->dn));
532 local_ctx = talloc_named(call, 0, "DelRequest local memory context");
533 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
535 dn = ldb_dn_new(local_ctx, samdb, req->dn);
536 VALID_DN_SYNTAX(dn,1);
538 DEBUG(10, ("DelRequest: dn: [%s]\n", req->dn));
541 del_reply = ldapsrv_init_reply(call, LDAP_TAG_DelResponse);
542 NT_STATUS_HAVE_NO_MEMORY(del_reply);
544 if (result == LDAP_SUCCESS) {
545 ldb_ret = ldb_delete(samdb, dn);
546 result = map_ldb_error(samdb, ldb_ret, &errstr);
549 del_result = &del_reply->msg->r.DelResponse;
550 del_result->dn = NULL;
551 del_result->resultcode = result;
552 del_result->errormessage = (errstr?talloc_strdup(del_reply,errstr):NULL);
553 del_result->referral = NULL;
555 talloc_free(local_ctx);
557 ldapsrv_queue_reply(call, del_reply);
561 static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call)
563 struct ldap_ModifyDNRequest *req = &call->request->r.ModifyDNRequest;
564 struct ldap_Result *modifydn;
565 struct ldapsrv_reply *modifydn_r;
567 struct ldb_context *samdb = call->conn->ldb;
568 struct ldb_dn *olddn, *newdn=NULL, *newrdn;
569 struct ldb_dn *parentdn = NULL;
570 const char *errstr = NULL;
571 int result = LDAP_SUCCESS;
574 DEBUG(10, ("ModifyDNRequrest"));
575 DEBUGADD(10, (" dn: %s", req->dn));
576 DEBUGADD(10, (" newrdn: %s", req->newrdn));
578 local_ctx = talloc_named(call, 0, "ModifyDNRequest local memory context");
579 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
581 olddn = ldb_dn_new(local_ctx, samdb, req->dn);
582 VALID_DN_SYNTAX(olddn, 2);
584 newrdn = ldb_dn_new(local_ctx, samdb, req->newrdn);
585 VALID_DN_SYNTAX(newrdn, 1);
587 DEBUG(10, ("ModifyDNRequest: olddn: [%s]\n", req->dn));
588 DEBUG(10, ("ModifyDNRequest: newrdn: [%s]\n", req->newrdn));
590 /* we can't handle the rename if we should not remove the old dn */
591 if (!req->deleteolddn) {
592 result = LDAP_UNWILLING_TO_PERFORM;
593 errstr = "Old RDN must be deleted";
597 if (req->newsuperior) {
598 parentdn = ldb_dn_new(local_ctx, samdb, req->newsuperior);
599 VALID_DN_SYNTAX(parentdn, 0);
600 DEBUG(10, ("ModifyDNRequest: newsuperior: [%s]\n", req->newsuperior));
602 if (ldb_dn_get_comp_num(parentdn) < 1) {
603 result = LDAP_AFFECTS_MULTIPLE_DSAS;
604 errstr = "Error new Superior DN invalid";
610 parentdn = ldb_dn_get_parent(local_ctx, olddn);
611 NT_STATUS_HAVE_NO_MEMORY(parentdn);
614 if ( ! ldb_dn_add_child_fmt(parentdn,
616 ldb_dn_get_rdn_name(newrdn),
617 (char *)ldb_dn_get_rdn_val(newrdn)->data)) {
624 modifydn_r = ldapsrv_init_reply(call, LDAP_TAG_ModifyDNResponse);
625 NT_STATUS_HAVE_NO_MEMORY(modifydn_r);
627 if (result == LDAP_SUCCESS) {
628 ldb_ret = ldb_rename(samdb, olddn, newdn);
629 result = map_ldb_error(samdb, ldb_ret, &errstr);
632 modifydn = &modifydn_r->msg->r.ModifyDNResponse;
634 modifydn->resultcode = result;
635 modifydn->errormessage = (errstr?talloc_strdup(modifydn_r,errstr):NULL);
636 modifydn->referral = NULL;
638 talloc_free(local_ctx);
640 ldapsrv_queue_reply(call, modifydn_r);
644 static NTSTATUS ldapsrv_CompareRequest(struct ldapsrv_call *call)
646 struct ldap_CompareRequest *req = &call->request->r.CompareRequest;
647 struct ldap_Result *compare;
648 struct ldapsrv_reply *compare_r;
650 struct ldb_context *samdb = call->conn->ldb;
651 struct ldb_result *res = NULL;
653 const char *attrs[1];
654 const char *errstr = NULL;
655 const char *filter = NULL;
656 int result = LDAP_SUCCESS;
659 DEBUG(10, ("CompareRequest"));
660 DEBUGADD(10, (" dn: %s", req->dn));
662 local_ctx = talloc_named(call, 0, "CompareRequest local_memory_context");
663 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
665 dn = ldb_dn_new(local_ctx, samdb, req->dn);
666 VALID_DN_SYNTAX(dn, 1);
668 DEBUG(10, ("CompareRequest: dn: [%s]\n", req->dn));
669 filter = talloc_asprintf(local_ctx, "(%s=%*s)", req->attribute,
670 (int)req->value.length, req->value.data);
671 NT_STATUS_HAVE_NO_MEMORY(filter);
673 DEBUGADD(10, ("CompareRequest: attribute: [%s]\n", filter));
678 compare_r = ldapsrv_init_reply(call, LDAP_TAG_CompareResponse);
679 NT_STATUS_HAVE_NO_MEMORY(compare_r);
681 if (result == LDAP_SUCCESS) {
682 ldb_ret = ldb_search(samdb, dn, LDB_SCOPE_BASE, filter, attrs, &res);
683 talloc_steal(local_ctx, res);
684 if (ldb_ret != LDB_SUCCESS) {
685 result = map_ldb_error(samdb, ldb_ret, &errstr);
686 DEBUG(10,("CompareRequest: error: %s\n", errstr));
687 } else if (res->count == 0) {
688 DEBUG(10,("CompareRequest: doesn't matched\n"));
689 result = LDAP_COMPARE_FALSE;
691 } else if (res->count == 1) {
692 DEBUG(10,("CompareRequest: matched\n"));
693 result = LDAP_COMPARE_TRUE;
695 } else if (res->count > 1) {
697 errstr = "too many objects match";
698 DEBUG(10,("CompareRequest: %d results: %s\n", res->count, errstr));
702 compare = &compare_r->msg->r.CompareResponse;
704 compare->resultcode = result;
705 compare->errormessage = (errstr?talloc_strdup(compare_r,errstr):NULL);
706 compare->referral = NULL;
708 talloc_free(local_ctx);
710 ldapsrv_queue_reply(call, compare_r);
714 static NTSTATUS ldapsrv_AbandonRequest(struct ldapsrv_call *call)
716 /* struct ldap_AbandonRequest *req = &call->request.r.AbandonRequest;*/
717 DEBUG(10, ("AbandonRequest\n"));
721 NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
724 struct ldap_message *msg = call->request;
725 /* Check for undecoded critical extensions */
726 for (i=0; msg->controls && msg->controls[i]; i++) {
727 if (!msg->controls_decoded[i] &&
728 msg->controls[i]->critical) {
729 DEBUG(3, ("ldapsrv_do_call: Critical extension %s is not known to this server\n",
730 msg->controls[i]->oid));
731 return ldapsrv_unwilling(call, LDAP_UNAVAILABLE_CRITICAL_EXTENSION);
735 switch(call->request->type) {
736 case LDAP_TAG_BindRequest:
737 return ldapsrv_BindRequest(call);
738 case LDAP_TAG_UnbindRequest:
739 return ldapsrv_UnbindRequest(call);
740 case LDAP_TAG_SearchRequest:
741 return ldapsrv_SearchRequest(call);
742 case LDAP_TAG_ModifyRequest:
743 return ldapsrv_ModifyRequest(call);
744 case LDAP_TAG_AddRequest:
745 return ldapsrv_AddRequest(call);
746 case LDAP_TAG_DelRequest:
747 return ldapsrv_DelRequest(call);
748 case LDAP_TAG_ModifyDNRequest:
749 return ldapsrv_ModifyDNRequest(call);
750 case LDAP_TAG_CompareRequest:
751 return ldapsrv_CompareRequest(call);
752 case LDAP_TAG_AbandonRequest:
753 return ldapsrv_AbandonRequest(call);
754 case LDAP_TAG_ExtendedRequest:
755 return ldapsrv_ExtendedRequest(call);
757 return ldapsrv_unwilling(call, 2);