From 0cae043b0c1d2fa55f6709230658155caaecb4fc Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 30 Aug 2009 09:46:34 +0200 Subject: w3:winbind: Convert WINBINDD_ALLOCATE_GID to the new API --- source3/librpc/gen_ndr/srv_wbint.c | 93 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 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 498784d249..cc62b4067b 100644 --- a/source3/librpc/gen_ndr/srv_wbint.c +++ b/source3/librpc/gen_ndr/srv_wbint.c @@ -664,6 +664,86 @@ static bool api_wbint_AllocateUid(pipes_struct *p) return true; } +static bool api_wbint_AllocateGid(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_AllocateGid *r; + + call = &ndr_table_wbint.calls[NDR_WBINT_ALLOCATEGID]; + + r = talloc(talloc_tos(), struct wbint_AllocateGid); + 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_AllocateGid, r); + } + + ZERO_STRUCT(r->out); + r->out.gid = talloc_zero(r, uint64_t); + if (r->out.gid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _wbint_AllocateGid(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_AllocateGid, 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; +} + static bool api_wbint_QueryUser(pipes_struct *p) { const struct ndr_interface_call *call; @@ -1396,6 +1476,7 @@ static struct api_struct api_wbint_cmds[] = {"WBINT_UID2SID", NDR_WBINT_UID2SID, api_wbint_Uid2Sid}, {"WBINT_GID2SID", NDR_WBINT_GID2SID, api_wbint_Gid2Sid}, {"WBINT_ALLOCATEUID", NDR_WBINT_ALLOCATEUID, api_wbint_AllocateUid}, + {"WBINT_ALLOCATEGID", NDR_WBINT_ALLOCATEGID, api_wbint_AllocateGid}, {"WBINT_QUERYUSER", NDR_WBINT_QUERYUSER, api_wbint_QueryUser}, {"WBINT_LOOKUPUSERALIASES", NDR_WBINT_LOOKUPUSERALIASES, api_wbint_LookupUserAliases}, {"WBINT_LOOKUPUSERGROUPS", NDR_WBINT_LOOKUPUSERGROUPS, api_wbint_LookupUserGroups}, @@ -1532,6 +1613,18 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co return NT_STATUS_OK; } + case NDR_WBINT_ALLOCATEGID: { + struct wbint_AllocateGid *r = (struct wbint_AllocateGid *)_r; + ZERO_STRUCT(r->out); + r->out.gid = talloc_zero(mem_ctx, uint64_t); + if (r->out.gid == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wbint_AllocateGid(cli->pipes_struct, r); + return NT_STATUS_OK; + } + case NDR_WBINT_QUERYUSER: { struct wbint_QueryUser *r = (struct wbint_QueryUser *)_r; ZERO_STRUCT(r->out); -- cgit