diff options
author | Simo Sorce <idra@samba.org> | 2006-02-22 01:31:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:51:59 -0500 |
commit | 00fe70e5b917769418f68eaa255d3a06a9a08ce7 (patch) | |
tree | 7fe1d0d71e1771a3365a5dfda3ec4058b1bb2de1 /source4/ldap_server | |
parent | f490434c0f1f8e63de478c6d65f264277257968a (diff) | |
download | samba-00fe70e5b917769418f68eaa255d3a06a9a08ce7.tar.gz samba-00fe70e5b917769418f68eaa255d3a06a9a08ce7.tar.bz2 samba-00fe70e5b917769418f68eaa255d3a06a9a08ce7.zip |
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)
Diffstat (limited to 'source4/ldap_server')
-rw-r--r-- | source4/ldap_server/ldap_backend.c | 49 |
1 files changed, 2 insertions, 47 deletions
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 @@ -45,44 +45,6 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin } /* - 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 */ NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn) @@ -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 { |