struct cli_do_rpc_ndr_state {
const struct ndr_interface_call *call;
- prs_struct q_ps, r_ps;
+ prs_struct q_ps;
+ DATA_BLOB r_pdu;
void *r;
};
struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct rpc_pipe_client *cli,
- const char *interface,
- uint32_t interface_version,
+ const struct ndr_interface_table *table,
uint32_t opnum,
void *r)
{
struct tevent_req *req, *subreq;
struct cli_do_rpc_ndr_state *state;
- struct ndr_syntax_id syntax;
- const struct ndr_interface_table *table;
struct ndr_push *push;
DATA_BLOB blob;
enum ndr_err_code ndr_err;
return NULL;
}
- if (!ndr_syntax_from_string(interface, interface_version, &syntax)) {
- tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
- return tevent_req_post(req, ev);
- }
-
- table = get_iface_from_syntax(&syntax);
- if (table == NULL) {
- tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
- return tevent_req_post(req, ev);
- }
-
if (!ndr_syntax_id_equal(&table->syntax_id, &cli->abstract_syntax)
|| (opnum >= table->num_calls)) {
tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
state->call->name, NDR_IN, r);
}
- push = ndr_push_init_ctx(talloc_tos(), NULL);
+ push = ndr_push_init_ctx(talloc_tos());
if (tevent_req_nomem(push, req)) {
return tevent_req_post(req, ev);
}
req, struct cli_do_rpc_ndr_state);
NTSTATUS status;
- status = rpc_api_pipe_req_recv(subreq, state, &state->r_ps);
+ status = rpc_api_pipe_req_recv(subreq, state, &state->r_pdu);
TALLOC_FREE(subreq);
- prs_mem_free(&state->q_ps);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
struct ndr_pull *pull;
enum ndr_err_code ndr_err;
NTSTATUS status;
- DATA_BLOB blob;
- bool ret;
if (tevent_req_is_nterror(req, &status)) {
return status;
}
- ret = prs_data_blob(&state->r_ps, &blob, talloc_tos());
- prs_mem_free(&state->r_ps);
- if (!ret) {
- return NT_STATUS_NO_MEMORY;
- }
-
- pull = ndr_pull_init_blob(&blob, mem_ctx, NULL);
+ pull = ndr_pull_init_blob(&state->r_pdu, mem_ctx);
if (pull == NULL) {
return NT_STATUS_NO_MEMORY;
}
NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
- const char *interface, uint32_t interface_version,
+ const struct ndr_interface_table *table,
uint32_t opnum, void *r)
{
TALLOC_CTX *frame = talloc_stackframe();
goto fail;
}
- req = cli_do_rpc_ndr_send(frame, ev, cli, interface, interface_version,
- opnum, r);
+ req = cli_do_rpc_ndr_send(frame, ev, cli, table, opnum, r);
if (req == NULL) {
status = NT_STATUS_NO_MEMORY;
goto fail;
}
status = cli_do_rpc_ndr_recv(req, mem_ctx);
+
fail:
TALLOC_FREE(frame);
return status;