diff options
Diffstat (limited to 'source3/librpc')
-rw-r--r-- | source3/librpc/gen_ndr/cli_wbint.c | 165 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_wbint.h | 14 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_wbint.c | 224 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_wbint.h | 11 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_wbint.c | 93 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_wbint.h | 2 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/wbint.h | 25 | ||||
-rw-r--r-- | source3/librpc/idl/wbint.idl | 17 |
8 files changed, 549 insertions, 2 deletions
diff --git a/source3/librpc/gen_ndr/cli_wbint.c b/source3/librpc/gen_ndr/cli_wbint.c index 07486c2e40..ab9d984a83 100644 --- a/source3/librpc/gen_ndr/cli_wbint.c +++ b/source3/librpc/gen_ndr/cli_wbint.c @@ -1801,3 +1801,168 @@ NTSTATUS rpccli_wbint_QuerySequenceNumber(struct rpc_pipe_client *cli, /* Return result */ return r.out.result; } + +struct rpccli_wbint_LookupGroupMembers_state { + struct wbint_LookupGroupMembers orig; + struct wbint_LookupGroupMembers tmp; + TALLOC_CTX *out_mem_ctx; + NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx); +}; + +static void rpccli_wbint_LookupGroupMembers_done(struct tevent_req *subreq); + +struct tevent_req *rpccli_wbint_LookupGroupMembers_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct rpc_pipe_client *cli, + struct dom_sid *_sid /* [in] [ref] */, + enum lsa_SidType _type /* [in] */, + struct wbint_GroupMembers *_members /* [out] [ref] */) +{ + struct tevent_req *req; + struct rpccli_wbint_LookupGroupMembers_state *state; + struct tevent_req *subreq; + + req = tevent_req_create(mem_ctx, &state, + struct rpccli_wbint_LookupGroupMembers_state); + if (req == NULL) { + return NULL; + } + state->out_mem_ctx = NULL; + state->dispatch_recv = cli->dispatch_recv; + + /* In parameters */ + state->orig.in.sid = _sid; + state->orig.in.type = _type; + + /* Out parameters */ + state->orig.out.members = _members; + + /* Result */ + ZERO_STRUCT(state->orig.out.result); + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(wbint_LookupGroupMembers, &state->orig); + } + + state->out_mem_ctx = talloc_named_const(state, 0, + "rpccli_wbint_LookupGroupMembers_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_LOOKUPGROUPMEMBERS, + &state->tmp); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, rpccli_wbint_LookupGroupMembers_done, req); + return req; +} + +static void rpccli_wbint_LookupGroupMembers_done(struct tevent_req *subreq) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct rpccli_wbint_LookupGroupMembers_state *state = tevent_req_data( + req, struct rpccli_wbint_LookupGroupMembers_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.members = *state->tmp.out.members; + + /* 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_LookupGroupMembers, &state->orig); + } + + tevent_req_done(req); +} + +NTSTATUS rpccli_wbint_LookupGroupMembers_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + NTSTATUS *result) +{ + struct rpccli_wbint_LookupGroupMembers_state *state = tevent_req_data( + req, struct rpccli_wbint_LookupGroupMembers_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_LookupGroupMembers(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct dom_sid *sid /* [in] [ref] */, + enum lsa_SidType type /* [in] */, + struct wbint_GroupMembers *members /* [out] [ref] */) +{ + struct wbint_LookupGroupMembers r; + NTSTATUS status; + + /* In parameters */ + r.in.sid = sid; + r.in.type = type; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(wbint_LookupGroupMembers, &r); + } + + status = cli->dispatch(cli, + mem_ctx, + &ndr_table_wbint, + NDR_WBINT_LOOKUPGROUPMEMBERS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(wbint_LookupGroupMembers, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *members = *r.out.members; + + /* Return result */ + return r.out.result; +} diff --git a/source3/librpc/gen_ndr/cli_wbint.h b/source3/librpc/gen_ndr/cli_wbint.h index ded93309ae..d5b333f42a 100644 --- a/source3/librpc/gen_ndr/cli_wbint.h +++ b/source3/librpc/gen_ndr/cli_wbint.h @@ -148,4 +148,18 @@ NTSTATUS rpccli_wbint_QuerySequenceNumber_recv(struct tevent_req *req, NTSTATUS rpccli_wbint_QuerySequenceNumber(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *sequence /* [out] [ref] */); +struct tevent_req *rpccli_wbint_LookupGroupMembers_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct rpc_pipe_client *cli, + struct dom_sid *_sid /* [in] [ref] */, + enum lsa_SidType _type /* [in] */, + struct wbint_GroupMembers *_members /* [out] [ref] */); +NTSTATUS rpccli_wbint_LookupGroupMembers_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + NTSTATUS *result); +NTSTATUS rpccli_wbint_LookupGroupMembers(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct dom_sid *sid /* [in] [ref] */, + enum lsa_SidType type /* [in] */, + struct wbint_GroupMembers *members /* [out] [ref] */); #endif /* __CLI_WBINT__ */ diff --git a/source3/librpc/gen_ndr/ndr_wbint.c b/source3/librpc/gen_ndr/ndr_wbint.c index 295b72f1cf..bb0d01b0b7 100644 --- a/source3/librpc/gen_ndr/ndr_wbint.c +++ b/source3/librpc/gen_ndr/ndr_wbint.c @@ -290,6 +290,140 @@ _PUBLIC_ void ndr_print_wbint_RidArray(struct ndr_print *ndr, const char *name, ndr->depth--; } +_PUBLIC_ enum ndr_err_code ndr_push_wbint_GroupMember(struct ndr_push *ndr, int ndr_flags, const struct wbint_GroupMember *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->sid)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->name)); + NDR_CHECK(ndr_push_lsa_SidType(ndr, NDR_SCALARS, r->type)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, ndr_charset_length(r->name, CH_UTF8), sizeof(uint8_t), CH_UTF8)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_wbint_GroupMember(struct ndr_pull *ndr, int ndr_flags, struct wbint_GroupMember *r) +{ + uint32_t _ptr_name; + TALLOC_CTX *_mem_save_name_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->sid)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name)); + if (_ptr_name) { + NDR_PULL_ALLOC(ndr, r->name); + } else { + r->name = NULL; + } + NDR_CHECK(ndr_pull_lsa_SidType(ndr, NDR_SCALARS, &r->type)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->name)); + if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->name), ndr_get_array_length(ndr, &r->name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->name), sizeof(uint8_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint8_t), CH_UTF8)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_wbint_GroupMember(struct ndr_print *ndr, const char *name, const struct wbint_GroupMember *r) +{ + ndr_print_struct(ndr, name, "wbint_GroupMember"); + ndr->depth++; + ndr_print_dom_sid(ndr, "sid", &r->sid); + ndr_print_ptr(ndr, "name", r->name); + ndr->depth++; + if (r->name) { + ndr_print_string(ndr, "name", r->name); + } + ndr->depth--; + ndr_print_lsa_SidType(ndr, "type", r->type); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_wbint_GroupMembers(struct ndr_push *ndr, int ndr_flags, const struct wbint_GroupMembers *r) +{ + uint32_t cntr_members_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_members)); + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_int32(ndr, NDR_SCALARS, r->num_members)); + for (cntr_members_0 = 0; cntr_members_0 < r->num_members; cntr_members_0++) { + NDR_CHECK(ndr_push_wbint_GroupMember(ndr, NDR_SCALARS, &r->members[cntr_members_0])); + } + } + if (ndr_flags & NDR_BUFFERS) { + for (cntr_members_0 = 0; cntr_members_0 < r->num_members; cntr_members_0++) { + NDR_CHECK(ndr_push_wbint_GroupMember(ndr, NDR_BUFFERS, &r->members[cntr_members_0])); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_wbint_GroupMembers(struct ndr_pull *ndr, int ndr_flags, struct wbint_GroupMembers *r) +{ + uint32_t cntr_members_0; + TALLOC_CTX *_mem_save_members_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_array_size(ndr, &r->members)); + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_int32(ndr, NDR_SCALARS, &r->num_members)); + NDR_PULL_ALLOC_N(ndr, r->members, ndr_get_array_size(ndr, &r->members)); + _mem_save_members_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->members, 0); + for (cntr_members_0 = 0; cntr_members_0 < r->num_members; cntr_members_0++) { + NDR_CHECK(ndr_pull_wbint_GroupMember(ndr, NDR_SCALARS, &r->members[cntr_members_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_members_0, 0); + if (r->members) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->members, r->num_members)); + } + } + if (ndr_flags & NDR_BUFFERS) { + _mem_save_members_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->members, 0); + for (cntr_members_0 = 0; cntr_members_0 < r->num_members; cntr_members_0++) { + NDR_CHECK(ndr_pull_wbint_GroupMember(ndr, NDR_BUFFERS, &r->members[cntr_members_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_members_0, 0); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_wbint_GroupMembers(struct ndr_print *ndr, const char *name, const struct wbint_GroupMembers *r) +{ + uint32_t cntr_members_0; + ndr_print_struct(ndr, name, "wbint_GroupMembers"); + ndr->depth++; + ndr_print_int32(ndr, "num_members", r->num_members); + ndr->print(ndr, "%s: ARRAY(%d)", "members", (int)r->num_members); + ndr->depth++; + for (cntr_members_0=0;cntr_members_0<r->num_members;cntr_members_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_members_0) != -1) { + ndr_print_wbint_GroupMember(ndr, "members", &r->members[cntr_members_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; +} + static enum ndr_err_code ndr_push_wbint_Ping(struct ndr_push *ndr, int flags, const struct wbint_Ping *r) { if (flags & NDR_IN) { @@ -1348,6 +1482,86 @@ _PUBLIC_ void ndr_print_wbint_QuerySequenceNumber(struct ndr_print *ndr, const c ndr->depth--; } +static enum ndr_err_code ndr_push_wbint_LookupGroupMembers(struct ndr_push *ndr, int flags, const struct wbint_LookupGroupMembers *r) +{ + if (flags & NDR_IN) { + if (r->in.sid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->in.sid)); + NDR_CHECK(ndr_push_lsa_SidType(ndr, NDR_SCALARS, r->in.type)); + } + if (flags & NDR_OUT) { + if (r->out.members == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_wbint_GroupMembers(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.members)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_wbint_LookupGroupMembers(struct ndr_pull *ndr, int flags, struct wbint_LookupGroupMembers *r) +{ + TALLOC_CTX *_mem_save_sid_0; + TALLOC_CTX *_mem_save_members_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sid); + } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->in.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_SidType(ndr, NDR_SCALARS, &r->in.type)); + NDR_PULL_ALLOC(ndr, r->out.members); + ZERO_STRUCTP(r->out.members); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.members); + } + _mem_save_members_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.members, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_wbint_GroupMembers(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.members)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_members_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_wbint_LookupGroupMembers(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupGroupMembers *r) +{ + ndr_print_struct(ndr, name, "wbint_LookupGroupMembers"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "wbint_LookupGroupMembers"); + ndr->depth++; + ndr_print_ptr(ndr, "sid", r->in.sid); + ndr->depth++; + ndr_print_dom_sid(ndr, "sid", r->in.sid); + ndr->depth--; + ndr_print_lsa_SidType(ndr, "type", r->in.type); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "wbint_LookupGroupMembers"); + ndr->depth++; + ndr_print_ptr(ndr, "members", r->out.members); + ndr->depth++; + ndr_print_wbint_GroupMembers(ndr, "members", r->out.members); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + static const struct ndr_interface_call wbint_calls[] = { { "wbint_Ping", @@ -1437,6 +1651,14 @@ static const struct ndr_interface_call wbint_calls[] = { (ndr_print_function_t) ndr_print_wbint_QuerySequenceNumber, false, }, + { + "wbint_LookupGroupMembers", + sizeof(struct wbint_LookupGroupMembers), + (ndr_push_flags_fn_t) ndr_push_wbint_LookupGroupMembers, + (ndr_pull_flags_fn_t) ndr_pull_wbint_LookupGroupMembers, + (ndr_print_function_t) ndr_print_wbint_LookupGroupMembers, + false, + }, { NULL, 0, NULL, NULL, NULL, false } }; @@ -1466,7 +1688,7 @@ const struct ndr_interface_table ndr_table_wbint = { NDR_WBINT_VERSION }, .helpstring = NDR_WBINT_HELPSTRING, - .num_calls = 11, + .num_calls = 12, .calls = wbint_calls, .endpoints = &wbint_endpoints, .authservices = &wbint_authservices diff --git a/source3/librpc/gen_ndr/ndr_wbint.h b/source3/librpc/gen_ndr/ndr_wbint.h index 4acdc404ec..f6871ada6b 100644 --- a/source3/librpc/gen_ndr/ndr_wbint.h +++ b/source3/librpc/gen_ndr/ndr_wbint.h @@ -33,7 +33,9 @@ extern const struct ndr_interface_table ndr_table_wbint; #define NDR_WBINT_QUERYSEQUENCENUMBER (0x0a) -#define NDR_WBINT_CALL_COUNT (11) +#define NDR_WBINT_LOOKUPGROUPMEMBERS (0x0b) + +#define NDR_WBINT_CALL_COUNT (12) enum ndr_err_code ndr_push_wbint_userinfo(struct ndr_push *ndr, int ndr_flags, const struct wbint_userinfo *r); enum ndr_err_code ndr_pull_wbint_userinfo(struct ndr_pull *ndr, int ndr_flags, struct wbint_userinfo *r); void ndr_print_wbint_userinfo(struct ndr_print *ndr, const char *name, const struct wbint_userinfo *r); @@ -43,6 +45,12 @@ void ndr_print_wbint_SidArray(struct ndr_print *ndr, const char *name, const str enum ndr_err_code ndr_push_wbint_RidArray(struct ndr_push *ndr, int ndr_flags, const struct wbint_RidArray *r); enum ndr_err_code ndr_pull_wbint_RidArray(struct ndr_pull *ndr, int ndr_flags, struct wbint_RidArray *r); void ndr_print_wbint_RidArray(struct ndr_print *ndr, const char *name, const struct wbint_RidArray *r); +enum ndr_err_code ndr_push_wbint_GroupMember(struct ndr_push *ndr, int ndr_flags, const struct wbint_GroupMember *r); +enum ndr_err_code ndr_pull_wbint_GroupMember(struct ndr_pull *ndr, int ndr_flags, struct wbint_GroupMember *r); +void ndr_print_wbint_GroupMember(struct ndr_print *ndr, const char *name, const struct wbint_GroupMember *r); +enum ndr_err_code ndr_push_wbint_GroupMembers(struct ndr_push *ndr, int ndr_flags, const struct wbint_GroupMembers *r); +enum ndr_err_code ndr_pull_wbint_GroupMembers(struct ndr_pull *ndr, int ndr_flags, struct wbint_GroupMembers *r); +void ndr_print_wbint_GroupMembers(struct ndr_print *ndr, const char *name, const struct wbint_GroupMembers *r); void ndr_print_wbint_Ping(struct ndr_print *ndr, const char *name, int flags, const struct wbint_Ping *r); void ndr_print_wbint_LookupSid(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupSid *r); void ndr_print_wbint_LookupName(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupName *r); @@ -54,4 +62,5 @@ void ndr_print_wbint_QueryUser(struct ndr_print *ndr, const char *name, int flag void ndr_print_wbint_LookupUserAliases(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupUserAliases *r); void ndr_print_wbint_LookupUserGroups(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupUserGroups *r); void ndr_print_wbint_QuerySequenceNumber(struct ndr_print *ndr, const char *name, int flags, const struct wbint_QuerySequenceNumber *r); +void ndr_print_wbint_LookupGroupMembers(struct ndr_print *ndr, const char *name, int flags, const struct wbint_LookupGroupMembers *r); #endif /* _HEADER_NDR_wbint */ diff --git a/source3/librpc/gen_ndr/srv_wbint.c b/source3/librpc/gen_ndr/srv_wbint.c index 1c2799c165..f8fb3209e6 100644 --- a/source3/librpc/gen_ndr/srv_wbint.c +++ b/source3/librpc/gen_ndr/srv_wbint.c @@ -904,6 +904,86 @@ static bool api_wbint_QuerySequenceNumber(pipes_struct *p) return true; } +static bool api_wbint_LookupGroupMembers(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_LookupGroupMembers *r; + + call = &ndr_table_wbint.calls[NDR_WBINT_LOOKUPGROUPMEMBERS]; + + r = talloc(talloc_tos(), struct wbint_LookupGroupMembers); + 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_LookupGroupMembers, r); + } + + ZERO_STRUCT(r->out); + r->out.members = talloc_zero(r, struct wbint_GroupMembers); + if (r->out.members == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _wbint_LookupGroupMembers(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_LookupGroupMembers, 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[] = @@ -919,6 +999,7 @@ static struct api_struct api_wbint_cmds[] = {"WBINT_LOOKUPUSERALIASES", NDR_WBINT_LOOKUPUSERALIASES, api_wbint_LookupUserAliases}, {"WBINT_LOOKUPUSERGROUPS", NDR_WBINT_LOOKUPUSERGROUPS, api_wbint_LookupUserGroups}, {"WBINT_QUERYSEQUENCENUMBER", NDR_WBINT_QUERYSEQUENCENUMBER, api_wbint_QuerySequenceNumber}, + {"WBINT_LOOKUPGROUPMEMBERS", NDR_WBINT_LOOKUPGROUPMEMBERS, api_wbint_LookupGroupMembers}, }; void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns) @@ -1082,6 +1163,18 @@ NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co return NT_STATUS_OK; } + case NDR_WBINT_LOOKUPGROUPMEMBERS: { + struct wbint_LookupGroupMembers *r = (struct wbint_LookupGroupMembers *)_r; + ZERO_STRUCT(r->out); + r->out.members = talloc_zero(mem_ctx, struct wbint_GroupMembers); + if (r->out.members == NULL) { + return NT_STATUS_NO_MEMORY; + } + + r->out.result = _wbint_LookupGroupMembers(cli->pipes_struct, r); + return NT_STATUS_OK; + } + default: return NT_STATUS_NOT_IMPLEMENTED; } diff --git a/source3/librpc/gen_ndr/srv_wbint.h b/source3/librpc/gen_ndr/srv_wbint.h index 5749b1e9ae..324425a248 100644 --- a/source3/librpc/gen_ndr/srv_wbint.h +++ b/source3/librpc/gen_ndr/srv_wbint.h @@ -12,6 +12,7 @@ NTSTATUS _wbint_QueryUser(pipes_struct *p, struct wbint_QueryUser *r); NTSTATUS _wbint_LookupUserAliases(pipes_struct *p, struct wbint_LookupUserAliases *r); NTSTATUS _wbint_LookupUserGroups(pipes_struct *p, struct wbint_LookupUserGroups *r); NTSTATUS _wbint_QuerySequenceNumber(pipes_struct *p, struct wbint_QuerySequenceNumber *r); +NTSTATUS _wbint_LookupGroupMembers(pipes_struct *p, struct wbint_LookupGroupMembers *r); void wbint_get_pipe_fns(struct api_struct **fns, int *n_fns); NTSTATUS rpc_wbint_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r); void _wbint_Ping(pipes_struct *p, struct wbint_Ping *r); @@ -25,5 +26,6 @@ NTSTATUS _wbint_QueryUser(pipes_struct *p, struct wbint_QueryUser *r); NTSTATUS _wbint_LookupUserAliases(pipes_struct *p, struct wbint_LookupUserAliases *r); NTSTATUS _wbint_LookupUserGroups(pipes_struct *p, struct wbint_LookupUserGroups *r); NTSTATUS _wbint_QuerySequenceNumber(pipes_struct *p, struct wbint_QuerySequenceNumber *r); +NTSTATUS _wbint_LookupGroupMembers(pipes_struct *p, struct wbint_LookupGroupMembers *r); NTSTATUS rpc_wbint_init(void); #endif /* __SRV_WBINT__ */ diff --git a/source3/librpc/gen_ndr/wbint.h b/source3/librpc/gen_ndr/wbint.h index c5caa79a4b..7ed1fb2753 100644 --- a/source3/librpc/gen_ndr/wbint.h +++ b/source3/librpc/gen_ndr/wbint.h @@ -28,6 +28,17 @@ struct wbint_RidArray { uint32_t *rids;/* [size_is(num_rids)] */ }/* [public] */; +struct wbint_GroupMember { + struct dom_sid sid; + const char *name;/* [unique,charset(UTF8)] */ + enum lsa_SidType type; +}/* [public] */; + +struct wbint_GroupMembers { + int32_t num_members; + struct wbint_GroupMember *members;/* [size_is(num_members)] */ +}/* [public] */; + struct wbint_Ping { struct { @@ -175,4 +186,18 @@ struct wbint_QuerySequenceNumber { }; + +struct wbint_LookupGroupMembers { + struct { + struct dom_sid *sid;/* [ref] */ + enum lsa_SidType type; + } in; + + struct { + struct wbint_GroupMembers *members;/* [ref] */ + NTSTATUS result; + } out; + +}; + #endif /* _HEADER_wbint */ diff --git a/source3/librpc/idl/wbint.idl b/source3/librpc/idl/wbint.idl index a4aab7c1ac..b7a1ce37ad 100644 --- a/source3/librpc/idl/wbint.idl +++ b/source3/librpc/idl/wbint.idl @@ -92,4 +92,21 @@ interface wbint NTSTATUS wbint_QuerySequenceNumber( [out] uint32 *sequence ); + + typedef [public] struct { + dom_sid sid; + [string,charset(UTF8)] char *name; + lsa_SidType type; + } wbint_GroupMember; + + typedef [public] struct { + int num_members; + [size_is(num_members)] wbint_GroupMember members[]; + } wbint_GroupMembers; + + NTSTATUS wbint_LookupGroupMembers( + [in] dom_sid *sid, + [in] lsa_SidType type, + [out] wbint_GroupMembers *members + ); }
\ No newline at end of file |