summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/password_hash.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-05-28 02:10:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:39 -0500
commit90a5e19e03842b77fd7811965fb2603e552261bc (patch)
tree211bda772b224b6cfdc54e5b3fc1857fc539d9dd /source4/dsdb/samdb/ldb_modules/password_hash.c
parent53107aed4a45f28aa1a159019ff4c3b45fbc8f02 (diff)
downloadsamba-90a5e19e03842b77fd7811965fb2603e552261bc.tar.gz
samba-90a5e19e03842b77fd7811965fb2603e552261bc.tar.bz2
samba-90a5e19e03842b77fd7811965fb2603e552261bc.zip
r15913: Error passing in the async code is not in agood shape
Start enhancing it and fix some problems with incorrect evalutaion of the codes Implement rdn rename (async only) (This used to be commit 6af1d738b9668d4f0eb6194ac0f84af9e73f8c2e)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/password_hash.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c110
1 files changed, 73 insertions, 37 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 2885fb82a2..67cb01b9d8 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -1680,82 +1680,119 @@ 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);
switch (ac->step) {
case PH_ADD_SEARCH_DOM:
- if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
- ret = ldb_async_wait(ac->dom_req->async.handle, LDB_WAIT_NONE);
- if (ret != LDB_SUCCESS) goto done;
+ ret = ldb_async_wait(ac->dom_req->async.handle, LDB_WAIT_NONE);
- if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
- return LDB_SUCCESS;
- }
+ 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;
+ goto done;
+ }
+
+ if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
+ return LDB_SUCCESS;
}
/* domain search done, go on */
return password_hash_add_async_do_add(handle);
case PH_ADD_DO_ADD:
- if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
- ret = ldb_async_wait(ac->down_req->async.handle, LDB_WAIT_NONE);
- if (ret != LDB_SUCCESS) goto done;
+ ret = ldb_async_wait(ac->down_req->async.handle, LDB_WAIT_NONE);
- if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
- return LDB_SUCCESS;
- }
+ 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;
+ goto done;
+ }
+
+ if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
+ return LDB_SUCCESS;
}
break;
case PH_MOD_DO_REQ:
- if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
- ret = ldb_async_wait(ac->down_req->async.handle, LDB_WAIT_NONE);
- if (ret != LDB_SUCCESS) goto done;
+ ret = ldb_async_wait(ac->down_req->async.handle, LDB_WAIT_NONE);
- if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
- return LDB_SUCCESS;
- }
+ 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;
+ goto done;
+ }
+
+ if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
+ return LDB_SUCCESS;
}
/* non-password mods done, go on */
return password_hash_mod_async_search_self(handle);
case PH_MOD_SEARCH_SELF:
- if (ac->search_req->async.handle->state != LDB_ASYNC_DONE) {
- ret = ldb_async_wait(ac->search_req->async.handle, LDB_WAIT_NONE);
- if (ret != LDB_SUCCESS) goto done;
+ ret = ldb_async_wait(ac->search_req->async.handle, LDB_WAIT_NONE);
- if (ac->search_req->async.handle->state != LDB_ASYNC_DONE) {
- return LDB_SUCCESS;
- }
+ 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;
+ goto done;
+ }
+
+ if (ac->search_req->async.handle->state != LDB_ASYNC_DONE) {
+ return LDB_SUCCESS;
}
/* self search done, go on */
return password_hash_mod_async_search_dom(handle);
case PH_MOD_SEARCH_DOM:
- if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
- ret = ldb_async_wait(ac->dom_req->async.handle, LDB_WAIT_NONE);
- if (ret != LDB_SUCCESS) goto done;
+ ret = ldb_async_wait(ac->dom_req->async.handle, LDB_WAIT_NONE);
- if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
- return LDB_SUCCESS;
- }
+ 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;
+ goto done;
+ }
+
+ if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
+ return LDB_SUCCESS;
}
/* domain search done, go on */
return password_hash_mod_async_do_mod(handle);
case PH_MOD_DO_MOD:
- if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) {
- ret = ldb_async_wait(ac->mod_req->async.handle, LDB_WAIT_NONE);
- if (ret != LDB_SUCCESS) goto done;
+ ret = ldb_async_wait(ac->mod_req->async.handle, LDB_WAIT_NONE);
- if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) {
- return LDB_SUCCESS;
- }
+ 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;
+ goto done;
+ }
+
+ if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) {
+ return LDB_SUCCESS;
}
break;
@@ -1769,7 +1806,6 @@ static int ph_async_wait(struct ldb_async_handle *handle) {
done:
handle->state = LDB_ASYNC_DONE;
- handle->status = ret;
return ret;
}