diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-08-21 14:06:46 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:30:08 -0500 |
commit | 96567fa3ea92e5447b66a23514df392f1f7d353c (patch) | |
tree | c7b81716af98e66447fe3296a426b1e4383ae35d /source3/librpc/gen_ndr/srv_echo.c | |
parent | a9184f49d3226358042bd88e65e29adacc2ecf41 (diff) | |
download | samba-96567fa3ea92e5447b66a23514df392f1f7d353c.tar.gz samba-96567fa3ea92e5447b66a23514df392f1f7d353c.tar.bz2 samba-96567fa3ea92e5447b66a23514df392f1f7d353c.zip |
r24597: - talloc request structure for the samba3 server bindings
and make that the primary context for the request
which the implementations can also use.
- go via functions pointers in the ndr_interface_table
instead of calling functions directly.
metze
(This used to be commit 5c4d998300d0c9836eb3cc6c3cd8ee4f262396b8)
Diffstat (limited to 'source3/librpc/gen_ndr/srv_echo.c')
-rw-r--r-- | source3/librpc/gen_ndr/srv_echo.c | 482 |
1 files changed, 276 insertions, 206 deletions
diff --git a/source3/librpc/gen_ndr/srv_echo.c b/source3/librpc/gen_ndr/srv_echo.c index 298a4ba874..e5315ba9f7 100644 --- a/source3/librpc/gen_ndr/srv_echo.c +++ b/source3/librpc/gen_ndr/srv_echo.c @@ -8,681 +8,751 @@ static BOOL api_echo_AddOne(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_AddOne r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_AddOne"); + struct echo_AddOne *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_rpcecho.calls[NDR_ECHO_ADDONE]; + + r = talloc(NULL, struct echo_AddOne); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_AddOne(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_AddOne, &r); + NDR_PRINT_IN_DEBUG(echo_AddOne, r); - ZERO_STRUCT(r.out); - r.out.out_data = talloc_zero(mem_ctx, uint32_t); - if (r.out.out_data == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.out_data = talloc_zero(r, uint32_t); + if (r->out.out_data == NULL) { + talloc_free(r); return False; } - _echo_AddOne(p, &r); + _echo_AddOne(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_AddOne, &r); + NDR_PRINT_OUT_DEBUG(echo_AddOne, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_AddOne(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_EchoData(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_EchoData r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_EchoData"); + struct echo_EchoData *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_ECHODATA]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct echo_EchoData); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_EchoData(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_EchoData, &r); + NDR_PRINT_IN_DEBUG(echo_EchoData, r); - ZERO_STRUCT(r.out); - r.out.out_data = talloc_zero_array(mem_ctx, uint8_t, r.in.len); - if (r.out.out_data == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.out_data = talloc_zero_array(r, uint8_t, r->in.len); + if (r->out.out_data == NULL) { + talloc_free(r); return False; } - _echo_EchoData(p, &r); + _echo_EchoData(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_EchoData, &r); + NDR_PRINT_OUT_DEBUG(echo_EchoData, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_EchoData(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_SinkData(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_SinkData r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_SinkData"); + struct echo_SinkData *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_SINKDATA]; + + r = talloc(NULL, struct echo_SinkData); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_SinkData(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_SinkData, &r); + NDR_PRINT_IN_DEBUG(echo_SinkData, r); - _echo_SinkData(p, &r); + _echo_SinkData(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_SinkData, &r); + NDR_PRINT_OUT_DEBUG(echo_SinkData, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_SinkData(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_SourceData(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_SourceData r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_SourceData"); + struct echo_SourceData *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_SOURCEDATA]; + + r = talloc(NULL, struct echo_SourceData); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_SourceData(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_SourceData, &r); + NDR_PRINT_IN_DEBUG(echo_SourceData, r); - ZERO_STRUCT(r.out); - r.out.data = talloc_zero_array(mem_ctx, uint8_t, r.in.len); - if (r.out.data == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.data = talloc_zero_array(r, uint8_t, r->in.len); + if (r->out.data == NULL) { + talloc_free(r); return False; } - _echo_SourceData(p, &r); + _echo_SourceData(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_SourceData, &r); + NDR_PRINT_OUT_DEBUG(echo_SourceData, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_SourceData(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestCall(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestCall r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall"); + struct echo_TestCall *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL]; + + r = talloc(NULL, struct echo_TestCall); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestCall(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestCall, &r); + NDR_PRINT_IN_DEBUG(echo_TestCall, r); - ZERO_STRUCT(r.out); - r.out.s2 = talloc_zero(mem_ctx, const char *); - if (r.out.s2 == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.s2 = talloc_zero(r, const char *); + if (r->out.s2 == NULL) { + talloc_free(r); return False; } - _echo_TestCall(p, &r); + _echo_TestCall(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestCall, &r); + NDR_PRINT_OUT_DEBUG(echo_TestCall, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestCall(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestCall2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestCall2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall2"); + struct echo_TestCall2 *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL2]; + + r = talloc(NULL, struct echo_TestCall2); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestCall2(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestCall2, &r); + NDR_PRINT_IN_DEBUG(echo_TestCall2, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union echo_Info); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union echo_Info); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _echo_TestCall2(p, &r); + r->out.result = _echo_TestCall2(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestCall2, &r); + NDR_PRINT_OUT_DEBUG(echo_TestCall2, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestCall2(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestSleep(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestSleep r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSleep"); + struct echo_TestSleep *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSLEEP]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct echo_TestSleep); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestSleep(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestSleep, &r); + NDR_PRINT_IN_DEBUG(echo_TestSleep, r); - r.out.result = _echo_TestSleep(p, &r); + r->out.result = _echo_TestSleep(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestSleep, &r); + NDR_PRINT_OUT_DEBUG(echo_TestSleep, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestSleep(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestEnum"); + struct echo_TestEnum *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTENUM]; + + r = talloc(NULL, struct echo_TestEnum); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestEnum(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestEnum, &r); + NDR_PRINT_IN_DEBUG(echo_TestEnum, r); - ZERO_STRUCT(r.out); - r.out.foo1 = r.in.foo1; - r.out.foo2 = r.in.foo2; - r.out.foo3 = r.in.foo3; - _echo_TestEnum(p, &r); + ZERO_STRUCT(r->out); + r->out.foo1 = r->in.foo1; + r->out.foo2 = r->in.foo2; + r->out.foo3 = r->in.foo3; + _echo_TestEnum(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestEnum, &r); + NDR_PRINT_OUT_DEBUG(echo_TestEnum, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestEnum(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestSurrounding(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestSurrounding r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSurrounding"); + struct echo_TestSurrounding *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSURROUNDING]; + + r = talloc(NULL, struct echo_TestSurrounding); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestSurrounding(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestSurrounding, &r); + NDR_PRINT_IN_DEBUG(echo_TestSurrounding, r); - ZERO_STRUCT(r.out); - r.out.data = r.in.data; - _echo_TestSurrounding(p, &r); + ZERO_STRUCT(r->out); + r->out.data = r->in.data; + _echo_TestSurrounding(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, &r); + NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestSurrounding(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestDoublePointer(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestDoublePointer r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestDoublePointer"); + struct echo_TestDoublePointer *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTDOUBLEPOINTER]; + + r = talloc(NULL, struct echo_TestDoublePointer); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestDoublePointer(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, &r); + NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, r); - r.out.result = _echo_TestDoublePointer(p, &r); + r->out.result = _echo_TestDoublePointer(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, &r); + NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestDoublePointer(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } |