From bb359c780aee3fd7e1074db93a28c95590ae5d36 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 3 Aug 2009 23:44:46 +0200 Subject: s3:winbind: Add async wb_lookupsid --- source3/librpc/gen_ndr/srv_wbint.c | 115 +++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) (limited to 'source3/librpc/gen_ndr/srv_wbint.c') diff --git a/source3/librpc/gen_ndr/srv_wbint.c b/source3/librpc/gen_ndr/srv_wbint.c index 0a3569b874..85ebf5dd3a 100644 --- a/source3/librpc/gen_ndr/srv_wbint.c +++ b/source3/librpc/gen_ndr/srv_wbint.c @@ -86,11 +86,104 @@ static bool api_wbint_Ping(pipes_struct *p) return true; } +static bool api_wbint_LookupSid(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct wbint_LookupSid *r; + + call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPSID]; + + r = talloc(talloc_tos(), struct wbint_LookupSid); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r, NULL); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(wbint_LookupSid, r); + } + + ZERO_STRUCT(r->out); + r->out.type = talloc_zero(r, enum lsa_SidType); + if (r->out.type == NULL) { + talloc_free(r); + return false; + } + + r->out.domain = talloc_zero(r, const char *); + if (r->out.domain == NULL) { + talloc_free(r); + return false; + } + + r->out.name = talloc_zero(r, const char *); + if (r->out.name == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _wbint_LookupSid(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(wbint_LookupSid, r); + } + + push = ndr_push_init_ctx(r, NULL); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + /* Tables */ static struct api_struct api_wbint_cmds[] = { {"WBINT_PING", NDR_WBINT_PING, api_wbint_Ping}, + {"WBINT_LOOKUPSID", NDR_WBINT_LOOKUPSID, api_wbint_LookupSid}, }; void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns) @@ -119,6 +212,28 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co return NT_STATUS_OK; } + case NDR_WBINT_LOOKUPSID: { + struct wbint_LookupSid *r = (struct wbint_LookupSid *)_r; + ZERO_STRUCT(r->out); + r->out.type = talloc_zero(mem_ctx, enum lsa_SidType); + if (r->out.type == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.domain = talloc_zero(mem_ctx, const char *); + if (r->out.domain == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.name = talloc_zero(mem_ctx, const char *); + if (r->out.name == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wbint_LookupSid(cli->pipes_struct, r); + return NT_STATUS_OK; + } + default: return NT_STATUS_NOT_IMPLEMENTED; } -- cgit