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_lsa.c | |
parent | a9184f49d3226358042bd88e65e29adacc2ecf41 (diff) | |
download | samba-96567fa3ea92e5447b66a23514df392f1f7d353c.tar.gz samba-96567fa3ea92e5447b66a23514df392f1f7d353c.tar.xz 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_lsa.c')
-rw-r--r-- | source3/librpc/gen_ndr/srv_lsa.c | 3852 |
1 files changed, 2213 insertions, 1639 deletions
diff --git a/source3/librpc/gen_ndr/srv_lsa.c b/source3/librpc/gen_ndr/srv_lsa.c index 01d34abfeac..d528d7bb0c7 100644 --- a/source3/librpc/gen_ndr/srv_lsa.c +++ b/source3/librpc/gen_ndr/srv_lsa.c @@ -8,5510 +8,6084 @@ static BOOL api_lsa_Close(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_Close r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_Close"); + struct lsa_Close *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_CLOSE]; + + r = talloc(NULL, struct lsa_Close); + 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, 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_lsa_Close(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(lsa_Close, &r); + NDR_PRINT_IN_DEBUG(lsa_Close, r); - ZERO_STRUCT(r.out); - r.out.handle = r.in.handle; - r.out.result = _lsa_Close(p, &r); + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _lsa_Close(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(lsa_Close, &r); + NDR_PRINT_OUT_DEBUG(lsa_Close, 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_lsa_Close(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_lsa_Delete(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_Delete r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_Delete"); + struct lsa_Delete *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_DELETE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_Delete); + 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_lsa_Delete(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(lsa_Delete, &r); + NDR_PRINT_IN_DEBUG(lsa_Delete, r); - r.out.result = _lsa_Delete(p, &r); + r->out.result = _lsa_Delete(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(lsa_Delete, &r); + NDR_PRINT_OUT_DEBUG(lsa_Delete, 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_lsa_Delete(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_lsa_EnumPrivs(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_EnumPrivs r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_EnumPrivs"); + struct lsa_EnumPrivs *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMPRIVS]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_EnumPrivs); + 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_lsa_EnumPrivs(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(lsa_EnumPrivs, &r); + NDR_PRINT_IN_DEBUG(lsa_EnumPrivs, r); - ZERO_STRUCT(r.out); - r.out.resume_handle = r.in.resume_handle; - r.out.privs = talloc_zero(mem_ctx, struct lsa_PrivArray); - if (r.out.privs == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.privs = talloc_zero(r, struct lsa_PrivArray); + if (r->out.privs == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_EnumPrivs(p, &r); + r->out.result = _lsa_EnumPrivs(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(lsa_EnumPrivs, &r); + NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, 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_lsa_EnumPrivs(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_lsa_QuerySecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_QuerySecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_QuerySecurity"); + struct lsa_QuerySecurity *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYSECURITY]; + + r = talloc(NULL, struct lsa_QuerySecurity); + 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_lsa_QuerySecurity(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(lsa_QuerySecurity, &r); + NDR_PRINT_IN_DEBUG(lsa_QuerySecurity, r); - ZERO_STRUCT(r.out); - r.out.sdbuf = talloc_zero(mem_ctx, struct sec_desc_buf); - if (r.out.sdbuf == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.sdbuf = talloc_zero(r, struct sec_desc_buf); + if (r->out.sdbuf == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_QuerySecurity(p, &r); + r->out.result = _lsa_QuerySecurity(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(lsa_QuerySecurity, &r); + NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, 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_lsa_QuerySecurity(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_lsa_SetSecObj(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetSecObj r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetSecObj"); + struct lsa_SetSecObj *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_SETSECOBJ]; + + r = talloc(NULL, struct lsa_SetSecObj); + 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_lsa_SetSecObj(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(lsa_SetSecObj, &r); + NDR_PRINT_IN_DEBUG(lsa_SetSecObj, r); - r.out.result = _lsa_SetSecObj(p, &r); + r->out.result = _lsa_SetSecObj(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(lsa_SetSecObj, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, 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_lsa_SetSecObj(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_lsa_ChangePassword(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_ChangePassword r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_ChangePassword"); + struct lsa_ChangePassword *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CHANGEPASSWORD]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_ChangePassword); + 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_lsa_ChangePassword(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(lsa_ChangePassword, &r); + NDR_PRINT_IN_DEBUG(lsa_ChangePassword, r); - r.out.result = _lsa_ChangePassword(p, &r); + r->out.result = _lsa_ChangePassword(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(lsa_ChangePassword, &r); + NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, 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_lsa_ChangePassword(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_lsa_OpenPolicy(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_OpenPolicy r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_OpenPolicy"); + struct lsa_OpenPolicy *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENPOLICY]; + + r = talloc(NULL, struct lsa_OpenPolicy); + 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_lsa_OpenPolicy(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(lsa_OpenPolicy, &r); + NDR_PRINT_IN_DEBUG(lsa_OpenPolicy, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_OpenPolicy(p, &r); + r->out.result = _lsa_OpenPolicy(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(lsa_OpenPolicy, &r); + NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, 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_lsa_OpenPolicy(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_lsa_QueryInfoPolicy(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_QueryInfoPolicy r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_QueryInfoPolicy"); + struct lsa_QueryInfoPolicy *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYINFOPOLICY]; + + r = talloc(NULL, struct lsa_QueryInfoPolicy); + 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_lsa_QueryInfoPolicy(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(lsa_QueryInfoPolicy, &r); + NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union lsa_PolicyInformation); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union lsa_PolicyInformation); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_QueryInfoPolicy(p, &r); + r->out.result = _lsa_QueryInfoPolicy(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(lsa_QueryInfoPolicy, &r); + NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, 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_lsa_QueryInfoPolicy(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_lsa_SetInfoPolicy(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetInfoPolicy r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetInfoPolicy"); + struct lsa_SetInfoPolicy *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFOPOLICY]; + + r = talloc(NULL, struct lsa_SetInfoPolicy); + 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_lsa_SetInfoPolicy(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(lsa_SetInfoPolicy, &r); + NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, r); - r.out.result = _lsa_SetInfoPolicy(p, &r); + r->out.result = _lsa_SetInfoPolicy(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(lsa_SetInfoPolicy, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, 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_lsa_SetInfoPolicy(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_lsa_ClearAuditLog(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_ClearAuditLog r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_ClearAuditLog"); + struct lsa_ClearAuditLog *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_CLEARAUDITLOG]; + + r = talloc(NULL, struct lsa_ClearAuditLog); + 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_lsa_ClearAuditLog(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(lsa_ClearAuditLog, &r); + NDR_PRINT_IN_DEBUG(lsa_ClearAuditLog, r); - r.out.result = _lsa_ClearAuditLog(p, &r); + r->out.result = _lsa_ClearAuditLog(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(lsa_ClearAuditLog, &r); + NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, 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_lsa_ClearAuditLog(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_lsa_CreateAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CreateAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CreateAccount"); + struct lsa_CreateAccount *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATEACCOUNT]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_CreateAccount); + 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_lsa_CreateAccount(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(lsa_CreateAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_CreateAccount, r); - ZERO_STRUCT(r.out); - r.out.acct_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.acct_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.acct_handle = talloc_zero(r, struct policy_handle); + if (r->out.acct_handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_CreateAccount(p, &r); + r->out.result = _lsa_CreateAccount(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(lsa_CreateAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, 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_lsa_CreateAccount(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_lsa_EnumAccounts(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_EnumAccounts r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_EnumAccounts"); + struct lsa_EnumAccounts *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTS]; + + r = talloc(NULL, struct lsa_EnumAccounts); + 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_lsa_EnumAccounts(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(lsa_EnumAccounts, &r); + NDR_PRINT_IN_DEBUG(lsa_EnumAccounts, r); - ZERO_STRUCT(r.out); - r.out.resume_handle = r.in.resume_handle; - r.out.sids = talloc_zero(mem_ctx, struct lsa_SidArray); - if (r.out.sids == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sids = talloc_zero(r, struct lsa_SidArray); + if (r->out.sids == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_EnumAccounts(p, &r); + r->out.result = _lsa_EnumAccounts(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(lsa_EnumAccounts, &r); + NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, 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_lsa_EnumAccounts(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_lsa_CreateTrustedDomain(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CreateTrustedDomain r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CreateTrustedDomain"); + struct lsa_CreateTrustedDomain *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAIN]; + + r = talloc(NULL, struct lsa_CreateTrustedDomain); + 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_lsa_CreateTrustedDomain(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(lsa_CreateTrustedDomain, &r); + NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomain, r); - ZERO_STRUCT(r.out); - r.out.trustdom_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.trustdom_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.trustdom_handle = talloc_zero(r, struct policy_handle); + if (r->out.trustdom_handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_CreateTrustedDomain(p, &r); + r->out.result = _lsa_CreateTrustedDomain(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(lsa_CreateTrustedDomain, &r); + NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, 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_lsa_CreateTrustedDomain(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_lsa_EnumTrustDom(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_EnumTrustDom r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_EnumTrustDom"); + struct lsa_EnumTrustDom *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMTRUSTDOM]; + + r = talloc(NULL, struct lsa_EnumTrustDom); + 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_lsa_EnumTrustDom(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(lsa_EnumTrustDom, &r); + NDR_PRINT_IN_DEBUG(lsa_EnumTrustDom, r); - ZERO_STRUCT(r.out); - r.out.resume_handle = r.in.resume_handle; - r.out.domains = talloc_zero(mem_ctx, struct lsa_DomainList); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.domains = talloc_zero(r, struct lsa_DomainList); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_EnumTrustDom(p, &r); + r->out.result = _lsa_EnumTrustDom(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(lsa_EnumTrustDom, &r); + NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, 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_lsa_EnumTrustDom(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_lsa_LookupNames(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupNames r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupNames"); + struct lsa_LookupNames *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_LookupNames); + 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_lsa_LookupNames(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(lsa_LookupNames, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupNames, r); - ZERO_STRUCT(r.out); - r.out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.domains = talloc_zero(r, struct lsa_RefDomainList); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.sids = r.in.sids; - r.out.count = r.in.count; - r.out.result = _lsa_LookupNames(p, &r); + r->out.sids = r->in.sids; + r->out.count = r->in.count; + r->out.result = _lsa_LookupNames(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(lsa_LookupNames, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupNames, 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_lsa_LookupNames(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_lsa_LookupSids(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupSids r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupSids"); + struct lsa_LookupSids *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS]; + + r = talloc(NULL, struct lsa_LookupSids); + 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_lsa_LookupSids(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(lsa_LookupSids, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupSids, r); - ZERO_STRUCT(r.out); - r.out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.domains = talloc_zero(r, struct lsa_RefDomainList); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.names = r.in.names; - r.out.count = r.in.count; - r.out.result = _lsa_LookupSids(p, &r); + r->out.names = r->in.names; + r->out.count = r->in.count; + r->out.result = _lsa_LookupSids(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(lsa_LookupSids, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupSids, 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_lsa_LookupSids(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_lsa_CreateSecret(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CreateSecret r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CreateSecret"); + struct lsa_CreateSecret *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATESECRET]; + + r = talloc(NULL, struct lsa_CreateSecret); + 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_lsa_CreateSecret(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(lsa_CreateSecret, &r); + NDR_PRINT_IN_DEBUG(lsa_CreateSecret, r); - ZERO_STRUCT(r.out); - r.out.sec_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.sec_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.sec_handle = talloc_zero(r, struct policy_handle); + if (r->out.sec_handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_CreateSecret(p, &r); + r->out.result = _lsa_CreateSecret(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(lsa_CreateSecret, &r); + NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, 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_lsa_CreateSecret(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_lsa_OpenAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_OpenAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_OpenAccount"); + struct lsa_OpenAccount *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENACCOUNT]; + + r = talloc(NULL, struct lsa_OpenAccount); + 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_lsa_OpenAccount(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(lsa_OpenAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_OpenAccount, r); - ZERO_STRUCT(r.out); - r.out.acct_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.acct_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.acct_handle = talloc_zero(r, struct policy_handle); + if (r->out.acct_handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_OpenAccount(p, &r); + r->out.result = _lsa_OpenAccount(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(lsa_OpenAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, 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_lsa_OpenAccount(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_lsa_EnumPrivsAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_EnumPrivsAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_EnumPrivsAccount"); + struct lsa_EnumPrivsAccount *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMPRIVSACCOUNT]; + + r = talloc(NULL, struct lsa_EnumPrivsAccount); + 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_lsa_EnumPrivsAccount(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(lsa_EnumPrivsAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_EnumPrivsAccount, r); - ZERO_STRUCT(r.out); - r.out.privs = talloc_zero(mem_ctx, struct lsa_PrivilegeSet); - if (r.out.privs == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.privs = talloc_zero(r, struct lsa_PrivilegeSet); + if (r->out.privs == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_EnumPrivsAccount(p, &r); + r->out.result = _lsa_EnumPrivsAccount(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(lsa_EnumPrivsAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, 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_lsa_EnumPrivsAccount(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_lsa_AddPrivilegesToAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_AddPrivilegesToAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_AddPrivilegesToAccount"); + struct lsa_AddPrivilegesToAccount *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_ADDPRIVILEGESTOACCOUNT]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_AddPrivilegesToAccount); + 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_lsa_AddPrivilegesToAccount(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(lsa_AddPrivilegesToAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_AddPrivilegesToAccount, r); - r.out.result = _lsa_AddPrivilegesToAccount(p, &r); + r->out.result = _lsa_AddPrivilegesToAccount(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(lsa_AddPrivilegesToAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, 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_lsa_AddPrivilegesToAccount(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_lsa_RemovePrivilegesFromAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_RemovePrivilegesFromAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_RemovePrivilegesFromAccount"); + struct lsa_RemovePrivilegesFromAccount *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT]; + + r = talloc(NULL, struct lsa_RemovePrivilegesFromAccount); + 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_lsa_RemovePrivilegesFromAccount(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(lsa_RemovePrivilegesFromAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_RemovePrivilegesFromAccount, r); - r.out.result = _lsa_RemovePrivilegesFromAccount(p, &r); + r->out.result = _lsa_RemovePrivilegesFromAccount(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(lsa_RemovePrivilegesFromAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, 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_lsa_RemovePrivilegesFromAccount(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_lsa_GetQuotasForAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_GetQuotasForAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_GetQuotasForAccount"); + struct lsa_GetQuotasForAccount *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_GETQUOTASFORACCOUNT]; + + r = talloc(NULL, struct lsa_GetQuotasForAccount); + 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_lsa_GetQuotasForAccount(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(lsa_GetQuotasForAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_GetQuotasForAccount, r); - r.out.result = _lsa_GetQuotasForAccount(p, &r); + r->out.result = _lsa_GetQuotasForAccount(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(lsa_GetQuotasForAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, 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_lsa_GetQuotasForAccount(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_lsa_SetQuotasForAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetQuotasForAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetQuotasForAccount"); + struct lsa_SetQuotasForAccount *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_SETQUOTASFORACCOUNT]; + + r = talloc(NULL, struct lsa_SetQuotasForAccount); + 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_lsa_SetQuotasForAccount(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(lsa_SetQuotasForAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_SetQuotasForAccount, r); - r.out.result = _lsa_SetQuotasForAccount(p, &r); + r->out.result = _lsa_SetQuotasForAccount(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(lsa_SetQuotasForAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, 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_lsa_SetQuotasForAccount(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_lsa_GetSystemAccessAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_GetSystemAccessAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_GetSystemAccessAccount"); + struct lsa_GetSystemAccessAccount *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_GETSYSTEMACCESSACCOUNT]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_GetSystemAccessAccount); + 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_lsa_GetSystemAccessAccount(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(lsa_GetSystemAccessAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, r); - r.out.result = _lsa_GetSystemAccessAccount(p, &r); + r->out.result = _lsa_GetSystemAccessAccount(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(lsa_GetSystemAccessAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, 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_lsa_GetSystemAccessAccount(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_lsa_SetSystemAccessAccount(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetSystemAccessAccount r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetSystemAccessAccount"); + struct lsa_SetSystemAccessAccount *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_SETSYSTEMACCESSACCOUNT]; + + r = talloc(NULL, struct lsa_SetSystemAccessAccount); + 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_lsa_SetSystemAccessAccount(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(lsa_SetSystemAccessAccount, &r); + NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, r); - r.out.result = _lsa_SetSystemAccessAccount(p, &r); + r->out.result = _lsa_SetSystemAccessAccount(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(lsa_SetSystemAccessAccount, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, 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_lsa_SetSystemAccessAccount(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_lsa_OpenTrustedDomain(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_OpenTrustedDomain r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_OpenTrustedDomain"); + struct lsa_OpenTrustedDomain *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENTRUSTEDDOMAIN]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_OpenTrustedDomain); + 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_lsa_OpenTrustedDomain(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(lsa_OpenTrustedDomain, &r); + NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomain, r); - ZERO_STRUCT(r.out); - r.out.trustdom_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.trustdom_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.trustdom_handle = talloc_zero(r, struct policy_handle); + if (r->out.trustdom_handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_OpenTrustedDomain(p, &r); + r->out.result = _lsa_OpenTrustedDomain(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(lsa_OpenTrustedDomain, &r); + NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, 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_lsa_OpenTrustedDomain(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_lsa_QueryTrustedDomainInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_QueryTrustedDomainInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_QueryTrustedDomainInfo"); + struct lsa_QueryTrustedDomainInfo *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFO]; + + r = talloc(NULL, struct lsa_QueryTrustedDomainInfo); + 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_lsa_QueryTrustedDomainInfo(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(lsa_QueryTrustedDomainInfo, &r); + NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfo, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union lsa_TrustedDomainInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_QueryTrustedDomainInfo(p, &r); + r->out.result = _lsa_QueryTrustedDomainInfo(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(lsa_QueryTrustedDomainInfo, &r); + NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, 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_lsa_QueryTrustedDomainInfo(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_lsa_SetInformationTrustedDomain(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetInformationTrustedDomain r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetInformationTrustedDomain"); + struct lsa_SetInformationTrustedDomain *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN]; + + r = talloc(NULL, struct lsa_SetInformationTrustedDomain); + 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_lsa_SetInformationTrustedDomain(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(lsa_SetInformationTrustedDomain, &r); + NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, r); - r.out.result = _lsa_SetInformationTrustedDomain(p, &r); + r->out.result = _lsa_SetInformationTrustedDomain(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(lsa_SetInformationTrustedDomain, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, 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_lsa_SetInformationTrustedDomain(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_lsa_OpenSecret(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_OpenSecret r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_OpenSecret"); + struct lsa_OpenSecret *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENSECRET]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_OpenSecret); + 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_lsa_OpenSecret(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(lsa_OpenSecret, &r); + NDR_PRINT_IN_DEBUG(lsa_OpenSecret, r); - ZERO_STRUCT(r.out); - r.out.sec_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.sec_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.sec_handle = talloc_zero(r, struct policy_handle); + if (r->out.sec_handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_OpenSecret(p, &r); + r->out.result = _lsa_OpenSecret(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(lsa_OpenSecret, &r); + NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, 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_lsa_OpenSecret(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_lsa_SetSecret(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetSecret r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetSecret"); + struct lsa_SetSecret *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_SETSECRET]; + + r = talloc(NULL, struct lsa_SetSecret); + 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_lsa_SetSecret(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(lsa_SetSecret, &r); + NDR_PRINT_IN_DEBUG(lsa_SetSecret, r); - r.out.result = _lsa_SetSecret(p, &r); + r->out.result = _lsa_SetSecret(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(lsa_SetSecret, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetSecret, 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_lsa_SetSecret(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_lsa_QuerySecret(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_QuerySecret r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_QuerySecret"); + struct lsa_QuerySecret *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYSECRET]; + + r = talloc(NULL, struct lsa_QuerySecret); + 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_lsa_QuerySecret(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(lsa_QuerySecret, &r); + NDR_PRINT_IN_DEBUG(lsa_QuerySecret, r); - ZERO_STRUCT(r.out); - r.out.new_val = r.in.new_val; - r.out.new_mtime = r.in.new_mtime; - r.out.old_val = r.in.old_val; - r.out.old_mtime = r.in.old_mtime; - r.out.result = _lsa_QuerySecret(p, &r); + ZERO_STRUCT(r->out); + r->out.new_val = r->in.new_val; + r->out.new_mtime = r->in.new_mtime; + r->out.old_val = r->in.old_val; + r->out.old_mtime = r->in.old_mtime; + r->out.result = _lsa_QuerySecret(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(lsa_QuerySecret, &r); + NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, 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_lsa_QuerySecret(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_lsa_LookupPrivValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupPrivValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupPrivValue"); + struct lsa_LookupPrivValue *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVVALUE]; + + r = talloc(NULL, struct lsa_LookupPrivValue); + 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_lsa_LookupPrivValue(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(lsa_LookupPrivValue, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupPrivValue, r); - ZERO_STRUCT(r.out); - r.out.luid = talloc_zero(mem_ctx, struct lsa_LUID); - if (r.out.luid == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.luid = talloc_zero(r, struct lsa_LUID); + if (r->out.luid == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_LookupPrivValue(p, &r); + r->out.result = _lsa_LookupPrivValue(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(lsa_LookupPrivValue, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, 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_lsa_LookupPrivValue(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_lsa_LookupPrivName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupPrivName r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupPrivName"); + struct lsa_LookupPrivName *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVNAME]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_LookupPrivName); + 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_lsa_LookupPrivName(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(lsa_LookupPrivName, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupPrivName, r); - ZERO_STRUCT(r.out); - r.out.name = talloc_zero(mem_ctx, struct lsa_StringLarge); - if (r.out.name == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.name = talloc_zero(r, struct lsa_StringLarge); + if (r->out.name == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_LookupPrivName(p, &r); + r->out.result = _lsa_LookupPrivName(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(lsa_LookupPrivName, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, 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_lsa_LookupPrivName(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_lsa_LookupPrivDisplayName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupPrivDisplayName r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupPrivDisplayName"); + struct lsa_LookupPrivDisplayName *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVDISPLAYNAME]; + + r = talloc(NULL, struct lsa_LookupPrivDisplayName); + 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_lsa_LookupPrivDisplayName(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(lsa_LookupPrivDisplayName, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupPrivDisplayName, r); - ZERO_STRUCT(r.out); - r.out.disp_name = talloc_zero(mem_ctx, struct lsa_StringLarge); - if (r.out.disp_name == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.disp_name = talloc_zero(r, struct lsa_StringLarge); + if (r->out.disp_name == NULL) { + talloc_free(r); return False; } - r.out.language_id = r.in.language_id; - r.out.result = _lsa_LookupPrivDisplayName(p, &r); + r->out.language_id = r->in.language_id; + r->out.result = _lsa_LookupPrivDisplayName(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(lsa_LookupPrivDisplayName, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, 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_lsa_LookupPrivDisplayName(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_lsa_DeleteObject(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_DeleteObject r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_DeleteObject"); + struct lsa_DeleteObject *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_DELETEOBJECT]; + + r = talloc(NULL, struct lsa_DeleteObject); + 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_lsa_DeleteObject(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(lsa_DeleteObject, &r); + NDR_PRINT_IN_DEBUG(lsa_DeleteObject, r); - r.out.result = _lsa_DeleteObject(p, &r); + r->out.result = _lsa_DeleteObject(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(lsa_DeleteObject, &r); + NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, 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_lsa_DeleteObject(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_lsa_EnumAccountsWithUserRight(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_EnumAccountsWithUserRight r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_EnumAccountsWithUserRight"); + struct lsa_EnumAccountsWithUserRight *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT]; + + r = talloc(NULL, struct lsa_EnumAccountsWithUserRight); + 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_lsa_EnumAccountsWithUserRight(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(lsa_EnumAccountsWithUserRight, &r); + NDR_PRINT_IN_DEBUG(lsa_EnumAccountsWithUserRight, r); - ZERO_STRUCT(r.out); - r.out.sids = talloc_zero(mem_ctx, struct lsa_SidArray); - if (r.out.sids == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.sids = talloc_zero(r, struct lsa_SidArray); + if (r->out.sids == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_EnumAccountsWithUserRight(p, &r); + r->out.result = _lsa_EnumAccountsWithUserRight(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(lsa_EnumAccountsWithUserRight, &r); + NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, 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_lsa_EnumAccountsWithUserRight(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_lsa_EnumAccountRights(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_EnumAccountRights r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_EnumAccountRights"); + struct lsa_EnumAccountRights *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTRIGHTS]; + + r = talloc(NULL, struct lsa_EnumAccountRights); + 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_lsa_EnumAccountRights(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(lsa_EnumAccountRights, &r); + NDR_PRINT_IN_DEBUG(lsa_EnumAccountRights, r); - ZERO_STRUCT(r.out); - r.out.rights = talloc_zero(mem_ctx, struct lsa_RightSet); - if (r.out.rights == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.rights = talloc_zero(r, struct lsa_RightSet); + if (r->out.rights == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_EnumAccountRights(p, &r); + r->out.result = _lsa_EnumAccountRights(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(lsa_EnumAccountRights, &r); + NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, 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_lsa_EnumAccountRights(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_lsa_AddAccountRights(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_AddAccountRights r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_AddAccountRights"); + struct lsa_AddAccountRights *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_ADDACCOUNTRIGHTS]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_AddAccountRights); + 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_lsa_AddAccountRights(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(lsa_AddAccountRights, &r); + NDR_PRINT_IN_DEBUG(lsa_AddAccountRights, r); - r.out.result = _lsa_AddAccountRights(p, &r); + r->out.result = _lsa_AddAccountRights(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(lsa_AddAccountRights, &r); + NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, 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_lsa_AddAccountRights(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_lsa_RemoveAccountRights(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_RemoveAccountRights r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_RemoveAccountRights"); + struct lsa_RemoveAccountRights *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_REMOVEACCOUNTRIGHTS]; + + r = talloc(NULL, struct lsa_RemoveAccountRights); + 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_lsa_RemoveAccountRights(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(lsa_RemoveAccountRights, &r); + NDR_PRINT_IN_DEBUG(lsa_RemoveAccountRights, r); - r.out.result = _lsa_RemoveAccountRights(p, &r); + r->out.result = _lsa_RemoveAccountRights(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(lsa_RemoveAccountRights, &r); + NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, 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_lsa_RemoveAccountRights(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_lsa_QueryTrustedDomainInfoBySid(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_QueryTrustedDomainInfoBySid r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_QueryTrustedDomainInfoBySid"); + struct lsa_QueryTrustedDomainInfoBySid *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID]; + + r = talloc(NULL, struct lsa_QueryTrustedDomainInfoBySid); + 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_lsa_QueryTrustedDomainInfoBySid(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(lsa_QueryTrustedDomainInfoBySid, &r); + NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoBySid, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union lsa_TrustedDomainInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_QueryTrustedDomainInfoBySid(p, &r); + r->out.result = _lsa_QueryTrustedDomainInfoBySid(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(lsa_QueryTrustedDomainInfoBySid, &r); + NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, 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_lsa_QueryTrustedDomainInfoBySid(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_lsa_SetTrustedDomainInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetTrustedDomainInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetTrustedDomainInfo"); + struct lsa_SetTrustedDomainInfo *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_SETTRUSTEDDOMAININFO]; + + r = talloc(NULL, struct lsa_SetTrustedDomainInfo); + 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_lsa_SetTrustedDomainInfo(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(lsa_SetTrustedDomainInfo, &r); + NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, r); - r.out.result = _lsa_SetTrustedDomainInfo(p, &r); + r->out.result = _lsa_SetTrustedDomainInfo(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(lsa_SetTrustedDomainInfo, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, 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_lsa_SetTrustedDomainInfo(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_lsa_DeleteTrustedDomain(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_DeleteTrustedDomain r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_DeleteTrustedDomain"); + struct lsa_DeleteTrustedDomain *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_DELETETRUSTEDDOMAIN]; + + r = talloc(NULL, struct lsa_DeleteTrustedDomain); + 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, 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_lsa_DeleteTrustedDomain(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(lsa_DeleteTrustedDomain, &r); + NDR_PRINT_IN_DEBUG(lsa_DeleteTrustedDomain, r); - r.out.result = _lsa_DeleteTrustedDomain(p, &r); + r->out.result = _lsa_DeleteTrustedDomain(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(lsa_DeleteTrustedDomain, &r); + NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, 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_lsa_DeleteTrustedDomain(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_lsa_StorePrivateData(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_StorePrivateData r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_StorePrivateData"); + struct lsa_StorePrivateData *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_STOREPRIVATEDATA]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_StorePrivateData); + 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_lsa_StorePrivateData(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(lsa_StorePrivateData, &r); + NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, r); - r.out.result = _lsa_StorePrivateData(p, &r); + r->out.result = _lsa_StorePrivateData(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(lsa_StorePrivateData, &r); + NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, 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_lsa_StorePrivateData(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_lsa_RetrievePrivateData(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_RetrievePrivateData r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_RetrievePrivateData"); + struct lsa_RetrievePrivateData *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_RETRIEVEPRIVATEDATA]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_RetrievePrivateData); + 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_lsa_RetrievePrivateData(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(lsa_RetrievePrivateData, &r); + NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, r); - r.out.result = _lsa_RetrievePrivateData(p, &r); + r->out.result = _lsa_RetrievePrivateData(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(lsa_RetrievePrivateData, &r); + NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, 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_lsa_RetrievePrivateData(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_lsa_OpenPolicy2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_OpenPolicy2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_OpenPolicy2"); + struct lsa_OpenPolicy2 *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENPOLICY2]; + + r = talloc(NULL, struct lsa_OpenPolicy2); + 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_lsa_OpenPolicy2(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(lsa_OpenPolicy2, &r); + NDR_PRINT_IN_DEBUG(lsa_OpenPolicy2, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_OpenPolicy2(p, &r); + r->out.result = _lsa_OpenPolicy2(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(lsa_OpenPolicy2, &r); + NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, 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_lsa_OpenPolicy2(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_lsa_GetUserName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_GetUserName r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_GetUserName"); + struct lsa_GetUserName *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_GETUSERNAME]; + + r = talloc(NULL, struct lsa_GetUserName); + 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_lsa_GetUserName(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(lsa_GetUserName, &r); + NDR_PRINT_IN_DEBUG(lsa_GetUserName, r); - ZERO_STRUCT(r.out); - r.out.account_name = r.in.account_name; - r.out.authority_name = r.in.authority_name; - r.out.result = _lsa_GetUserName(p, &r); + ZERO_STRUCT(r->out); + r->out.account_name = r->in.account_name; + r->out.authority_name = r->in.authority_name; + r->out.result = _lsa_GetUserName(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(lsa_GetUserName, &r); + NDR_PRINT_OUT_DEBUG(lsa_GetUserName, 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_lsa_GetUserName(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_lsa_QueryInfoPolicy2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_QueryInfoPolicy2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_QueryInfoPolicy2"); + struct lsa_QueryInfoPolicy2 *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYINFOPOLICY2]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_QueryInfoPolicy2); + 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_lsa_QueryInfoPolicy2(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(lsa_QueryInfoPolicy2, &r); + NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy2, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union lsa_PolicyInformation); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union lsa_PolicyInformation); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_QueryInfoPolicy2(p, &r); + r->out.result = _lsa_QueryInfoPolicy2(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(lsa_QueryInfoPolicy2, &r); + NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, 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_lsa_QueryInfoPolicy2(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_lsa_SetInfoPolicy2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetInfoPolicy2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetInfoPolicy2"); + struct lsa_SetInfoPolicy2 *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFOPOLICY2]; + + r = talloc(NULL, struct lsa_SetInfoPolicy2); + 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_lsa_SetInfoPolicy2(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(lsa_SetInfoPolicy2, &r); + NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, r); - r.out.result = _lsa_SetInfoPolicy2(p, &r); + r->out.result = _lsa_SetInfoPolicy2(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(lsa_SetInfoPolicy2, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, 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_lsa_SetInfoPolicy2(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_lsa_QueryTrustedDomainInfoByName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_QueryTrustedDomainInfoByName r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_QueryTrustedDomainInfoByName"); + struct lsa_QueryTrustedDomainInfoByName *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME]; + + r = talloc(NULL, struct lsa_QueryTrustedDomainInfoByName); + 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_lsa_QueryTrustedDomainInfoByName(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(lsa_QueryTrustedDomainInfoByName, &r); + NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoByName, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union lsa_TrustedDomainInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_QueryTrustedDomainInfoByName(p, &r); + r->out.result = _lsa_QueryTrustedDomainInfoByName(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(lsa_QueryTrustedDomainInfoByName, &r); + NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, 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_lsa_QueryTrustedDomainInfoByName(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_lsa_SetTrustedDomainInfoByName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetTrustedDomainInfoByName r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetTrustedDomainInfoByName"); + struct lsa_SetTrustedDomainInfoByName *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_SETTRUSTEDDOMAININFOBYNAME]; + + r = talloc(NULL, struct lsa_SetTrustedDomainInfoByName); + 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_lsa_SetTrustedDomainInfoByName(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(lsa_SetTrustedDomainInfoByName, &r); + NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfoByName, r); - r.out.result = _lsa_SetTrustedDomainInfoByName(p, &r); + r->out.result = _lsa_SetTrustedDomainInfoByName(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(lsa_SetTrustedDomainInfoByName, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, 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_lsa_SetTrustedDomainInfoByName(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_lsa_EnumTrustedDomainsEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_EnumTrustedDomainsEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_EnumTrustedDomainsEx"); + struct lsa_EnumTrustedDomainsEx *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMTRUSTEDDOMAINSEX]; + + r = talloc(NULL, struct lsa_EnumTrustedDomainsEx); + 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_lsa_EnumTrustedDomainsEx(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(lsa_EnumTrustedDomainsEx, &r); + NDR_PRINT_IN_DEBUG(lsa_EnumTrustedDomainsEx, r); - ZERO_STRUCT(r.out); - r.out.resume_handle = r.in.resume_handle; - r.out.domains = talloc_zero(mem_ctx, struct lsa_DomainListEx); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.domains = talloc_zero(r, struct lsa_DomainListEx); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_EnumTrustedDomainsEx(p, &r); + r->out.result = _lsa_EnumTrustedDomainsEx(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(lsa_EnumTrustedDomainsEx, &r); + NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, 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_lsa_EnumTrustedDomainsEx(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_lsa_CreateTrustedDomainEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CreateTrustedDomainEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CreateTrustedDomainEx"); + struct lsa_CreateTrustedDomainEx *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAINEX]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_CreateTrustedDomainEx); + 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_lsa_CreateTrustedDomainEx(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(lsa_CreateTrustedDomainEx, &r); + NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, r); - r.out.result = _lsa_CreateTrustedDomainEx(p, &r); + r->out.result = _lsa_CreateTrustedDomainEx(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(lsa_CreateTrustedDomainEx, &r); + NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, 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_lsa_CreateTrustedDomainEx(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_lsa_CloseTrustedDomainEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CloseTrustedDomainEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CloseTrustedDomainEx"); + struct lsa_CloseTrustedDomainEx *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_CLOSETRUSTEDDOMAINEX]; + + r = talloc(NULL, struct lsa_CloseTrustedDomainEx); + 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_lsa_CloseTrustedDomainEx(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(lsa_CloseTrustedDomainEx, &r); + NDR_PRINT_IN_DEBUG(lsa_CloseTrustedDomainEx, r); - ZERO_STRUCT(r.out); - r.out.handle = r.in.handle; - r.out.result = _lsa_CloseTrustedDomainEx(p, &r); + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _lsa_CloseTrustedDomainEx(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(lsa_CloseTrustedDomainEx, &r); + NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, 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_lsa_CloseTrustedDomainEx(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_lsa_QueryDomainInformationPolicy(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_QueryDomainInformationPolicy r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_QueryDomainInformationPolicy"); + struct lsa_QueryDomainInformationPolicy *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYDOMAININFORMATIONPOLICY]; + + r = talloc(NULL, struct lsa_QueryDomainInformationPolicy); + 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_lsa_QueryDomainInformationPolicy(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(lsa_QueryDomainInformationPolicy, &r); + NDR_PRINT_IN_DEBUG(lsa_QueryDomainInformationPolicy, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union lsa_DomainInformationPolicy); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union lsa_DomainInformationPolicy); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_QueryDomainInformationPolicy(p, &r); + r->out.result = _lsa_QueryDomainInformationPolicy(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(lsa_QueryDomainInformationPolicy, &r); + NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, 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_lsa_QueryDomainInformationPolicy(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_lsa_SetDomainInformationPolicy(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_SetDomainInformationPolicy r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_SetDomainInformationPolicy"); + struct lsa_SetDomainInformationPolicy *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_SETDOMAININFORMATIONPOLICY]; + + r = talloc(NULL, struct lsa_SetDomainInformationPolicy); + 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_lsa_SetDomainInformationPolicy(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(lsa_SetDomainInformationPolicy, &r); + NDR_PRINT_IN_DEBUG(lsa_SetDomainInformationPolicy, r); - r.out.result = _lsa_SetDomainInformationPolicy(p, &r); + r->out.result = _lsa_SetDomainInformationPolicy(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(lsa_SetDomainInformationPolicy, &r); + NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, 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_lsa_SetDomainInformationPolicy(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_lsa_OpenTrustedDomainByName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_OpenTrustedDomainByName r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_OpenTrustedDomainByName"); + struct lsa_OpenTrustedDomainByName *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENTRUSTEDDOMAINBYNAME]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_OpenTrustedDomainByName); + 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_lsa_OpenTrustedDomainByName(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(lsa_OpenTrustedDomainByName, &r); + NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomainByName, r); - ZERO_STRUCT(r.out); - r.out.trustdom_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.trustdom_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.trustdom_handle = talloc_zero(r, struct policy_handle); + if (r->out.trustdom_handle == NULL) { + talloc_free(r); return False; } - r.out.result = _lsa_OpenTrustedDomainByName(p, &r); + r->out.result = _lsa_OpenTrustedDomainByName(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(lsa_OpenTrustedDomainByName, &r); + NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, 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_lsa_OpenTrustedDomainByName(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_lsa_TestCall(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_TestCall r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_TestCall"); + struct lsa_TestCall *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_TESTCALL]; + + r = talloc(NULL, struct lsa_TestCall); + 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_lsa_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(lsa_TestCall, &r); + NDR_PRINT_IN_DEBUG(lsa_TestCall, r); - r.out.result = _lsa_TestCall(p, &r); + r->out.result = _lsa_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(lsa_TestCall, &r); + NDR_PRINT_OUT_DEBUG(lsa_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_lsa_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_lsa_LookupSids2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupSids2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupSids2"); + struct lsa_LookupSids2 *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS2]; + + r = talloc(NULL, struct lsa_LookupSids2); + 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_lsa_LookupSids2(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(lsa_LookupSids2, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupSids2, r); - ZERO_STRUCT(r.out); - r.out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.domains = talloc_zero(r, struct lsa_RefDomainList); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.names = r.in.names; - r.out.count = r.in.count; - r.out.result = _lsa_LookupSids2(p, &r); + r->out.names = r->in.names; + r->out.count = r->in.count; + r->out.result = _lsa_LookupSids2(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(lsa_LookupSids2, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, 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_lsa_LookupSids2(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_lsa_LookupNames2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupNames2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupNames2"); + struct lsa_LookupNames2 *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES2]; + + r = talloc(NULL, struct lsa_LookupNames2); + 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_lsa_LookupNames2(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(lsa_LookupNames2, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupNames2, r); - ZERO_STRUCT(r.out); - r.out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.domains = talloc_zero(r, struct lsa_RefDomainList); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.sids = r.in.sids; - r.out.count = r.in.count; - r.out.result = _lsa_LookupNames2(p, &r); + r->out.sids = r->in.sids; + r->out.count = r->in.count; + r->out.result = _lsa_LookupNames2(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(lsa_LookupNames2, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, 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_lsa_LookupNames2(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_lsa_CreateTrustedDomainEx2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CreateTrustedDomainEx2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CreateTrustedDomainEx2"); + struct lsa_CreateTrustedDomainEx2 *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAINEX2]; + + r = talloc(NULL, struct lsa_CreateTrustedDomainEx2); + 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_lsa_CreateTrustedDomainEx2(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(lsa_CreateTrustedDomainEx2, &r); + NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, r); - r.out.result = _lsa_CreateTrustedDomainEx2(p, &r); + r->out.result = _lsa_CreateTrustedDomainEx2(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(lsa_CreateTrustedDomainEx2, &r); + NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, 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_lsa_CreateTrustedDomainEx2(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_lsa_CREDRWRITE(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRWRITE r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRWRITE"); + struct lsa_CREDRWRITE *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRWRITE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_CREDRWRITE); + 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_lsa_CREDRWRITE(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(lsa_CREDRWRITE, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRWRITE, r); - r.out.result = _lsa_CREDRWRITE(p, &r); + r->out.result = _lsa_CREDRWRITE(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(lsa_CREDRWRITE, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, 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_lsa_CREDRWRITE(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_lsa_CREDRREAD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRREAD r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRREAD"); + struct lsa_CREDRREAD *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRREAD]; + + r = talloc(NULL, struct lsa_CREDRREAD); + 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_lsa_CREDRREAD(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(lsa_CREDRREAD, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRREAD, r); - r.out.result = _lsa_CREDRREAD(p, &r); + r->out.result = _lsa_CREDRREAD(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(lsa_CREDRREAD, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, 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_lsa_CREDRREAD(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_lsa_CREDRENUMERATE(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRENUMERATE r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRENUMERATE"); + struct lsa_CREDRENUMERATE *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRENUMERATE]; + + r = talloc(NULL, struct lsa_CREDRENUMERATE); + 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_lsa_CREDRENUMERATE(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(lsa_CREDRENUMERATE, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRENUMERATE, r); - r.out.result = _lsa_CREDRENUMERATE(p, &r); + r->out.result = _lsa_CREDRENUMERATE(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(lsa_CREDRENUMERATE, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, 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_lsa_CREDRENUMERATE(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_lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRWRITEDOMAINCREDENTIALS r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRWRITEDOMAINCREDENTIALS"); + struct lsa_CREDRWRITEDOMAINCREDENTIALS *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRWRITEDOMAINCREDENTIALS]; + + r = talloc(NULL, struct lsa_CREDRWRITEDOMAINCREDENTIALS); + 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_lsa_CREDRWRITEDOMAINCREDENTIALS(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(lsa_CREDRWRITEDOMAINCREDENTIALS, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, r); - r.out.result = _lsa_CREDRWRITEDOMAINCREDENTIALS(p, &r); + r->out.result = _lsa_CREDRWRITEDOMAINCREDENTIALS(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(lsa_CREDRWRITEDOMAINCREDENTIALS, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, 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_lsa_CREDRWRITEDOMAINCREDENTIALS(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_lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRREADDOMAINCREDENTIALS r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRREADDOMAINCREDENTIALS"); + struct lsa_CREDRREADDOMAINCREDENTIALS *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRREADDOMAINCREDENTIALS]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_CREDRREADDOMAINCREDENTIALS); + 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_lsa_CREDRREADDOMAINCREDENTIALS(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(lsa_CREDRREADDOMAINCREDENTIALS, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, r); - r.out.result = _lsa_CREDRREADDOMAINCREDENTIALS(p, &r); + r->out.result = _lsa_CREDRREADDOMAINCREDENTIALS(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(lsa_CREDRREADDOMAINCREDENTIALS, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, 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_lsa_CREDRREADDOMAINCREDENTIALS(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_lsa_CREDRDELETE(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRDELETE r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRDELETE"); + struct lsa_CREDRDELETE *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRDELETE]; + + r = talloc(NULL, struct lsa_CREDRDELETE); + 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_lsa_CREDRDELETE(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(lsa_CREDRDELETE, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRDELETE, r); - r.out.result = _lsa_CREDRDELETE(p, &r); + r->out.result = _lsa_CREDRDELETE(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(lsa_CREDRDELETE, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, 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_lsa_CREDRDELETE(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_lsa_CREDRGETTARGETINFO(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRGETTARGETINFO r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRGETTARGETINFO"); + struct lsa_CREDRGETTARGETINFO *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRGETTARGETINFO]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_CREDRGETTARGETINFO); + 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_lsa_CREDRGETTARGETINFO(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(lsa_CREDRGETTARGETINFO, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRGETTARGETINFO, r); - r.out.result = _lsa_CREDRGETTARGETINFO(p, &r); + r->out.result = _lsa_CREDRGETTARGETINFO(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(lsa_CREDRGETTARGETINFO, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, 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_lsa_CREDRGETTARGETINFO(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_lsa_CREDRPROFILELOADED(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRPROFILELOADED r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRPROFILELOADED"); + struct lsa_CREDRPROFILELOADED *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRPROFILELOADED]; + + r = talloc(NULL, struct lsa_CREDRPROFILELOADED); + 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_lsa_CREDRPROFILELOADED(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(lsa_CREDRPROFILELOADED, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRPROFILELOADED, r); - r.out.result = _lsa_CREDRPROFILELOADED(p, &r); + r->out.result = _lsa_CREDRPROFILELOADED(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(lsa_CREDRPROFILELOADED, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, 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_lsa_CREDRPROFILELOADED(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_lsa_LookupNames3(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupNames3 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupNames3"); + struct lsa_LookupNames3 *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES3]; + + r = talloc(NULL, struct lsa_LookupNames3); + 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_lsa_LookupNames3(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(lsa_LookupNames3, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupNames3, r); - ZERO_STRUCT(r.out); - r.out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.domains = talloc_zero(r, struct lsa_RefDomainList); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.sids = r.in.sids; - r.out.count = r.in.count; - r.out.result = _lsa_LookupNames3(p, &r); + r->out.sids = r->in.sids; + r->out.count = r->in.count; + r->out.result = _lsa_LookupNames3(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(lsa_LookupNames3, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, 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_lsa_LookupNames3(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_lsa_CREDRGETSESSIONTYPES(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRGETSESSIONTYPES r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRGETSESSIONTYPES"); + struct lsa_CREDRGETSESSIONTYPES *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRGETSESSIONTYPES]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_CREDRGETSESSIONTYPES); + 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_lsa_CREDRGETSESSIONTYPES(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(lsa_CREDRGETSESSIONTYPES, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRGETSESSIONTYPES, r); - r.out.result = _lsa_CREDRGETSESSIONTYPES(p, &r); + r->out.result = _lsa_CREDRGETSESSIONTYPES(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(lsa_CREDRGETSESSIONTYPES, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, 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_lsa_CREDRGETSESSIONTYPES(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_lsa_LSARREGISTERAUDITEVENT(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSARREGISTERAUDITEVENT r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSARREGISTERAUDITEVENT"); + struct lsa_LSARREGISTERAUDITEVENT *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARREGISTERAUDITEVENT]; + + r = talloc(NULL, struct lsa_LSARREGISTERAUDITEVENT); + 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_lsa_LSARREGISTERAUDITEVENT(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(lsa_LSARREGISTERAUDITEVENT, &r); + NDR_PRINT_IN_DEBUG(lsa_LSARREGISTERAUDITEVENT, r); - r.out.result = _lsa_LSARREGISTERAUDITEVENT(p, &r); + r->out.result = _lsa_LSARREGISTERAUDITEVENT(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(lsa_LSARREGISTERAUDITEVENT, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, 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_lsa_LSARREGISTERAUDITEVENT(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_lsa_LSARGENAUDITEVENT(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSARGENAUDITEVENT r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSARGENAUDITEVENT"); + struct lsa_LSARGENAUDITEVENT *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARGENAUDITEVENT]; + + r = talloc(NULL, struct lsa_LSARGENAUDITEVENT); + 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_lsa_LSARGENAUDITEVENT(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(lsa_LSARGENAUDITEVENT, &r); + NDR_PRINT_IN_DEBUG(lsa_LSARGENAUDITEVENT, r); - r.out.result = _lsa_LSARGENAUDITEVENT(p, &r); + r->out.result = _lsa_LSARGENAUDITEVENT(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(lsa_LSARGENAUDITEVENT, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, 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_lsa_LSARGENAUDITEVENT(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_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSARUNREGISTERAUDITEVENT r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSARUNREGISTERAUDITEVENT"); + struct lsa_LSARUNREGISTERAUDITEVENT *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARUNREGISTERAUDITEVENT]; + + r = talloc(NULL, struct lsa_LSARUNREGISTERAUDITEVENT); + 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_lsa_LSARUNREGISTERAUDITEVENT(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(lsa_LSARUNREGISTERAUDITEVENT, &r); + NDR_PRINT_IN_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, r); - r.out.result = _lsa_LSARUNREGISTERAUDITEVENT(p, &r); + r->out.result = _lsa_LSARUNREGISTERAUDITEVENT(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(lsa_LSARUNREGISTERAUDITEVENT, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, 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_lsa_LSARUNREGISTERAUDITEVENT(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_lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSARQUERYFORESTTRUSTINFORMATION r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSARQUERYFORESTTRUSTINFORMATION"); + struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_LSARQUERYFORESTTRUSTINFORMATION); + 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_lsa_LSARQUERYFORESTTRUSTINFORMATION(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(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r); + NDR_PRINT_IN_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, r); - r.out.result = _lsa_LSARQUERYFORESTTRUSTINFORMATION(p, &r); + r->out.result = _lsa_LSARQUERYFORESTTRUSTINFORMATION(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(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, 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_lsa_LSARQUERYFORESTTRUSTINFORMATION(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_lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSARSETFORESTTRUSTINFORMATION r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSARSETFORESTTRUSTINFORMATION"); + struct lsa_LSARSETFORESTTRUSTINFORMATION *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARSETFORESTTRUSTINFORMATION]; + + r = talloc(NULL, struct lsa_LSARSETFORESTTRUSTINFORMATION); + 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_lsa_LSARSETFORESTTRUSTINFORMATION(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(lsa_LSARSETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_IN_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, r); - r.out.result = _lsa_LSARSETFORESTTRUSTINFORMATION(p, &r); + r->out.result = _lsa_LSARSETFORESTTRUSTINFORMATION(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(lsa_LSARSETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, 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_lsa_LSARSETFORESTTRUSTINFORMATION(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_lsa_CREDRRENAME(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_CREDRRENAME r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_CREDRRENAME"); + struct lsa_CREDRRENAME *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRRENAME]; + + r = talloc(NULL, struct lsa_CREDRRENAME); + 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_lsa_CREDRRENAME(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(lsa_CREDRRENAME, &r); + NDR_PRINT_IN_DEBUG(lsa_CREDRRENAME, r); - r.out.result = _lsa_CREDRRENAME(p, &r); + r->out.result = _lsa_CREDRRENAME(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(lsa_CREDRRENAME, &r); + NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, 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_lsa_CREDRRENAME(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_lsa_LookupSids3(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupSids3 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupSids3"); + struct lsa_LookupSids3 *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS3]; + + r = talloc(NULL, struct lsa_LookupSids3); + 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_lsa_LookupSids3(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(lsa_LookupSids3, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupSids3, r); - ZERO_STRUCT(r.out); - r.out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.domains = talloc_zero(r, struct lsa_RefDomainList); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.names = r.in.names; - r.out.count = r.in.count; - r.out.result = _lsa_LookupSids3(p, &r); + r->out.names = r->in.names; + r->out.count = r->in.count; + r->out.result = _lsa_LookupSids3(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(lsa_LookupSids3, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, 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_lsa_LookupSids3(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_lsa_LookupNames4(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LookupNames4 r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LookupNames4"); + struct lsa_LookupNames4 *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES4]; + + r = talloc(NULL, struct lsa_LookupNames4); + 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_lsa_LookupNames4(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(lsa_LookupNames4, &r); + NDR_PRINT_IN_DEBUG(lsa_LookupNames4, r); - ZERO_STRUCT(r.out); - r.out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList); - if (r.out.domains == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.domains = talloc_zero(r, struct lsa_RefDomainList); + if (r->out.domains == NULL) { + talloc_free(r); return False; } - r.out.sids = r.in.sids; - r.out.count = r.in.count; - r.out.result = _lsa_LookupNames4(p, &r); + r->out.sids = r->in.sids; + r->out.count = r->in.count; + r->out.result = _lsa_LookupNames4(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(lsa_LookupNames4, &r); + NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, 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_lsa_LookupNames4(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_lsa_LSAROPENPOLICYSCE(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSAROPENPOLICYSCE r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSAROPENPOLICYSCE"); + struct lsa_LSAROPENPOLICYSCE *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LSAROPENPOLICYSCE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct lsa_LSAROPENPOLICYSCE); + 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_lsa_LSAROPENPOLICYSCE(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(lsa_LSAROPENPOLICYSCE, &r); + NDR_PRINT_IN_DEBUG(lsa_LSAROPENPOLICYSCE, r); - r.out.result = _lsa_LSAROPENPOLICYSCE(p, &r); + r->out.result = _lsa_LSAROPENPOLICYSCE(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(lsa_LSAROPENPOLICYSCE, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, 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_lsa_LSAROPENPOLICYSCE(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_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSARADTREGISTERSECURITYEVENTSOURCE"); + struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE]; + + r = talloc(NULL, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE); + 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_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(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(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r); + NDR_PRINT_IN_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, r); - r.out.result = _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(p, &r); + r->out.result = _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(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(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, 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_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(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_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE"); + struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE]; + + r = talloc(NULL, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE); + 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_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(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(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r); + NDR_PRINT_IN_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, r); - r.out.result = _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(p, &r); + r->out.result = _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(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(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, 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_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(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_lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct lsa_LSARADTREPORTSECURITYEVENT r; - TALLOC_CTX *mem_ctx = talloc_init("api_lsa_LSARADTREPORTSECURITYEVENT"); + struct lsa_LSARADTREPORTSECURITYEVENT *r; + + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTREPORTSECURITYEVENT]; + + r = talloc(NULL, struct lsa_LSARADTREPORTSECURITYEVENT); + 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_lsa_LSARADTREPORTSECURITYEVENT(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(lsa_LSARADTREPORTSECURITYEVENT, &r); + NDR_PRINT_IN_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, r); - r.out.result = _lsa_LSARADTREPORTSECURITYEVENT(p, &r); + r->out.result = _lsa_LSARADTREPORTSECURITYEVENT(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(lsa_LSARADTREPORTSECURITYEVENT, &r); + NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, 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_lsa_LSARADTREPORTSECURITYEVENT(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; } |