diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-11-05 09:34:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:45:47 -0500 |
commit | 6b6a739eca1e16c0c101289b1984a639fce10223 (patch) | |
tree | eb3e8b8e54449535e1d713c79f90e08d0850f0a9 /source4/winbind/wb_cmd_lookupsid.c | |
parent | 687dea8de634d6d0e1e4ee9a0550f258cd63a014 (diff) | |
download | samba-6b6a739eca1e16c0c101289b1984a639fce10223.tar.gz samba-6b6a739eca1e16c0c101289b1984a639fce10223.tar.bz2 samba-6b6a739eca1e16c0c101289b1984a639fce10223.zip |
r11517: Cleanup time, this looks larger than it is. This mainly gets rid of
wb_domain_request, now that we have queued rpc requests.
Volker
(This used to be commit 848522d1b64c1c283ac1ea7ce7f1a7a1b014a2aa)
Diffstat (limited to 'source4/winbind/wb_cmd_lookupsid.c')
-rw-r--r-- | source4/winbind/wb_cmd_lookupsid.c | 65 |
1 files changed, 40 insertions, 25 deletions
diff --git a/source4/winbind/wb_cmd_lookupsid.c b/source4/winbind/wb_cmd_lookupsid.c index a92b2ea183..450fc86aae 100644 --- a/source4/winbind/wb_cmd_lookupsid.c +++ b/source4/winbind/wb_cmd_lookupsid.c @@ -32,54 +32,69 @@ struct cmd_lookupsid_state { struct wb_sid_object *result; }; -static struct composite_context *lookupsid_send_req(struct wbsrv_domain *domain, void *p); -static NTSTATUS lookupsid_recv_req(struct composite_context *ctx, void *p); +static void lookupsid_recv_domain(struct composite_context *ctx); +static void lookupsid_recv_names(struct composite_context *ctx); struct composite_context *wb_cmd_lookupsid_send(TALLOC_CTX *mem_ctx, struct wbsrv_service *service, const struct dom_sid *sid) { + struct composite_context *result, *ctx; struct cmd_lookupsid_state *state; - state = talloc(mem_ctx, struct cmd_lookupsid_state); + result = talloc(mem_ctx, struct composite_context); + if (result == NULL) goto failed; + result->state = COMPOSITE_STATE_IN_PROGRESS; + result->async.fn = NULL; + result->event_ctx = service->task->event_ctx; + + state = talloc(result, struct cmd_lookupsid_state); + if (state == NULL) goto failed; + state->ctx = result; + result->private_data = state; + state->sid = dom_sid_dup(state, sid); if (state->sid == NULL) goto failed; - state->ctx = wb_domain_request_send(state, service, - service->primary_sid, - lookupsid_send_req, - lookupsid_recv_req, - state); - if (state->ctx == NULL) goto failed; - state->ctx->private_data = state; - return state->ctx; + + ctx = wb_sid2domain_send(state, service, service->primary_sid); + if (ctx == NULL) goto failed; + + ctx->async.fn = lookupsid_recv_domain; + ctx->async.private_data = state; + return result; failed: - talloc_free(state); + talloc_free(result); return NULL; } -static struct composite_context *lookupsid_send_req(struct wbsrv_domain *domain, void *p) +static void lookupsid_recv_domain(struct composite_context *ctx) { struct cmd_lookupsid_state *state = - talloc_get_type(p, struct cmd_lookupsid_state); + talloc_get_type(ctx->async.private_data, + struct cmd_lookupsid_state); + struct wbsrv_domain *domain; - return wb_lsa_lookupsids_send(domain->lsa_pipe, - domain->lsa_policy, - 1, &state->sid); + state->ctx->status = wb_sid2domain_recv(ctx, &domain); + if (!composite_is_ok(state->ctx)) return; + + ctx = wb_lsa_lookupsids_send(state, domain->lsa_pipe, + domain->lsa_policy, 1, &state->sid); + composite_continue(state->ctx, ctx, lookupsid_recv_names, state); } -static NTSTATUS lookupsid_recv_req(struct composite_context *ctx, void *p) +static void lookupsid_recv_names(struct composite_context *ctx) { struct cmd_lookupsid_state *state = - talloc_get_type(p, struct cmd_lookupsid_state); + talloc_get_type(ctx->async.private_data, + struct cmd_lookupsid_state); struct wb_sid_object **names; - NTSTATUS status; - status = wb_lsa_lookupsids_recv(ctx, state, &names); - if (NT_STATUS_IS_OK(status)) { - state->result = names[0]; - } - return status; + state->ctx->status = wb_lsa_lookupsids_recv(ctx, state, &names); + if (!composite_is_ok(state->ctx)) return; + + state->result = names[0]; + composite_done(state->ctx); } NTSTATUS wb_cmd_lookupsid_recv(struct composite_context *c, |