diff options
author | Volker Lendecke <vl@samba.org> | 2009-08-04 16:07:01 -0400 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-08-05 03:21:25 -0400 |
commit | 1dc1ac00512a28bdc025b00fbfa676b0f5b15751 (patch) | |
tree | 5f84b6351c3fb3f8a1248bc8bdf4d792dbb95a43 /source3/librpc/gen_ndr/cli_wbint.c | |
parent | 718a26fd29036cc200cdc1c320733eafe84d2337 (diff) | |
download | samba-1dc1ac00512a28bdc025b00fbfa676b0f5b15751.tar.gz samba-1dc1ac00512a28bdc025b00fbfa676b0f5b15751.tar.bz2 samba-1dc1ac00512a28bdc025b00fbfa676b0f5b15751.zip |
s3:winbind: Add async wb_lookupusergroups
Diffstat (limited to 'source3/librpc/gen_ndr/cli_wbint.c')
-rw-r--r-- | source3/librpc/gen_ndr/cli_wbint.c | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/source3/librpc/gen_ndr/cli_wbint.c b/source3/librpc/gen_ndr/cli_wbint.c index 30eb8e53d4..de6b345a0e 100644 --- a/source3/librpc/gen_ndr/cli_wbint.c +++ b/source3/librpc/gen_ndr/cli_wbint.c @@ -1484,3 +1484,164 @@ NTSTATUS rpccli_wbint_LookupUserAliases(struct rpc_pipe_client *cli, return r.out.result; } +struct rpccli_wbint_LookupUserGroups_state { + struct wbint_LookupUserGroups orig; + struct wbint_LookupUserGroups tmp; + TALLOC_CTX *out_mem_ctx; + NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx); +}; + +static void rpccli_wbint_LookupUserGroups_done(struct tevent_req *subreq); + +struct tevent_req *rpccli_wbint_LookupUserGroups_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct rpc_pipe_client *cli, + struct dom_sid *_sid /* [in] [ref] */, + struct wbint_SidArray *_sids /* [out] [ref] */) +{ + struct tevent_req *req; + struct rpccli_wbint_LookupUserGroups_state *state; + struct tevent_req *subreq; + + req = tevent_req_create(mem_ctx, &state, + struct rpccli_wbint_LookupUserGroups_state); + if (req == NULL) { + return NULL; + } + state->out_mem_ctx = NULL; + state->dispatch_recv = cli->dispatch_recv; + + /* In parameters */ + state->orig.in.sid = _sid; + + /* Out parameters */ + state->orig.out.sids = _sids; + + /* Result */ + ZERO_STRUCT(state->orig.out.result); + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(wbint_LookupUserGroups, &state->orig); + } + + state->out_mem_ctx = talloc_named_const(state, 0, + "rpccli_wbint_LookupUserGroups_out_memory"); + if (tevent_req_nomem(state->out_mem_ctx, req)) { + return tevent_req_post(req, ev); + } + + /* make a temporary copy, that we pass to the dispatch function */ + state->tmp = state->orig; + + subreq = cli->dispatch_send(state, ev, cli, + &ndr_table_wbint, + NDR_WBINT_LOOKUPUSERGROUPS, + &state->tmp); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, rpccli_wbint_LookupUserGroups_done, req); + return req; +} + +static void rpccli_wbint_LookupUserGroups_done(struct tevent_req *subreq) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct rpccli_wbint_LookupUserGroups_state *state = tevent_req_data( + req, struct rpccli_wbint_LookupUserGroups_state); + NTSTATUS status; + TALLOC_CTX *mem_ctx; + + if (state->out_mem_ctx) { + mem_ctx = state->out_mem_ctx; + } else { + mem_ctx = state; + } + + status = state->dispatch_recv(subreq, mem_ctx); + TALLOC_FREE(subreq); + if (!NT_STATUS_IS_OK(status)) { + tevent_req_nterror(req, status); + return; + } + + /* Copy out parameters */ + *state->orig.out.sids = *state->tmp.out.sids; + + /* Copy result */ + state->orig.out.result = state->tmp.out.result; + + /* Reset temporary structure */ + ZERO_STRUCT(state->tmp); + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(wbint_LookupUserGroups, &state->orig); + } + + tevent_req_done(req); +} + +NTSTATUS rpccli_wbint_LookupUserGroups_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + NTSTATUS *result) +{ + struct rpccli_wbint_LookupUserGroups_state *state = tevent_req_data( + req, struct rpccli_wbint_LookupUserGroups_state); + NTSTATUS status; + + if (tevent_req_is_nterror(req, &status)) { + tevent_req_received(req); + return status; + } + + /* Steal possbile out parameters to the callers context */ + talloc_steal(mem_ctx, state->out_mem_ctx); + + /* Return result */ + *result = state->orig.out.result; + + tevent_req_received(req); + return NT_STATUS_OK; +} + +NTSTATUS rpccli_wbint_LookupUserGroups(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct dom_sid *sid /* [in] [ref] */, + struct wbint_SidArray *sids /* [out] [ref] */) +{ + struct wbint_LookupUserGroups r; + NTSTATUS status; + + /* In parameters */ + r.in.sid = sid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(wbint_LookupUserGroups, &r); + } + + status = cli->dispatch(cli, + mem_ctx, + &ndr_table_wbint, + NDR_WBINT_LOOKUPUSERGROUPS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(wbint_LookupUserGroups, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *sids = *r.out.sids; + + /* Return result */ + return r.out.result; +} + |