Author: mkhl Date: 2006-07-15 09:22:24 +0000 (Sat, 15 Jul 2006) New Revision: 17056
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17056 Log: Defer setting async handled until *after* the up request was copied. When an async handle is likely to still have been copied, reset to NULL. Martin Modified: branches/SOC/mkhl/ldb-map/modules/ldb_map.c Changeset: Modified: branches/SOC/mkhl/ldb-map/modules/ldb_map.c =================================================================== --- branches/SOC/mkhl/ldb-map/modules/ldb_map.c 2006-07-15 09:16:41 UTC (rev 17055) +++ branches/SOC/mkhl/ldb-map/modules/ldb_map.c 2006-07-15 09:22:24 UTC (rev 17056) @@ -2136,9 +2136,6 @@ return LDB_ERR_OPERATIONS_ERROR; ac = talloc_get_type(h->private_data, struct map_async_context); - /* return or own handle to deal with this call */ - req->async.handle = h; - /* prepare the local operation */ ac->local_req = talloc(ac, struct ldb_request); if (ac->local_req == NULL) { @@ -2193,6 +2190,9 @@ if (ldb_msg_add_string(local, IS_MAPPED, dn) != 0) goto failed; + /* return or own handle to deal with this call */ + req->async.handle = h; + ldb_set_timeout_from_prev_req(module->ldb, req, ac->remote_req); /* continue with the remote request */ @@ -2299,9 +2299,6 @@ return LDB_ERR_OPERATIONS_ERROR; ac = talloc_get_type(h->private_data, struct map_async_context); - /* return or own handle to deal with this call */ - req->async.handle = h; - /* prepare the local operation */ ac->local_req = talloc(ac, struct ldb_request); if (ac->local_req == NULL) { @@ -2358,6 +2355,9 @@ ac->step = MAP_SEARCH_SELF_MODIFY; + /* return or own handle to deal with this call */ + req->async.handle = h; + return ldb_next_request(module, ac->search_req); failed: @@ -2385,8 +2385,10 @@ *(ac->local_req) = *(ac->orig_req); /* copy the request */ + ac->local_req->async.handle = NULL; ac->local_req->async.context = NULL; ac->local_req->async.callback = NULL; + ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->local_req); @@ -2420,8 +2422,10 @@ *(ac->remote_req) = *(ac->orig_req); /* copy the request */ + ac->remote_req->async.handle = NULL; ac->remote_req->async.context = NULL; ac->remote_req->async.callback = NULL; + ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->remote_req); @@ -2460,14 +2464,14 @@ return LDB_ERR_OPERATIONS_ERROR; ac = talloc_get_type(h->private_data, struct map_async_context); - /* return or own handle to deal with this call */ - req->async.handle = h; - /* prepare the search operation */ ac->search_req = search_self_req(ac, req->op.del.dn); if (ac->search_req == NULL) return LDB_ERR_OPERATIONS_ERROR; + /* return or own handle to deal with this call */ + req->async.handle = h; + ac->step = MAP_SEARCH_SELF_DELETE; return ldb_next_request(module, ac->search_req); @@ -2492,8 +2496,10 @@ *(ac->local_req) = *(ac->orig_req); /* copy the request */ + ac->local_req->async.handle = NULL; ac->local_req->async.context = NULL; ac->local_req->async.callback = NULL; + ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->local_req); @@ -2543,8 +2549,10 @@ ac->down_req->operation = LDB_MODIFY; ac->down_req->op.mod.message = msg; ac->down_req->controls = NULL; + ac->down_req->async.handle = NULL; ac->down_req->async.context = NULL; ac->down_req->async.callback = NULL; + ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->down_req); @@ -2582,8 +2590,10 @@ *(ac->remote_req) = *(ac->orig_req); /* copy the request */ + ac->remote_req->async.handle = NULL; ac->remote_req->async.context = NULL; ac->remote_req->async.callback = NULL; + ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->remote_req); @@ -2630,14 +2640,14 @@ return LDB_ERR_OPERATIONS_ERROR; ac = talloc_get_type(h->private_data, struct map_async_context); - /* return or own handle to deal with this call */ - req->async.handle = h; - /* prepare the search operation */ ac->search_req = search_self_req(ac, req->op.rename.olddn); if (ac->search_req == NULL) return LDB_ERR_OPERATIONS_ERROR; + /* return or own handle to deal with this call */ + req->async.handle = h; + ac->step = MAP_SEARCH_SELF_RENAME; return ldb_next_request(module, ac->search_req);