diff options
author | Simo Sorce <idra@samba.org> | 2006-07-22 16:56:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:10:16 -0500 |
commit | c93817b36d3ff7f44cb7b3e1d1a29e37ec12affe (patch) | |
tree | 70d3018287cbbe9ceee3cae3ab66ce33f32559aa /source4/lib/ldb/modules | |
parent | 550f5fb26e67f46eead182476f7a9bcfd1ac5dc0 (diff) | |
download | samba-c93817b36d3ff7f44cb7b3e1d1a29e37ec12affe.tar.gz samba-c93817b36d3ff7f44cb7b3e1d1a29e37ec12affe.tar.bz2 samba-c93817b36d3ff7f44cb7b3e1d1a29e37ec12affe.zip |
r17185: Oh, I wanted to do this for sooo long time.
Finally acknowledge that ldb is inherently async and does not have a dual personality anymore
Rename all ldb_async_XXX functions to ldb_XXX except for ldb_async_result, it is now ldb_reply
to reflect the real function of this structure.
Simo.
(This used to be commit 25fc7354049d62efeba17681ef1cdd326bc3f2ef)
Diffstat (limited to 'source4/lib/ldb/modules')
-rw-r--r-- | source4/lib/ldb/modules/asq.c | 76 | ||||
-rw-r--r-- | source4/lib/ldb/modules/objectclass.c | 62 | ||||
-rw-r--r-- | source4/lib/ldb/modules/operational.c | 4 | ||||
-rw-r--r-- | source4/lib/ldb/modules/paged_results.c | 56 | ||||
-rw-r--r-- | source4/lib/ldb/modules/rdn_name.c | 38 | ||||
-rw-r--r-- | source4/lib/ldb/modules/sort.c | 58 |
6 files changed, 147 insertions, 147 deletions
diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c index 2c0baa6827..466286e8cd 100644 --- a/source4/lib/ldb/modules/asq.c +++ b/source4/lib/ldb/modules/asq.c @@ -41,20 +41,20 @@ #define ASQ_CTRL_UNWILLING_TO_PERFORM 53 #define ASQ_CTRL_AFFECTS_MULTIPLE_DSA 71 -struct asq_async_context { +struct asq_context { enum {ASQ_SEARCH_BASE, ASQ_SEARCH_MULTI} step; struct ldb_module *module; void *up_context; - int (*up_callback)(struct ldb_context *, void *, struct ldb_async_result *); + int (*up_callback)(struct ldb_context *, void *, struct ldb_reply *); const char * const *req_attrs; char *req_attribute; int asq_ret; struct ldb_request *base_req; - struct ldb_async_result *base_res; + struct ldb_reply *base_res; struct ldb_request **reqs; int num_reqs; @@ -63,14 +63,14 @@ struct asq_async_context { struct ldb_control **controls; }; -static struct ldb_async_handle *init_handle(void *mem_ctx, struct ldb_module *module, +static struct ldb_handle *init_handle(void *mem_ctx, struct ldb_module *module, void *context, - int (*callback)(struct ldb_context *, void *, struct ldb_async_result *)) + int (*callback)(struct ldb_context *, void *, struct ldb_reply *)) { - struct asq_async_context *ac; - struct ldb_async_handle *h; + struct asq_context *ac; + struct ldb_handle *h; - h = talloc_zero(mem_ctx, struct ldb_async_handle); + h = talloc_zero(mem_ctx, struct ldb_handle); if (h == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); return NULL; @@ -78,7 +78,7 @@ static struct ldb_async_handle *init_handle(void *mem_ctx, struct ldb_module *mo h->module = module; - ac = talloc_zero(h, struct asq_async_context); + ac = talloc_zero(h, struct asq_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); talloc_free(h); @@ -97,19 +97,19 @@ static struct ldb_async_handle *init_handle(void *mem_ctx, struct ldb_module *mo return h; } -static int asq_terminate(struct ldb_async_handle *handle) +static int asq_terminate(struct ldb_handle *handle) { - struct asq_async_context *ac; - struct ldb_async_result *ares; + struct asq_context *ac; + struct ldb_reply *ares; struct ldb_asq_control *asq; int i; - ac = talloc_get_type(handle->private_data, struct asq_async_context); + ac = talloc_get_type(handle->private_data, struct asq_context); handle->status = LDB_SUCCESS; handle->state = LDB_ASYNC_DONE; - ares = talloc_zero(ac, struct ldb_async_result); + ares = talloc_zero(ac, struct ldb_reply); if (ares == NULL) return LDB_ERR_OPERATIONS_ERROR; @@ -149,16 +149,16 @@ static int asq_terminate(struct ldb_async_handle *handle) return LDB_SUCCESS; } -static int asq_base_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int asq_base_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct asq_async_context *ac; + struct asq_context *ac; if (!context || !ares) { ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context or Result in callback")); goto error; } - ac = talloc_get_type(context, struct asq_async_context); + ac = talloc_get_type(context, struct asq_context); /* we are interested only in the single reply (base search) we receive here */ if (ares->type == LDB_REPLY_ENTRY) { @@ -173,16 +173,16 @@ error: return LDB_ERR_OPERATIONS_ERROR; } -static int asq_reqs_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int asq_reqs_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct asq_async_context *ac; + struct asq_context *ac; if (!context || !ares) { ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context or Result in callback")); goto error; } - ac = talloc_get_type(context, struct asq_async_context); + ac = talloc_get_type(context, struct asq_context); /* we are interested only in the single reply (base search) we receive here */ if (ares->type == LDB_REPLY_ENTRY) { @@ -205,8 +205,8 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req) { struct ldb_control *control; struct ldb_asq_control *asq_ctrl; - struct asq_async_context *ac; - struct ldb_async_handle *h; + struct asq_context *ac; + struct ldb_handle *h; char **base_attrs; int ret; @@ -234,7 +234,7 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req) if (!h) { return LDB_ERR_OPERATIONS_ERROR; } - ac = talloc_get_type(h->private_data, struct asq_async_context); + ac = talloc_get_type(h->private_data, struct asq_context); req->async.handle = h; @@ -281,12 +281,12 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req) return LDB_SUCCESS; } -static int asq_async_requests(struct ldb_async_handle *handle) { - struct asq_async_context *ac; +static int asq_requests(struct ldb_handle *handle) { + struct asq_context *ac; struct ldb_message_element *el; int i; - ac = talloc_get_type(handle->private_data, struct asq_async_context); + ac = talloc_get_type(handle->private_data, struct asq_context); /* look up the DNs */ el = ldb_msg_find_element(ac->base_res->message, ac->req_attribute); @@ -329,9 +329,9 @@ static int asq_async_requests(struct ldb_async_handle *handle) { return LDB_SUCCESS; } -static int asq_async_wait_none(struct ldb_async_handle *handle) +static int asq_wait_none(struct ldb_handle *handle) { - struct asq_async_context *ac; + struct asq_context *ac; int ret; if (!handle || !handle->private_data) { @@ -345,12 +345,12 @@ static int asq_async_wait_none(struct ldb_async_handle *handle) handle->state = LDB_ASYNC_PENDING; handle->status = LDB_SUCCESS; - ac = talloc_get_type(handle->private_data, struct asq_async_context); + ac = talloc_get_type(handle->private_data, struct asq_context); switch (ac->step) { case ASQ_SEARCH_BASE: - ret = ldb_async_wait(ac->base_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->base_req->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -365,7 +365,7 @@ static int asq_async_wait_none(struct ldb_async_handle *handle) return LDB_SUCCESS; } - ret = asq_async_requests(handle); + ret = asq_requests(handle); case ASQ_SEARCH_MULTI: @@ -376,7 +376,7 @@ static int asq_async_wait_none(struct ldb_async_handle *handle) } } - ret = ldb_async_wait(ac->reqs[ac->cur_req]->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->reqs[ac->cur_req]->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -408,12 +408,12 @@ done: return ret; } -static int asq_async_wait_all(struct ldb_async_handle *handle) +static int asq_wait_all(struct ldb_handle *handle) { int ret; while (handle->state != LDB_ASYNC_DONE) { - ret = asq_async_wait_none(handle); + ret = asq_wait_none(handle); if (ret != LDB_SUCCESS) { return ret; } @@ -422,12 +422,12 @@ static int asq_async_wait_all(struct ldb_async_handle *handle) return handle->status; } -static int asq_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int asq_wait(struct ldb_handle *handle, enum ldb_wait_type type) { if (type == LDB_WAIT_ALL) { - return asq_async_wait_all(handle); + return asq_wait_all(handle); } else { - return asq_async_wait_none(handle); + return asq_wait_none(handle); } } @@ -458,7 +458,7 @@ static int asq_init(struct ldb_module *module) static const struct ldb_module_ops asq_ops = { .name = "asq", .search = asq_search, - .async_wait = asq_async_wait, + .wait = asq_wait, .init_context = asq_init }; diff --git a/source4/lib/ldb/modules/objectclass.c b/source4/lib/ldb/modules/objectclass.c index eaa3f4472b..03ff58e994 100644 --- a/source4/lib/ldb/modules/objectclass.c +++ b/source4/lib/ldb/modules/objectclass.c @@ -36,7 +36,7 @@ #include "includes.h" #include "ldb/include/includes.h" -struct oc_async_context { +struct oc_context { enum oc_step {OC_DO_REQ, OC_SEARCH_SELF, OC_DO_MOD} step; @@ -46,7 +46,7 @@ struct oc_async_context { struct ldb_request *down_req; struct ldb_request *search_req; - struct ldb_async_result *search_res; + struct ldb_reply *search_res; struct ldb_request *mod_req; }; @@ -56,12 +56,12 @@ struct class_list { const char *objectclass; }; -static struct ldb_async_handle *oc_init_handle(struct ldb_request *req, struct ldb_module *module) +static struct ldb_handle *oc_init_handle(struct ldb_request *req, struct ldb_module *module) { - struct oc_async_context *ac; - struct ldb_async_handle *h; + struct oc_context *ac; + struct ldb_handle *h; - h = talloc_zero(req, struct ldb_async_handle); + h = talloc_zero(req, struct ldb_handle); if (h == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); return NULL; @@ -69,7 +69,7 @@ static struct ldb_async_handle *oc_init_handle(struct ldb_request *req, struct l h->module = module; - ac = talloc_zero(h, struct oc_async_context); + ac = talloc_zero(h, struct oc_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); talloc_free(h); @@ -389,14 +389,14 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req } { - struct ldb_async_handle *h; - struct oc_async_context *ac; + struct ldb_handle *h; + struct oc_context *ac; h = oc_init_handle(req, module); if (!h) { return LDB_ERR_OPERATIONS_ERROR; } - ac = talloc_get_type(h->private_data, struct oc_async_context); + ac = talloc_get_type(h->private_data, struct oc_context); /* return or own handle to deal with this call */ req->async.handle = h; @@ -420,16 +420,16 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req } } -static int get_self_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int get_self_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct oc_async_context *ac; + struct oc_context *ac; if (!context || !ares) { ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context or Result in callback")); return LDB_ERR_OPERATIONS_ERROR; } - ac = talloc_get_type(context, struct oc_async_context); + ac = talloc_get_type(context, struct oc_context); /* we are interested only in the single reply (base search) we receive here */ if (ares->type == LDB_REPLY_ENTRY) { @@ -447,12 +447,12 @@ static int get_self_callback(struct ldb_context *ldb, void *context, struct ldb_ return LDB_SUCCESS; } -static int objectclass_search_self(struct ldb_async_handle *h) { +static int objectclass_search_self(struct ldb_handle *h) { - struct oc_async_context *ac; + struct oc_context *ac; static const char * const attrs[] = { "objectClass", NULL }; - ac = talloc_get_type(h->private_data, struct oc_async_context); + ac = talloc_get_type(h->private_data, struct oc_context); /* prepare the search operation */ ac->search_req = talloc_zero(ac, struct ldb_request); @@ -480,16 +480,16 @@ static int objectclass_search_self(struct ldb_async_handle *h) { return ldb_next_request(ac->module, ac->search_req); } -static int objectclass_do_mod(struct ldb_async_handle *h) { +static int objectclass_do_mod(struct ldb_handle *h) { - struct oc_async_context *ac; + struct oc_context *ac; struct ldb_message_element *objectclass_element; struct ldb_message *msg; TALLOC_CTX *mem_ctx; struct class_list *sorted, *current; int ret; - ac = talloc_get_type(h->private_data, struct oc_async_context); + ac = talloc_get_type(h->private_data, struct oc_context); mem_ctx = talloc_new(ac); if (mem_ctx == NULL) { @@ -571,8 +571,8 @@ static int objectclass_do_mod(struct ldb_async_handle *h) { return ldb_next_request(ac->module, ac->mod_req); } -static int oc_async_wait(struct ldb_async_handle *handle) { - struct oc_async_context *ac; +static int oc_wait(struct ldb_handle *handle) { + struct oc_context *ac; int ret; if (!handle || !handle->private_data) { @@ -586,11 +586,11 @@ static int oc_async_wait(struct ldb_async_handle *handle) { handle->state = LDB_ASYNC_PENDING; handle->status = LDB_SUCCESS; - ac = talloc_get_type(handle->private_data, struct oc_async_context); + ac = talloc_get_type(handle->private_data, struct oc_context); switch (ac->step) { case OC_DO_REQ: - ret = ldb_async_wait(ac->down_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->down_req->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -609,7 +609,7 @@ static int oc_async_wait(struct ldb_async_handle *handle) { return objectclass_search_self(handle); case OC_SEARCH_SELF: - ret = ldb_async_wait(ac->search_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->search_req->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -628,7 +628,7 @@ static int oc_async_wait(struct ldb_async_handle *handle) { return objectclass_do_mod(handle); case OC_DO_MOD: - ret = ldb_async_wait(ac->mod_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->mod_req->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -657,12 +657,12 @@ done: return ret; } -static int oc_async_wait_all(struct ldb_async_handle *handle) { +static int oc_wait_all(struct ldb_handle *handle) { int ret; while (handle->state != LDB_ASYNC_DONE) { - ret = oc_async_wait(handle); + ret = oc_wait(handle); if (ret != LDB_SUCCESS) { return ret; } @@ -671,12 +671,12 @@ static int oc_async_wait_all(struct ldb_async_handle *handle) { return handle->status; } -static int objectclass_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int objectclass_wait(struct ldb_handle *handle, enum ldb_wait_type type) { if (type == LDB_WAIT_ALL) { - return oc_async_wait_all(handle); + return oc_wait_all(handle); } else { - return oc_async_wait(handle); + return oc_wait(handle); } } @@ -684,7 +684,7 @@ static const struct ldb_module_ops objectclass_ops = { .name = "objectclass", .add = objectclass_add, .modify = objectclass_modify, - .async_wait = objectclass_async_wait + .wait = objectclass_wait }; int ldb_objectclass_init(void) diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c index a15a553286..4cadaa27ee 100644 --- a/source4/lib/ldb/modules/operational.c +++ b/source4/lib/ldb/modules/operational.c @@ -230,12 +230,12 @@ struct operational_async_context { struct ldb_module *module; void *up_context; - int (*up_callback)(struct ldb_context *, void *, struct ldb_async_result *); + int (*up_callback)(struct ldb_context *, void *, struct ldb_reply *); const char * const *attrs; }; -static int operational_async_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int operational_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { struct operational_async_context *ac; diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index c5a1504fa5..3f2ff66b32 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -37,10 +37,10 @@ #include "ldb/include/includes.h" struct message_store { - /* keep the whole ldb_async_result as an optimization + /* keep the whole ldb_reply as an optimization * instead of freeing and talloc-ing the container * on each result */ - struct ldb_async_result *r; + struct ldb_reply *r; struct message_store *next; }; @@ -122,24 +122,24 @@ static struct results_store *new_store(struct private_data *priv) return new; } -struct paged_async_context { +struct paged_context { struct ldb_module *module; void *up_context; - int (*up_callback)(struct ldb_context *, void *, struct ldb_async_result *); + int (*up_callback)(struct ldb_context *, void *, struct ldb_reply *); int size; struct results_store *store; }; -static struct ldb_async_handle *init_handle(void *mem_ctx, struct ldb_module *module, +static struct ldb_handle *init_handle(void *mem_ctx, struct ldb_module *module, void *context, - int (*callback)(struct ldb_context *, void *, struct ldb_async_result *)) + int (*callback)(struct ldb_context *, void *, struct ldb_reply *)) { - struct paged_async_context *ac; - struct ldb_async_handle *h; + struct paged_context *ac; + struct ldb_handle *h; - h = talloc_zero(mem_ctx, struct ldb_async_handle); + h = talloc_zero(mem_ctx, struct ldb_handle); if (h == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); return NULL; @@ -147,7 +147,7 @@ static struct ldb_async_handle *init_handle(void *mem_ctx, struct ldb_module *mo h->module = module; - ac = talloc_zero(h, struct paged_async_context); + ac = talloc_zero(h, struct paged_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); talloc_free(h); @@ -166,16 +166,16 @@ static struct ldb_async_handle *init_handle(void *mem_ctx, struct ldb_module *mo return h; } -static int paged_search_async_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int paged_search_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct paged_async_context *ac = NULL; + struct paged_context *ac = NULL; if (!context || !ares) { ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context or Result in callback")); goto error; } - ac = talloc_get_type(context, struct paged_async_context); + ac = talloc_get_type(context, struct paged_context); if (ares->type == LDB_REPLY_ENTRY) { if (ac->store->first == NULL) { @@ -238,8 +238,8 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req) struct private_data *private_data; struct ldb_paged_control *paged_ctrl; struct ldb_control **saved_controls; - struct paged_async_context *ac; - struct ldb_async_handle *h; + struct paged_context *ac; + struct ldb_handle *h; int ret; /* check if there's a paged request control */ @@ -268,7 +268,7 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req) if (!h) { return LDB_ERR_OPERATIONS_ERROR; } - ac = talloc_get_type(h->private_data, struct paged_async_context); + ac = talloc_get_type(h->private_data, struct paged_context); ac->size = paged_ctrl->size; @@ -300,7 +300,7 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req) } ac->store->req->async.context = ac; - ac->store->req->async.callback = paged_search_async_callback; + ac->store->req->async.callback = paged_search_callback; ldb_set_timeout_from_prev_req(module->ldb, req, ac->store->req); ret = ldb_next_request(module, ac->store->req); @@ -339,15 +339,15 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req) } -static int paged_results(struct ldb_async_handle *handle) +static int paged_results(struct ldb_handle *handle) { - struct paged_async_context *ac; + struct paged_context *ac; struct ldb_paged_control *paged; - struct ldb_async_result *ares; + struct ldb_reply *ares; struct message_store *msg; int i, num_ctrls, ret; - ac = talloc_get_type(handle->private_data, struct paged_async_context); + ac = talloc_get_type(handle->private_data, struct paged_context); if (ac->store == NULL) return LDB_ERR_OPERATIONS_ERROR; @@ -382,7 +382,7 @@ static int paged_results(struct ldb_async_handle *handle) talloc_free(msg); } - ares = talloc_zero(ac->store, struct ldb_async_result); + ares = talloc_zero(ac->store, struct ldb_reply); if (ares == NULL) { handle->status = LDB_ERR_OPERATIONS_ERROR; return handle->status; @@ -446,9 +446,9 @@ static int paged_results(struct ldb_async_handle *handle) return ret; } -static int paged_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type) { - struct paged_async_context *ac; + struct paged_context *ac; int ret; if (!handle || !handle->private_data) { @@ -461,7 +461,7 @@ static int paged_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait handle->state = LDB_ASYNC_PENDING; - ac = talloc_get_type(handle->private_data, struct paged_async_context); + ac = talloc_get_type(handle->private_data, struct paged_context); if (ac->store->req->async.handle->state == LDB_ASYNC_DONE) { /* if lower level is finished we do not need to call it anymore */ @@ -479,7 +479,7 @@ static int paged_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait if (type == LDB_WAIT_ALL) { while (ac->store->req->async.handle->state != LDB_ASYNC_DONE) { - ret = ldb_async_wait(ac->store->req->async.handle, type); + ret = ldb_wait(ac->store->req->async.handle, type); if (ret != LDB_SUCCESS) { handle->state = LDB_ASYNC_DONE; handle->status = ret; @@ -498,7 +498,7 @@ static int paged_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait return ret; } - ret = ldb_async_wait(ac->store->req->async.handle, type); + ret = ldb_wait(ac->store->req->async.handle, type); if (ret != LDB_SUCCESS) { handle->state = LDB_ASYNC_DONE; handle->status = ret; @@ -560,7 +560,7 @@ static int paged_request_init(struct ldb_module *module) static const struct ldb_module_ops paged_ops = { .name = "paged_results", .search = paged_search, - .async_wait = paged_async_wait, + .wait = paged_wait, .init_context = paged_request_init }; diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index 7aedc260ad..b005b49c55 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -134,7 +134,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) return ret; } -struct rename_async_context { +struct rename_context { enum {RENAME_RENAME, RENAME_MODIFY} step; struct ldb_request *orig_req; @@ -144,8 +144,8 @@ struct rename_async_context { static int rdn_name_rename(struct ldb_module *module, struct ldb_request *req) { - struct ldb_async_handle *h; - struct rename_async_context *ac; + struct ldb_handle *h; + struct rename_context *ac; ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_name_rename\n"); @@ -154,14 +154,14 @@ static int rdn_name_rename(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, req); } - h = talloc_zero(req, struct ldb_async_handle); + h = talloc_zero(req, struct ldb_handle); if (h == NULL) { return LDB_ERR_OPERATIONS_ERROR; } h->module = module; - ac = talloc_zero(h, struct rename_async_context); + ac = talloc_zero(h, struct rename_context); if (ac == NULL) { return LDB_ERR_OPERATIONS_ERROR; } @@ -187,13 +187,13 @@ static int rdn_name_rename(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, ac->down_req); } -static int rdn_name_rename_do_mod(struct ldb_async_handle *h) { +static int rdn_name_rename_do_mod(struct ldb_handle *h) { - struct rename_async_context *ac; + struct rename_context *ac; struct ldb_dn_component *rdn; struct ldb_message *msg; - ac = talloc_get_type(h->private_data, struct rename_async_context); + ac = talloc_get_type(h->private_data, struct rename_context); rdn = ldb_dn_get_rdn(ac, ac->orig_req->op.rename.newdn); if (rdn == NULL) { @@ -234,9 +234,9 @@ static int rdn_name_rename_do_mod(struct ldb_async_handle *h) { return ldb_request(h->module->ldb, ac->mod_req); } -static int rename_async_wait(struct ldb_async_handle *handle) +static int rename_wait(struct ldb_handle *handle) { - struct rename_async_context *ac; + struct rename_context *ac; int ret; if (!handle || !handle->private_data) { @@ -250,11 +250,11 @@ static int rename_async_wait(struct ldb_async_handle *handle) handle->state = LDB_ASYNC_PENDING; handle->status = LDB_SUCCESS; - ac = talloc_get_type(handle->private_data, struct rename_async_context); + ac = talloc_get_type(handle->private_data, struct rename_context); switch(ac->step) { case RENAME_RENAME: - ret = ldb_async_wait(ac->down_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->down_req->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; @@ -272,7 +272,7 @@ static int rename_async_wait(struct ldb_async_handle *handle) return rdn_name_rename_do_mod(handle); case RENAME_MODIFY: - ret = ldb_async_wait(ac->mod_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->mod_req->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; @@ -300,12 +300,12 @@ done: return ret; } -static int rename_async_wait_all(struct ldb_async_handle *handle) { +static int rename_wait_all(struct ldb_handle *handle) { int ret; while (handle->state != LDB_ASYNC_DONE) { - ret = rename_async_wait(handle); + ret = rename_wait(handle); if (ret != LDB_SUCCESS) { return ret; } @@ -314,12 +314,12 @@ static int rename_async_wait_all(struct ldb_async_handle *handle) { return handle->status; } -static int rdn_name_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int rdn_name_wait(struct ldb_handle *handle, enum ldb_wait_type type) { if (type == LDB_WAIT_ALL) { - return rename_async_wait_all(handle); + return rename_wait_all(handle); } else { - return rename_async_wait(handle); + return rename_wait(handle); } } @@ -327,7 +327,7 @@ static const struct ldb_module_ops rdn_name_ops = { .name = "rdn_name", .add = rdn_name_add, .rename = rdn_name_rename, - .async_wait = rdn_name_async_wait + .wait = rdn_name_wait }; diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c index d72647be66..261bae7e78 100644 --- a/source4/lib/ldb/modules/sort.c +++ b/source4/lib/ldb/modules/sort.c @@ -43,10 +43,10 @@ struct opaque { int result; }; -struct sort_async_context { +struct sort_context { struct ldb_module *module; void *up_context; - int (*up_callback)(struct ldb_context *, void *, struct ldb_async_result *); + int (*up_callback)(struct ldb_context *, void *, struct ldb_reply *); char *attributeName; char *orderingRule; @@ -63,14 +63,14 @@ struct sort_async_context { int sort_result; }; -static struct ldb_async_handle *init_handle(void *mem_ctx, struct ldb_module *module, +static struct ldb_handle *init_handle(void *mem_ctx, struct ldb_module *module, void *context, - int (*callback)(struct ldb_context *, void *, struct ldb_async_result *)) + int (*callback)(struct ldb_context *, void *, struct ldb_reply *)) { - struct sort_async_context *ac; - struct ldb_async_handle *h; + struct sort_context *ac; + struct ldb_handle *h; - h = talloc_zero(mem_ctx, struct ldb_async_handle); + h = talloc_zero(mem_ctx, struct ldb_handle); if (h == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); return NULL; @@ -78,7 +78,7 @@ static struct ldb_async_handle *init_handle(void *mem_ctx, struct ldb_module *mo h->module = module; - ac = talloc_zero(h, struct sort_async_context); + ac = talloc_zero(h, struct sort_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); talloc_free(h); @@ -141,7 +141,7 @@ static int build_response(void *mem_ctx, struct ldb_control ***ctrls, int result static int sort_compare(struct ldb_message **msg1, struct ldb_message **msg2, void *opaque) { - struct sort_async_context *ac = talloc_get_type(opaque, struct sort_async_context); + struct sort_context *ac = talloc_get_type(opaque, struct sort_context); struct ldb_message_element *el1, *el2; if (ac->sort_result != 0) { @@ -166,16 +166,16 @@ static int sort_compare(struct ldb_message **msg1, struct ldb_message **msg2, vo return ac->h->comparison_fn(ac->module->ldb, ac, &el1->values[0], &el2->values[0]); } -static int server_sort_search_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int server_sort_search_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct sort_async_context *ac = NULL; + struct sort_context *ac = NULL; if (!context || !ares) { ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context or Result in callback")); goto error; } - ac = talloc_get_type(context, struct sort_async_context); + ac = talloc_get_type(context, struct sort_context); if (ares->type == LDB_REPLY_ENTRY) { ac->msgs = talloc_realloc(ac, ac->msgs, struct ldb_message *, ac->num_msgs + 2); @@ -231,8 +231,8 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req struct ldb_control *control; struct ldb_server_sort_control **sort_ctrls; struct ldb_control **saved_controls; - struct sort_async_context *ac; - struct ldb_async_handle *h; + struct sort_context *ac; + struct ldb_handle *h; int ret; /* check if there's a paged request control */ @@ -253,7 +253,7 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req if (!h) { return LDB_ERR_OPERATIONS_ERROR; } - ac = talloc_get_type(h->private_data, struct sort_async_context); + ac = talloc_get_type(h->private_data, struct sort_context); sort_ctrls = talloc_get_type(control->data, struct ldb_server_sort_control *); if (!sort_ctrls) { @@ -265,9 +265,9 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req if (sort_ctrls[1] != NULL) { if (control->critical) { - struct ldb_async_result *ares; + struct ldb_reply *ares; - ares = talloc_zero(req, struct ldb_async_result); + ares = talloc_zero(req, struct ldb_reply); if (!ares) return LDB_ERR_OPERATIONS_ERROR; @@ -319,13 +319,13 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req return ldb_next_request(module, ac->req); } -static int server_sort_results(struct ldb_async_handle *handle) +static int server_sort_results(struct ldb_handle *handle) { - struct sort_async_context *ac; - struct ldb_async_result *ares; + struct sort_context *ac; + struct ldb_reply *ares; int i, ret; - ac = talloc_get_type(handle->private_data, struct sort_async_context); + ac = talloc_get_type(handle->private_data, struct sort_context); ac->h = ldb_attrib_handler(ac->module->ldb, ac->attributeName); ac->sort_result = 0; @@ -335,7 +335,7 @@ static int server_sort_results(struct ldb_async_handle *handle) ac, (ldb_qsort_cmp_fn_t)sort_compare); for (i = 0; i < ac->num_msgs; i++) { - ares = talloc_zero(ac, struct ldb_async_result); + ares = talloc_zero(ac, struct ldb_reply); if (!ares) { handle->status = LDB_ERR_OPERATIONS_ERROR; return handle->status; @@ -351,7 +351,7 @@ static int server_sort_results(struct ldb_async_handle *handle) } for (i = 0; i < ac->num_refs; i++) { - ares = talloc_zero(ac, struct ldb_async_result); + ares = talloc_zero(ac, struct ldb_reply); if (!ares) { handle->status = LDB_ERR_OPERATIONS_ERROR; return handle->status; @@ -366,7 +366,7 @@ static int server_sort_results(struct ldb_async_handle *handle) } } - ares = talloc_zero(ac, struct ldb_async_result); + ares = talloc_zero(ac, struct ldb_reply); if (!ares) { handle->status = LDB_ERR_OPERATIONS_ERROR; return handle->status; @@ -387,18 +387,18 @@ static int server_sort_results(struct ldb_async_handle *handle) return LDB_SUCCESS; } -static int server_sort_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int server_sort_wait(struct ldb_handle *handle, enum ldb_wait_type type) { - struct sort_async_context *ac; + struct sort_context *ac; int ret; if (!handle || !handle->private_data) { return LDB_ERR_OPERATIONS_ERROR; } - ac = talloc_get_type(handle->private_data, struct sort_async_context); + ac = talloc_get_type(handle->private_data, struct sort_context); - ret = ldb_async_wait(ac->req->async.handle, type); + ret = ldb_wait(ac->req->async.handle, type); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -447,7 +447,7 @@ static int server_sort_init(struct ldb_module *module) static const struct ldb_module_ops server_sort_ops = { .name = "server_sort", .search = server_sort_search, - .async_wait = server_sort_async_wait, + .wait = server_sort_wait, .init_context = server_sort_init }; |