diff options
author | Simo Sorce <idra@samba.org> | 2006-07-22 17:21:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:10:17 -0500 |
commit | 49f68caed20d2a7d1850e493005bdf85929d6365 (patch) | |
tree | 6c81b47125cbe4a597c379d8876d919832cde4db | |
parent | c93817b36d3ff7f44cb7b3e1d1a29e37ec12affe (diff) | |
download | samba-49f68caed20d2a7d1850e493005bdf85929d6365.tar.gz samba-49f68caed20d2a7d1850e493005bdf85929d6365.tar.bz2 samba-49f68caed20d2a7d1850e493005bdf85929d6365.zip |
r17186: "async" word abuse clean-up part 2
(This used to be commit c6aa60c7e69abf1f83efc150b1c3ed02751c45fc)
23 files changed, 272 insertions, 286 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c index 0d8d49dea5..e79af57042 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c @@ -167,7 +167,7 @@ static BOOL inject_extended_dn(struct ldb_message *msg, } /* search */ -struct extended_async_context { +struct extended_context { struct ldb_module *module; void *up_context; @@ -179,16 +179,16 @@ struct extended_async_context { int extended_type; }; -static int extended_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) +static int extended_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct extended_async_context *ac; + struct extended_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 extended_async_context); + ac = talloc_get_type(context, struct extended_context); if (ares->type == LDB_REPLY_ENTRY) { /* for each record returned post-process to add any derived @@ -205,12 +205,12 @@ error: return LDB_ERR_OPERATIONS_ERROR; } -static int extended_search_async(struct ldb_module *module, struct ldb_request *req) +static int extended_search(struct ldb_module *module, struct ldb_request *req) { struct ldb_control *control; struct ldb_extended_dn_control *extended_ctrl; struct ldb_control **saved_controls; - struct extended_async_context *ac; + struct extended_context *ac; struct ldb_request *down_req; char **new_attrs; int ret; @@ -227,14 +227,14 @@ static int extended_search_async(struct ldb_module *module, struct ldb_request * return LDB_ERR_PROTOCOL_ERROR; } - ac = talloc(req, struct extended_async_context); + ac = talloc(req, struct extended_context); if (ac == NULL) { return LDB_ERR_OPERATIONS_ERROR; } ac->module = module; - ac->up_context = req->async.context; - ac->up_callback = req->async.callback; + ac->up_context = req->context; + ac->up_callback = req->callback; ac->attrs = req->op.search.attrs; ac->remove_guid = False; ac->remove_sid = False; @@ -285,8 +285,8 @@ static int extended_search_async(struct ldb_module *module, struct ldb_request * return LDB_ERR_OPERATIONS_ERROR; } - down_req->async.context = ac; - down_req->async.callback = extended_async_callback; + down_req->context = ac; + down_req->callback = extended_callback; ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* perform the search */ @@ -295,7 +295,7 @@ static int extended_search_async(struct ldb_module *module, struct ldb_request * /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; @@ -328,7 +328,7 @@ static int extended_init(struct ldb_module *module) static const struct ldb_module_ops extended_dn_ops = { .name = "extended_dn", - .search = extended_search_async, + .search = extended_search, .init_context = extended_init }; diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c index 09173f0aa4..ecb3e00f95 100644 --- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c +++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c @@ -98,7 +98,7 @@ static const char *user_name(TALLOC_CTX *mem_ctx, struct ldb_module *module) } /* search */ -struct kludge_acl_async_context { +struct kludge_acl_context { struct ldb_module *module; void *up_context; @@ -107,9 +107,9 @@ struct kludge_acl_async_context { enum user_is user_type; }; -static int kludge_acl_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) +static int kludge_acl_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct kludge_acl_async_context *ac; + struct kludge_acl_context *ac; struct kludge_private_data *data; int i; @@ -118,7 +118,7 @@ static int kludge_acl_async_callback(struct ldb_context *ldb, void *context, str goto error; } - ac = talloc_get_type(context, struct kludge_acl_async_context); + ac = talloc_get_type(context, struct kludge_acl_context); data = talloc_get_type(ac->module->private_data, struct kludge_private_data); if (ares->type == LDB_REPLY_ENTRY @@ -143,22 +143,22 @@ error: return LDB_ERR_OPERATIONS_ERROR; } -static int kludge_acl_search_async(struct ldb_module *module, struct ldb_request *req) +static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req) { - struct kludge_acl_async_context *ac; + struct kludge_acl_context *ac; struct ldb_request *down_req; int ret; - req->async.handle = NULL; + req->handle = NULL; - ac = talloc(req, struct kludge_acl_async_context); + ac = talloc(req, struct kludge_acl_context); if (ac == NULL) { return LDB_ERR_OPERATIONS_ERROR; } ac->module = module; - ac->up_context = req->async.context; - ac->up_callback = req->async.callback; + ac->up_context = req->context; + ac->up_callback = req->callback; ac->user_type = what_is_user(module); down_req = talloc_zero(req, struct ldb_request); @@ -174,8 +174,8 @@ static int kludge_acl_search_async(struct ldb_module *module, struct ldb_request down_req->controls = req->controls; - down_req->async.context = ac; - down_req->async.callback = kludge_acl_async_callback; + down_req->context = ac; + down_req->callback = kludge_acl_callback; ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* perform the search */ @@ -184,7 +184,7 @@ static int kludge_acl_search_async(struct ldb_module *module, struct ldb_request /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; @@ -271,7 +271,7 @@ done: static const struct ldb_module_ops kludge_acl_ops = { .name = "kludge_acl", - .search = kludge_acl_search_async, + .search = kludge_acl_search, .add = kludge_acl_change, .modify = kludge_acl_change, .del = kludge_acl_change, diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 3f6a951997..1f18f0e603 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -107,7 +107,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c index 0dcf710ba4..92fddca270 100644 --- a/source4/dsdb/samdb/ldb_modules/partition.c +++ b/source4/dsdb/samdb/ldb_modules/partition.c @@ -167,7 +167,7 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } /* return our own handle to deal with this call */ - req->async.handle = h; + req->handle = h; ac = talloc_get_type(h->private_data, struct partition_context); @@ -537,18 +537,18 @@ static int partition_wait_none(struct ldb_handle *handle) { ac = talloc_get_type(handle->private_data, struct partition_context); for (i=0; i < ac->num_searches; i++) { - ret = ldb_wait(ac->search_req[i]->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->search_req[i]->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->search_req[i]->async.handle->status != LDB_SUCCESS) { - handle->status = ac->search_req[i]->async.handle->status; + if (ac->search_req[i]->handle->status != LDB_SUCCESS) { + handle->status = ac->search_req[i]->handle->status; goto done; } - if (ac->search_req[i]->async.handle->state != LDB_ASYNC_DONE) { + if (ac->search_req[i]->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } } diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index d6c2a45217..ec42249633 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -509,9 +509,9 @@ static int build_domain_data_request(struct ph_context *ac) } ac->dom_req->op.search.attrs = attrs; ac->dom_req->controls = NULL; - ac->dom_req->async.context = ac; - ac->dom_req->async.callback = get_domain_data_callback; - ac->dom_req->async.timeout = ac->orig_req->async.timeout; + ac->dom_req->context = ac; + ac->dom_req->callback = get_domain_data_callback; + ac->dom_req->timeout = ac->orig_req->timeout; ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->dom_req); return LDB_SUCCESS; @@ -637,7 +637,7 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req) ac->step = PH_ADD_SEARCH_DOM; - req->async.handle = h; + req->handle = h; return ldb_next_request(module, ac->dom_req); } @@ -787,7 +787,7 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r ac = talloc_get_type(h->private_data, struct ph_context); /* return or own handle to deal with this call */ - req->async.handle = h; + req->handle = h; /* prepare the first operation */ ac->down_req = talloc_zero(ac, struct ldb_request); @@ -814,8 +814,8 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r return password_hash_mod_search_self(h); } - ac->down_req->async.context = NULL; - ac->down_req->async.callback = NULL; + ac->down_req->context = NULL; + ac->down_req->callback = NULL; ac->step = PH_MOD_DO_REQ; @@ -889,8 +889,8 @@ static int password_hash_mod_search_self(struct ldb_handle *h) { } ac->search_req->op.search.attrs = attrs; ac->search_req->controls = NULL; - ac->search_req->async.context = ac; - ac->search_req->async.callback = get_self_callback; + ac->search_req->context = ac; + ac->search_req->callback = get_self_callback; ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->search_req); ac->step = PH_MOD_SEARCH_SELF; @@ -1079,18 +1079,18 @@ static int ph_wait(struct ldb_handle *handle) { switch (ac->step) { case PH_ADD_SEARCH_DOM: - ret = ldb_wait(ac->dom_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->dom_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->dom_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->dom_req->async.handle->status; + if (ac->dom_req->handle->status != LDB_SUCCESS) { + handle->status = ac->dom_req->handle->status; goto done; } - if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->dom_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } @@ -1098,36 +1098,36 @@ static int ph_wait(struct ldb_handle *handle) { return password_hash_add_do_add(handle); case PH_ADD_DO_ADD: - ret = ldb_wait(ac->down_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->down_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->down_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->down_req->async.handle->status; + if (ac->down_req->handle->status != LDB_SUCCESS) { + handle->status = ac->down_req->handle->status; goto done; } - if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->down_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } break; case PH_MOD_DO_REQ: - ret = ldb_wait(ac->down_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->down_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->down_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->down_req->async.handle->status; + if (ac->down_req->handle->status != LDB_SUCCESS) { + handle->status = ac->down_req->handle->status; goto done; } - if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->down_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } @@ -1135,18 +1135,18 @@ static int ph_wait(struct ldb_handle *handle) { return password_hash_mod_search_self(handle); case PH_MOD_SEARCH_SELF: - ret = ldb_wait(ac->search_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->search_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->search_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->search_req->async.handle->status; + if (ac->search_req->handle->status != LDB_SUCCESS) { + handle->status = ac->search_req->handle->status; goto done; } - if (ac->search_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->search_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } @@ -1154,18 +1154,18 @@ static int ph_wait(struct ldb_handle *handle) { return password_hash_mod_search_dom(handle); case PH_MOD_SEARCH_DOM: - ret = ldb_wait(ac->dom_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->dom_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->dom_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->dom_req->async.handle->status; + if (ac->dom_req->handle->status != LDB_SUCCESS) { + handle->status = ac->dom_req->handle->status; goto done; } - if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->dom_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } @@ -1173,18 +1173,18 @@ static int ph_wait(struct ldb_handle *handle) { return password_hash_mod_do_mod(handle); case PH_MOD_DO_MOD: - ret = ldb_wait(ac->mod_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->mod_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->mod_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->mod_req->async.handle->status; + if (ac->mod_req->handle->status != LDB_SUCCESS) { + handle->status = ac->mod_req->handle->status; goto done; } - if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->mod_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index 01421d2817..efb3d9a05f 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -139,7 +139,7 @@ failed: handle search requests */ -struct rootdse_async_context { +struct rootdse_context { struct ldb_module *module; void *up_context; int (*up_callback)(struct ldb_context *, void *, struct ldb_reply *); @@ -147,16 +147,16 @@ struct rootdse_async_context { const char * const * attrs; }; -static int rootdse_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) +static int rootdse_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct rootdse_async_context *ac; + struct rootdse_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 rootdse_async_context); + ac = talloc_get_type(context, struct rootdse_context); if (ares->type == LDB_REPLY_ENTRY) { /* for each record returned post-process to add any dynamic @@ -175,7 +175,7 @@ error: static int rootdse_search(struct ldb_module *module, struct ldb_request *req) { - struct rootdse_async_context *ac; + struct rootdse_context *ac; struct ldb_request *down_req; int ret; @@ -185,14 +185,14 @@ static int rootdse_search(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, req); } - ac = talloc(req, struct rootdse_async_context); + ac = talloc(req, struct rootdse_context); if (ac == NULL) { return LDB_ERR_OPERATIONS_ERROR; } ac->module = module; - ac->up_context = req->async.context; - ac->up_callback = req->async.callback; + ac->up_context = req->context; + ac->up_callback = req->callback; ac->attrs = req->op.search.attrs; down_req = talloc_zero(req, struct ldb_request); @@ -213,8 +213,8 @@ static int rootdse_search(struct ldb_module *module, struct ldb_request *req) down_req->op.search.attrs = req->op.search.attrs; down_req->controls = req->controls; - down_req->async.context = ac; - down_req->async.callback = rootdse_async_callback; + down_req->context = ac; + down_req->callback = rootdse_callback; ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* perform the search */ @@ -223,7 +223,7 @@ static int rootdse_search(struct ldb_module *module, struct ldb_request *req) /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 81bfa32398..d0c278257e 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -740,7 +740,7 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req) /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 3f9aaf6af8..6e4df86b88 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -250,8 +250,8 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) lreq->controls = call->request->controls; - lreq->async.context = res; - lreq->async.callback = ldapsrv_SearchCallback; + lreq->context = res; + lreq->callback = ldapsrv_SearchCallback; /* Copy the timeout from the incoming call */ ldb_set_timeout(samdb, lreq, req->timelimit); @@ -262,7 +262,7 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) goto reply; } - ldb_ret = ldb_wait(lreq->async.handle, LDB_WAIT_ALL); + ldb_ret = ldb_wait(lreq->handle, LDB_WAIT_ALL); if (ldb_ret == LDB_SUCCESS) { for (i = 0; i < res->count; i++) { diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index a962aa4322..9420318fa9 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -335,7 +335,7 @@ static int ldb_autotransaction_request(struct ldb_context *ldb, struct ldb_reque ret = ldb_request(ldb, req); if (ret == LDB_SUCCESS) { - ret = ldb_wait(req->async.handle, LDB_WAIT_ALL); + ret = ldb_wait(req->handle, LDB_WAIT_ALL); } if (ret == LDB_SUCCESS) { @@ -369,11 +369,11 @@ int ldb_set_timeout(struct ldb_context *ldb, struct ldb_request *req, int timeou if (req == NULL) return LDB_ERR_OPERATIONS_ERROR; if (timeout != 0) { - req->async.timeout = timeout; + req->timeout = timeout; } else { - req->async.timeout = ldb->default_timeout; + req->timeout = ldb->default_timeout; } - req->async.starttime = time(NULL); + req->starttime = time(NULL); return LDB_SUCCESS; } @@ -390,11 +390,11 @@ int ldb_set_timeout_from_prev_req(struct ldb_context *ldb, struct ldb_request *o if (oldreq == NULL) return ldb_set_timeout(ldb, newreq, 0); - if ((now - oldreq->async.starttime) > oldreq->async.timeout) { + if ((now - oldreq->starttime) > oldreq->timeout) { return LDB_ERR_TIME_LIMIT_EXCEEDED; } - newreq->async.starttime = oldreq->async.starttime; - newreq->async.timeout = oldreq->async.timeout - (now - oldreq->async.starttime); + newreq->starttime = oldreq->starttime; + newreq->timeout = oldreq->timeout - (now - oldreq->starttime); return LDB_SUCCESS; } @@ -556,14 +556,14 @@ int ldb_search(struct ldb_context *ldb, req->op.search.attrs = attrs; req->controls = NULL; - req->async.context = res; - req->async.callback = ldb_search_callback; + req->context = res; + req->callback = ldb_search_callback; ldb_set_timeout(ldb, req, 0); /* use default timeout */ ret = ldb_request(ldb, req); if (ret == LDB_SUCCESS) { - ret = ldb_wait(req->async.handle, LDB_WAIT_ALL); + ret = ldb_wait(req->handle, LDB_WAIT_ALL); } if (ret != LDB_SUCCESS) { @@ -600,8 +600,8 @@ int ldb_add(struct ldb_context *ldb, req->operation = LDB_ADD; req->op.add.message = message; req->controls = NULL; - req->async.context = NULL; - req->async.callback = NULL; + req->context = NULL; + req->callback = NULL; ldb_set_timeout(ldb, req, 0); /* use default timeout */ /* do request and autostart a transaction */ @@ -632,8 +632,8 @@ int ldb_modify(struct ldb_context *ldb, req->operation = LDB_MODIFY; req->op.add.message = message; req->controls = NULL; - req->async.context = NULL; - req->async.callback = NULL; + req->context = NULL; + req->callback = NULL; ldb_set_timeout(ldb, req, 0); /* use default timeout */ /* do request and autostart a transaction */ @@ -661,8 +661,8 @@ int ldb_delete(struct ldb_context *ldb, const struct ldb_dn *dn) req->operation = LDB_DELETE; req->op.del.dn = dn; req->controls = NULL; - req->async.context = NULL; - req->async.callback = NULL; + req->context = NULL; + req->callback = NULL; ldb_set_timeout(ldb, req, 0); /* use default timeout */ /* do request and autostart a transaction */ @@ -690,8 +690,8 @@ int ldb_rename(struct ldb_context *ldb, const struct ldb_dn *olddn, const struct req->op.rename.olddn = olddn; req->op.rename.newdn = newdn; req->controls = NULL; - req->async.context = NULL; - req->async.callback = NULL; + req->context = NULL; + req->callback = NULL; ldb_set_timeout(ldb, req, 0); /* use default timeout */ /* do request and autostart a transaction */ @@ -718,8 +718,8 @@ int ldb_sequence_number(struct ldb_context *ldb, uint64_t *seq_num) req->operation = LDB_SEQUENCE_NUMBER; req->controls = NULL; - req->async.context = NULL; - req->async.callback = NULL; + req->context = NULL; + req->callback = NULL; ldb_set_timeout(ldb, req, 0); /* use default timeout */ /* do request and autostart a transaction */ diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 885842ff9c..68c2272adf 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -664,14 +664,12 @@ struct ldb_request { struct ldb_control **controls; - struct { - void *context; - int (*callback)(struct ldb_context *, void *, struct ldb_reply *); - - int timeout; - time_t starttime; - struct ldb_handle *handle; - } async; + void *context; + int (*callback)(struct ldb_context *, void *, struct ldb_reply *); + + int timeout; + time_t starttime; + struct ldb_handle *handle; }; int ldb_request(struct ldb_context *ldb, struct ldb_request *request); diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index 3410d68c5e..ae92ede8ce 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -391,9 +391,9 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req) struct ldap_message *msg; int n; - req->async.handle = NULL; + req->handle = NULL; - if (!req->async.callback || !req->async.context) { + if (!req->callback || !req->context) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context")); return LDB_ERR_OPERATIONS_ERROR; } @@ -444,7 +444,7 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req) msg->r.SearchRequest.attributes = discard_const(req->op.search.attrs); msg->controls = req->controls; - return ildb_request_send(module, msg, req->async.context, req->async.callback, req->async.timeout, &(req->async.handle)); + return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle)); } /* @@ -457,7 +457,7 @@ static int ildb_add(struct ldb_module *module, struct ldb_request *req) struct ldap_mod **mods; int i,n; - req->async.handle = NULL; + req->handle = NULL; /* ignore ltdb specials */ if (ldb_dn_is_special(req->op.add.message->dn)) { @@ -494,7 +494,7 @@ static int ildb_add(struct ldb_module *module, struct ldb_request *req) msg->r.AddRequest.attributes[i] = mods[i]->attrib; } - return ildb_request_send(module, msg, req->async.context, req->async.callback, req->async.timeout, &(req->async.handle)); + return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle)); } /* @@ -507,7 +507,7 @@ static int ildb_modify(struct ldb_module *module, struct ldb_request *req) struct ldap_mod **mods; int i,n; - req->async.handle = NULL; + req->handle = NULL; /* ignore ltdb specials */ if (ldb_dn_is_special(req->op.mod.message->dn)) { @@ -544,11 +544,7 @@ static int ildb_modify(struct ldb_module *module, struct ldb_request *req) msg->r.ModifyRequest.mods[i] = *mods[i]; } - return ildb_request_send(module, msg, - req->async.context, - req->async.callback, - req->async.timeout, - &(req->async.handle)); + return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle)); } /* @@ -559,7 +555,7 @@ static int ildb_delete(struct ldb_module *module, struct ldb_request *req) struct ildb_private *ildb = talloc_get_type(module->private_data, struct ildb_private); struct ldap_message *msg; - req->async.handle = NULL; + req->handle = NULL; /* ignore ltdb specials */ if (ldb_dn_is_special(req->op.del.dn)) { @@ -579,11 +575,7 @@ static int ildb_delete(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_INVALID_DN_SYNTAX; } - return ildb_request_send(module, msg, - req->async.context, - req->async.callback, - req->async.timeout, - &(req->async.handle)); + return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle)); } /* @@ -594,7 +586,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req) struct ildb_private *ildb = talloc_get_type(module->private_data, struct ildb_private); struct ldap_message *msg; - req->async.handle = NULL; + req->handle = NULL; /* ignore ltdb specials */ if (ldb_dn_is_special(req->op.rename.olddn) || ldb_dn_is_special(req->op.rename.newdn)) { @@ -632,11 +624,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req) msg->r.ModifyDNRequest.deleteolddn = True; - return ildb_request_send(module, msg, - req->async.context, - req->async.callback, - req->async.timeout, - &(req->async.handle)); + return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle)); } static int ildb_start_trans(struct ldb_module *module) @@ -757,8 +745,8 @@ static int ildb_init(struct ldb_module *module) req->op.search.tree = ldb_parse_tree(req, "dn=dc=rootDSE"); req->op.search.attrs = NULL; req->controls = NULL; - req->async.context = ildb; - req->async.callback = ildb_rootdse_callback; + req->context = ildb; + req->callback = ildb_rootdse_callback; ldb_set_timeout(module->ldb, req, 60); ret = ildb_search(module, req); @@ -767,7 +755,7 @@ static int ildb_init(struct ldb_module *module) return ret; } - ret = ildb_wait(req->async.handle, LDB_WAIT_ALL); + ret = ildb_wait(req->handle, LDB_WAIT_ALL); talloc_free(req); return ret; diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index f6d24411db..1a20a28590 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -236,7 +236,7 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req) char *expression; int ret; - if (!req->async.callback || !req->async.context) { + if (!req->callback || !req->context) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context")); return LDB_ERR_OPERATIONS_ERROR; } @@ -250,12 +250,12 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req) ldb_debug(module->ldb, LDB_DEBUG_WARNING, "Controls are not yet supported by ldb_ldap backend!\n"); } - req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime); - if (req->async.handle == NULL) { + req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context); + lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context); search_base = ldb_dn_linearize(lldb_ac, req->op.search.base); if (req->op.search.base == NULL) { @@ -282,7 +282,7 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req) break; } - tv.tv_sec = req->async.timeout; + tv.tv_sec = req->timeout; tv.tv_usec = 0; ret = ldap_search_ext(lldb->ldap, search_base, ldap_scope, @@ -318,12 +318,12 @@ static int lldb_add(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_INVALID_DN_SYNTAX; } - req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime); - if (req->async.handle == NULL) { + req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context); + lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context); mods = lldb_msg_to_mods(lldb_ac, req->op.add.message, 0); if (mods == NULL) { @@ -363,12 +363,12 @@ static int lldb_modify(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_INVALID_DN_SYNTAX; } - req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime); - if (req->async.handle == NULL) { + req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context); + lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context); mods = lldb_msg_to_mods(lldb_ac, req->op.mod.message, 1); if (mods == NULL) { @@ -407,12 +407,12 @@ static int lldb_delete(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_INVALID_DN_SYNTAX; } - req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime); - if (req->async.handle == NULL) { + req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context); + lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context); dnstr = ldb_dn_linearize(lldb_ac, req->op.del.dn); @@ -445,12 +445,12 @@ static int lldb_rename(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_INVALID_DN_SYNTAX; } - req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime); - if (req->async.handle == NULL) { + req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context); + lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context); old_dn = ldb_dn_linearize(lldb_ac, req->op.rename.olddn); if (old_dn == NULL) { diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index c2ac9f47f4..153a6d27d4 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -2018,38 +2018,38 @@ static int lsql_request(struct ldb_module *module, struct ldb_request *req) req->op.search.scope, req->op.search.tree, req->op.search.attrs, - req->async.context, - req->async.callback, - &req->async.handle); + req->context, + req->callback, + &req->handle); /* case LDB_ADD: return lsql_add_async(module, req->op.add.message, - req->async.context, - req->async.callback, - &req->async.handle); + req->context, + req->callback, + &req->handle); case LDB_MODIFY: return lsql_modify_async(module, req->op.mod.message, - req->async.context, - req->async.callback, - &req->async.handle); + req->context, + req->callback, + &req->handle); */ case LDB_DELETE: return lsql_delete_async(module, req->op.del.dn, - req->async.context, - req->async.callback, - &req->async.handle); + req->context, + req->callback, + &req->handle); case LDB_RENAME: return lsql_rename_async(module, req->op.rename.olddn, req->op.rename.newdn, - req->async.context, - req->async.callback, - &req->async.handle); + req->context, + req->callback, + &req->handle); default: return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index 62e310ede6..ad6f98ea97 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -498,27 +498,27 @@ int ltdb_search(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } - req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback); - if (req->async.handle == NULL) { + req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); + if (req->handle == NULL) { ltdb_unlock_read(module); return LDB_ERR_OPERATIONS_ERROR; } - ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context); + ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context); ltdb_ac->tree = req->op.search.tree; ltdb_ac->scope = req->op.search.scope; ltdb_ac->base = req->op.search.base; ltdb_ac->attrs = req->op.search.attrs; - ret = ltdb_search_indexed(req->async.handle); + ret = ltdb_search_indexed(req->handle); if (ret == -1) { - ret = ltdb_search_full(req->async.handle); + ret = ltdb_search_full(req->handle); } if (ret != LDB_SUCCESS) { ldb_set_errstring(module->ldb, talloc_strdup(module->ldb, "Indexed and full searches both failed!\n")); - req->async.handle->state = LDB_ASYNC_DONE; - req->async.handle->status = ret; + req->handle->state = LDB_ASYNC_DONE; + req->handle->status = ret; } ltdb_unlock_read(module); diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index ababedad15..1401052955 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -298,15 +298,15 @@ static int ltdb_add(struct ldb_module *module, struct ldb_request *req) } } - req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback); - if (req->async.handle == NULL) { + req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context); + ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context); tret = ltdb_add_internal(module, req->op.add.message); if (tret != LDB_SUCCESS) { - req->async.handle->status = tret; + req->handle->status = tret; goto done; } @@ -314,7 +314,7 @@ static int ltdb_add(struct ldb_module *module, struct ldb_request *req) ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL); } done: - req->async.handle->state = LDB_ASYNC_DONE; + req->handle->state = LDB_ASYNC_DONE; return ret; } @@ -400,21 +400,21 @@ static int ltdb_delete(struct ldb_module *module, struct ldb_request *req) } } - req->async.handle = NULL; + req->handle = NULL; if (ltdb_cache_load(module) != 0) { return LDB_ERR_OPERATIONS_ERROR; } - req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback); - if (req->async.handle == NULL) { + req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context); + ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context); tret = ltdb_delete_internal(module, req->op.del.dn); if (tret != LDB_SUCCESS) { - req->async.handle->status = tret; + req->handle->status = tret; goto done; } @@ -422,7 +422,7 @@ static int ltdb_delete(struct ldb_module *module, struct ldb_request *req) ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL); } done: - req->async.handle->state = LDB_ASYNC_DONE; + req->handle->state = LDB_ASYNC_DONE; return ret; } @@ -764,17 +764,17 @@ static int ltdb_modify(struct ldb_module *module, struct ldb_request *req) } } - req->async.handle = NULL; + req->handle = NULL; - req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback); - if (req->async.handle == NULL) { + req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context); + ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context); tret = ltdb_check_special_dn(module, req->op.mod.message); if (tret != LDB_SUCCESS) { - req->async.handle->status = tret; + req->handle->status = tret; goto done; } @@ -785,7 +785,7 @@ static int ltdb_modify(struct ldb_module *module, struct ldb_request *req) tret = ltdb_modify_internal(module, req->op.mod.message); if (tret != LDB_SUCCESS) { - req->async.handle->status = tret; + req->handle->status = tret; goto done; } @@ -793,7 +793,7 @@ static int ltdb_modify(struct ldb_module *module, struct ldb_request *req) ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL); } done: - req->async.handle->state = LDB_ASYNC_DONE; + req->handle->state = LDB_ASYNC_DONE; return ret; } @@ -814,17 +814,17 @@ static int ltdb_rename(struct ldb_module *module, struct ldb_request *req) } } - req->async.handle = NULL; + req->handle = NULL; if (ltdb_cache_load(module) != 0) { return LDB_ERR_OPERATIONS_ERROR; } - req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback); - if (req->async.handle == NULL) { + req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback); + if (req->handle == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context); + ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context); msg = talloc(ltdb_ac, struct ldb_message); if (msg == NULL) { @@ -837,7 +837,7 @@ static int ltdb_rename(struct ldb_module *module, struct ldb_request *req) tret = ltdb_search_dn1(module, req->op.rename.olddn, msg); if (tret != 1) { /* not finding the old record is an error */ - req->async.handle->status = LDB_ERR_NO_SUCH_OBJECT; + req->handle->status = LDB_ERR_NO_SUCH_OBJECT; goto done; } @@ -864,7 +864,7 @@ static int ltdb_rename(struct ldb_module *module, struct ldb_request *req) ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL); } done: - req->async.handle->state = LDB_ASYNC_DONE; + req->handle->state = LDB_ASYNC_DONE; return ret; } diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c index 466286e8cd..110470c8bb 100644 --- a/source4/lib/ldb/modules/asq.c +++ b/source4/lib/ldb/modules/asq.c @@ -217,9 +217,9 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, req); } - req->async.handle = NULL; + req->handle = NULL; - if (!req->async.callback || !req->async.context) { + if (!req->callback || !req->context) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context")); return LDB_ERR_OPERATIONS_ERROR; @@ -230,13 +230,13 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_PROTOCOL_ERROR; } - h = init_handle(req, module, req->async.context, req->async.callback); + h = init_handle(req, module, req->context, req->callback); if (!h) { return LDB_ERR_OPERATIONS_ERROR; } ac = talloc_get_type(h->private_data, struct asq_context); - req->async.handle = h; + req->handle = h; /* check the search is well formed */ if (req->op.search.scope != LDB_SCOPE_BASE) { @@ -266,8 +266,8 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req) base_attrs[1] = NULL; ac->base_req->op.search.attrs = (const char * const *)base_attrs; - ac->base_req->async.context = ac; - ac->base_req->async.callback = asq_base_callback; + ac->base_req->context = ac; + ac->base_req->callback = asq_base_callback; ldb_set_timeout_from_prev_req(module->ldb, req, ac->base_req); ac->step = ASQ_SEARCH_BASE; @@ -319,8 +319,8 @@ static int asq_requests(struct ldb_handle *handle) { ac->reqs[i]->op.search.tree = ac->base_req->op.search.tree; ac->reqs[i]->op.search.attrs = ac->req_attrs; - ac->reqs[i]->async.context = ac; - ac->reqs[i]->async.callback = asq_reqs_callback; + ac->reqs[i]->context = ac; + ac->reqs[i]->callback = asq_reqs_callback; ldb_set_timeout_from_prev_req(ac->module->ldb, ac->base_req, ac->reqs[i]); } @@ -350,18 +350,18 @@ static int asq_wait_none(struct ldb_handle *handle) switch (ac->step) { case ASQ_SEARCH_BASE: - ret = ldb_wait(ac->base_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->base_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->base_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->base_req->async.handle->status; + if (ac->base_req->handle->status != LDB_SUCCESS) { + handle->status = ac->base_req->handle->status; goto done; } - if (ac->base_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->base_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } @@ -369,24 +369,24 @@ static int asq_wait_none(struct ldb_handle *handle) case ASQ_SEARCH_MULTI: - if (ac->reqs[ac->cur_req]->async.handle == NULL) { + if (ac->reqs[ac->cur_req]->handle == NULL) { ret = ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]); if (ret != LDB_SUCCESS) { return ret; } } - ret = ldb_wait(ac->reqs[ac->cur_req]->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->reqs[ac->cur_req]->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->reqs[ac->cur_req]->async.handle->status != LDB_SUCCESS) { - handle->status = ac->reqs[ac->cur_req]->async.handle->status; + if (ac->reqs[ac->cur_req]->handle->status != LDB_SUCCESS) { + handle->status = ac->reqs[ac->cur_req]->handle->status; } - if (ac->reqs[ac->cur_req]->async.handle->state == LDB_ASYNC_DONE) { + if (ac->reqs[ac->cur_req]->handle->state == LDB_ASYNC_DONE) { ac->cur_req++; } diff --git a/source4/lib/ldb/modules/objectclass.c b/source4/lib/ldb/modules/objectclass.c index 03ff58e994..a8c99226cd 100644 --- a/source4/lib/ldb/modules/objectclass.c +++ b/source4/lib/ldb/modules/objectclass.c @@ -283,7 +283,7 @@ static int objectclass_add(struct ldb_module *module, struct ldb_request *req) /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; } @@ -382,7 +382,7 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; } @@ -399,7 +399,7 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req ac = talloc_get_type(h->private_data, struct oc_context); /* return or own handle to deal with this call */ - req->async.handle = h; + req->handle = h; /* prepare the first operation */ ac->down_req = talloc(ac, struct ldb_request); @@ -410,8 +410,8 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req *(ac->down_req) = *req; /* copy the request */ - ac->down_req->async.context = NULL; - ac->down_req->async.callback = NULL; + ac->down_req->context = NULL; + ac->down_req->callback = NULL; ldb_set_timeout_from_prev_req(module->ldb, req, ac->down_req); ac->step = OC_DO_REQ; @@ -471,8 +471,8 @@ static int objectclass_search_self(struct ldb_handle *h) { } ac->search_req->op.search.attrs = attrs; ac->search_req->controls = NULL; - ac->search_req->async.context = ac; - ac->search_req->async.callback = get_self_callback; + ac->search_req->context = ac; + ac->search_req->callback = get_self_callback; ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->search_req); ac->step = OC_SEARCH_SELF; @@ -504,8 +504,8 @@ static int objectclass_do_mod(struct ldb_handle *h) { ac->mod_req->operation = LDB_MODIFY; ac->mod_req->controls = NULL; - ac->mod_req->async.context = ac; - ac->mod_req->async.callback = NULL; + ac->mod_req->context = ac; + ac->mod_req->callback = NULL; ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->mod_req); /* use a new message structure */ @@ -590,18 +590,18 @@ static int oc_wait(struct ldb_handle *handle) { switch (ac->step) { case OC_DO_REQ: - ret = ldb_wait(ac->down_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->down_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->down_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->down_req->async.handle->status; + if (ac->down_req->handle->status != LDB_SUCCESS) { + handle->status = ac->down_req->handle->status; goto done; } - if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->down_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } @@ -609,18 +609,18 @@ static int oc_wait(struct ldb_handle *handle) { return objectclass_search_self(handle); case OC_SEARCH_SELF: - ret = ldb_wait(ac->search_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->search_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->search_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->search_req->async.handle->status; + if (ac->search_req->handle->status != LDB_SUCCESS) { + handle->status = ac->search_req->handle->status; goto done; } - if (ac->search_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->search_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } @@ -628,18 +628,18 @@ static int oc_wait(struct ldb_handle *handle) { return objectclass_do_mod(handle); case OC_DO_MOD: - ret = ldb_wait(ac->mod_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->mod_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->mod_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->mod_req->async.handle->status; + if (ac->mod_req->handle->status != LDB_SUCCESS) { + handle->status = ac->mod_req->handle->status; goto done; } - if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->mod_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c index 4cadaa27ee..7e7c8d83ad 100644 --- a/source4/lib/ldb/modules/operational.c +++ b/source4/lib/ldb/modules/operational.c @@ -226,7 +226,7 @@ static int add_uint64_element(struct ldb_message *msg, const char *attr, uint64_ hook search operations */ -struct operational_async_context { +struct operational_context { struct ldb_module *module; void *up_context; @@ -235,16 +235,16 @@ struct operational_async_context { const char * const *attrs; }; -static int operational_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) +static int operational_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct operational_async_context *ac; + struct operational_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 operational_async_context); + ac = talloc_get_type(context, struct operational_context); if (ares->type == LDB_REPLY_ENTRY) { /* for each record returned post-process to add any derived @@ -263,21 +263,21 @@ error: static int operational_search(struct ldb_module *module, struct ldb_request *req) { - struct operational_async_context *ac; + struct operational_context *ac; struct ldb_request *down_req; const char **search_attrs = NULL; int i, a, ret; - req->async.handle = NULL; + req->handle = NULL; - ac = talloc(req, struct operational_async_context); + ac = talloc(req, struct operational_context); if (ac == NULL) { return LDB_ERR_OPERATIONS_ERROR; } ac->module = module; - ac->up_context = req->async.context; - ac->up_callback = req->async.callback; + ac->up_context = req->context; + ac->up_callback = req->callback; ac->attrs = req->op.search.attrs; down_req = talloc_zero(req, struct ldb_request); @@ -325,8 +325,8 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req down_req->controls = req->controls; - down_req->async.context = ac; - down_req->async.callback = operational_async_callback; + down_req->context = ac; + down_req->callback = operational_callback; ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* perform the search */ @@ -335,7 +335,7 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; @@ -392,7 +392,7 @@ static int operational_add(struct ldb_module *module, struct ldb_request *req) /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; @@ -449,7 +449,7 @@ static int operational_modify(struct ldb_module *module, struct ldb_request *req /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index 3f2ff66b32..2d972b7316 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -251,9 +251,9 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req) private_data = talloc_get_type(module->private_data, struct private_data); - req->async.handle = NULL; + req->handle = NULL; - if (!req->async.callback || !req->async.context) { + if (!req->callback || !req->context) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context")); return LDB_ERR_OPERATIONS_ERROR; @@ -264,7 +264,7 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_PROTOCOL_ERROR; } - h = init_handle(req, module, req->async.context, req->async.callback); + h = init_handle(req, module, req->context, req->callback); if (!h) { return LDB_ERR_OPERATIONS_ERROR; } @@ -299,8 +299,8 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } - ac->store->req->async.context = ac; - ac->store->req->async.callback = paged_search_callback; + ac->store->req->context = ac; + ac->store->req->callback = paged_search_callback; ldb_set_timeout_from_prev_req(module->ldb, req, ac->store->req); ret = ldb_next_request(module, ac->store->req); @@ -323,7 +323,7 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req) ret = LDB_SUCCESS; } - req->async.handle = h; + req->handle = h; /* check if it is an abandon */ if (ac->size == 0) { @@ -463,7 +463,7 @@ static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type) ac = talloc_get_type(handle->private_data, struct paged_context); - if (ac->store->req->async.handle->state == LDB_ASYNC_DONE) { + if (ac->store->req->handle->state == LDB_ASYNC_DONE) { /* if lower level is finished we do not need to call it anymore */ /* return all we have until size == 0 or we empty storage */ ret = paged_results(handle); @@ -478,8 +478,8 @@ static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type) } if (type == LDB_WAIT_ALL) { - while (ac->store->req->async.handle->state != LDB_ASYNC_DONE) { - ret = ldb_wait(ac->store->req->async.handle, type); + while (ac->store->req->handle->state != LDB_ASYNC_DONE) { + ret = ldb_wait(ac->store->req->handle, type); if (ret != LDB_SUCCESS) { handle->state = LDB_ASYNC_DONE; handle->status = ret; @@ -498,7 +498,7 @@ static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type) return ret; } - ret = ldb_wait(ac->store->req->async.handle, type); + ret = ldb_wait(ac->store->req->handle, type); if (ret != LDB_SUCCESS) { handle->state = LDB_ASYNC_DONE; handle->status = ret; @@ -508,7 +508,7 @@ static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type) handle->status = ret; if (ac->store->num_entries >= ac->size || - ac->store->req->async.handle->state == LDB_ASYNC_DONE) { + ac->store->req->handle->state == LDB_ASYNC_DONE) { ret = paged_results(handle); diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index b005b49c55..fce1d34ac0 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -128,7 +128,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; @@ -181,7 +181,7 @@ static int rdn_name_rename(struct ldb_module *module, struct ldb_request *req) ac->step = RENAME_RENAME; - req->async.handle = h; + req->handle = h; /* rename first, modify "name" if rename is ok */ return ldb_next_request(module, ac->down_req); @@ -254,17 +254,17 @@ static int rename_wait(struct ldb_handle *handle) switch(ac->step) { case RENAME_RENAME: - ret = ldb_wait(ac->down_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->down_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->down_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->down_req->async.handle->status; + if (ac->down_req->handle->status != LDB_SUCCESS) { + handle->status = ac->down_req->handle->status; goto done; } - if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->down_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } @@ -272,17 +272,17 @@ static int rename_wait(struct ldb_handle *handle) return rdn_name_rename_do_mod(handle); case RENAME_MODIFY: - ret = ldb_wait(ac->mod_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->mod_req->handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; goto done; } - if (ac->mod_req->async.handle->status != LDB_SUCCESS) { - handle->status = ac->mod_req->async.handle->status; + if (ac->mod_req->handle->status != LDB_SUCCESS) { + handle->status = ac->mod_req->handle->status; goto done; } - if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) { + if (ac->mod_req->handle->state != LDB_ASYNC_DONE) { return LDB_SUCCESS; } diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c index 261bae7e78..1ab034f4fb 100644 --- a/source4/lib/ldb/modules/sort.c +++ b/source4/lib/ldb/modules/sort.c @@ -242,14 +242,14 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req return ldb_next_request(module, req); } - req->async.handle = NULL; + req->handle = NULL; - if (!req->async.callback || !req->async.context) { + if (!req->callback || !req->context) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context")); return LDB_ERR_OPERATIONS_ERROR; } - h = init_handle(req, module, req->async.context, req->async.callback); + h = init_handle(req, module, req->context, req->callback); if (!h) { return LDB_ERR_OPERATIONS_ERROR; } @@ -310,11 +310,11 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req return LDB_ERR_OPERATIONS_ERROR; } - ac->req->async.context = ac; - ac->req->async.callback = server_sort_search_callback; + ac->req->context = ac; + ac->req->callback = server_sort_search_callback; ldb_set_timeout_from_prev_req(module->ldb, req, ac->req); - req->async.handle = h; + req->handle = h; return ldb_next_request(module, ac->req); } @@ -398,15 +398,15 @@ static int server_sort_wait(struct ldb_handle *handle, enum ldb_wait_type type) ac = talloc_get_type(handle->private_data, struct sort_context); - ret = ldb_wait(ac->req->async.handle, type); + ret = ldb_wait(ac->req->handle, type); if (ret != LDB_SUCCESS) { handle->status = ret; return ret; } - handle->state = ac->req->async.handle->state; - handle->status = ac->req->async.handle->status; + handle->state = ac->req->handle->state; + handle->status = ac->req->handle->status; if (handle->status != LDB_SUCCESS) { return handle->status; diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 45826f0996..93bb89a1d3 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -224,8 +224,8 @@ static int do_search(struct ldb_context *ldb, if (req->op.search.tree == NULL) return -1; req->op.search.attrs = attrs; req->controls = sctx->req_ctrls; - req->async.context = sctx; - req->async.callback = &search_callback; + req->context = sctx; + req->callback = &search_callback; ldb_set_timeout(ldb, req, 0); /* TODO: make this settable by command line */ again: @@ -237,7 +237,7 @@ again: return -1; } - ret = ldb_wait(req->async.handle, LDB_WAIT_ALL); + ret = ldb_wait(req->handle, LDB_WAIT_ALL); if (ret != LDB_SUCCESS) { printf("search error - %s\n", ldb_errstring(ldb)); return -1; diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c index 80fe3eab1c..068888bae9 100644 --- a/source4/torture/ldap/schema.c +++ b/source4/torture/ldap/schema.c @@ -231,8 +231,8 @@ static BOOL test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE if (req->op.search.tree == NULL) return -1; req->op.search.attrs = NULL; req->controls = ctrl; - req->async.context = actx; - req->async.callback = test_schema_search_callback; + req->context = actx; + req->callback = test_schema_search_callback; ldb_set_timeout(ldb, req, 0); actx->count = 0; @@ -248,7 +248,7 @@ again: return False; } - ret = ldb_wait(req->async.handle, LDB_WAIT_ALL); + ret = ldb_wait(req->handle, LDB_WAIT_ALL); if (ret != LDB_SUCCESS) { d_printf("search error - %s\n", ldb_errstring(ldb)); return False; |