From 00fe70e5b917769418f68eaa255d3a06a9a08ce7 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 22 Feb 2006 01:31:35 +0000 Subject: r13609: Get in the initial work on making ldb async Currently only ldb_ildap is async, the plan is to first make all backend support the async calls, and then remove the sync functions from backends and keep the only in the API. Modules will need to be transformed along the way. Simo (This used to be commit 1e2c13b2d52de7c534493dd79a2c0596a3e8c1f5) --- source4/ldap_server/ldap_backend.c | 49 ++------------------------------------ 1 file changed, 2 insertions(+), 47 deletions(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 1399ac18e4..713d99a2ea 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -44,44 +44,6 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin return err; } -/* - map controls -*/ -static int get_ldb_controls(void *mem_ctx, struct ldap_Control **controls, struct ldb_control ***lcontrols) -{ - struct ldb_control **lctrl; - int i, l; - - if (controls == NULL || controls[0] == NULL) { - *lcontrols = NULL; - return LDB_SUCCESS; - } - - l = 0; - lctrl = NULL; - *lcontrols = NULL; - - for (i = 0; controls[i] != NULL; i++) { - lctrl = talloc_realloc(mem_ctx, lctrl, struct ldb_control *, l + 2); - if (lctrl == NULL) { - return LDB_ERR_OTHER; - } - lctrl[l] = talloc(lctrl, struct ldb_control); - if (lctrl[l] == NULL) { - return LDB_ERR_OTHER; - } - lctrl[l]->oid = controls[i]->oid; - lctrl[l]->critical = controls[i]->critical; - lctrl[l]->data = controls[i]->value; - l++; - } - lctrl[l] = NULL; - - *lcontrols = lctrl; - - return LDB_SUCCESS; -} - /* connect to the sam database */ @@ -217,14 +179,7 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) lreq.op.search.tree = req->tree; lreq.op.search.attrs = attrs; - ldb_ret = get_ldb_controls(local_ctx, call->request->controls, &lreq.controls); - - if (ldb_ret != LDB_SUCCESS) { - /* get_ldb_controls fails only on a critical internal error or when - * a control is defined as critical but it is not supported - */ - goto reply; - } + lreq.controls = call->request->controls; ldb_ret = ldb_request(samdb, &lreq); @@ -281,7 +236,7 @@ reply: errstr = ldb_errstring(samdb); } if (res->controls) { - done_r->msg->controls = (struct ldap_Control **)(res->controls); + done_r->msg->controls = res->controls; talloc_steal(done_r, res->controls); } } else { -- cgit