From c93817b36d3ff7f44cb7b3e1d1a29e37ec12affe Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 22 Jul 2006 16:56:33 +0000 Subject: 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) --- source4/dsdb/samdb/ldb_modules/extended_dn.c | 4 +- source4/dsdb/samdb/ldb_modules/kludge_acl.c | 4 +- source4/dsdb/samdb/ldb_modules/partition.c | 40 +++++----- source4/dsdb/samdb/ldb_modules/password_hash.c | 104 ++++++++++++------------- source4/dsdb/samdb/ldb_modules/rootdse.c | 4 +- 5 files changed, 78 insertions(+), 78 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules') diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c index aa800a0ae1..0d8d49dea5 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c @@ -171,7 +171,7 @@ struct extended_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; BOOL remove_guid; @@ -179,7 +179,7 @@ struct extended_async_context { int extended_type; }; -static int extended_async_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int extended_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { struct extended_async_context *ac; diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c index 9db443f48f..09173f0aa4 100644 --- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c +++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c @@ -102,12 +102,12 @@ struct kludge_acl_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 *); enum user_is user_type; }; -static int kludge_acl_async_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int kludge_acl_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { struct kludge_acl_async_context *ac; struct kludge_private_data *data; diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c index f523119e21..0dcf710ba4 100644 --- a/source4/dsdb/samdb/ldb_modules/partition.c +++ b/source4/dsdb/samdb/ldb_modules/partition.c @@ -44,7 +44,7 @@ struct partition_private_data { struct partition **partitions; }; -struct partition_async_context { +struct partition_context { struct ldb_module *module; struct ldb_request *orig_req; @@ -53,12 +53,12 @@ struct partition_async_context { int num_searches; }; -static struct ldb_async_handle *partition_init_handle(struct ldb_request *req, struct ldb_module *module) +static struct ldb_handle *partition_init_handle(struct ldb_request *req, struct ldb_module *module) { - struct partition_async_context *ac; - struct ldb_async_handle *h; + struct partition_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; @@ -66,7 +66,7 @@ static struct ldb_async_handle *partition_init_handle(struct ldb_request *req, s h->module = module; - ac = talloc_zero(h, struct partition_async_context); + ac = talloc_zero(h, struct partition_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); talloc_free(h); @@ -118,7 +118,7 @@ struct ldb_module *find_backend(struct ldb_module *module, struct ldb_request *r return module; }; -static int partition_send_search(struct partition_async_context *ac, struct ldb_module *partition) +static int partition_send_search(struct partition_context *ac, struct ldb_module *partition) { int ret; struct ldb_module *next = make_module_for_next_request(ac->module, ac->module->ldb, partition); @@ -159,8 +159,8 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req) * partitions (for 'invisible' partition behaviour */ if (ldb_get_opaque(module->ldb, "global_catalog")) { int ret, i; - struct ldb_async_handle *h; - struct partition_async_context *ac; + struct ldb_handle *h; + struct partition_context *ac; h = partition_init_handle(req, module); if (!h) { @@ -169,7 +169,7 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req) /* return our own handle to deal with this call */ req->async.handle = h; - ac = talloc_get_type(h->private_data, struct partition_async_context); + ac = talloc_get_type(h->private_data, struct partition_context); ac->orig_req = req; ac->num_searches = 0; @@ -518,8 +518,8 @@ static int partition_init(struct ldb_module *module) return ldb_next_init(module); } -static int partition_async_wait_none(struct ldb_async_handle *handle) { - struct partition_async_context *ac; +static int partition_wait_none(struct ldb_handle *handle) { + struct partition_context *ac; int ret; int i; @@ -534,10 +534,10 @@ static int partition_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 partition_async_context); + ac = talloc_get_type(handle->private_data, struct partition_context); for (i=0; i < ac->num_searches; i++) { - ret = ldb_async_wait(ac->search_req[i]->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->search_req[i]->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -561,12 +561,12 @@ done: } -static int partition_async_wait_all(struct ldb_async_handle *handle) { +static int partition_wait_all(struct ldb_handle *handle) { int ret; while (handle->state != LDB_ASYNC_DONE) { - ret = partition_async_wait_none(handle); + ret = partition_wait_none(handle); if (ret != LDB_SUCCESS) { return ret; } @@ -575,12 +575,12 @@ static int partition_async_wait_all(struct ldb_async_handle *handle) { return handle->status; } -static int partition_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int partition_wait(struct ldb_handle *handle, enum ldb_wait_type type) { if (type == LDB_WAIT_ALL) { - return partition_async_wait_all(handle); + return partition_wait_all(handle); } else { - return partition_async_wait_none(handle); + return partition_wait_none(handle); } } @@ -596,7 +596,7 @@ static const struct ldb_module_ops partition_ops = { .end_transaction = partition_end_trans, .del_transaction = partition_del_trans, .sequence_number = partition_sequence_number, - .async_wait = partition_async_wait + .wait = partition_wait }; int ldb_partition_init(void) diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index abb267d884..d6c2a45217 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -65,7 +65,7 @@ * */ -struct ph_async_context { +struct ph_context { enum ph_type {PH_ADD, PH_MOD} type; enum ph_step {PH_ADD_SEARCH_DOM, PH_ADD_DO_ADD, PH_MOD_DO_REQ, PH_MOD_SEARCH_SELF, PH_MOD_SEARCH_DOM, PH_MOD_DO_MOD} step; @@ -74,12 +74,12 @@ struct ph_async_context { struct ldb_request *orig_req; struct ldb_request *dom_req; - struct ldb_async_result *dom_res; + struct ldb_reply *dom_res; 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; @@ -418,12 +418,12 @@ static int setPwdHistory(struct ldb_module *module, struct ldb_message *msg, str return LDB_SUCCESS; } -static struct ldb_async_handle *ph_init_handle(struct ldb_request *req, struct ldb_module *module, enum ph_type type) +static struct ldb_handle *ph_init_handle(struct ldb_request *req, struct ldb_module *module, enum ph_type type) { - struct ph_async_context *ac; - struct ldb_async_handle *h; + struct ph_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; @@ -431,7 +431,7 @@ static struct ldb_async_handle *ph_init_handle(struct ldb_request *req, struct l h->module = module; - ac = talloc_zero(h, struct ph_async_context); + ac = talloc_zero(h, struct ph_context); if (ac == NULL) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory")); talloc_free(h); @@ -450,16 +450,16 @@ static struct ldb_async_handle *ph_init_handle(struct ldb_request *req, struct l return h; } -static int get_domain_data_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int get_domain_data_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - struct ph_async_context *ac; + struct ph_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 ph_async_context); + ac = talloc_get_type(context, struct ph_context); /* we are interested only in the single reply (base search) we receive here */ if (ares->type == LDB_REPLY_ENTRY) { @@ -476,7 +476,7 @@ static int get_domain_data_callback(struct ldb_context *ldb, void *context, stru return LDB_SUCCESS; } -static int build_domain_data_request(struct ph_async_context *ac) +static int build_domain_data_request(struct ph_context *ac) { /* attrs[] is returned from this function in ac->dom_req->op.search.attrs, so it must be static, as @@ -517,13 +517,13 @@ static int build_domain_data_request(struct ph_async_context *ac) return LDB_SUCCESS; } -static struct domain_data *get_domain_data(struct ldb_module *module, void *ctx, struct ldb_async_result *res) +static struct domain_data *get_domain_data(struct ldb_module *module, void *ctx, struct ldb_reply *res) { struct domain_data *data; const char *tmp; - struct ph_async_context *ac; + struct ph_context *ac; - ac = talloc_get_type(ctx, struct ph_async_context); + ac = talloc_get_type(ctx, struct ph_context); data = talloc_zero(ac, struct domain_data); if (data == NULL) { @@ -558,8 +558,8 @@ static struct domain_data *get_domain_data(struct ldb_module *module, void *ctx, static int password_hash_add(struct ldb_module *module, struct ldb_request *req) { - struct ldb_async_handle *h; - struct ph_async_context *ac; + struct ldb_handle *h; + struct ph_context *ac; struct ldb_message_element *sambaAttr; struct ldb_message_element *ntAttr; struct ldb_message_element *lmAttr; @@ -621,7 +621,7 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req) if (!h) { return LDB_ERR_OPERATIONS_ERROR; } - ac = talloc_get_type(h->private_data, struct ph_async_context); + ac = talloc_get_type(h->private_data, struct ph_context); /* get user domain data */ ac->domain_sid = samdb_result_sid_prefix(ac, req->op.add.message, "objectSid"); @@ -642,16 +642,16 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, ac->dom_req); } -static int password_hash_add_do_add(struct ldb_async_handle *h) { +static int password_hash_add_do_add(struct ldb_handle *h) { - struct ph_async_context *ac; + struct ph_context *ac; struct domain_data *domain; struct smb_krb5_context *smb_krb5_context; struct ldb_message_element *sambaAttr; struct ldb_message *msg; int ret; - ac = talloc_get_type(h->private_data, struct ph_async_context); + ac = talloc_get_type(h->private_data, struct ph_context); domain = get_domain_data(ac->module, ac, ac->dom_res); if (domain == NULL) { @@ -731,12 +731,12 @@ static int password_hash_add_do_add(struct ldb_async_handle *h) { return ldb_next_request(ac->module, ac->down_req); } -static int password_hash_mod_search_self(struct ldb_async_handle *h); +static int password_hash_mod_search_self(struct ldb_handle *h); static int password_hash_modify(struct ldb_module *module, struct ldb_request *req) { - struct ldb_async_handle *h; - struct ph_async_context *ac; + struct ldb_handle *h; + struct ph_context *ac; struct ldb_message_element *sambaAttr; struct ldb_message_element *ntAttr; struct ldb_message_element *lmAttr; @@ -784,7 +784,7 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r if (!h) { return LDB_ERR_OPERATIONS_ERROR; } - ac = talloc_get_type(h->private_data, struct ph_async_context); + ac = talloc_get_type(h->private_data, struct ph_context); /* return or own handle to deal with this call */ req->async.handle = h; @@ -824,16 +824,16 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r return ldb_next_request(module, ac->down_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 ph_async_context *ac; + struct ph_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 ph_async_context); + ac = talloc_get_type(context, struct ph_context); /* we are interested only in the single reply (base search) we receive here */ if (ares->type == LDB_REPLY_ENTRY) { @@ -859,9 +859,9 @@ static int get_self_callback(struct ldb_context *ldb, void *context, struct ldb_ return LDB_SUCCESS; } -static int password_hash_mod_search_self(struct ldb_async_handle *h) { +static int password_hash_mod_search_self(struct ldb_handle *h) { - struct ph_async_context *ac; + struct ph_context *ac; static const char * const attrs[] = { "userAccountControl", "sambaLMPwdHistory", "sambaNTPwdHistory", "objectSid", "msDS-KeyVersionNumber", @@ -870,7 +870,7 @@ static int password_hash_mod_search_self(struct ldb_async_handle *h) { "lmPwdHash", "ntPwdHash", NULL }; - ac = talloc_get_type(h->private_data, struct ph_async_context); + ac = talloc_get_type(h->private_data, struct ph_context); /* prepare the search operation */ ac->search_req = talloc_zero(ac, struct ldb_request); @@ -898,12 +898,12 @@ static int password_hash_mod_search_self(struct ldb_async_handle *h) { return ldb_next_request(ac->module, ac->search_req); } -static int password_hash_mod_search_dom(struct ldb_async_handle *h) { +static int password_hash_mod_search_dom(struct ldb_handle *h) { - struct ph_async_context *ac; + struct ph_context *ac; int ret; - ac = talloc_get_type(h->private_data, struct ph_async_context); + ac = talloc_get_type(h->private_data, struct ph_context); /* get object domain sid */ ac->domain_sid = samdb_result_sid_prefix(ac, ac->search_res->message, "objectSid"); @@ -923,9 +923,9 @@ static int password_hash_mod_search_dom(struct ldb_async_handle *h) { return ldb_next_request(ac->module, ac->dom_req); } -static int password_hash_mod_do_mod(struct ldb_async_handle *h) { +static int password_hash_mod_do_mod(struct ldb_handle *h) { - struct ph_async_context *ac; + struct ph_context *ac; struct domain_data *domain; struct smb_krb5_context *smb_krb5_context; struct ldb_message_element *sambaAttr; @@ -934,7 +934,7 @@ static int password_hash_mod_do_mod(struct ldb_async_handle *h) { int ret; BOOL added_hashes = False; - ac = talloc_get_type(h->private_data, struct ph_async_context); + ac = talloc_get_type(h->private_data, struct ph_context); domain = get_domain_data(ac->module, ac, ac->dom_res); if (domain == NULL) { @@ -1060,8 +1060,8 @@ static int password_hash_mod_do_mod(struct ldb_async_handle *h) { return ldb_next_request(ac->module, ac->mod_req); } -static int ph_async_wait(struct ldb_async_handle *handle) { - struct ph_async_context *ac; +static int ph_wait(struct ldb_handle *handle) { + struct ph_context *ac; int ret; if (!handle || !handle->private_data) { @@ -1075,11 +1075,11 @@ static int ph_async_wait(struct ldb_async_handle *handle) { handle->state = LDB_ASYNC_PENDING; handle->status = LDB_SUCCESS; - ac = talloc_get_type(handle->private_data, struct ph_async_context); + ac = talloc_get_type(handle->private_data, struct ph_context); switch (ac->step) { case PH_ADD_SEARCH_DOM: - ret = ldb_async_wait(ac->dom_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->dom_req->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -1098,7 +1098,7 @@ static int ph_async_wait(struct ldb_async_handle *handle) { return password_hash_add_do_add(handle); case PH_ADD_DO_ADD: - 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; @@ -1116,7 +1116,7 @@ static int ph_async_wait(struct ldb_async_handle *handle) { break; case PH_MOD_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; @@ -1135,7 +1135,7 @@ static int ph_async_wait(struct ldb_async_handle *handle) { return password_hash_mod_search_self(handle); case PH_MOD_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; @@ -1154,7 +1154,7 @@ static int ph_async_wait(struct ldb_async_handle *handle) { return password_hash_mod_search_dom(handle); case PH_MOD_SEARCH_DOM: - ret = ldb_async_wait(ac->dom_req->async.handle, LDB_WAIT_NONE); + ret = ldb_wait(ac->dom_req->async.handle, LDB_WAIT_NONE); if (ret != LDB_SUCCESS) { handle->status = ret; @@ -1173,7 +1173,7 @@ static int ph_async_wait(struct ldb_async_handle *handle) { return password_hash_mod_do_mod(handle); case PH_MOD_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; @@ -1202,12 +1202,12 @@ done: return ret; } -static int ph_async_wait_all(struct ldb_async_handle *handle) { +static int ph_wait_all(struct ldb_handle *handle) { int ret; while (handle->state != LDB_ASYNC_DONE) { - ret = ph_async_wait(handle); + ret = ph_wait(handle); if (ret != LDB_SUCCESS) { return ret; } @@ -1216,12 +1216,12 @@ static int ph_async_wait_all(struct ldb_async_handle *handle) { return handle->status; } -static int password_hash_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type) +static int password_hash_wait(struct ldb_handle *handle, enum ldb_wait_type type) { if (type == LDB_WAIT_ALL) { - return ph_async_wait_all(handle); + return ph_wait_all(handle); } else { - return ph_async_wait(handle); + return ph_wait(handle); } } @@ -1229,7 +1229,7 @@ static const struct ldb_module_ops password_hash_ops = { .name = "password_hash", .add = password_hash_add, .modify = password_hash_modify, - .async_wait = password_hash_async_wait + .wait = password_hash_wait }; diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index fd3d2d0fe7..01421d2817 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -142,12 +142,12 @@ failed: struct rootdse_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 rootdse_async_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares) +static int rootdse_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { struct rootdse_async_context *ac; -- cgit