diff options
Diffstat (limited to 'source3/librpc')
-rw-r--r-- | source3/librpc/gen_ndr/srv_dfs.c | 1025 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_echo.c | 482 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_epmapper.c | 380 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_eventlog.c | 1072 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_initshutdown.c | 129 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_lsa.c | 3852 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_netlogon.c | 2333 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_srvsvc.c | 2564 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_svcctl.c | 2260 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_unixinfo.c | 257 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_winreg.c | 1701 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_wkssvc.c | 1377 |
12 files changed, 9997 insertions, 7435 deletions
diff --git a/source3/librpc/gen_ndr/srv_dfs.c b/source3/librpc/gen_ndr/srv_dfs.c index 6250508ccd..82cb5c8d9a 100644 --- a/source3/librpc/gen_ndr/srv_dfs.c +++ b/source3/librpc/gen_ndr/srv_dfs.c @@ -8,1496 +8,1657 @@ static BOOL api_dfs_GetManagerVersion(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_GetManagerVersion r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_GetManagerVersion"); + struct dfs_GetManagerVersion *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netdfs.calls[NDR_DFS_GETMANAGERVERSION]; + + r = talloc(NULL, struct dfs_GetManagerVersion); + 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_dfs_GetManagerVersion(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(dfs_GetManagerVersion, &r); + NDR_PRINT_IN_DEBUG(dfs_GetManagerVersion, r); - ZERO_STRUCT(r.out); - r.out.version = talloc_zero(mem_ctx, enum dfs_ManagerVersion); - if (r.out.version == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.version = talloc_zero(r, enum dfs_ManagerVersion); + if (r->out.version == NULL) { + talloc_free(r); return False; } - _dfs_GetManagerVersion(p, &r); + _dfs_GetManagerVersion(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(dfs_GetManagerVersion, &r); + NDR_PRINT_OUT_DEBUG(dfs_GetManagerVersion, 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_dfs_GetManagerVersion(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_dfs_Add(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_Add r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_Add"); + struct dfs_Add *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_ADD]; + + r = talloc(NULL, struct dfs_Add); + 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_dfs_Add(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(dfs_Add, &r); + NDR_PRINT_IN_DEBUG(dfs_Add, r); - r.out.result = _dfs_Add(p, &r); + r->out.result = _dfs_Add(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(dfs_Add, &r); + NDR_PRINT_OUT_DEBUG(dfs_Add, 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_dfs_Add(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_dfs_Remove(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_Remove r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_Remove"); + struct dfs_Remove *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_REMOVE]; + + r = talloc(NULL, struct dfs_Remove); + 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_dfs_Remove(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(dfs_Remove, &r); + NDR_PRINT_IN_DEBUG(dfs_Remove, r); - r.out.result = _dfs_Remove(p, &r); + r->out.result = _dfs_Remove(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(dfs_Remove, &r); + NDR_PRINT_OUT_DEBUG(dfs_Remove, 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_dfs_Remove(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_dfs_SetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_SetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_SetInfo"); + struct dfs_SetInfo *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netdfs.calls[NDR_DFS_SETINFO]; + + r = talloc(NULL, struct dfs_SetInfo); + 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_dfs_SetInfo(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(dfs_SetInfo, &r); + NDR_PRINT_IN_DEBUG(dfs_SetInfo, r); - r.out.result = _dfs_SetInfo(p, &r); + r->out.result = _dfs_SetInfo(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(dfs_SetInfo, &r); + NDR_PRINT_OUT_DEBUG(dfs_SetInfo, 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_dfs_SetInfo(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_dfs_GetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_GetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_GetInfo"); + struct dfs_GetInfo *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_GETINFO]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct dfs_GetInfo); + 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_dfs_GetInfo(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(dfs_GetInfo, &r); + NDR_PRINT_IN_DEBUG(dfs_GetInfo, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union dfs_Info); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union dfs_Info); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _dfs_GetInfo(p, &r); + r->out.result = _dfs_GetInfo(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(dfs_GetInfo, &r); + NDR_PRINT_OUT_DEBUG(dfs_GetInfo, 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_dfs_GetInfo(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_dfs_Enum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_Enum r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_Enum"); + struct dfs_Enum *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_ENUM]; + + r = talloc(NULL, struct dfs_Enum); + 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_dfs_Enum(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(dfs_Enum, &r); + NDR_PRINT_IN_DEBUG(dfs_Enum, r); - ZERO_STRUCT(r.out); - r.out.info = r.in.info; - r.out.total = r.in.total; - r.out.result = _dfs_Enum(p, &r); + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.total = r->in.total; + r->out.result = _dfs_Enum(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(dfs_Enum, &r); + NDR_PRINT_OUT_DEBUG(dfs_Enum, 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_dfs_Enum(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_dfs_Rename(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_Rename r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_Rename"); + struct dfs_Rename *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_RENAME]; + + r = talloc(NULL, struct dfs_Rename); + 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_dfs_Rename(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(dfs_Rename, &r); + NDR_PRINT_IN_DEBUG(dfs_Rename, r); - r.out.result = _dfs_Rename(p, &r); + r->out.result = _dfs_Rename(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(dfs_Rename, &r); + NDR_PRINT_OUT_DEBUG(dfs_Rename, 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_dfs_Rename(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_dfs_Move(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_Move r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_Move"); + struct dfs_Move *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_MOVE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct dfs_Move); + 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_dfs_Move(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(dfs_Move, &r); + NDR_PRINT_IN_DEBUG(dfs_Move, r); - r.out.result = _dfs_Move(p, &r); + r->out.result = _dfs_Move(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(dfs_Move, &r); + NDR_PRINT_OUT_DEBUG(dfs_Move, 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_dfs_Move(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_dfs_ManagerGetConfigInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_ManagerGetConfigInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_ManagerGetConfigInfo"); + struct dfs_ManagerGetConfigInfo *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERGETCONFIGINFO]; + + r = talloc(NULL, struct dfs_ManagerGetConfigInfo); + 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_dfs_ManagerGetConfigInfo(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(dfs_ManagerGetConfigInfo, &r); + NDR_PRINT_IN_DEBUG(dfs_ManagerGetConfigInfo, r); - r.out.result = _dfs_ManagerGetConfigInfo(p, &r); + r->out.result = _dfs_ManagerGetConfigInfo(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(dfs_ManagerGetConfigInfo, &r); + NDR_PRINT_OUT_DEBUG(dfs_ManagerGetConfigInfo, 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_dfs_ManagerGetConfigInfo(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_dfs_ManagerSendSiteInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_ManagerSendSiteInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_ManagerSendSiteInfo"); + struct dfs_ManagerSendSiteInfo *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERSENDSITEINFO]; + + r = talloc(NULL, struct dfs_ManagerSendSiteInfo); + 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_dfs_ManagerSendSiteInfo(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(dfs_ManagerSendSiteInfo, &r); + NDR_PRINT_IN_DEBUG(dfs_ManagerSendSiteInfo, r); - r.out.result = _dfs_ManagerSendSiteInfo(p, &r); + r->out.result = _dfs_ManagerSendSiteInfo(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(dfs_ManagerSendSiteInfo, &r); + NDR_PRINT_OUT_DEBUG(dfs_ManagerSendSiteInfo, 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_dfs_ManagerSendSiteInfo(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_dfs_AddFtRoot(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_AddFtRoot r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_AddFtRoot"); + struct dfs_AddFtRoot *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_ADDFTROOT]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct dfs_AddFtRoot); + 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_dfs_AddFtRoot(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(dfs_AddFtRoot, &r); + NDR_PRINT_IN_DEBUG(dfs_AddFtRoot, r); - ZERO_STRUCT(r.out); - r.out.unknown2 = r.in.unknown2; - r.out.result = _dfs_AddFtRoot(p, &r); + ZERO_STRUCT(r->out); + r->out.unknown2 = r->in.unknown2; + r->out.result = _dfs_AddFtRoot(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(dfs_AddFtRoot, &r); + NDR_PRINT_OUT_DEBUG(dfs_AddFtRoot, 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_dfs_AddFtRoot(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_dfs_RemoveFtRoot(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_RemoveFtRoot r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_RemoveFtRoot"); + struct dfs_RemoveFtRoot *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_REMOVEFTROOT]; + + r = talloc(NULL, struct dfs_RemoveFtRoot); + 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_dfs_RemoveFtRoot(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(dfs_RemoveFtRoot, &r); + NDR_PRINT_IN_DEBUG(dfs_RemoveFtRoot, r); - ZERO_STRUCT(r.out); - r.out.unknown = r.in.unknown; - r.out.result = _dfs_RemoveFtRoot(p, &r); + ZERO_STRUCT(r->out); + r->out.unknown = r->in.unknown; + r->out.result = _dfs_RemoveFtRoot(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(dfs_RemoveFtRoot, &r); + NDR_PRINT_OUT_DEBUG(dfs_RemoveFtRoot, 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_dfs_RemoveFtRoot(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_dfs_AddStdRoot(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_AddStdRoot r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_AddStdRoot"); + struct dfs_AddStdRoot *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_ADDSTDROOT]; + + r = talloc(NULL, struct dfs_AddStdRoot); + 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_dfs_AddStdRoot(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(dfs_AddStdRoot, &r); + NDR_PRINT_IN_DEBUG(dfs_AddStdRoot, r); - r.out.result = _dfs_AddStdRoot(p, &r); + r->out.result = _dfs_AddStdRoot(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(dfs_AddStdRoot, &r); + NDR_PRINT_OUT_DEBUG(dfs_AddStdRoot, 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_dfs_AddStdRoot(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_dfs_RemoveStdRoot(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_RemoveStdRoot r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_RemoveStdRoot"); + struct dfs_RemoveStdRoot *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netdfs.calls[NDR_DFS_REMOVESTDROOT]; + + r = talloc(NULL, struct dfs_RemoveStdRoot); + 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_dfs_RemoveStdRoot(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(dfs_RemoveStdRoot, &r); + NDR_PRINT_IN_DEBUG(dfs_RemoveStdRoot, r); - r.out.result = _dfs_RemoveStdRoot(p, &r); + r->out.result = _dfs_RemoveStdRoot(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(dfs_RemoveStdRoot, &r); + NDR_PRINT_OUT_DEBUG(dfs_RemoveStdRoot, 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_dfs_RemoveStdRoot(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_dfs_ManagerInitialize(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_ManagerInitialize r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_ManagerInitialize"); + struct dfs_ManagerInitialize *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERINITIALIZE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct dfs_ManagerInitialize); + 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_dfs_ManagerInitialize(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(dfs_ManagerInitialize, &r); + NDR_PRINT_IN_DEBUG(dfs_ManagerInitialize, r); - r.out.result = _dfs_ManagerInitialize(p, &r); + r->out.result = _dfs_ManagerInitialize(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(dfs_ManagerInitialize, &r); + NDR_PRINT_OUT_DEBUG(dfs_ManagerInitialize, 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_dfs_ManagerInitialize(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_dfs_AddStdRootForced(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_AddStdRootForced r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_AddStdRootForced"); + struct dfs_AddStdRootForced *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_ADDSTDROOTFORCED]; + + r = talloc(NULL, struct dfs_AddStdRootForced); + 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_dfs_AddStdRootForced(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(dfs_AddStdRootForced, &r); + NDR_PRINT_IN_DEBUG(dfs_AddStdRootForced, r); - r.out.result = _dfs_AddStdRootForced(p, &r); + r->out.result = _dfs_AddStdRootForced(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(dfs_AddStdRootForced, &r); + NDR_PRINT_OUT_DEBUG(dfs_AddStdRootForced, 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_dfs_AddStdRootForced(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_dfs_GetDcAddress(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_GetDcAddress r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_GetDcAddress"); + struct dfs_GetDcAddress *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netdfs.calls[NDR_DFS_GETDCADDRESS]; + + r = talloc(NULL, struct dfs_GetDcAddress); + 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_dfs_GetDcAddress(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(dfs_GetDcAddress, &r); + NDR_PRINT_IN_DEBUG(dfs_GetDcAddress, r); - r.out.result = _dfs_GetDcAddress(p, &r); + r->out.result = _dfs_GetDcAddress(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(dfs_GetDcAddress, &r); + NDR_PRINT_OUT_DEBUG(dfs_GetDcAddress, 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_dfs_GetDcAddress(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_dfs_SetDcAddress(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_SetDcAddress r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_SetDcAddress"); + struct dfs_SetDcAddress *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_SETDCADDRESS]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct dfs_SetDcAddress); + 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_dfs_SetDcAddress(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(dfs_SetDcAddress, &r); + NDR_PRINT_IN_DEBUG(dfs_SetDcAddress, r); - r.out.result = _dfs_SetDcAddress(p, &r); + r->out.result = _dfs_SetDcAddress(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(dfs_SetDcAddress, &r); + NDR_PRINT_OUT_DEBUG(dfs_SetDcAddress, 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_dfs_SetDcAddress(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_dfs_FlushFtTable(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_FlushFtTable r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_FlushFtTable"); + struct dfs_FlushFtTable *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_FLUSHFTTABLE]; + + r = talloc(NULL, struct dfs_FlushFtTable); + 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_dfs_FlushFtTable(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(dfs_FlushFtTable, &r); + NDR_PRINT_IN_DEBUG(dfs_FlushFtTable, r); - r.out.result = _dfs_FlushFtTable(p, &r); + r->out.result = _dfs_FlushFtTable(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(dfs_FlushFtTable, &r); + NDR_PRINT_OUT_DEBUG(dfs_FlushFtTable, 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_dfs_FlushFtTable(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_dfs_Add2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_Add2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_Add2"); + struct dfs_Add2 *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_ADD2]; + + r = talloc(NULL, struct dfs_Add2); + 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_dfs_Add2(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(dfs_Add2, &r); + NDR_PRINT_IN_DEBUG(dfs_Add2, r); - r.out.result = _dfs_Add2(p, &r); + r->out.result = _dfs_Add2(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(dfs_Add2, &r); + NDR_PRINT_OUT_DEBUG(dfs_Add2, 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_dfs_Add2(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_dfs_Remove2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_Remove2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_Remove2"); + struct dfs_Remove2 *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_REMOVE2]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct dfs_Remove2); + 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_dfs_Remove2(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(dfs_Remove2, &r); + NDR_PRINT_IN_DEBUG(dfs_Remove2, r); - r.out.result = _dfs_Remove2(p, &r); + r->out.result = _dfs_Remove2(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(dfs_Remove2, &r); + NDR_PRINT_OUT_DEBUG(dfs_Remove2, 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_dfs_Remove2(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_dfs_EnumEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_EnumEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_EnumEx"); + struct dfs_EnumEx *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netdfs.calls[NDR_DFS_ENUMEX]; + + r = talloc(NULL, struct dfs_EnumEx); + 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_dfs_EnumEx(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(dfs_EnumEx, &r); + NDR_PRINT_IN_DEBUG(dfs_EnumEx, r); - ZERO_STRUCT(r.out); - r.out.info = r.in.info; - r.out.total = r.in.total; - r.out.result = _dfs_EnumEx(p, &r); + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.total = r->in.total; + r->out.result = _dfs_EnumEx(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(dfs_EnumEx, &r); + NDR_PRINT_OUT_DEBUG(dfs_EnumEx, 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_dfs_EnumEx(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_dfs_SetInfo2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct dfs_SetInfo2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_dfs_SetInfo2"); + struct dfs_SetInfo2 *r; + + call = &ndr_table_netdfs.calls[NDR_DFS_SETINFO2]; + + r = talloc(NULL, struct dfs_SetInfo2); + 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_dfs_SetInfo2(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(dfs_SetInfo2, &r); + NDR_PRINT_IN_DEBUG(dfs_SetInfo2, r); - r.out.result = _dfs_SetInfo2(p, &r); + r->out.result = _dfs_SetInfo2(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(dfs_SetInfo2, &r); + NDR_PRINT_OUT_DEBUG(dfs_SetInfo2, 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_dfs_SetInfo2(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; } diff --git a/source3/librpc/gen_ndr/srv_echo.c b/source3/librpc/gen_ndr/srv_echo.c index 298a4ba874..e5315ba9f7 100644 --- a/source3/librpc/gen_ndr/srv_echo.c +++ b/source3/librpc/gen_ndr/srv_echo.c @@ -8,681 +8,751 @@ static BOOL api_echo_AddOne(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_AddOne r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_AddOne"); + struct echo_AddOne *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_rpcecho.calls[NDR_ECHO_ADDONE]; + + r = talloc(NULL, struct echo_AddOne); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_AddOne(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_AddOne, &r); + NDR_PRINT_IN_DEBUG(echo_AddOne, r); - ZERO_STRUCT(r.out); - r.out.out_data = talloc_zero(mem_ctx, uint32_t); - if (r.out.out_data == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.out_data = talloc_zero(r, uint32_t); + if (r->out.out_data == NULL) { + talloc_free(r); return False; } - _echo_AddOne(p, &r); + _echo_AddOne(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_AddOne, &r); + NDR_PRINT_OUT_DEBUG(echo_AddOne, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_AddOne(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_EchoData(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_EchoData r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_EchoData"); + struct echo_EchoData *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_ECHODATA]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct echo_EchoData); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_EchoData(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_EchoData, &r); + NDR_PRINT_IN_DEBUG(echo_EchoData, r); - ZERO_STRUCT(r.out); - r.out.out_data = talloc_zero_array(mem_ctx, uint8_t, r.in.len); - if (r.out.out_data == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.out_data = talloc_zero_array(r, uint8_t, r->in.len); + if (r->out.out_data == NULL) { + talloc_free(r); return False; } - _echo_EchoData(p, &r); + _echo_EchoData(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_EchoData, &r); + NDR_PRINT_OUT_DEBUG(echo_EchoData, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_EchoData(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_SinkData(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_SinkData r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_SinkData"); + struct echo_SinkData *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_SINKDATA]; + + r = talloc(NULL, struct echo_SinkData); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_SinkData(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_SinkData, &r); + NDR_PRINT_IN_DEBUG(echo_SinkData, r); - _echo_SinkData(p, &r); + _echo_SinkData(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_SinkData, &r); + NDR_PRINT_OUT_DEBUG(echo_SinkData, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_SinkData(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_SourceData(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_SourceData r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_SourceData"); + struct echo_SourceData *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_SOURCEDATA]; + + r = talloc(NULL, struct echo_SourceData); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_SourceData(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_SourceData, &r); + NDR_PRINT_IN_DEBUG(echo_SourceData, r); - ZERO_STRUCT(r.out); - r.out.data = talloc_zero_array(mem_ctx, uint8_t, r.in.len); - if (r.out.data == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.data = talloc_zero_array(r, uint8_t, r->in.len); + if (r->out.data == NULL) { + talloc_free(r); return False; } - _echo_SourceData(p, &r); + _echo_SourceData(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_SourceData, &r); + NDR_PRINT_OUT_DEBUG(echo_SourceData, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_SourceData(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestCall(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestCall r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall"); + struct echo_TestCall *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL]; + + r = talloc(NULL, struct echo_TestCall); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestCall(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestCall, &r); + NDR_PRINT_IN_DEBUG(echo_TestCall, r); - ZERO_STRUCT(r.out); - r.out.s2 = talloc_zero(mem_ctx, const char *); - if (r.out.s2 == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.s2 = talloc_zero(r, const char *); + if (r->out.s2 == NULL) { + talloc_free(r); return False; } - _echo_TestCall(p, &r); + _echo_TestCall(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestCall, &r); + NDR_PRINT_OUT_DEBUG(echo_TestCall, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestCall(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestCall2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestCall2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall2"); + struct echo_TestCall2 *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL2]; + + r = talloc(NULL, struct echo_TestCall2); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestCall2(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestCall2, &r); + NDR_PRINT_IN_DEBUG(echo_TestCall2, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union echo_Info); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union echo_Info); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _echo_TestCall2(p, &r); + r->out.result = _echo_TestCall2(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestCall2, &r); + NDR_PRINT_OUT_DEBUG(echo_TestCall2, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestCall2(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestSleep(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestSleep r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSleep"); + struct echo_TestSleep *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSLEEP]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct echo_TestSleep); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestSleep(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestSleep, &r); + NDR_PRINT_IN_DEBUG(echo_TestSleep, r); - r.out.result = _echo_TestSleep(p, &r); + r->out.result = _echo_TestSleep(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestSleep, &r); + NDR_PRINT_OUT_DEBUG(echo_TestSleep, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestSleep(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestEnum"); + struct echo_TestEnum *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTENUM]; + + r = talloc(NULL, struct echo_TestEnum); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestEnum(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestEnum, &r); + NDR_PRINT_IN_DEBUG(echo_TestEnum, r); - ZERO_STRUCT(r.out); - r.out.foo1 = r.in.foo1; - r.out.foo2 = r.in.foo2; - r.out.foo3 = r.in.foo3; - _echo_TestEnum(p, &r); + ZERO_STRUCT(r->out); + r->out.foo1 = r->in.foo1; + r->out.foo2 = r->in.foo2; + r->out.foo3 = r->in.foo3; + _echo_TestEnum(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestEnum, &r); + NDR_PRINT_OUT_DEBUG(echo_TestEnum, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestEnum(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestSurrounding(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestSurrounding r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSurrounding"); + struct echo_TestSurrounding *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSURROUNDING]; + + r = talloc(NULL, struct echo_TestSurrounding); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestSurrounding(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestSurrounding, &r); + NDR_PRINT_IN_DEBUG(echo_TestSurrounding, r); - ZERO_STRUCT(r.out); - r.out.data = r.in.data; - _echo_TestSurrounding(p, &r); + ZERO_STRUCT(r->out); + r->out.data = r->in.data; + _echo_TestSurrounding(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, &r); + NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestSurrounding(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_echo_TestDoublePointer(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct echo_TestDoublePointer r; - TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestDoublePointer"); + struct echo_TestDoublePointer *r; + + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTDOUBLEPOINTER]; + + r = talloc(NULL, struct echo_TestDoublePointer); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_echo_TestDoublePointer(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, &r); + NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, r); - r.out.result = _echo_TestDoublePointer(p, &r); + r->out.result = _echo_TestDoublePointer(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, &r); + NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_echo_TestDoublePointer(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } diff --git a/source3/librpc/gen_ndr/srv_epmapper.c b/source3/librpc/gen_ndr/srv_epmapper.c index e5a7989137..36c55b6890 100644 --- a/source3/librpc/gen_ndr/srv_epmapper.c +++ b/source3/librpc/gen_ndr/srv_epmapper.c @@ -8,542 +8,598 @@ static BOOL api_epm_Insert(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct epm_Insert r; - TALLOC_CTX *mem_ctx = talloc_init("api_epm_Insert"); + struct epm_Insert *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_epmapper.calls[NDR_EPM_INSERT]; + + r = talloc(NULL, struct epm_Insert); + 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_epm_Insert(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(epm_Insert, &r); + NDR_PRINT_IN_DEBUG(epm_Insert, r); - r.out.result = _epm_Insert(p, &r); + r->out.result = _epm_Insert(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(epm_Insert, &r); + NDR_PRINT_OUT_DEBUG(epm_Insert, 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_epm_Insert(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_epm_Delete(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct epm_Delete r; - TALLOC_CTX *mem_ctx = talloc_init("api_epm_Delete"); + struct epm_Delete *r; + + call = &ndr_table_epmapper.calls[NDR_EPM_DELETE]; + + r = talloc(NULL, struct epm_Delete); + 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_epm_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(epm_Delete, &r); + NDR_PRINT_IN_DEBUG(epm_Delete, r); - r.out.result = _epm_Delete(p, &r); + r->out.result = _epm_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(epm_Delete, &r); + NDR_PRINT_OUT_DEBUG(epm_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_epm_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_epm_Lookup(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct epm_Lookup r; - TALLOC_CTX *mem_ctx = talloc_init("api_epm_Lookup"); + struct epm_Lookup *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_epmapper.calls[NDR_EPM_LOOKUP]; + + r = talloc(NULL, struct epm_Lookup); + 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_epm_Lookup(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(epm_Lookup, &r); + NDR_PRINT_IN_DEBUG(epm_Lookup, r); - ZERO_STRUCT(r.out); - r.out.entry_handle = r.in.entry_handle; - r.out.num_ents = talloc_zero(mem_ctx, uint32_t); - if (r.out.num_ents == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.entry_handle = r->in.entry_handle; + r->out.num_ents = talloc_zero(r, uint32_t); + if (r->out.num_ents == NULL) { + talloc_free(r); return False; } - r.out.entries = talloc_zero_array(mem_ctx, struct epm_entry_t, r.in.max_ents); - if (r.out.entries == NULL) { - talloc_free(mem_ctx); + r->out.entries = talloc_zero_array(r, struct epm_entry_t, r->in.max_ents); + if (r->out.entries == NULL) { + talloc_free(r); return False; } - r.out.result = _epm_Lookup(p, &r); + r->out.result = _epm_Lookup(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(epm_Lookup, &r); + NDR_PRINT_OUT_DEBUG(epm_Lookup, 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_epm_Lookup(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_epm_Map(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct epm_Map r; - TALLOC_CTX *mem_ctx = talloc_init("api_epm_Map"); + struct epm_Map *r; + + call = &ndr_table_epmapper.calls[NDR_EPM_MAP]; + + r = talloc(NULL, struct epm_Map); + 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_epm_Map(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(epm_Map, &r); + NDR_PRINT_IN_DEBUG(epm_Map, r); - ZERO_STRUCT(r.out); - r.out.entry_handle = r.in.entry_handle; - r.out.num_towers = talloc_zero(mem_ctx, uint32_t); - if (r.out.num_towers == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.entry_handle = r->in.entry_handle; + r->out.num_towers = talloc_zero(r, uint32_t); + if (r->out.num_towers == NULL) { + talloc_free(r); return False; } - r.out.towers = talloc_zero_array(mem_ctx, struct epm_twr_p_t, r.in.max_towers); - if (r.out.towers == NULL) { - talloc_free(mem_ctx); + r->out.towers = talloc_zero_array(r, struct epm_twr_p_t, r->in.max_towers); + if (r->out.towers == NULL) { + talloc_free(r); return False; } - r.out.result = _epm_Map(p, &r); + r->out.result = _epm_Map(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(epm_Map, &r); + NDR_PRINT_OUT_DEBUG(epm_Map, 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_epm_Map(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_epm_LookupHandleFree(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct epm_LookupHandleFree r; - TALLOC_CTX *mem_ctx = talloc_init("api_epm_LookupHandleFree"); + struct epm_LookupHandleFree *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_epmapper.calls[NDR_EPM_LOOKUPHANDLEFREE]; + + r = talloc(NULL, struct epm_LookupHandleFree); + 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_epm_LookupHandleFree(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(epm_LookupHandleFree, &r); + NDR_PRINT_IN_DEBUG(epm_LookupHandleFree, r); - ZERO_STRUCT(r.out); - r.out.entry_handle = r.in.entry_handle; - r.out.result = _epm_LookupHandleFree(p, &r); + ZERO_STRUCT(r->out); + r->out.entry_handle = r->in.entry_handle; + r->out.result = _epm_LookupHandleFree(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(epm_LookupHandleFree, &r); + NDR_PRINT_OUT_DEBUG(epm_LookupHandleFree, 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_epm_LookupHandleFree(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_epm_InqObject(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct epm_InqObject r; - TALLOC_CTX *mem_ctx = talloc_init("api_epm_InqObject"); + struct epm_InqObject *r; + + call = &ndr_table_epmapper.calls[NDR_EPM_INQOBJECT]; + + r = talloc(NULL, struct epm_InqObject); + 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_epm_InqObject(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(epm_InqObject, &r); + NDR_PRINT_IN_DEBUG(epm_InqObject, r); - r.out.result = _epm_InqObject(p, &r); + r->out.result = _epm_InqObject(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(epm_InqObject, &r); + NDR_PRINT_OUT_DEBUG(epm_InqObject, 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_epm_InqObject(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_epm_MgmtDelete(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct epm_MgmtDelete r; - TALLOC_CTX *mem_ctx = talloc_init("api_epm_MgmtDelete"); + struct epm_MgmtDelete *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_epmapper.calls[NDR_EPM_MGMTDELETE]; + + r = talloc(NULL, struct epm_MgmtDelete); + 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_epm_MgmtDelete(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(epm_MgmtDelete, &r); + NDR_PRINT_IN_DEBUG(epm_MgmtDelete, r); - r.out.result = _epm_MgmtDelete(p, &r); + r->out.result = _epm_MgmtDelete(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(epm_MgmtDelete, &r); + NDR_PRINT_OUT_DEBUG(epm_MgmtDelete, 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_epm_MgmtDelete(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_epm_MapAuth(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct epm_MapAuth r; - TALLOC_CTX *mem_ctx = talloc_init("api_epm_MapAuth"); + struct epm_MapAuth *r; + + call = &ndr_table_epmapper.calls[NDR_EPM_MAPAUTH]; + + r = talloc(NULL, struct epm_MapAuth); + 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_epm_MapAuth(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(epm_MapAuth, &r); + NDR_PRINT_IN_DEBUG(epm_MapAuth, r); - r.out.result = _epm_MapAuth(p, &r); + r->out.result = _epm_MapAuth(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(epm_MapAuth, &r); + NDR_PRINT_OUT_DEBUG(epm_MapAuth, 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_epm_MapAuth(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; } diff --git a/source3/librpc/gen_ndr/srv_eventlog.c b/source3/librpc/gen_ndr/srv_eventlog.c index c2d65a6694..d58753511a 100644 --- a/source3/librpc/gen_ndr/srv_eventlog.c +++ b/source3/librpc/gen_ndr/srv_eventlog.c @@ -8,1571 +8,1739 @@ static BOOL api_eventlog_ClearEventLogW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_ClearEventLogW r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_ClearEventLogW"); + struct eventlog_ClearEventLogW *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLEAREVENTLOGW]; + + r = talloc(NULL, struct eventlog_ClearEventLogW); + 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_eventlog_ClearEventLogW(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(eventlog_ClearEventLogW, &r); + NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogW, r); - r.out.result = _eventlog_ClearEventLogW(p, &r); + r->out.result = _eventlog_ClearEventLogW(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(eventlog_ClearEventLogW, &r); + NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogW, 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_eventlog_ClearEventLogW(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_eventlog_BackupEventLogW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_BackupEventLogW r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_BackupEventLogW"); + struct eventlog_BackupEventLogW *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_BACKUPEVENTLOGW]; + + r = talloc(NULL, struct eventlog_BackupEventLogW); + 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_eventlog_BackupEventLogW(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(eventlog_BackupEventLogW, &r); + NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogW, r); - r.out.result = _eventlog_BackupEventLogW(p, &r); + r->out.result = _eventlog_BackupEventLogW(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(eventlog_BackupEventLogW, &r); + NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogW, 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_eventlog_BackupEventLogW(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_eventlog_CloseEventLog(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_CloseEventLog r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_CloseEventLog"); + struct eventlog_CloseEventLog *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLOSEEVENTLOG]; + + r = talloc(NULL, struct eventlog_CloseEventLog); + 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_eventlog_CloseEventLog(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(eventlog_CloseEventLog, &r); + NDR_PRINT_IN_DEBUG(eventlog_CloseEventLog, r); - ZERO_STRUCT(r.out); - r.out.handle = r.in.handle; - r.out.result = _eventlog_CloseEventLog(p, &r); + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _eventlog_CloseEventLog(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(eventlog_CloseEventLog, &r); + NDR_PRINT_OUT_DEBUG(eventlog_CloseEventLog, 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_eventlog_CloseEventLog(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_eventlog_DeregisterEventSource(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_DeregisterEventSource r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_DeregisterEventSource"); + struct eventlog_DeregisterEventSource *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_DEREGISTEREVENTSOURCE]; + + r = talloc(NULL, struct eventlog_DeregisterEventSource); + 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_eventlog_DeregisterEventSource(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(eventlog_DeregisterEventSource, &r); + NDR_PRINT_IN_DEBUG(eventlog_DeregisterEventSource, r); - r.out.result = _eventlog_DeregisterEventSource(p, &r); + r->out.result = _eventlog_DeregisterEventSource(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(eventlog_DeregisterEventSource, &r); + NDR_PRINT_OUT_DEBUG(eventlog_DeregisterEventSource, 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_eventlog_DeregisterEventSource(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_eventlog_GetNumRecords(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_GetNumRecords r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_GetNumRecords"); + struct eventlog_GetNumRecords *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETNUMRECORDS]; + + r = talloc(NULL, struct eventlog_GetNumRecords); + 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_eventlog_GetNumRecords(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(eventlog_GetNumRecords, &r); + NDR_PRINT_IN_DEBUG(eventlog_GetNumRecords, r); - ZERO_STRUCT(r.out); - r.out.number = talloc_zero(mem_ctx, uint32_t); - if (r.out.number == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.number = talloc_zero(r, uint32_t); + if (r->out.number == NULL) { + talloc_free(r); return False; } - r.out.result = _eventlog_GetNumRecords(p, &r); + r->out.result = _eventlog_GetNumRecords(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(eventlog_GetNumRecords, &r); + NDR_PRINT_OUT_DEBUG(eventlog_GetNumRecords, 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_eventlog_GetNumRecords(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_eventlog_GetOldestRecord(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_GetOldestRecord r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_GetOldestRecord"); + struct eventlog_GetOldestRecord *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETOLDESTRECORD]; + + r = talloc(NULL, struct eventlog_GetOldestRecord); + 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_eventlog_GetOldestRecord(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(eventlog_GetOldestRecord, &r); + NDR_PRINT_IN_DEBUG(eventlog_GetOldestRecord, r); - r.out.result = _eventlog_GetOldestRecord(p, &r); + r->out.result = _eventlog_GetOldestRecord(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(eventlog_GetOldestRecord, &r); + NDR_PRINT_OUT_DEBUG(eventlog_GetOldestRecord, 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_eventlog_GetOldestRecord(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_eventlog_ChangeNotify(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_ChangeNotify r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_ChangeNotify"); + struct eventlog_ChangeNotify *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CHANGENOTIFY]; + + r = talloc(NULL, struct eventlog_ChangeNotify); + 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_eventlog_ChangeNotify(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(eventlog_ChangeNotify, &r); + NDR_PRINT_IN_DEBUG(eventlog_ChangeNotify, r); - r.out.result = _eventlog_ChangeNotify(p, &r); + r->out.result = _eventlog_ChangeNotify(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(eventlog_ChangeNotify, &r); + NDR_PRINT_OUT_DEBUG(eventlog_ChangeNotify, 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_eventlog_ChangeNotify(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_eventlog_OpenEventLogW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_OpenEventLogW r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_OpenEventLogW"); + struct eventlog_OpenEventLogW *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENEVENTLOGW]; + + r = talloc(NULL, struct eventlog_OpenEventLogW); + 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_eventlog_OpenEventLogW(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(eventlog_OpenEventLogW, &r); + NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogW, 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 = _eventlog_OpenEventLogW(p, &r); + r->out.result = _eventlog_OpenEventLogW(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(eventlog_OpenEventLogW, &r); + NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogW, 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_eventlog_OpenEventLogW(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_eventlog_RegisterEventSourceW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_RegisterEventSourceW r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_RegisterEventSourceW"); + struct eventlog_RegisterEventSourceW *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTEREVENTSOURCEW]; + + r = talloc(NULL, struct eventlog_RegisterEventSourceW); + 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_eventlog_RegisterEventSourceW(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(eventlog_RegisterEventSourceW, &r); + NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceW, r); - r.out.result = _eventlog_RegisterEventSourceW(p, &r); + r->out.result = _eventlog_RegisterEventSourceW(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(eventlog_RegisterEventSourceW, &r); + NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceW, 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_eventlog_RegisterEventSourceW(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_eventlog_OpenBackupEventLogW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_OpenBackupEventLogW r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_OpenBackupEventLogW"); + struct eventlog_OpenBackupEventLogW *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENBACKUPEVENTLOGW]; + + r = talloc(NULL, struct eventlog_OpenBackupEventLogW); + 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_eventlog_OpenBackupEventLogW(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(eventlog_OpenBackupEventLogW, &r); + NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogW, r); - r.out.result = _eventlog_OpenBackupEventLogW(p, &r); + r->out.result = _eventlog_OpenBackupEventLogW(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(eventlog_OpenBackupEventLogW, &r); + NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogW, 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_eventlog_OpenBackupEventLogW(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_eventlog_ReadEventLogW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_ReadEventLogW r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_ReadEventLogW"); + struct eventlog_ReadEventLogW *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_READEVENTLOGW]; + + r = talloc(NULL, struct eventlog_ReadEventLogW); + 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_eventlog_ReadEventLogW(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(eventlog_ReadEventLogW, &r); + NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogW, r); - ZERO_STRUCT(r.out); - r.out.data = talloc_zero_array(mem_ctx, uint8_t, r.in.number_of_bytes); - if (r.out.data == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.data = talloc_zero_array(r, uint8_t, r->in.number_of_bytes); + if (r->out.data == NULL) { + talloc_free(r); return False; } - r.out.sent_size = talloc_zero(mem_ctx, uint32_t); - if (r.out.sent_size == NULL) { - talloc_free(mem_ctx); + r->out.sent_size = talloc_zero(r, uint32_t); + if (r->out.sent_size == NULL) { + talloc_free(r); return False; } - r.out.real_size = talloc_zero(mem_ctx, uint32_t); - if (r.out.real_size == NULL) { - talloc_free(mem_ctx); + r->out.real_size = talloc_zero(r, uint32_t); + if (r->out.real_size == NULL) { + talloc_free(r); return False; } - r.out.result = _eventlog_ReadEventLogW(p, &r); + r->out.result = _eventlog_ReadEventLogW(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(eventlog_ReadEventLogW, &r); + NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogW, 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_eventlog_ReadEventLogW(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_eventlog_ReportEventW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_ReportEventW r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_ReportEventW"); + struct eventlog_ReportEventW *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REPORTEVENTW]; + + r = talloc(NULL, struct eventlog_ReportEventW); + 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_eventlog_ReportEventW(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(eventlog_ReportEventW, &r); + NDR_PRINT_IN_DEBUG(eventlog_ReportEventW, r); - r.out.result = _eventlog_ReportEventW(p, &r); + r->out.result = _eventlog_ReportEventW(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(eventlog_ReportEventW, &r); + NDR_PRINT_OUT_DEBUG(eventlog_ReportEventW, 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_eventlog_ReportEventW(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_eventlog_ClearEventLogA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_ClearEventLogA r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_ClearEventLogA"); + struct eventlog_ClearEventLogA *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLEAREVENTLOGA]; + + r = talloc(NULL, struct eventlog_ClearEventLogA); + 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_eventlog_ClearEventLogA(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(eventlog_ClearEventLogA, &r); + NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogA, r); - r.out.result = _eventlog_ClearEventLogA(p, &r); + r->out.result = _eventlog_ClearEventLogA(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(eventlog_ClearEventLogA, &r); + NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogA, 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_eventlog_ClearEventLogA(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_eventlog_BackupEventLogA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_BackupEventLogA r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_BackupEventLogA"); + struct eventlog_BackupEventLogA *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_BACKUPEVENTLOGA]; + + r = talloc(NULL, struct eventlog_BackupEventLogA); + 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_eventlog_BackupEventLogA(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(eventlog_BackupEventLogA, &r); + NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogA, r); - r.out.result = _eventlog_BackupEventLogA(p, &r); + r->out.result = _eventlog_BackupEventLogA(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(eventlog_BackupEventLogA, &r); + NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogA, 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_eventlog_BackupEventLogA(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_eventlog_OpenEventLogA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_OpenEventLogA r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_OpenEventLogA"); + struct eventlog_OpenEventLogA *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENEVENTLOGA]; + + r = talloc(NULL, struct eventlog_OpenEventLogA); + 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_eventlog_OpenEventLogA(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(eventlog_OpenEventLogA, &r); + NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogA, r); - r.out.result = _eventlog_OpenEventLogA(p, &r); + r->out.result = _eventlog_OpenEventLogA(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(eventlog_OpenEventLogA, &r); + NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogA, 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_eventlog_OpenEventLogA(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_eventlog_RegisterEventSourceA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_RegisterEventSourceA r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_RegisterEventSourceA"); + struct eventlog_RegisterEventSourceA *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTEREVENTSOURCEA]; + + r = talloc(NULL, struct eventlog_RegisterEventSourceA); + 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_eventlog_RegisterEventSourceA(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(eventlog_RegisterEventSourceA, &r); + NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceA, r); - r.out.result = _eventlog_RegisterEventSourceA(p, &r); + r->out.result = _eventlog_RegisterEventSourceA(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(eventlog_RegisterEventSourceA, &r); + NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceA, 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_eventlog_RegisterEventSourceA(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_eventlog_OpenBackupEventLogA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_OpenBackupEventLogA r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_OpenBackupEventLogA"); + struct eventlog_OpenBackupEventLogA *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENBACKUPEVENTLOGA]; + + r = talloc(NULL, struct eventlog_OpenBackupEventLogA); + 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_eventlog_OpenBackupEventLogA(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(eventlog_OpenBackupEventLogA, &r); + NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogA, r); - r.out.result = _eventlog_OpenBackupEventLogA(p, &r); + r->out.result = _eventlog_OpenBackupEventLogA(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(eventlog_OpenBackupEventLogA, &r); + NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogA, 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_eventlog_OpenBackupEventLogA(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_eventlog_ReadEventLogA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_ReadEventLogA r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_ReadEventLogA"); + struct eventlog_ReadEventLogA *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_READEVENTLOGA]; + + r = talloc(NULL, struct eventlog_ReadEventLogA); + 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_eventlog_ReadEventLogA(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(eventlog_ReadEventLogA, &r); + NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogA, r); - r.out.result = _eventlog_ReadEventLogA(p, &r); + r->out.result = _eventlog_ReadEventLogA(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(eventlog_ReadEventLogA, &r); + NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogA, 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_eventlog_ReadEventLogA(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_eventlog_ReportEventA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_ReportEventA r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_ReportEventA"); + struct eventlog_ReportEventA *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REPORTEVENTA]; + + r = talloc(NULL, struct eventlog_ReportEventA); + 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_eventlog_ReportEventA(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(eventlog_ReportEventA, &r); + NDR_PRINT_IN_DEBUG(eventlog_ReportEventA, r); - r.out.result = _eventlog_ReportEventA(p, &r); + r->out.result = _eventlog_ReportEventA(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(eventlog_ReportEventA, &r); + NDR_PRINT_OUT_DEBUG(eventlog_ReportEventA, 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_eventlog_ReportEventA(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_eventlog_RegisterClusterSvc(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_RegisterClusterSvc r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_RegisterClusterSvc"); + struct eventlog_RegisterClusterSvc *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTERCLUSTERSVC]; + + r = talloc(NULL, struct eventlog_RegisterClusterSvc); + 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_eventlog_RegisterClusterSvc(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(eventlog_RegisterClusterSvc, &r); + NDR_PRINT_IN_DEBUG(eventlog_RegisterClusterSvc, r); - r.out.result = _eventlog_RegisterClusterSvc(p, &r); + r->out.result = _eventlog_RegisterClusterSvc(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(eventlog_RegisterClusterSvc, &r); + NDR_PRINT_OUT_DEBUG(eventlog_RegisterClusterSvc, 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_eventlog_RegisterClusterSvc(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_eventlog_DeregisterClusterSvc(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_DeregisterClusterSvc r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_DeregisterClusterSvc"); + struct eventlog_DeregisterClusterSvc *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_DEREGISTERCLUSTERSVC]; + + r = talloc(NULL, struct eventlog_DeregisterClusterSvc); + 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_eventlog_DeregisterClusterSvc(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(eventlog_DeregisterClusterSvc, &r); + NDR_PRINT_IN_DEBUG(eventlog_DeregisterClusterSvc, r); - r.out.result = _eventlog_DeregisterClusterSvc(p, &r); + r->out.result = _eventlog_DeregisterClusterSvc(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(eventlog_DeregisterClusterSvc, &r); + NDR_PRINT_OUT_DEBUG(eventlog_DeregisterClusterSvc, 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_eventlog_DeregisterClusterSvc(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_eventlog_WriteClusterEvents(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_WriteClusterEvents r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_WriteClusterEvents"); + struct eventlog_WriteClusterEvents *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_WRITECLUSTEREVENTS]; + + r = talloc(NULL, struct eventlog_WriteClusterEvents); + 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_eventlog_WriteClusterEvents(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(eventlog_WriteClusterEvents, &r); + NDR_PRINT_IN_DEBUG(eventlog_WriteClusterEvents, r); - r.out.result = _eventlog_WriteClusterEvents(p, &r); + r->out.result = _eventlog_WriteClusterEvents(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(eventlog_WriteClusterEvents, &r); + NDR_PRINT_OUT_DEBUG(eventlog_WriteClusterEvents, 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_eventlog_WriteClusterEvents(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_eventlog_GetLogIntormation(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_GetLogIntormation r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_GetLogIntormation"); + struct eventlog_GetLogIntormation *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETLOGINTORMATION]; + + r = talloc(NULL, struct eventlog_GetLogIntormation); + 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_eventlog_GetLogIntormation(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(eventlog_GetLogIntormation, &r); + NDR_PRINT_IN_DEBUG(eventlog_GetLogIntormation, r); - r.out.result = _eventlog_GetLogIntormation(p, &r); + r->out.result = _eventlog_GetLogIntormation(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(eventlog_GetLogIntormation, &r); + NDR_PRINT_OUT_DEBUG(eventlog_GetLogIntormation, 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_eventlog_GetLogIntormation(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_eventlog_FlushEventLog(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct eventlog_FlushEventLog r; - TALLOC_CTX *mem_ctx = talloc_init("api_eventlog_FlushEventLog"); + struct eventlog_FlushEventLog *r; + + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_FLUSHEVENTLOG]; + + r = talloc(NULL, struct eventlog_FlushEventLog); + 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_eventlog_FlushEventLog(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(eventlog_FlushEventLog, &r); + NDR_PRINT_IN_DEBUG(eventlog_FlushEventLog, r); - r.out.result = _eventlog_FlushEventLog(p, &r); + r->out.result = _eventlog_FlushEventLog(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(eventlog_FlushEventLog, &r); + NDR_PRINT_OUT_DEBUG(eventlog_FlushEventLog, 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_eventlog_FlushEventLog(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; } diff --git a/source3/librpc/gen_ndr/srv_initshutdown.c b/source3/librpc/gen_ndr/srv_initshutdown.c index b47ca9b600..3a7ce728ce 100644 --- a/source3/librpc/gen_ndr/srv_initshutdown.c +++ b/source3/librpc/gen_ndr/srv_initshutdown.c @@ -8,192 +8,213 @@ static BOOL api_initshutdown_Init(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct initshutdown_Init r; - TALLOC_CTX *mem_ctx = talloc_init("api_initshutdown_Init"); + struct initshutdown_Init *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_INIT]; + + r = talloc(NULL, struct initshutdown_Init); + 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_initshutdown_Init(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(initshutdown_Init, &r); + NDR_PRINT_IN_DEBUG(initshutdown_Init, r); - r.out.result = _initshutdown_Init(p, &r); + r->out.result = _initshutdown_Init(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(initshutdown_Init, &r); + NDR_PRINT_OUT_DEBUG(initshutdown_Init, 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_initshutdown_Init(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_initshutdown_Abort(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct initshutdown_Abort r; - TALLOC_CTX *mem_ctx = talloc_init("api_initshutdown_Abort"); + struct initshutdown_Abort *r; + + call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_ABORT]; + + r = talloc(NULL, struct initshutdown_Abort); + 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_initshutdown_Abort(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(initshutdown_Abort, &r); + NDR_PRINT_IN_DEBUG(initshutdown_Abort, r); - r.out.result = _initshutdown_Abort(p, &r); + r->out.result = _initshutdown_Abort(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(initshutdown_Abort, &r); + NDR_PRINT_OUT_DEBUG(initshutdown_Abort, 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_initshutdown_Abort(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_initshutdown_InitEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct initshutdown_InitEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_initshutdown_InitEx"); + struct initshutdown_InitEx *r; + + call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_INITEX]; + + r = talloc(NULL, struct initshutdown_InitEx); + 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_initshutdown_InitEx(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(initshutdown_InitEx, &r); + NDR_PRINT_IN_DEBUG(initshutdown_InitEx, r); - r.out.result = _initshutdown_InitEx(p, &r); + r->out.result = _initshutdown_InitEx(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(initshutdown_InitEx, &r); + NDR_PRINT_OUT_DEBUG(initshutdown_InitEx, 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_initshutdown_InitEx(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; } diff --git a/source3/librpc/gen_ndr/srv_lsa.c b/source3/librpc/gen_ndr/srv_lsa.c index 01d34abfea..d528d7bb0c 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; } diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c index 2dc90d1c74..a372d7f5d9 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.c +++ b/source3/librpc/gen_ndr/srv_netlogon.c @@ -8,3269 +8,3598 @@ static BOOL api_netr_LogonUasLogon(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonUasLogon r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonUasLogon"); + struct netr_LogonUasLogon *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONUASLOGON]; + + r = talloc(NULL, struct netr_LogonUasLogon); + 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_netr_LogonUasLogon(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(netr_LogonUasLogon, &r); + NDR_PRINT_IN_DEBUG(netr_LogonUasLogon, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, struct netr_UasInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, struct netr_UasInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_LogonUasLogon(p, &r); + r->out.result = _netr_LogonUasLogon(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(netr_LogonUasLogon, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, 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_netr_LogonUasLogon(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_netr_LogonUasLogoff(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonUasLogoff r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonUasLogoff"); + struct netr_LogonUasLogoff *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONUASLOGOFF]; + + r = talloc(NULL, struct netr_LogonUasLogoff); + 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_netr_LogonUasLogoff(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(netr_LogonUasLogoff, &r); + NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, struct netr_UasLogoffInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, struct netr_UasLogoffInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_LogonUasLogoff(p, &r); + r->out.result = _netr_LogonUasLogoff(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(netr_LogonUasLogoff, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, 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_netr_LogonUasLogoff(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_netr_LogonSamLogon(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonSamLogon r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonSamLogon"); + struct netr_LogonSamLogon *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGON]; + + r = talloc(NULL, struct netr_LogonSamLogon); + 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_netr_LogonSamLogon(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(netr_LogonSamLogon, &r); + NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.validation = talloc_zero(mem_ctx, union netr_Validation); - if (r.out.validation == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.validation = talloc_zero(r, union netr_Validation); + if (r->out.validation == NULL) { + talloc_free(r); return False; } - r.out.authoritative = talloc_zero(mem_ctx, uint8_t); - if (r.out.authoritative == NULL) { - talloc_free(mem_ctx); + r->out.authoritative = talloc_zero(r, uint8_t); + if (r->out.authoritative == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_LogonSamLogon(p, &r); + r->out.result = _netr_LogonSamLogon(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(netr_LogonSamLogon, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, 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_netr_LogonSamLogon(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_netr_LogonSamLogoff(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonSamLogoff r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonSamLogoff"); + struct netr_LogonSamLogoff *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGOFF]; + + r = talloc(NULL, struct netr_LogonSamLogoff); + 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_netr_LogonSamLogoff(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(netr_LogonSamLogoff, &r); + NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.result = _netr_LogonSamLogoff(p, &r); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.result = _netr_LogonSamLogoff(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(netr_LogonSamLogoff, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, 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_netr_LogonSamLogoff(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_netr_ServerReqChallenge(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_ServerReqChallenge r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_ServerReqChallenge"); + struct netr_ServerReqChallenge *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERREQCHALLENGE]; + + r = talloc(NULL, struct netr_ServerReqChallenge); + 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_netr_ServerReqChallenge(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(netr_ServerReqChallenge, &r); + NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, r); - ZERO_STRUCT(r.out); - r.out.credentials = r.in.credentials; - r.out.result = _netr_ServerReqChallenge(p, &r); + ZERO_STRUCT(r->out); + r->out.credentials = r->in.credentials; + r->out.result = _netr_ServerReqChallenge(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(netr_ServerReqChallenge, &r); + NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, 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_netr_ServerReqChallenge(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_netr_ServerAuthenticate(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_ServerAuthenticate r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_ServerAuthenticate"); + struct netr_ServerAuthenticate *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE]; + + r = talloc(NULL, struct netr_ServerAuthenticate); + 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_netr_ServerAuthenticate(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(netr_ServerAuthenticate, &r); + NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate, r); - ZERO_STRUCT(r.out); - r.out.credentials = r.in.credentials; - r.out.result = _netr_ServerAuthenticate(p, &r); + ZERO_STRUCT(r->out); + r->out.credentials = r->in.credentials; + r->out.result = _netr_ServerAuthenticate(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(netr_ServerAuthenticate, &r); + NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, 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_netr_ServerAuthenticate(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_netr_ServerPasswordSet(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_ServerPasswordSet r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_ServerPasswordSet"); + struct netr_ServerPasswordSet *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET]; + + r = talloc(NULL, struct netr_ServerPasswordSet); + 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_netr_ServerPasswordSet(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(netr_ServerPasswordSet, &r); + NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator); - if (r.out.return_authenticator == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_ServerPasswordSet(p, &r); + r->out.result = _netr_ServerPasswordSet(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(netr_ServerPasswordSet, &r); + NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, 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_netr_ServerPasswordSet(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_netr_DatabaseDeltas(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DatabaseDeltas r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DatabaseDeltas"); + struct netr_DatabaseDeltas *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DATABASEDELTAS]; + + r = talloc(NULL, struct netr_DatabaseDeltas); + 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_netr_DatabaseDeltas(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(netr_DatabaseDeltas, &r); + NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.sequence_num = r.in.sequence_num; - r.out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY); - if (r.out.delta_enum_array == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.sequence_num = r->in.sequence_num; + r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY); + if (r->out.delta_enum_array == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DatabaseDeltas(p, &r); + r->out.result = _netr_DatabaseDeltas(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(netr_DatabaseDeltas, &r); + NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, 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_netr_DatabaseDeltas(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_netr_DatabaseSync(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DatabaseSync r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DatabaseSync"); + struct netr_DatabaseSync *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DATABASESYNC]; + + r = talloc(NULL, struct netr_DatabaseSync); + 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_netr_DatabaseSync(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(netr_DatabaseSync, &r); + NDR_PRINT_IN_DEBUG(netr_DatabaseSync, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.sync_context = r.in.sync_context; - r.out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY); - if (r.out.delta_enum_array == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.sync_context = r->in.sync_context; + r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY); + if (r->out.delta_enum_array == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DatabaseSync(p, &r); + r->out.result = _netr_DatabaseSync(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(netr_DatabaseSync, &r); + NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, 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_netr_DatabaseSync(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_netr_AccountDeltas(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_AccountDeltas r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_AccountDeltas"); + struct netr_AccountDeltas *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_ACCOUNTDELTAS]; + + r = talloc(NULL, struct netr_AccountDeltas); + 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_netr_AccountDeltas(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(netr_AccountDeltas, &r); + NDR_PRINT_IN_DEBUG(netr_AccountDeltas, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.buffer = talloc_zero(mem_ctx, struct netr_AccountBuffer); - if (r.out.buffer == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.buffer = talloc_zero(r, struct netr_AccountBuffer); + if (r->out.buffer == NULL) { + talloc_free(r); return False; } - r.out.count_returned = talloc_zero(mem_ctx, uint32_t); - if (r.out.count_returned == NULL) { - talloc_free(mem_ctx); + r->out.count_returned = talloc_zero(r, uint32_t); + if (r->out.count_returned == NULL) { + talloc_free(r); return False; } - r.out.total_entries = talloc_zero(mem_ctx, uint32_t); - if (r.out.total_entries == NULL) { - talloc_free(mem_ctx); + r->out.total_entries = talloc_zero(r, uint32_t); + if (r->out.total_entries == NULL) { + talloc_free(r); return False; } - r.out.recordid = talloc_zero(mem_ctx, struct netr_UAS_INFO_0); - if (r.out.recordid == NULL) { - talloc_free(mem_ctx); + r->out.recordid = talloc_zero(r, struct netr_UAS_INFO_0); + if (r->out.recordid == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_AccountDeltas(p, &r); + r->out.result = _netr_AccountDeltas(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(netr_AccountDeltas, &r); + NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, 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_netr_AccountDeltas(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_netr_AccountSync(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_AccountSync r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_AccountSync"); + struct netr_AccountSync *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_ACCOUNTSYNC]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_AccountSync); + 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_netr_AccountSync(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(netr_AccountSync, &r); + NDR_PRINT_IN_DEBUG(netr_AccountSync, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.buffer = talloc_zero(mem_ctx, struct netr_AccountBuffer); - if (r.out.buffer == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.buffer = talloc_zero(r, struct netr_AccountBuffer); + if (r->out.buffer == NULL) { + talloc_free(r); return False; } - r.out.count_returned = talloc_zero(mem_ctx, uint32_t); - if (r.out.count_returned == NULL) { - talloc_free(mem_ctx); + r->out.count_returned = talloc_zero(r, uint32_t); + if (r->out.count_returned == NULL) { + talloc_free(r); return False; } - r.out.total_entries = talloc_zero(mem_ctx, uint32_t); - if (r.out.total_entries == NULL) { - talloc_free(mem_ctx); + r->out.total_entries = talloc_zero(r, uint32_t); + if (r->out.total_entries == NULL) { + talloc_free(r); return False; } - r.out.next_reference = talloc_zero(mem_ctx, uint32_t); - if (r.out.next_reference == NULL) { - talloc_free(mem_ctx); + r->out.next_reference = talloc_zero(r, uint32_t); + if (r->out.next_reference == NULL) { + talloc_free(r); return False; } - r.out.recordid = r.in.recordid; - r.out.result = _netr_AccountSync(p, &r); + r->out.recordid = r->in.recordid; + r->out.result = _netr_AccountSync(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(netr_AccountSync, &r); + NDR_PRINT_OUT_DEBUG(netr_AccountSync, 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_netr_AccountSync(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_netr_GetDcName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_GetDcName r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_GetDcName"); + struct netr_GetDcName *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_GETDCNAME]; + + r = talloc(NULL, struct netr_GetDcName); + 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_netr_GetDcName(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(netr_GetDcName, &r); + NDR_PRINT_IN_DEBUG(netr_GetDcName, r); - ZERO_STRUCT(r.out); - r.out.dcname = talloc_zero(mem_ctx, const char *); - if (r.out.dcname == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.dcname = talloc_zero(r, const char *); + if (r->out.dcname == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_GetDcName(p, &r); + r->out.result = _netr_GetDcName(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(netr_GetDcName, &r); + NDR_PRINT_OUT_DEBUG(netr_GetDcName, 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_netr_GetDcName(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_netr_LogonControl(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonControl r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonControl"); + struct netr_LogonControl *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL]; + + r = talloc(NULL, struct netr_LogonControl); + 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_netr_LogonControl(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(netr_LogonControl, &r); + NDR_PRINT_IN_DEBUG(netr_LogonControl, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_LogonControl(p, &r); + r->out.result = _netr_LogonControl(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(netr_LogonControl, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonControl, 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_netr_LogonControl(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_netr_GetAnyDCName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_GetAnyDCName r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_GetAnyDCName"); + struct netr_GetAnyDCName *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_GETANYDCNAME]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_GetAnyDCName); + 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_netr_GetAnyDCName(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(netr_GetAnyDCName, &r); + NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, r); - ZERO_STRUCT(r.out); - r.out.dcname = talloc_zero(mem_ctx, const char *); - if (r.out.dcname == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.dcname = talloc_zero(r, const char *); + if (r->out.dcname == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_GetAnyDCName(p, &r); + r->out.result = _netr_GetAnyDCName(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(netr_GetAnyDCName, &r); + NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, 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_netr_GetAnyDCName(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_netr_LogonControl2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonControl2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonControl2"); + struct netr_LogonControl2 *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL2]; + + r = talloc(NULL, struct netr_LogonControl2); + 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_netr_LogonControl2(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(netr_LogonControl2, &r); + NDR_PRINT_IN_DEBUG(netr_LogonControl2, r); - ZERO_STRUCT(r.out); - r.out.query = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION); - if (r.out.query == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION); + if (r->out.query == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_LogonControl2(p, &r); + r->out.result = _netr_LogonControl2(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(netr_LogonControl2, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonControl2, 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_netr_LogonControl2(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_netr_ServerAuthenticate2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_ServerAuthenticate2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_ServerAuthenticate2"); + struct netr_ServerAuthenticate2 *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE2]; + + r = talloc(NULL, struct netr_ServerAuthenticate2); + 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_netr_ServerAuthenticate2(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(netr_ServerAuthenticate2, &r); + NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, r); - ZERO_STRUCT(r.out); - r.out.credentials = r.in.credentials; - r.out.negotiate_flags = r.in.negotiate_flags; - r.out.result = _netr_ServerAuthenticate2(p, &r); + ZERO_STRUCT(r->out); + r->out.credentials = r->in.credentials; + r->out.negotiate_flags = r->in.negotiate_flags; + r->out.result = _netr_ServerAuthenticate2(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(netr_ServerAuthenticate2, &r); + NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, 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_netr_ServerAuthenticate2(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_netr_DatabaseSync2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DatabaseSync2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DatabaseSync2"); + struct netr_DatabaseSync2 *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DATABASESYNC2]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_DatabaseSync2); + 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_netr_DatabaseSync2(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(netr_DatabaseSync2, &r); + NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.sync_context = r.in.sync_context; - r.out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY); - if (r.out.delta_enum_array == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.sync_context = r->in.sync_context; + r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY); + if (r->out.delta_enum_array == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DatabaseSync2(p, &r); + r->out.result = _netr_DatabaseSync2(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(netr_DatabaseSync2, &r); + NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, 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_netr_DatabaseSync2(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_netr_DatabaseRedo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DatabaseRedo r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DatabaseRedo"); + struct netr_DatabaseRedo *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_DATABASEREDO]; + + r = talloc(NULL, struct netr_DatabaseRedo); + 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_netr_DatabaseRedo(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(netr_DatabaseRedo, &r); + NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.delta_enum_array = talloc_zero(mem_ctx, struct netr_DELTA_ENUM_ARRAY); - if (r.out.delta_enum_array == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY); + if (r->out.delta_enum_array == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DatabaseRedo(p, &r); + r->out.result = _netr_DatabaseRedo(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(netr_DatabaseRedo, &r); + NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, 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_netr_DatabaseRedo(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_netr_LogonControl2Ex(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonControl2Ex r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonControl2Ex"); + struct netr_LogonControl2Ex *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL2EX]; + + r = talloc(NULL, struct netr_LogonControl2Ex); + 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_netr_LogonControl2Ex(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(netr_LogonControl2Ex, &r); + NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, r); - ZERO_STRUCT(r.out); - r.out.query = talloc_zero(mem_ctx, union netr_CONTROL_QUERY_INFORMATION); - if (r.out.query == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION); + if (r->out.query == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_LogonControl2Ex(p, &r); + r->out.result = _netr_LogonControl2Ex(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(netr_LogonControl2Ex, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, 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_netr_LogonControl2Ex(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_netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRENUMERATETRUSTEDDOMAINS r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRENUMERATETRUSTEDDOMAINS"); + struct netr_NETRENUMERATETRUSTEDDOMAINS *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINS]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_NETRENUMERATETRUSTEDDOMAINS); + 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_netr_NETRENUMERATETRUSTEDDOMAINS(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(netr_NETRENUMERATETRUSTEDDOMAINS, &r); + NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, r); - r.out.result = _netr_NETRENUMERATETRUSTEDDOMAINS(p, &r); + r->out.result = _netr_NETRENUMERATETRUSTEDDOMAINS(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(netr_NETRENUMERATETRUSTEDDOMAINS, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, 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_netr_NETRENUMERATETRUSTEDDOMAINS(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_netr_DsRGetDCName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DsRGetDCName r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DsRGetDCName"); + struct netr_DsRGetDCName *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAME]; + + r = talloc(NULL, struct netr_DsRGetDCName); + 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_netr_DsRGetDCName(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(netr_DsRGetDCName, &r); + NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DsRGetDCName(p, &r); + r->out.result = _netr_DsRGetDCName(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(netr_DsRGetDCName, &r); + NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, 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_netr_DsRGetDCName(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_netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRLOGONDUMMYROUTINE1 r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRLOGONDUMMYROUTINE1"); + struct netr_NETRLOGONDUMMYROUTINE1 *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONDUMMYROUTINE1]; + + r = talloc(NULL, struct netr_NETRLOGONDUMMYROUTINE1); + 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_netr_NETRLOGONDUMMYROUTINE1(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(netr_NETRLOGONDUMMYROUTINE1, &r); + NDR_PRINT_IN_DEBUG(netr_NETRLOGONDUMMYROUTINE1, r); - r.out.result = _netr_NETRLOGONDUMMYROUTINE1(p, &r); + r->out.result = _netr_NETRLOGONDUMMYROUTINE1(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(netr_NETRLOGONDUMMYROUTINE1, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRLOGONDUMMYROUTINE1, 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_netr_NETRLOGONDUMMYROUTINE1(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_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRLOGONSETSERVICEBITS r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRLOGONSETSERVICEBITS"); + struct netr_NETRLOGONSETSERVICEBITS *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSETSERVICEBITS]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_NETRLOGONSETSERVICEBITS); + 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_netr_NETRLOGONSETSERVICEBITS(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(netr_NETRLOGONSETSERVICEBITS, &r); + NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, r); - r.out.result = _netr_NETRLOGONSETSERVICEBITS(p, &r); + r->out.result = _netr_NETRLOGONSETSERVICEBITS(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(netr_NETRLOGONSETSERVICEBITS, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, 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_netr_NETRLOGONSETSERVICEBITS(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_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRLOGONGETTRUSTRID r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRLOGONGETTRUSTRID"); + struct netr_NETRLOGONGETTRUSTRID *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTRUSTRID]; + + r = talloc(NULL, struct netr_NETRLOGONGETTRUSTRID); + 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_netr_NETRLOGONGETTRUSTRID(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(netr_NETRLOGONGETTRUSTRID, &r); + NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, r); - r.out.result = _netr_NETRLOGONGETTRUSTRID(p, &r); + r->out.result = _netr_NETRLOGONGETTRUSTRID(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(netr_NETRLOGONGETTRUSTRID, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, 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_netr_NETRLOGONGETTRUSTRID(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_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRLOGONCOMPUTESERVERDIGEST r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRLOGONCOMPUTESERVERDIGEST"); + struct netr_NETRLOGONCOMPUTESERVERDIGEST *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST]; + + r = talloc(NULL, struct netr_NETRLOGONCOMPUTESERVERDIGEST); + 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_netr_NETRLOGONCOMPUTESERVERDIGEST(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(netr_NETRLOGONCOMPUTESERVERDIGEST, &r); + NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r); - r.out.result = _netr_NETRLOGONCOMPUTESERVERDIGEST(p, &r); + r->out.result = _netr_NETRLOGONCOMPUTESERVERDIGEST(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(netr_NETRLOGONCOMPUTESERVERDIGEST, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, 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_netr_NETRLOGONCOMPUTESERVERDIGEST(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_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRLOGONCOMPUTECLIENTDIGEST r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRLOGONCOMPUTECLIENTDIGEST"); + struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST]; + + r = talloc(NULL, struct netr_NETRLOGONCOMPUTECLIENTDIGEST); + 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_netr_NETRLOGONCOMPUTECLIENTDIGEST(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(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r); + NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r); - r.out.result = _netr_NETRLOGONCOMPUTECLIENTDIGEST(p, &r); + r->out.result = _netr_NETRLOGONCOMPUTECLIENTDIGEST(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(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, 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_netr_NETRLOGONCOMPUTECLIENTDIGEST(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_netr_ServerAuthenticate3(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_ServerAuthenticate3 r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_ServerAuthenticate3"); + struct netr_ServerAuthenticate3 *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE3]; + + r = talloc(NULL, struct netr_ServerAuthenticate3); + 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_netr_ServerAuthenticate3(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(netr_ServerAuthenticate3, &r); + NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, r); - ZERO_STRUCT(r.out); - r.out.credentials = r.in.credentials; - r.out.negotiate_flags = r.in.negotiate_flags; - r.out.rid = talloc_zero(mem_ctx, uint32_t); - if (r.out.rid == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.credentials = r->in.credentials; + r->out.negotiate_flags = r->in.negotiate_flags; + r->out.rid = talloc_zero(r, uint32_t); + if (r->out.rid == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_ServerAuthenticate3(p, &r); + r->out.result = _netr_ServerAuthenticate3(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(netr_ServerAuthenticate3, &r); + NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, 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_netr_ServerAuthenticate3(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_netr_DsRGetDCNameEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DsRGetDCNameEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DsRGetDCNameEx"); + struct netr_DsRGetDCNameEx *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX]; + + r = talloc(NULL, struct netr_DsRGetDCNameEx); + 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_netr_DsRGetDCNameEx(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(netr_DsRGetDCNameEx, &r); + NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DsRGetDCNameEx(p, &r); + r->out.result = _netr_DsRGetDCNameEx(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(netr_DsRGetDCNameEx, &r); + NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, 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_netr_DsRGetDCNameEx(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_netr_DsRGetSiteName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DsRGetSiteName r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DsRGetSiteName"); + struct netr_DsRGetSiteName *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETSITENAME]; + + r = talloc(NULL, struct netr_DsRGetSiteName); + 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_netr_DsRGetSiteName(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(netr_DsRGetSiteName, &r); + NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, r); - ZERO_STRUCT(r.out); - r.out.site = talloc_zero(mem_ctx, const char *); - if (r.out.site == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.site = talloc_zero(r, const char *); + if (r->out.site == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DsRGetSiteName(p, &r); + r->out.result = _netr_DsRGetSiteName(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(netr_DsRGetSiteName, &r); + NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, 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_netr_DsRGetSiteName(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_netr_LogonGetDomainInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonGetDomainInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonGetDomainInfo"); + struct netr_LogonGetDomainInfo *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETDOMAININFO]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_LogonGetDomainInfo); + 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_netr_LogonGetDomainInfo(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(netr_LogonGetDomainInfo, &r); + NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.info = talloc_zero(mem_ctx, union netr_DomainInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.info = talloc_zero(r, union netr_DomainInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_LogonGetDomainInfo(p, &r); + r->out.result = _netr_LogonGetDomainInfo(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(netr_LogonGetDomainInfo, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, 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_netr_LogonGetDomainInfo(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_netr_ServerPasswordSet2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_ServerPasswordSet2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_ServerPasswordSet2"); + struct netr_ServerPasswordSet2 *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET2]; + + r = talloc(NULL, struct netr_ServerPasswordSet2); + 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_netr_ServerPasswordSet2(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(netr_ServerPasswordSet2, &r); + NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = talloc_zero(mem_ctx, struct netr_Authenticator); - if (r.out.return_authenticator == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_ServerPasswordSet2(p, &r); + r->out.result = _netr_ServerPasswordSet2(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(netr_ServerPasswordSet2, &r); + NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, 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_netr_ServerPasswordSet2(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_netr_NETRSERVERPASSWORDGET(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRSERVERPASSWORDGET r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRSERVERPASSWORDGET"); + struct netr_NETRSERVERPASSWORDGET *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERPASSWORDGET]; + + r = talloc(NULL, struct netr_NETRSERVERPASSWORDGET); + 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_netr_NETRSERVERPASSWORDGET(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(netr_NETRSERVERPASSWORDGET, &r); + NDR_PRINT_IN_DEBUG(netr_NETRSERVERPASSWORDGET, r); - r.out.result = _netr_NETRSERVERPASSWORDGET(p, &r); + r->out.result = _netr_NETRSERVERPASSWORDGET(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(netr_NETRSERVERPASSWORDGET, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRSERVERPASSWORDGET, 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_netr_NETRSERVERPASSWORDGET(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_netr_NETRLOGONSENDTOSAM(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRLOGONSENDTOSAM r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRLOGONSENDTOSAM"); + struct netr_NETRLOGONSENDTOSAM *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSENDTOSAM]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_NETRLOGONSENDTOSAM); + 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_netr_NETRLOGONSENDTOSAM(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(netr_NETRLOGONSENDTOSAM, &r); + NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, r); - r.out.result = _netr_NETRLOGONSENDTOSAM(p, &r); + r->out.result = _netr_NETRLOGONSENDTOSAM(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(netr_NETRLOGONSENDTOSAM, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, 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_netr_NETRLOGONSENDTOSAM(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_netr_DSRADDRESSTOSITENAMESW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DSRADDRESSTOSITENAMESW r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DSRADDRESSTOSITENAMESW"); + struct netr_DSRADDRESSTOSITENAMESW *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESW]; + + r = talloc(NULL, struct netr_DSRADDRESSTOSITENAMESW); + 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_netr_DSRADDRESSTOSITENAMESW(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(netr_DSRADDRESSTOSITENAMESW, &r); + NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESW, r); - r.out.result = _netr_DSRADDRESSTOSITENAMESW(p, &r); + r->out.result = _netr_DSRADDRESSTOSITENAMESW(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(netr_DSRADDRESSTOSITENAMESW, &r); + NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESW, 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_netr_DSRADDRESSTOSITENAMESW(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_netr_DsRGetDCNameEx2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DsRGetDCNameEx2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DsRGetDCNameEx2"); + struct netr_DsRGetDCNameEx2 *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX2]; + + r = talloc(NULL, struct netr_DsRGetDCNameEx2); + 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_netr_DsRGetDCNameEx2(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(netr_DsRGetDCNameEx2, &r); + NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, struct netr_DsRGetDCNameInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DsRGetDCNameEx2(p, &r); + r->out.result = _netr_DsRGetDCNameEx2(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(netr_DsRGetDCNameEx2, &r); + NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, 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_netr_DsRGetDCNameEx2(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_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN"); + struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN); + 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_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(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(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r); + NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r); - r.out.result = _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(p, &r); + r->out.result = _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(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(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, 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_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(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_netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRENUMERATETRUSTEDDOMAINSEX r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRENUMERATETRUSTEDDOMAINSEX"); + struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX]; + + r = talloc(NULL, struct netr_NETRENUMERATETRUSTEDDOMAINSEX); + 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_netr_NETRENUMERATETRUSTEDDOMAINSEX(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(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r); + NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, r); - r.out.result = _netr_NETRENUMERATETRUSTEDDOMAINSEX(p, &r); + r->out.result = _netr_NETRENUMERATETRUSTEDDOMAINSEX(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(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, 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_netr_NETRENUMERATETRUSTEDDOMAINSEX(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_netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DSRADDRESSTOSITENAMESEXW r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DSRADDRESSTOSITENAMESEXW"); + struct netr_DSRADDRESSTOSITENAMESEXW *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESEXW]; + + r = talloc(NULL, struct netr_DSRADDRESSTOSITENAMESEXW); + 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_netr_DSRADDRESSTOSITENAMESEXW(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(netr_DSRADDRESSTOSITENAMESEXW, &r); + NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, r); - r.out.result = _netr_DSRADDRESSTOSITENAMESEXW(p, &r); + r->out.result = _netr_DSRADDRESSTOSITENAMESEXW(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(netr_DSRADDRESSTOSITENAMESEXW, &r); + NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, 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_netr_DSRADDRESSTOSITENAMESEXW(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_netr_DSRGETDCSITECOVERAGEW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DSRGETDCSITECOVERAGEW r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DSRGETDCSITECOVERAGEW"); + struct netr_DSRGETDCSITECOVERAGEW *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCSITECOVERAGEW]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_DSRGETDCSITECOVERAGEW); + 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_netr_DSRGETDCSITECOVERAGEW(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(netr_DSRGETDCSITECOVERAGEW, &r); + NDR_PRINT_IN_DEBUG(netr_DSRGETDCSITECOVERAGEW, r); - r.out.result = _netr_DSRGETDCSITECOVERAGEW(p, &r); + r->out.result = _netr_DSRGETDCSITECOVERAGEW(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(netr_DSRGETDCSITECOVERAGEW, &r); + NDR_PRINT_OUT_DEBUG(netr_DSRGETDCSITECOVERAGEW, 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_netr_DSRGETDCSITECOVERAGEW(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_netr_LogonSamLogonEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonSamLogonEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonSamLogonEx"); + struct netr_LogonSamLogonEx *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONEX]; + + r = talloc(NULL, struct netr_LogonSamLogonEx); + 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_netr_LogonSamLogonEx(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(netr_LogonSamLogonEx, &r); + NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, r); - ZERO_STRUCT(r.out); - r.out.validation = talloc_zero(mem_ctx, union netr_Validation); - if (r.out.validation == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.validation = talloc_zero(r, union netr_Validation); + if (r->out.validation == NULL) { + talloc_free(r); return False; } - r.out.authoritative = talloc_zero(mem_ctx, uint8_t); - if (r.out.authoritative == NULL) { - talloc_free(mem_ctx); + r->out.authoritative = talloc_zero(r, uint8_t); + if (r->out.authoritative == NULL) { + talloc_free(r); return False; } - r.out.flags = r.in.flags; - r.out.result = _netr_LogonSamLogonEx(p, &r); + r->out.flags = r->in.flags; + r->out.result = _netr_LogonSamLogonEx(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(netr_LogonSamLogonEx, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, 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_netr_LogonSamLogonEx(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_netr_DsrEnumerateDomainTrusts(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DsrEnumerateDomainTrusts r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DsrEnumerateDomainTrusts"); + struct netr_DsrEnumerateDomainTrusts *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DSRENUMERATEDOMAINTRUSTS]; + + r = talloc(NULL, struct netr_DsrEnumerateDomainTrusts); + 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_netr_DsrEnumerateDomainTrusts(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(netr_DsrEnumerateDomainTrusts, &r); + NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, r); - ZERO_STRUCT(r.out); - r.out.count = talloc_zero(mem_ctx, uint32_t); - if (r.out.count == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.count = talloc_zero(r, uint32_t); + if (r->out.count == NULL) { + talloc_free(r); return False; } - r.out.trusts = talloc_zero_array(mem_ctx, struct netr_DomainTrust *, r.out.count); - if (r.out.trusts == NULL) { - talloc_free(mem_ctx); + r->out.trusts = talloc_zero_array(r, struct netr_DomainTrust *, r->out.count); + if (r->out.trusts == NULL) { + talloc_free(r); return False; } - r.out.result = _netr_DsrEnumerateDomainTrusts(p, &r); + r->out.result = _netr_DsrEnumerateDomainTrusts(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(netr_DsrEnumerateDomainTrusts, &r); + NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, 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_netr_DsrEnumerateDomainTrusts(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_netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DSRDEREGISTERDNSHOSTRECORDS r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DSRDEREGISTERDNSHOSTRECORDS"); + struct netr_DSRDEREGISTERDNSHOSTRECORDS *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_DSRDEREGISTERDNSHOSTRECORDS); + 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_netr_DSRDEREGISTERDNSHOSTRECORDS(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(netr_DSRDEREGISTERDNSHOSTRECORDS, &r); + NDR_PRINT_IN_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, r); - r.out.result = _netr_DSRDEREGISTERDNSHOSTRECORDS(p, &r); + r->out.result = _netr_DSRDEREGISTERDNSHOSTRECORDS(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(netr_DSRDEREGISTERDNSHOSTRECORDS, &r); + NDR_PRINT_OUT_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, 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_netr_DSRDEREGISTERDNSHOSTRECORDS(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_netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRSERVERTRUSTPASSWORDSGET r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRSERVERTRUSTPASSWORDSGET"); + struct netr_NETRSERVERTRUSTPASSWORDSGET *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERTRUSTPASSWORDSGET]; + + r = talloc(NULL, struct netr_NETRSERVERTRUSTPASSWORDSGET); + 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_netr_NETRSERVERTRUSTPASSWORDSGET(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(netr_NETRSERVERTRUSTPASSWORDSGET, &r); + NDR_PRINT_IN_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, r); - r.out.result = _netr_NETRSERVERTRUSTPASSWORDSGET(p, &r); + r->out.result = _netr_NETRSERVERTRUSTPASSWORDSGET(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(netr_NETRSERVERTRUSTPASSWORDSGET, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, 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_netr_NETRSERVERTRUSTPASSWORDSGET(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_netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_DSRGETFORESTTRUSTINFORMATION r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_DSRGETFORESTTRUSTINFORMATION"); + struct netr_DSRGETFORESTTRUSTINFORMATION *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETFORESTTRUSTINFORMATION]; + + r = talloc(NULL, struct netr_DSRGETFORESTTRUSTINFORMATION); + 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_netr_DSRGETFORESTTRUSTINFORMATION(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(netr_DSRGETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_IN_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, r); - r.out.result = _netr_DSRGETFORESTTRUSTINFORMATION(p, &r); + r->out.result = _netr_DSRGETFORESTTRUSTINFORMATION(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(netr_DSRGETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_OUT_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, 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_netr_DSRGETFORESTTRUSTINFORMATION(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_netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRGETFORESTTRUSTINFORMATION r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRGETFORESTTRUSTINFORMATION"); + struct netr_NETRGETFORESTTRUSTINFORMATION *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRGETFORESTTRUSTINFORMATION]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct netr_NETRGETFORESTTRUSTINFORMATION); + 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_netr_NETRGETFORESTTRUSTINFORMATION(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(netr_NETRGETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_IN_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, r); - r.out.result = _netr_NETRGETFORESTTRUSTINFORMATION(p, &r); + r->out.result = _netr_NETRGETFORESTTRUSTINFORMATION(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(netr_NETRGETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, 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_netr_NETRGETFORESTTRUSTINFORMATION(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_netr_LogonSamLogonWithFlags(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_LogonSamLogonWithFlags r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_LogonSamLogonWithFlags"); + struct netr_LogonSamLogonWithFlags *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONWITHFLAGS]; + + r = talloc(NULL, struct netr_LogonSamLogonWithFlags); + 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_netr_LogonSamLogonWithFlags(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(netr_LogonSamLogonWithFlags, &r); + NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, r); - ZERO_STRUCT(r.out); - r.out.return_authenticator = r.in.return_authenticator; - r.out.validation = talloc_zero(mem_ctx, union netr_Validation); - if (r.out.validation == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.return_authenticator = r->in.return_authenticator; + r->out.validation = talloc_zero(r, union netr_Validation); + if (r->out.validation == NULL) { + talloc_free(r); return False; } - r.out.authoritative = talloc_zero(mem_ctx, uint8_t); - if (r.out.authoritative == NULL) { - talloc_free(mem_ctx); + r->out.authoritative = talloc_zero(r, uint8_t); + if (r->out.authoritative == NULL) { + talloc_free(r); return False; } - r.out.flags = r.in.flags; - r.out.result = _netr_LogonSamLogonWithFlags(p, &r); + r->out.flags = r->in.flags; + r->out.result = _netr_LogonSamLogonWithFlags(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(netr_LogonSamLogonWithFlags, &r); + NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, 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_netr_LogonSamLogonWithFlags(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_netr_NETRSERVERGETTRUSTINFO(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct netr_NETRSERVERGETTRUSTINFO r; - TALLOC_CTX *mem_ctx = talloc_init("api_netr_NETRSERVERGETTRUSTINFO"); + struct netr_NETRSERVERGETTRUSTINFO *r; + + call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERGETTRUSTINFO]; + + r = talloc(NULL, struct netr_NETRSERVERGETTRUSTINFO); + 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_netr_NETRSERVERGETTRUSTINFO(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(netr_NETRSERVERGETTRUSTINFO, &r); + NDR_PRINT_IN_DEBUG(netr_NETRSERVERGETTRUSTINFO, r); - r.out.result = _netr_NETRSERVERGETTRUSTINFO(p, &r); + r->out.result = _netr_NETRSERVERGETTRUSTINFO(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(netr_NETRSERVERGETTRUSTINFO, &r); + NDR_PRINT_OUT_DEBUG(netr_NETRSERVERGETTRUSTINFO, 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_netr_NETRSERVERGETTRUSTINFO(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; } diff --git a/source3/librpc/gen_ndr/srv_srvsvc.c b/source3/librpc/gen_ndr/srv_srvsvc.c index 72daa7ed09..88ca7fdc64 100644 --- a/source3/librpc/gen_ndr/srv_srvsvc.c +++ b/source3/librpc/gen_ndr/srv_srvsvc.c @@ -8,3640 +8,4018 @@ static BOOL api_srvsvc_NetCharDevEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetCharDevEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetCharDevEnum"); + struct srvsvc_NetCharDevEnum *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVENUM]; + + r = talloc(NULL, struct srvsvc_NetCharDevEnum); + 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_srvsvc_NetCharDevEnum(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(srvsvc_NetCharDevEnum, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevEnum, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.ctr = r.in.ctr; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.ctr = r->in.ctr; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetCharDevEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetCharDevEnum(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(srvsvc_NetCharDevEnum, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevEnum, 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_srvsvc_NetCharDevEnum(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_srvsvc_NetCharDevGetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetCharDevGetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetCharDevGetInfo"); + struct srvsvc_NetCharDevGetInfo *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVGETINFO]; + + r = talloc(NULL, struct srvsvc_NetCharDevGetInfo); + 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_srvsvc_NetCharDevGetInfo(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(srvsvc_NetCharDevGetInfo, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevGetInfo, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union srvsvc_NetCharDevInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union srvsvc_NetCharDevInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetCharDevGetInfo(p, &r); + r->out.result = _srvsvc_NetCharDevGetInfo(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(srvsvc_NetCharDevGetInfo, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevGetInfo, 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_srvsvc_NetCharDevGetInfo(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_srvsvc_NetCharDevControl(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetCharDevControl r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetCharDevControl"); + struct srvsvc_NetCharDevControl *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVCONTROL]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetCharDevControl); + 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_srvsvc_NetCharDevControl(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(srvsvc_NetCharDevControl, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevControl, r); - r.out.result = _srvsvc_NetCharDevControl(p, &r); + r->out.result = _srvsvc_NetCharDevControl(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(srvsvc_NetCharDevControl, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevControl, 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_srvsvc_NetCharDevControl(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_srvsvc_NetCharDevQEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetCharDevQEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetCharDevQEnum"); + struct srvsvc_NetCharDevQEnum *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQENUM]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetCharDevQEnum); + 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_srvsvc_NetCharDevQEnum(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(srvsvc_NetCharDevQEnum, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQEnum, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.ctr = r.in.ctr; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.ctr = r->in.ctr; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetCharDevQEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetCharDevQEnum(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(srvsvc_NetCharDevQEnum, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQEnum, 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_srvsvc_NetCharDevQEnum(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_srvsvc_NetCharDevQGetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetCharDevQGetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetCharDevQGetInfo"); + struct srvsvc_NetCharDevQGetInfo *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQGETINFO]; + + r = talloc(NULL, struct srvsvc_NetCharDevQGetInfo); + 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_srvsvc_NetCharDevQGetInfo(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(srvsvc_NetCharDevQGetInfo, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQGetInfo, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union srvsvc_NetCharDevQInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union srvsvc_NetCharDevQInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetCharDevQGetInfo(p, &r); + r->out.result = _srvsvc_NetCharDevQGetInfo(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(srvsvc_NetCharDevQGetInfo, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQGetInfo, 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_srvsvc_NetCharDevQGetInfo(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_srvsvc_NetCharDevQSetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetCharDevQSetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetCharDevQSetInfo"); + struct srvsvc_NetCharDevQSetInfo *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQSETINFO]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetCharDevQSetInfo); + 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_srvsvc_NetCharDevQSetInfo(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(srvsvc_NetCharDevQSetInfo, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQSetInfo, r); - ZERO_STRUCT(r.out); - r.out.parm_error = r.in.parm_error; - r.out.result = _srvsvc_NetCharDevQSetInfo(p, &r); + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _srvsvc_NetCharDevQSetInfo(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(srvsvc_NetCharDevQSetInfo, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQSetInfo, 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_srvsvc_NetCharDevQSetInfo(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_srvsvc_NetCharDevQPurge(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetCharDevQPurge r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetCharDevQPurge"); + struct srvsvc_NetCharDevQPurge *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQPURGE]; + + r = talloc(NULL, struct srvsvc_NetCharDevQPurge); + 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_srvsvc_NetCharDevQPurge(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(srvsvc_NetCharDevQPurge, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurge, r); - r.out.result = _srvsvc_NetCharDevQPurge(p, &r); + r->out.result = _srvsvc_NetCharDevQPurge(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(srvsvc_NetCharDevQPurge, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurge, 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_srvsvc_NetCharDevQPurge(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_srvsvc_NetCharDevQPurgeSelf(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetCharDevQPurgeSelf r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetCharDevQPurgeSelf"); + struct srvsvc_NetCharDevQPurgeSelf *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQPURGESELF]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetCharDevQPurgeSelf); + 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_srvsvc_NetCharDevQPurgeSelf(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(srvsvc_NetCharDevQPurgeSelf, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurgeSelf, r); - r.out.result = _srvsvc_NetCharDevQPurgeSelf(p, &r); + r->out.result = _srvsvc_NetCharDevQPurgeSelf(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(srvsvc_NetCharDevQPurgeSelf, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurgeSelf, 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_srvsvc_NetCharDevQPurgeSelf(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_srvsvc_NetConnEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetConnEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetConnEnum"); + struct srvsvc_NetConnEnum *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCONNENUM]; + + r = talloc(NULL, struct srvsvc_NetConnEnum); + 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_srvsvc_NetConnEnum(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(srvsvc_NetConnEnum, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetConnEnum, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.ctr = r.in.ctr; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.ctr = r->in.ctr; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetConnEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetConnEnum(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(srvsvc_NetConnEnum, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetConnEnum, 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_srvsvc_NetConnEnum(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_srvsvc_NetFileEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetFileEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetFileEnum"); + struct srvsvc_NetFileEnum *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILEENUM]; + + r = talloc(NULL, struct srvsvc_NetFileEnum); + 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_srvsvc_NetFileEnum(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(srvsvc_NetFileEnum, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetFileEnum, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.ctr = r.in.ctr; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.ctr = r->in.ctr; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetFileEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetFileEnum(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(srvsvc_NetFileEnum, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetFileEnum, 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_srvsvc_NetFileEnum(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_srvsvc_NetFileGetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetFileGetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetFileGetInfo"); + struct srvsvc_NetFileGetInfo *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILEGETINFO]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetFileGetInfo); + 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_srvsvc_NetFileGetInfo(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(srvsvc_NetFileGetInfo, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetFileGetInfo, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union srvsvc_NetFileInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union srvsvc_NetFileInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetFileGetInfo(p, &r); + r->out.result = _srvsvc_NetFileGetInfo(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(srvsvc_NetFileGetInfo, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetFileGetInfo, 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_srvsvc_NetFileGetInfo(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_srvsvc_NetFileClose(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetFileClose r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetFileClose"); + struct srvsvc_NetFileClose *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILECLOSE]; + + r = talloc(NULL, struct srvsvc_NetFileClose); + 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_srvsvc_NetFileClose(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(srvsvc_NetFileClose, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetFileClose, r); - r.out.result = _srvsvc_NetFileClose(p, &r); + r->out.result = _srvsvc_NetFileClose(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(srvsvc_NetFileClose, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetFileClose, 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_srvsvc_NetFileClose(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_srvsvc_NetSessEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetSessEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetSessEnum"); + struct srvsvc_NetSessEnum *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSESSENUM]; + + r = talloc(NULL, struct srvsvc_NetSessEnum); + 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_srvsvc_NetSessEnum(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(srvsvc_NetSessEnum, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetSessEnum, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.ctr = r.in.ctr; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.ctr = r->in.ctr; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetSessEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetSessEnum(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(srvsvc_NetSessEnum, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetSessEnum, 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_srvsvc_NetSessEnum(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_srvsvc_NetSessDel(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetSessDel r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetSessDel"); + struct srvsvc_NetSessDel *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSESSDEL]; + + r = talloc(NULL, struct srvsvc_NetSessDel); + 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_srvsvc_NetSessDel(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(srvsvc_NetSessDel, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetSessDel, r); - r.out.result = _srvsvc_NetSessDel(p, &r); + r->out.result = _srvsvc_NetSessDel(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(srvsvc_NetSessDel, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetSessDel, 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_srvsvc_NetSessDel(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_srvsvc_NetShareAdd(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareAdd r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareAdd"); + struct srvsvc_NetShareAdd *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREADD]; + + r = talloc(NULL, struct srvsvc_NetShareAdd); + 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_srvsvc_NetShareAdd(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(srvsvc_NetShareAdd, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareAdd, r); - ZERO_STRUCT(r.out); - r.out.parm_error = r.in.parm_error; - r.out.result = _srvsvc_NetShareAdd(p, &r); + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _srvsvc_NetShareAdd(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(srvsvc_NetShareAdd, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareAdd, 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_srvsvc_NetShareAdd(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_srvsvc_NetShareEnumAll(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareEnumAll r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareEnumAll"); + struct srvsvc_NetShareEnumAll *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREENUMALL]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetShareEnumAll); + 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_srvsvc_NetShareEnumAll(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(srvsvc_NetShareEnumAll, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnumAll, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.ctr = r.in.ctr; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.ctr = r->in.ctr; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetShareEnumAll(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetShareEnumAll(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(srvsvc_NetShareEnumAll, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnumAll, 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_srvsvc_NetShareEnumAll(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_srvsvc_NetShareGetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareGetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareGetInfo"); + struct srvsvc_NetShareGetInfo *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREGETINFO]; + + r = talloc(NULL, struct srvsvc_NetShareGetInfo); + 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_srvsvc_NetShareGetInfo(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(srvsvc_NetShareGetInfo, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareGetInfo, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union srvsvc_NetShareInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union srvsvc_NetShareInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetShareGetInfo(p, &r); + r->out.result = _srvsvc_NetShareGetInfo(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(srvsvc_NetShareGetInfo, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareGetInfo, 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_srvsvc_NetShareGetInfo(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_srvsvc_NetShareSetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareSetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareSetInfo"); + struct srvsvc_NetShareSetInfo *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHARESETINFO]; + + r = talloc(NULL, struct srvsvc_NetShareSetInfo); + 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_srvsvc_NetShareSetInfo(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(srvsvc_NetShareSetInfo, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareSetInfo, r); - ZERO_STRUCT(r.out); - r.out.parm_error = r.in.parm_error; - r.out.result = _srvsvc_NetShareSetInfo(p, &r); + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _srvsvc_NetShareSetInfo(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(srvsvc_NetShareSetInfo, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareSetInfo, 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_srvsvc_NetShareSetInfo(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_srvsvc_NetShareDel(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareDel r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareDel"); + struct srvsvc_NetShareDel *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDEL]; + + r = talloc(NULL, struct srvsvc_NetShareDel); + 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_srvsvc_NetShareDel(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(srvsvc_NetShareDel, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareDel, r); - r.out.result = _srvsvc_NetShareDel(p, &r); + r->out.result = _srvsvc_NetShareDel(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(srvsvc_NetShareDel, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDel, 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_srvsvc_NetShareDel(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_srvsvc_NetShareDelSticky(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareDelSticky r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareDelSticky"); + struct srvsvc_NetShareDelSticky *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELSTICKY]; + + r = talloc(NULL, struct srvsvc_NetShareDelSticky); + 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_srvsvc_NetShareDelSticky(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(srvsvc_NetShareDelSticky, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelSticky, r); - r.out.result = _srvsvc_NetShareDelSticky(p, &r); + r->out.result = _srvsvc_NetShareDelSticky(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(srvsvc_NetShareDelSticky, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelSticky, 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_srvsvc_NetShareDelSticky(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_srvsvc_NetShareCheck(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareCheck r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareCheck"); + struct srvsvc_NetShareCheck *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHARECHECK]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetShareCheck); + 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_srvsvc_NetShareCheck(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(srvsvc_NetShareCheck, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareCheck, r); - ZERO_STRUCT(r.out); - r.out.type = talloc_zero(mem_ctx, enum srvsvc_ShareType); - if (r.out.type == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.type = talloc_zero(r, enum srvsvc_ShareType); + if (r->out.type == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetShareCheck(p, &r); + r->out.result = _srvsvc_NetShareCheck(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(srvsvc_NetShareCheck, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareCheck, 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_srvsvc_NetShareCheck(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_srvsvc_NetSrvGetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetSrvGetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetSrvGetInfo"); + struct srvsvc_NetSrvGetInfo *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSRVGETINFO]; + + r = talloc(NULL, struct srvsvc_NetSrvGetInfo); + 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_srvsvc_NetSrvGetInfo(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(srvsvc_NetSrvGetInfo, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetSrvGetInfo, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union srvsvc_NetSrvInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union srvsvc_NetSrvInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetSrvGetInfo(p, &r); + r->out.result = _srvsvc_NetSrvGetInfo(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(srvsvc_NetSrvGetInfo, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvGetInfo, 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_srvsvc_NetSrvGetInfo(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_srvsvc_NetSrvSetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetSrvSetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetSrvSetInfo"); + struct srvsvc_NetSrvSetInfo *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSRVSETINFO]; + + r = talloc(NULL, struct srvsvc_NetSrvSetInfo); + 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_srvsvc_NetSrvSetInfo(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(srvsvc_NetSrvSetInfo, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetSrvSetInfo, r); - ZERO_STRUCT(r.out); - r.out.parm_error = r.in.parm_error; - r.out.result = _srvsvc_NetSrvSetInfo(p, &r); + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _srvsvc_NetSrvSetInfo(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(srvsvc_NetSrvSetInfo, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvSetInfo, 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_srvsvc_NetSrvSetInfo(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_srvsvc_NetDiskEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetDiskEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetDiskEnum"); + struct srvsvc_NetDiskEnum *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETDISKENUM]; + + r = talloc(NULL, struct srvsvc_NetDiskEnum); + 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_srvsvc_NetDiskEnum(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(srvsvc_NetDiskEnum, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetDiskEnum, r); - ZERO_STRUCT(r.out); - r.out.info = r.in.info; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = r->in.info; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetDiskEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetDiskEnum(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(srvsvc_NetDiskEnum, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetDiskEnum, 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_srvsvc_NetDiskEnum(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_srvsvc_NetServerStatisticsGet(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetServerStatisticsGet r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetServerStatisticsGet"); + struct srvsvc_NetServerStatisticsGet *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERSTATISTICSGET]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetServerStatisticsGet); + 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_srvsvc_NetServerStatisticsGet(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(srvsvc_NetServerStatisticsGet, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetServerStatisticsGet, r); - ZERO_STRUCT(r.out); - r.out.stats = talloc_zero(mem_ctx, struct srvsvc_Statistics); - if (r.out.stats == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.stats = talloc_zero(r, struct srvsvc_Statistics); + if (r->out.stats == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetServerStatisticsGet(p, &r); + r->out.result = _srvsvc_NetServerStatisticsGet(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(srvsvc_NetServerStatisticsGet, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetServerStatisticsGet, 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_srvsvc_NetServerStatisticsGet(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_srvsvc_NetTransportAdd(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetTransportAdd r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetTransportAdd"); + struct srvsvc_NetTransportAdd *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTADD]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetTransportAdd); + 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_srvsvc_NetTransportAdd(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(srvsvc_NetTransportAdd, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetTransportAdd, r); - r.out.result = _srvsvc_NetTransportAdd(p, &r); + r->out.result = _srvsvc_NetTransportAdd(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(srvsvc_NetTransportAdd, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportAdd, 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_srvsvc_NetTransportAdd(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_srvsvc_NetTransportEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetTransportEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetTransportEnum"); + struct srvsvc_NetTransportEnum *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTENUM]; + + r = talloc(NULL, struct srvsvc_NetTransportEnum); + 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_srvsvc_NetTransportEnum(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(srvsvc_NetTransportEnum, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetTransportEnum, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.transports = r.in.transports; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.transports = r->in.transports; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetTransportEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetTransportEnum(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(srvsvc_NetTransportEnum, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportEnum, 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_srvsvc_NetTransportEnum(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_srvsvc_NetTransportDel(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetTransportDel r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetTransportDel"); + struct srvsvc_NetTransportDel *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTDEL]; + + r = talloc(NULL, struct srvsvc_NetTransportDel); + 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_srvsvc_NetTransportDel(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(srvsvc_NetTransportDel, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetTransportDel, r); - r.out.result = _srvsvc_NetTransportDel(p, &r); + r->out.result = _srvsvc_NetTransportDel(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(srvsvc_NetTransportDel, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportDel, 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_srvsvc_NetTransportDel(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_srvsvc_NetRemoteTOD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetRemoteTOD r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetRemoteTOD"); + struct srvsvc_NetRemoteTOD *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETREMOTETOD]; + + r = talloc(NULL, struct srvsvc_NetRemoteTOD); + 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_srvsvc_NetRemoteTOD(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(srvsvc_NetRemoteTOD, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetRemoteTOD, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, struct srvsvc_NetRemoteTODInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, struct srvsvc_NetRemoteTODInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetRemoteTOD(p, &r); + r->out.result = _srvsvc_NetRemoteTOD(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(srvsvc_NetRemoteTOD, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetRemoteTOD, 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_srvsvc_NetRemoteTOD(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_srvsvc_NetSetServiceBits(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetSetServiceBits r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetSetServiceBits"); + struct srvsvc_NetSetServiceBits *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSETSERVICEBITS]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetSetServiceBits); + 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_srvsvc_NetSetServiceBits(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(srvsvc_NetSetServiceBits, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetSetServiceBits, r); - r.out.result = _srvsvc_NetSetServiceBits(p, &r); + r->out.result = _srvsvc_NetSetServiceBits(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(srvsvc_NetSetServiceBits, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetSetServiceBits, 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_srvsvc_NetSetServiceBits(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_srvsvc_NetPathType(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetPathType r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetPathType"); + struct srvsvc_NetPathType *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHTYPE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetPathType); + 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_srvsvc_NetPathType(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(srvsvc_NetPathType, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetPathType, r); - ZERO_STRUCT(r.out); - r.out.pathtype = talloc_zero(mem_ctx, uint32_t); - if (r.out.pathtype == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.pathtype = talloc_zero(r, uint32_t); + if (r->out.pathtype == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetPathType(p, &r); + r->out.result = _srvsvc_NetPathType(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(srvsvc_NetPathType, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetPathType, 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_srvsvc_NetPathType(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_srvsvc_NetPathCanonicalize(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetPathCanonicalize r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetPathCanonicalize"); + struct srvsvc_NetPathCanonicalize *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHCANONICALIZE]; + + r = talloc(NULL, struct srvsvc_NetPathCanonicalize); + 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_srvsvc_NetPathCanonicalize(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(srvsvc_NetPathCanonicalize, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetPathCanonicalize, r); - ZERO_STRUCT(r.out); - r.out.can_path = talloc_zero_array(mem_ctx, uint8_t, r.in.maxbuf); - if (r.out.can_path == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.can_path = talloc_zero_array(r, uint8_t, r->in.maxbuf); + if (r->out.can_path == NULL) { + talloc_free(r); return False; } - r.out.pathtype = r.in.pathtype; - r.out.result = _srvsvc_NetPathCanonicalize(p, &r); + r->out.pathtype = r->in.pathtype; + r->out.result = _srvsvc_NetPathCanonicalize(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(srvsvc_NetPathCanonicalize, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCanonicalize, 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_srvsvc_NetPathCanonicalize(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_srvsvc_NetPathCompare(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetPathCompare r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetPathCompare"); + struct srvsvc_NetPathCompare *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHCOMPARE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetPathCompare); + 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_srvsvc_NetPathCompare(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(srvsvc_NetPathCompare, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetPathCompare, r); - r.out.result = _srvsvc_NetPathCompare(p, &r); + r->out.result = _srvsvc_NetPathCompare(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(srvsvc_NetPathCompare, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCompare, 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_srvsvc_NetPathCompare(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_srvsvc_NetNameValidate(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetNameValidate r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetNameValidate"); + struct srvsvc_NetNameValidate *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETNAMEVALIDATE]; + + r = talloc(NULL, struct srvsvc_NetNameValidate); + 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_srvsvc_NetNameValidate(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(srvsvc_NetNameValidate, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetNameValidate, r); - r.out.result = _srvsvc_NetNameValidate(p, &r); + r->out.result = _srvsvc_NetNameValidate(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(srvsvc_NetNameValidate, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetNameValidate, 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_srvsvc_NetNameValidate(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_srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRPRNAMECANONICALIZE r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRPRNAMECANONICALIZE"); + struct srvsvc_NETRPRNAMECANONICALIZE *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRPRNAMECANONICALIZE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NETRPRNAMECANONICALIZE); + 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_srvsvc_NETRPRNAMECANONICALIZE(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(srvsvc_NETRPRNAMECANONICALIZE, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, r); - r.out.result = _srvsvc_NETRPRNAMECANONICALIZE(p, &r); + r->out.result = _srvsvc_NETRPRNAMECANONICALIZE(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(srvsvc_NETRPRNAMECANONICALIZE, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, 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_srvsvc_NETRPRNAMECANONICALIZE(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_srvsvc_NetPRNameCompare(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetPRNameCompare r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetPRNameCompare"); + struct srvsvc_NetPRNameCompare *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPRNAMECOMPARE]; + + r = talloc(NULL, struct srvsvc_NetPRNameCompare); + 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_srvsvc_NetPRNameCompare(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(srvsvc_NetPRNameCompare, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetPRNameCompare, r); - r.out.result = _srvsvc_NetPRNameCompare(p, &r); + r->out.result = _srvsvc_NetPRNameCompare(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(srvsvc_NetPRNameCompare, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetPRNameCompare, 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_srvsvc_NetPRNameCompare(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_srvsvc_NetShareEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareEnum"); + struct srvsvc_NetShareEnum *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREENUM]; + + r = talloc(NULL, struct srvsvc_NetShareEnum); + 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_srvsvc_NetShareEnum(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(srvsvc_NetShareEnum, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnum, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.ctr = r.in.ctr; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.ctr = r->in.ctr; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _srvsvc_NetShareEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _srvsvc_NetShareEnum(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(srvsvc_NetShareEnum, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnum, 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_srvsvc_NetShareEnum(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_srvsvc_NetShareDelStart(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareDelStart r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareDelStart"); + struct srvsvc_NetShareDelStart *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELSTART]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetShareDelStart); + 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_srvsvc_NetShareDelStart(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(srvsvc_NetShareDelStart, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelStart, r); - ZERO_STRUCT(r.out); - r.out.hnd = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.hnd == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.hnd = talloc_zero(r, struct policy_handle); + if (r->out.hnd == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetShareDelStart(p, &r); + r->out.result = _srvsvc_NetShareDelStart(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(srvsvc_NetShareDelStart, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelStart, 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_srvsvc_NetShareDelStart(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_srvsvc_NetShareDelCommit(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetShareDelCommit r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetShareDelCommit"); + struct srvsvc_NetShareDelCommit *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELCOMMIT]; + + r = talloc(NULL, struct srvsvc_NetShareDelCommit); + 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_srvsvc_NetShareDelCommit(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(srvsvc_NetShareDelCommit, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelCommit, r); - ZERO_STRUCT(r.out); - r.out.hnd = r.in.hnd; - r.out.result = _srvsvc_NetShareDelCommit(p, &r); + ZERO_STRUCT(r->out); + r->out.hnd = r->in.hnd; + r->out.result = _srvsvc_NetShareDelCommit(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(srvsvc_NetShareDelCommit, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelCommit, 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_srvsvc_NetShareDelCommit(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_srvsvc_NetGetFileSecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetGetFileSecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetGetFileSecurity"); + struct srvsvc_NetGetFileSecurity *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETGETFILESECURITY]; + + r = talloc(NULL, struct srvsvc_NetGetFileSecurity); + 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_srvsvc_NetGetFileSecurity(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(srvsvc_NetGetFileSecurity, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetGetFileSecurity, r); - ZERO_STRUCT(r.out); - r.out.sd_buf = talloc_zero(mem_ctx, struct sec_desc_buf); - if (r.out.sd_buf == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.sd_buf = talloc_zero(r, struct sec_desc_buf); + if (r->out.sd_buf == NULL) { + talloc_free(r); return False; } - r.out.result = _srvsvc_NetGetFileSecurity(p, &r); + r->out.result = _srvsvc_NetGetFileSecurity(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(srvsvc_NetGetFileSecurity, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetGetFileSecurity, 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_srvsvc_NetGetFileSecurity(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_srvsvc_NetSetFileSecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetSetFileSecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetSetFileSecurity"); + struct srvsvc_NetSetFileSecurity *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSETFILESECURITY]; + + r = talloc(NULL, struct srvsvc_NetSetFileSecurity); + 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_srvsvc_NetSetFileSecurity(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(srvsvc_NetSetFileSecurity, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetSetFileSecurity, r); - r.out.result = _srvsvc_NetSetFileSecurity(p, &r); + r->out.result = _srvsvc_NetSetFileSecurity(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(srvsvc_NetSetFileSecurity, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetSetFileSecurity, 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_srvsvc_NetSetFileSecurity(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_srvsvc_NetServerTransportAddEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetServerTransportAddEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetServerTransportAddEx"); + struct srvsvc_NetServerTransportAddEx *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERTRANSPORTADDEX]; + + r = talloc(NULL, struct srvsvc_NetServerTransportAddEx); + 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_srvsvc_NetServerTransportAddEx(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(srvsvc_NetServerTransportAddEx, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetServerTransportAddEx, r); - r.out.result = _srvsvc_NetServerTransportAddEx(p, &r); + r->out.result = _srvsvc_NetServerTransportAddEx(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(srvsvc_NetServerTransportAddEx, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetServerTransportAddEx, 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_srvsvc_NetServerTransportAddEx(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_srvsvc_NetServerSetServiceBitsEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NetServerSetServiceBitsEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NetServerSetServiceBitsEx"); + struct srvsvc_NetServerSetServiceBitsEx *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERSETSERVICEBITSEX]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NetServerSetServiceBitsEx); + 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_srvsvc_NetServerSetServiceBitsEx(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(srvsvc_NetServerSetServiceBitsEx, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NetServerSetServiceBitsEx, r); - r.out.result = _srvsvc_NetServerSetServiceBitsEx(p, &r); + r->out.result = _srvsvc_NetServerSetServiceBitsEx(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(srvsvc_NetServerSetServiceBitsEx, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NetServerSetServiceBitsEx, 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_srvsvc_NetServerSetServiceBitsEx(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_srvsvc_NETRDFSGETVERSION(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSGETVERSION r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSGETVERSION"); + struct srvsvc_NETRDFSGETVERSION *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSGETVERSION]; + + r = talloc(NULL, struct srvsvc_NETRDFSGETVERSION); + 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_srvsvc_NETRDFSGETVERSION(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(srvsvc_NETRDFSGETVERSION, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSGETVERSION, r); - r.out.result = _srvsvc_NETRDFSGETVERSION(p, &r); + r->out.result = _srvsvc_NETRDFSGETVERSION(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(srvsvc_NETRDFSGETVERSION, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSGETVERSION, 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_srvsvc_NETRDFSGETVERSION(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_srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSCREATELOCALPARTITION r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSCREATELOCALPARTITION"); + struct srvsvc_NETRDFSCREATELOCALPARTITION *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSCREATELOCALPARTITION]; + + r = talloc(NULL, struct srvsvc_NETRDFSCREATELOCALPARTITION); + 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_srvsvc_NETRDFSCREATELOCALPARTITION(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(srvsvc_NETRDFSCREATELOCALPARTITION, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, r); - r.out.result = _srvsvc_NETRDFSCREATELOCALPARTITION(p, &r); + r->out.result = _srvsvc_NETRDFSCREATELOCALPARTITION(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(srvsvc_NETRDFSCREATELOCALPARTITION, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, 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_srvsvc_NETRDFSCREATELOCALPARTITION(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_srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSDELETELOCALPARTITION r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSDELETELOCALPARTITION"); + struct srvsvc_NETRDFSDELETELOCALPARTITION *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSDELETELOCALPARTITION]; + + r = talloc(NULL, struct srvsvc_NETRDFSDELETELOCALPARTITION); + 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_srvsvc_NETRDFSDELETELOCALPARTITION(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(srvsvc_NETRDFSDELETELOCALPARTITION, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, r); - r.out.result = _srvsvc_NETRDFSDELETELOCALPARTITION(p, &r); + r->out.result = _srvsvc_NETRDFSDELETELOCALPARTITION(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(srvsvc_NETRDFSDELETELOCALPARTITION, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, 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_srvsvc_NETRDFSDELETELOCALPARTITION(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_srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSSETLOCALVOLUMESTATE r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSSETLOCALVOLUMESTATE"); + struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE]; + + r = talloc(NULL, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE); + 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_srvsvc_NETRDFSSETLOCALVOLUMESTATE(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(srvsvc_NETRDFSSETLOCALVOLUMESTATE, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, r); - r.out.result = _srvsvc_NETRDFSSETLOCALVOLUMESTATE(p, &r); + r->out.result = _srvsvc_NETRDFSSETLOCALVOLUMESTATE(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(srvsvc_NETRDFSSETLOCALVOLUMESTATE, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, 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_srvsvc_NETRDFSSETLOCALVOLUMESTATE(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_srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSSETSERVERINFO r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSSETSERVERINFO"); + struct srvsvc_NETRDFSSETSERVERINFO *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSSETSERVERINFO]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NETRDFSSETSERVERINFO); + 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_srvsvc_NETRDFSSETSERVERINFO(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(srvsvc_NETRDFSSETSERVERINFO, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETSERVERINFO, r); - r.out.result = _srvsvc_NETRDFSSETSERVERINFO(p, &r); + r->out.result = _srvsvc_NETRDFSSETSERVERINFO(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(srvsvc_NETRDFSSETSERVERINFO, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETSERVERINFO, 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_srvsvc_NETRDFSSETSERVERINFO(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_srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSCREATEEXITPOINT r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSCREATEEXITPOINT"); + struct srvsvc_NETRDFSCREATEEXITPOINT *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSCREATEEXITPOINT]; + + r = talloc(NULL, struct srvsvc_NETRDFSCREATEEXITPOINT); + 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_srvsvc_NETRDFSCREATEEXITPOINT(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(srvsvc_NETRDFSCREATEEXITPOINT, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, r); - r.out.result = _srvsvc_NETRDFSCREATEEXITPOINT(p, &r); + r->out.result = _srvsvc_NETRDFSCREATEEXITPOINT(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(srvsvc_NETRDFSCREATEEXITPOINT, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, 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_srvsvc_NETRDFSCREATEEXITPOINT(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_srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSDELETEEXITPOINT r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSDELETEEXITPOINT"); + struct srvsvc_NETRDFSDELETEEXITPOINT *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSDELETEEXITPOINT]; + + r = talloc(NULL, struct srvsvc_NETRDFSDELETEEXITPOINT); + 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_srvsvc_NETRDFSDELETEEXITPOINT(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(srvsvc_NETRDFSDELETEEXITPOINT, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, r); - r.out.result = _srvsvc_NETRDFSDELETEEXITPOINT(p, &r); + r->out.result = _srvsvc_NETRDFSDELETEEXITPOINT(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(srvsvc_NETRDFSDELETEEXITPOINT, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, 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_srvsvc_NETRDFSDELETEEXITPOINT(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_srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSMODIFYPREFIX r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSMODIFYPREFIX"); + struct srvsvc_NETRDFSMODIFYPREFIX *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSMODIFYPREFIX]; + + r = talloc(NULL, struct srvsvc_NETRDFSMODIFYPREFIX); + 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_srvsvc_NETRDFSMODIFYPREFIX(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(srvsvc_NETRDFSMODIFYPREFIX, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, r); - r.out.result = _srvsvc_NETRDFSMODIFYPREFIX(p, &r); + r->out.result = _srvsvc_NETRDFSMODIFYPREFIX(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(srvsvc_NETRDFSMODIFYPREFIX, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, 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_srvsvc_NETRDFSMODIFYPREFIX(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_srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSFIXLOCALVOLUME r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSFIXLOCALVOLUME"); + struct srvsvc_NETRDFSFIXLOCALVOLUME *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSFIXLOCALVOLUME]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NETRDFSFIXLOCALVOLUME); + 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_srvsvc_NETRDFSFIXLOCALVOLUME(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(srvsvc_NETRDFSFIXLOCALVOLUME, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, r); - r.out.result = _srvsvc_NETRDFSFIXLOCALVOLUME(p, &r); + r->out.result = _srvsvc_NETRDFSFIXLOCALVOLUME(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(srvsvc_NETRDFSFIXLOCALVOLUME, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, 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_srvsvc_NETRDFSFIXLOCALVOLUME(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_srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRDFSMANAGERREPORTSITEINFO r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRDFSMANAGERREPORTSITEINFO"); + struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO); + 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_srvsvc_NETRDFSMANAGERREPORTSITEINFO(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(srvsvc_NETRDFSMANAGERREPORTSITEINFO, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, r); - r.out.result = _srvsvc_NETRDFSMANAGERREPORTSITEINFO(p, &r); + r->out.result = _srvsvc_NETRDFSMANAGERREPORTSITEINFO(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(srvsvc_NETRDFSMANAGERREPORTSITEINFO, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, 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_srvsvc_NETRDFSMANAGERREPORTSITEINFO(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_srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct srvsvc_NETRSERVERTRANSPORTDELEX r; - TALLOC_CTX *mem_ctx = talloc_init("api_srvsvc_NETRSERVERTRANSPORTDELEX"); + struct srvsvc_NETRSERVERTRANSPORTDELEX *r; + + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRSERVERTRANSPORTDELEX]; + + r = talloc(NULL, struct srvsvc_NETRSERVERTRANSPORTDELEX); + 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_srvsvc_NETRSERVERTRANSPORTDELEX(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(srvsvc_NETRSERVERTRANSPORTDELEX, &r); + NDR_PRINT_IN_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, r); - r.out.result = _srvsvc_NETRSERVERTRANSPORTDELEX(p, &r); + r->out.result = _srvsvc_NETRSERVERTRANSPORTDELEX(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(srvsvc_NETRSERVERTRANSPORTDELEX, &r); + NDR_PRINT_OUT_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, 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_srvsvc_NETRSERVERTRANSPORTDELEX(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; } diff --git a/source3/librpc/gen_ndr/srv_svcctl.c b/source3/librpc/gen_ndr/srv_svcctl.c index 6386bd4563..05dd27e7d8 100644 --- a/source3/librpc/gen_ndr/srv_svcctl.c +++ b/source3/librpc/gen_ndr/srv_svcctl.c @@ -8,3144 +8,3452 @@ static BOOL api_svcctl_CloseServiceHandle(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_CloseServiceHandle r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_CloseServiceHandle"); + struct svcctl_CloseServiceHandle *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CLOSESERVICEHANDLE]; + + r = talloc(NULL, struct svcctl_CloseServiceHandle); + 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_svcctl_CloseServiceHandle(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(svcctl_CloseServiceHandle, &r); + NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, r); - ZERO_STRUCT(r.out); - r.out.handle = r.in.handle; - r.out.result = _svcctl_CloseServiceHandle(p, &r); + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _svcctl_CloseServiceHandle(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(svcctl_CloseServiceHandle, &r); + NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, 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_svcctl_CloseServiceHandle(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_svcctl_ControlService(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_ControlService r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_ControlService"); + struct svcctl_ControlService *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CONTROLSERVICE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_ControlService); + 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_svcctl_ControlService(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(svcctl_ControlService, &r); + NDR_PRINT_IN_DEBUG(svcctl_ControlService, r); - ZERO_STRUCT(r.out); - r.out.service_status = talloc_zero(mem_ctx, struct SERVICE_STATUS); - if (r.out.service_status == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.service_status = talloc_zero(r, struct SERVICE_STATUS); + if (r->out.service_status == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_ControlService(p, &r); + r->out.result = _svcctl_ControlService(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(svcctl_ControlService, &r); + NDR_PRINT_OUT_DEBUG(svcctl_ControlService, 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_svcctl_ControlService(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_svcctl_DeleteService(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_DeleteService r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_DeleteService"); + struct svcctl_DeleteService *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_DELETESERVICE]; + + r = talloc(NULL, struct svcctl_DeleteService); + 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_svcctl_DeleteService(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(svcctl_DeleteService, &r); + NDR_PRINT_IN_DEBUG(svcctl_DeleteService, r); - r.out.result = _svcctl_DeleteService(p, &r); + r->out.result = _svcctl_DeleteService(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(svcctl_DeleteService, &r); + NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, 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_svcctl_DeleteService(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_svcctl_LockServiceDatabase(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_LockServiceDatabase r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_LockServiceDatabase"); + struct svcctl_LockServiceDatabase *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_LOCKSERVICEDATABASE]; + + r = talloc(NULL, struct svcctl_LockServiceDatabase); + 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_svcctl_LockServiceDatabase(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(svcctl_LockServiceDatabase, &r); + NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, r); - ZERO_STRUCT(r.out); - r.out.lock = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.lock == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.lock = talloc_zero(r, struct policy_handle); + if (r->out.lock == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_LockServiceDatabase(p, &r); + r->out.result = _svcctl_LockServiceDatabase(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(svcctl_LockServiceDatabase, &r); + NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, 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_svcctl_LockServiceDatabase(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_svcctl_QueryServiceObjectSecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceObjectSecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceObjectSecurity"); + struct svcctl_QueryServiceObjectSecurity *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_QueryServiceObjectSecurity); + 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_svcctl_QueryServiceObjectSecurity(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(svcctl_QueryServiceObjectSecurity, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, r); - r.out.result = _svcctl_QueryServiceObjectSecurity(p, &r); + r->out.result = _svcctl_QueryServiceObjectSecurity(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(svcctl_QueryServiceObjectSecurity, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, 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_svcctl_QueryServiceObjectSecurity(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_svcctl_SetServiceObjectSecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_SetServiceObjectSecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_SetServiceObjectSecurity"); + struct svcctl_SetServiceObjectSecurity *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SETSERVICEOBJECTSECURITY]; + + r = talloc(NULL, struct svcctl_SetServiceObjectSecurity); + 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_svcctl_SetServiceObjectSecurity(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(svcctl_SetServiceObjectSecurity, &r); + NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, r); - r.out.result = _svcctl_SetServiceObjectSecurity(p, &r); + r->out.result = _svcctl_SetServiceObjectSecurity(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(svcctl_SetServiceObjectSecurity, &r); + NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, 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_svcctl_SetServiceObjectSecurity(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_svcctl_QueryServiceStatus(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceStatus r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceStatus"); + struct svcctl_QueryServiceStatus *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICESTATUS]; + + r = talloc(NULL, struct svcctl_QueryServiceStatus); + 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_svcctl_QueryServiceStatus(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(svcctl_QueryServiceStatus, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, r); - ZERO_STRUCT(r.out); - r.out.service_status = talloc_zero(mem_ctx, struct SERVICE_STATUS); - if (r.out.service_status == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.service_status = talloc_zero(r, struct SERVICE_STATUS); + if (r->out.service_status == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_QueryServiceStatus(p, &r); + r->out.result = _svcctl_QueryServiceStatus(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(svcctl_QueryServiceStatus, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, 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_svcctl_QueryServiceStatus(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_svcctl_SetServiceStatus(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_SetServiceStatus r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_SetServiceStatus"); + struct svcctl_SetServiceStatus *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SETSERVICESTATUS]; + + r = talloc(NULL, struct svcctl_SetServiceStatus); + 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_svcctl_SetServiceStatus(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(svcctl_SetServiceStatus, &r); + NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, r); - r.out.result = _svcctl_SetServiceStatus(p, &r); + r->out.result = _svcctl_SetServiceStatus(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(svcctl_SetServiceStatus, &r); + NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, 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_svcctl_SetServiceStatus(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_svcctl_UnlockServiceDatabase(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_UnlockServiceDatabase r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_UnlockServiceDatabase"); + struct svcctl_UnlockServiceDatabase *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_UNLOCKSERVICEDATABASE]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_UnlockServiceDatabase); + 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_svcctl_UnlockServiceDatabase(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(svcctl_UnlockServiceDatabase, &r); + NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, r); - ZERO_STRUCT(r.out); - r.out.lock = r.in.lock; - r.out.result = _svcctl_UnlockServiceDatabase(p, &r); + ZERO_STRUCT(r->out); + r->out.lock = r->in.lock; + r->out.result = _svcctl_UnlockServiceDatabase(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(svcctl_UnlockServiceDatabase, &r); + NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, 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_svcctl_UnlockServiceDatabase(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_svcctl_NotifyBootConfigStatus(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_NotifyBootConfigStatus r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_NotifyBootConfigStatus"); + struct svcctl_NotifyBootConfigStatus *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS]; + + r = talloc(NULL, struct svcctl_NotifyBootConfigStatus); + 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_svcctl_NotifyBootConfigStatus(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(svcctl_NotifyBootConfigStatus, &r); + NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, r); - r.out.result = _svcctl_NotifyBootConfigStatus(p, &r); + r->out.result = _svcctl_NotifyBootConfigStatus(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(svcctl_NotifyBootConfigStatus, &r); + NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, 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_svcctl_NotifyBootConfigStatus(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_svcctl_SCSetServiceBitsW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_SCSetServiceBitsW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_SCSetServiceBitsW"); + struct svcctl_SCSetServiceBitsW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSETSERVICEBITSW]; + + r = talloc(NULL, struct svcctl_SCSetServiceBitsW); + 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_svcctl_SCSetServiceBitsW(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(svcctl_SCSetServiceBitsW, &r); + NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, r); - r.out.result = _svcctl_SCSetServiceBitsW(p, &r); + r->out.result = _svcctl_SCSetServiceBitsW(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(svcctl_SCSetServiceBitsW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, 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_svcctl_SCSetServiceBitsW(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_svcctl_ChangeServiceConfigW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_ChangeServiceConfigW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_ChangeServiceConfigW"); + struct svcctl_ChangeServiceConfigW *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIGW]; + + r = talloc(NULL, struct svcctl_ChangeServiceConfigW); + 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_svcctl_ChangeServiceConfigW(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(svcctl_ChangeServiceConfigW, &r); + NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, r); - ZERO_STRUCT(r.out); - r.out.tag_id = talloc_zero(mem_ctx, uint32_t); - if (r.out.tag_id == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.tag_id = talloc_zero(r, uint32_t); + if (r->out.tag_id == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_ChangeServiceConfigW(p, &r); + r->out.result = _svcctl_ChangeServiceConfigW(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(svcctl_ChangeServiceConfigW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, 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_svcctl_ChangeServiceConfigW(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_svcctl_CreateServiceW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_CreateServiceW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_CreateServiceW"); + struct svcctl_CreateServiceW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CREATESERVICEW]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_CreateServiceW); + 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_svcctl_CreateServiceW(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(svcctl_CreateServiceW, &r); + NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, r); - ZERO_STRUCT(r.out); - r.out.TagId = r.in.TagId; - 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.TagId = r->in.TagId; + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_CreateServiceW(p, &r); + r->out.result = _svcctl_CreateServiceW(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(svcctl_CreateServiceW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, 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_svcctl_CreateServiceW(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_svcctl_EnumDependentServicesW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_EnumDependentServicesW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_EnumDependentServicesW"); + struct svcctl_EnumDependentServicesW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMDEPENDENTSERVICESW]; + + r = talloc(NULL, struct svcctl_EnumDependentServicesW); + 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_svcctl_EnumDependentServicesW(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(svcctl_EnumDependentServicesW, &r); + NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, r); - ZERO_STRUCT(r.out); - r.out.service_status = talloc_zero(mem_ctx, struct ENUM_SERVICE_STATUS); - if (r.out.service_status == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUS); + if (r->out.service_status == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.services_returned = talloc_zero(mem_ctx, uint32_t); - if (r.out.services_returned == NULL) { - talloc_free(mem_ctx); + r->out.services_returned = talloc_zero(r, uint32_t); + if (r->out.services_returned == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_EnumDependentServicesW(p, &r); + r->out.result = _svcctl_EnumDependentServicesW(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(svcctl_EnumDependentServicesW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, 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_svcctl_EnumDependentServicesW(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_svcctl_EnumServicesStatusW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_EnumServicesStatusW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_EnumServicesStatusW"); + struct svcctl_EnumServicesStatusW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICESSTATUSW]; + + r = talloc(NULL, struct svcctl_EnumServicesStatusW); + 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_svcctl_EnumServicesStatusW(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(svcctl_EnumServicesStatusW, &r); + NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, r); - ZERO_STRUCT(r.out); - r.out.service = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.service == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.service = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.service == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.services_returned = talloc_zero(mem_ctx, uint32_t); - if (r.out.services_returned == NULL) { - talloc_free(mem_ctx); + r->out.services_returned = talloc_zero(r, uint32_t); + if (r->out.services_returned == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _svcctl_EnumServicesStatusW(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _svcctl_EnumServicesStatusW(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(svcctl_EnumServicesStatusW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, 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_svcctl_EnumServicesStatusW(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_svcctl_OpenSCManagerW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_OpenSCManagerW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_OpenSCManagerW"); + struct svcctl_OpenSCManagerW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSCMANAGERW]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_OpenSCManagerW); + 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_svcctl_OpenSCManagerW(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(svcctl_OpenSCManagerW, &r); + NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, 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 = _svcctl_OpenSCManagerW(p, &r); + r->out.result = _svcctl_OpenSCManagerW(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(svcctl_OpenSCManagerW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, 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_svcctl_OpenSCManagerW(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_svcctl_OpenServiceW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_OpenServiceW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_OpenServiceW"); + struct svcctl_OpenServiceW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSERVICEW]; + + r = talloc(NULL, struct svcctl_OpenServiceW); + 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_svcctl_OpenServiceW(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(svcctl_OpenServiceW, &r); + NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, 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 = _svcctl_OpenServiceW(p, &r); + r->out.result = _svcctl_OpenServiceW(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(svcctl_OpenServiceW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, 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_svcctl_OpenServiceW(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_svcctl_QueryServiceConfigW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceConfigW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceConfigW"); + struct svcctl_QueryServiceConfigW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIGW]; + + r = talloc(NULL, struct svcctl_QueryServiceConfigW); + 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_svcctl_QueryServiceConfigW(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(svcctl_QueryServiceConfigW, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, r); - ZERO_STRUCT(r.out); - r.out.query = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.query == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.query = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.query == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_QueryServiceConfigW(p, &r); + r->out.result = _svcctl_QueryServiceConfigW(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(svcctl_QueryServiceConfigW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, 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_svcctl_QueryServiceConfigW(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_svcctl_QueryServiceLockStatusW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceLockStatusW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceLockStatusW"); + struct svcctl_QueryServiceLockStatusW *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICELOCKSTATUSW]; + + r = talloc(NULL, struct svcctl_QueryServiceLockStatusW); + 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_svcctl_QueryServiceLockStatusW(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(svcctl_QueryServiceLockStatusW, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, r); - ZERO_STRUCT(r.out); - r.out.lock_status = talloc_zero(mem_ctx, struct SERVICE_LOCK_STATUS); - if (r.out.lock_status == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS); + if (r->out.lock_status == NULL) { + talloc_free(r); return False; } - r.out.required_buf_size = talloc_zero(mem_ctx, uint32_t); - if (r.out.required_buf_size == NULL) { - talloc_free(mem_ctx); + r->out.required_buf_size = talloc_zero(r, uint32_t); + if (r->out.required_buf_size == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_QueryServiceLockStatusW(p, &r); + r->out.result = _svcctl_QueryServiceLockStatusW(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(svcctl_QueryServiceLockStatusW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, 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_svcctl_QueryServiceLockStatusW(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_svcctl_StartServiceW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_StartServiceW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_StartServiceW"); + struct svcctl_StartServiceW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_STARTSERVICEW]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_StartServiceW); + 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_svcctl_StartServiceW(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(svcctl_StartServiceW, &r); + NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, r); - r.out.result = _svcctl_StartServiceW(p, &r); + r->out.result = _svcctl_StartServiceW(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(svcctl_StartServiceW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, 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_svcctl_StartServiceW(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_svcctl_GetServiceDisplayNameW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_GetServiceDisplayNameW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_GetServiceDisplayNameW"); + struct svcctl_GetServiceDisplayNameW *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEDISPLAYNAMEW]; + + r = talloc(NULL, struct svcctl_GetServiceDisplayNameW); + 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_svcctl_GetServiceDisplayNameW(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(svcctl_GetServiceDisplayNameW, &r); + NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, r); - ZERO_STRUCT(r.out); - r.out.display_name = talloc_zero(mem_ctx, const char *); - if (r.out.display_name == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.display_name = talloc_zero(r, const char *); + if (r->out.display_name == NULL) { + talloc_free(r); return False; } - r.out.display_name_length = r.in.display_name_length; - r.out.result = _svcctl_GetServiceDisplayNameW(p, &r); + r->out.display_name_length = r->in.display_name_length; + r->out.result = _svcctl_GetServiceDisplayNameW(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(svcctl_GetServiceDisplayNameW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, 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_svcctl_GetServiceDisplayNameW(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_svcctl_GetServiceKeyNameW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_GetServiceKeyNameW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_GetServiceKeyNameW"); + struct svcctl_GetServiceKeyNameW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEKEYNAMEW]; + + r = talloc(NULL, struct svcctl_GetServiceKeyNameW); + 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_svcctl_GetServiceKeyNameW(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(svcctl_GetServiceKeyNameW, &r); + NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, r); - ZERO_STRUCT(r.out); - r.out.key_name = talloc_zero(mem_ctx, const char *); - if (r.out.key_name == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.key_name = talloc_zero(r, const char *); + if (r->out.key_name == NULL) { + talloc_free(r); return False; } - r.out.display_name_length = r.in.display_name_length; - r.out.result = _svcctl_GetServiceKeyNameW(p, &r); + r->out.display_name_length = r->in.display_name_length; + r->out.result = _svcctl_GetServiceKeyNameW(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(svcctl_GetServiceKeyNameW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, 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_svcctl_GetServiceKeyNameW(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_svcctl_SCSetServiceBitsA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_SCSetServiceBitsA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_SCSetServiceBitsA"); + struct svcctl_SCSetServiceBitsA *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSETSERVICEBITSA]; + + r = talloc(NULL, struct svcctl_SCSetServiceBitsA); + 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_svcctl_SCSetServiceBitsA(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(svcctl_SCSetServiceBitsA, &r); + NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, r); - r.out.result = _svcctl_SCSetServiceBitsA(p, &r); + r->out.result = _svcctl_SCSetServiceBitsA(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(svcctl_SCSetServiceBitsA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, 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_svcctl_SCSetServiceBitsA(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_svcctl_ChangeServiceConfigA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_ChangeServiceConfigA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_ChangeServiceConfigA"); + struct svcctl_ChangeServiceConfigA *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIGA]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_ChangeServiceConfigA); + 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_svcctl_ChangeServiceConfigA(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(svcctl_ChangeServiceConfigA, &r); + NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, r); - ZERO_STRUCT(r.out); - r.out.tag_id = talloc_zero(mem_ctx, uint32_t); - if (r.out.tag_id == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.tag_id = talloc_zero(r, uint32_t); + if (r->out.tag_id == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_ChangeServiceConfigA(p, &r); + r->out.result = _svcctl_ChangeServiceConfigA(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(svcctl_ChangeServiceConfigA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, 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_svcctl_ChangeServiceConfigA(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_svcctl_CreateServiceA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_CreateServiceA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_CreateServiceA"); + struct svcctl_CreateServiceA *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CREATESERVICEA]; + + r = talloc(NULL, struct svcctl_CreateServiceA); + 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_svcctl_CreateServiceA(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(svcctl_CreateServiceA, &r); + NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, r); - ZERO_STRUCT(r.out); - r.out.TagId = talloc_zero(mem_ctx, uint32_t); - if (r.out.TagId == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.TagId = talloc_zero(r, uint32_t); + if (r->out.TagId == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_CreateServiceA(p, &r); + r->out.result = _svcctl_CreateServiceA(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(svcctl_CreateServiceA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, 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_svcctl_CreateServiceA(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_svcctl_EnumDependentServicesA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_EnumDependentServicesA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_EnumDependentServicesA"); + struct svcctl_EnumDependentServicesA *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMDEPENDENTSERVICESA]; + + r = talloc(NULL, struct svcctl_EnumDependentServicesA); + 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_svcctl_EnumDependentServicesA(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(svcctl_EnumDependentServicesA, &r); + NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, r); - ZERO_STRUCT(r.out); - r.out.service_status = talloc_zero(mem_ctx, struct ENUM_SERVICE_STATUS); - if (r.out.service_status == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUS); + if (r->out.service_status == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.services_returned = talloc_zero(mem_ctx, uint32_t); - if (r.out.services_returned == NULL) { - talloc_free(mem_ctx); + r->out.services_returned = talloc_zero(r, uint32_t); + if (r->out.services_returned == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_EnumDependentServicesA(p, &r); + r->out.result = _svcctl_EnumDependentServicesA(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(svcctl_EnumDependentServicesA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, 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_svcctl_EnumDependentServicesA(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_svcctl_EnumServicesStatusA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_EnumServicesStatusA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_EnumServicesStatusA"); + struct svcctl_EnumServicesStatusA *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICESSTATUSA]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_EnumServicesStatusA); + 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_svcctl_EnumServicesStatusA(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(svcctl_EnumServicesStatusA, &r); + NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, r); - ZERO_STRUCT(r.out); - r.out.service = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.service == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.service = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.service == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.services_returned = talloc_zero(mem_ctx, uint32_t); - if (r.out.services_returned == NULL) { - talloc_free(mem_ctx); + r->out.services_returned = talloc_zero(r, uint32_t); + if (r->out.services_returned == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _svcctl_EnumServicesStatusA(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _svcctl_EnumServicesStatusA(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(svcctl_EnumServicesStatusA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, 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_svcctl_EnumServicesStatusA(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_svcctl_OpenSCManagerA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_OpenSCManagerA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_OpenSCManagerA"); + struct svcctl_OpenSCManagerA *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSCMANAGERA]; + + r = talloc(NULL, struct svcctl_OpenSCManagerA); + 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_svcctl_OpenSCManagerA(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(svcctl_OpenSCManagerA, &r); + NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, 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 = _svcctl_OpenSCManagerA(p, &r); + r->out.result = _svcctl_OpenSCManagerA(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(svcctl_OpenSCManagerA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, 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_svcctl_OpenSCManagerA(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_svcctl_OpenServiceA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_OpenServiceA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_OpenServiceA"); + struct svcctl_OpenServiceA *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSERVICEA]; + + r = talloc(NULL, struct svcctl_OpenServiceA); + 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_svcctl_OpenServiceA(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(svcctl_OpenServiceA, &r); + NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, r); - r.out.result = _svcctl_OpenServiceA(p, &r); + r->out.result = _svcctl_OpenServiceA(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(svcctl_OpenServiceA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, 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_svcctl_OpenServiceA(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_svcctl_QueryServiceConfigA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceConfigA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceConfigA"); + struct svcctl_QueryServiceConfigA *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIGA]; + + r = talloc(NULL, struct svcctl_QueryServiceConfigA); + 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_svcctl_QueryServiceConfigA(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(svcctl_QueryServiceConfigA, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, r); - ZERO_STRUCT(r.out); - r.out.query = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.query == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.query = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.query == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_QueryServiceConfigA(p, &r); + r->out.result = _svcctl_QueryServiceConfigA(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(svcctl_QueryServiceConfigA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, 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_svcctl_QueryServiceConfigA(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_svcctl_QueryServiceLockStatusA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceLockStatusA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceLockStatusA"); + struct svcctl_QueryServiceLockStatusA *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICELOCKSTATUSA]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_QueryServiceLockStatusA); + 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_svcctl_QueryServiceLockStatusA(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(svcctl_QueryServiceLockStatusA, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, r); - ZERO_STRUCT(r.out); - r.out.lock_status = talloc_zero(mem_ctx, struct SERVICE_LOCK_STATUS); - if (r.out.lock_status == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS); + if (r->out.lock_status == NULL) { + talloc_free(r); return False; } - r.out.required_buf_size = talloc_zero(mem_ctx, uint32_t); - if (r.out.required_buf_size == NULL) { - talloc_free(mem_ctx); + r->out.required_buf_size = talloc_zero(r, uint32_t); + if (r->out.required_buf_size == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_QueryServiceLockStatusA(p, &r); + r->out.result = _svcctl_QueryServiceLockStatusA(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(svcctl_QueryServiceLockStatusA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, 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_svcctl_QueryServiceLockStatusA(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_svcctl_StartServiceA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_StartServiceA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_StartServiceA"); + struct svcctl_StartServiceA *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_STARTSERVICEA]; + + r = talloc(NULL, struct svcctl_StartServiceA); + 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_svcctl_StartServiceA(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(svcctl_StartServiceA, &r); + NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, r); - r.out.result = _svcctl_StartServiceA(p, &r); + r->out.result = _svcctl_StartServiceA(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(svcctl_StartServiceA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, 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_svcctl_StartServiceA(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_svcctl_GetServiceDisplayNameA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_GetServiceDisplayNameA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_GetServiceDisplayNameA"); + struct svcctl_GetServiceDisplayNameA *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEDISPLAYNAMEA]; + + r = talloc(NULL, struct svcctl_GetServiceDisplayNameA); + 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_svcctl_GetServiceDisplayNameA(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(svcctl_GetServiceDisplayNameA, &r); + NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, r); - ZERO_STRUCT(r.out); - r.out.display_name = talloc_zero(mem_ctx, const char *); - if (r.out.display_name == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.display_name = talloc_zero(r, const char *); + if (r->out.display_name == NULL) { + talloc_free(r); return False; } - r.out.display_name_length = r.in.display_name_length; - r.out.result = _svcctl_GetServiceDisplayNameA(p, &r); + r->out.display_name_length = r->in.display_name_length; + r->out.result = _svcctl_GetServiceDisplayNameA(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(svcctl_GetServiceDisplayNameA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, 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_svcctl_GetServiceDisplayNameA(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_svcctl_GetServiceKeyNameA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_GetServiceKeyNameA r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_GetServiceKeyNameA"); + struct svcctl_GetServiceKeyNameA *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEKEYNAMEA]; + + r = talloc(NULL, struct svcctl_GetServiceKeyNameA); + 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_svcctl_GetServiceKeyNameA(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(svcctl_GetServiceKeyNameA, &r); + NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, r); - ZERO_STRUCT(r.out); - r.out.key_name = talloc_zero(mem_ctx, const char *); - if (r.out.key_name == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.key_name = talloc_zero(r, const char *); + if (r->out.key_name == NULL) { + talloc_free(r); return False; } - r.out.display_name_length = r.in.display_name_length; - r.out.result = _svcctl_GetServiceKeyNameA(p, &r); + r->out.display_name_length = r->in.display_name_length; + r->out.result = _svcctl_GetServiceKeyNameA(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(svcctl_GetServiceKeyNameA, &r); + NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, 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_svcctl_GetServiceKeyNameA(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_svcctl_GetCurrentGroupeStateW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_GetCurrentGroupeStateW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_GetCurrentGroupeStateW"); + struct svcctl_GetCurrentGroupeStateW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETCURRENTGROUPESTATEW]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_GetCurrentGroupeStateW); + 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_svcctl_GetCurrentGroupeStateW(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(svcctl_GetCurrentGroupeStateW, &r); + NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, r); - r.out.result = _svcctl_GetCurrentGroupeStateW(p, &r); + r->out.result = _svcctl_GetCurrentGroupeStateW(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(svcctl_GetCurrentGroupeStateW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, 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_svcctl_GetCurrentGroupeStateW(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_svcctl_EnumServiceGroupW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_EnumServiceGroupW r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_EnumServiceGroupW"); + struct svcctl_EnumServiceGroupW *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICEGROUPW]; + + r = talloc(NULL, struct svcctl_EnumServiceGroupW); + 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_svcctl_EnumServiceGroupW(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(svcctl_EnumServiceGroupW, &r); + NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, r); - r.out.result = _svcctl_EnumServiceGroupW(p, &r); + r->out.result = _svcctl_EnumServiceGroupW(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(svcctl_EnumServiceGroupW, &r); + NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, 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_svcctl_EnumServiceGroupW(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_svcctl_ChangeServiceConfig2A(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_ChangeServiceConfig2A r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_ChangeServiceConfig2A"); + struct svcctl_ChangeServiceConfig2A *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIG2A]; + + r = talloc(NULL, struct svcctl_ChangeServiceConfig2A); + 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_svcctl_ChangeServiceConfig2A(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(svcctl_ChangeServiceConfig2A, &r); + NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, r); - r.out.result = _svcctl_ChangeServiceConfig2A(p, &r); + r->out.result = _svcctl_ChangeServiceConfig2A(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(svcctl_ChangeServiceConfig2A, &r); + NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, 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_svcctl_ChangeServiceConfig2A(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_svcctl_ChangeServiceConfig2W(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_ChangeServiceConfig2W r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_ChangeServiceConfig2W"); + struct svcctl_ChangeServiceConfig2W *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIG2W]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct svcctl_ChangeServiceConfig2W); + 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_svcctl_ChangeServiceConfig2W(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(svcctl_ChangeServiceConfig2W, &r); + NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, r); - r.out.result = _svcctl_ChangeServiceConfig2W(p, &r); + r->out.result = _svcctl_ChangeServiceConfig2W(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(svcctl_ChangeServiceConfig2W, &r); + NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, 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_svcctl_ChangeServiceConfig2W(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_svcctl_QueryServiceConfig2A(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceConfig2A r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceConfig2A"); + struct svcctl_QueryServiceConfig2A *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIG2A]; + + r = talloc(NULL, struct svcctl_QueryServiceConfig2A); + 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_svcctl_QueryServiceConfig2A(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(svcctl_QueryServiceConfig2A, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, r); - ZERO_STRUCT(r.out); - r.out.buffer = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.buffer == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.buffer == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_QueryServiceConfig2A(p, &r); + r->out.result = _svcctl_QueryServiceConfig2A(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(svcctl_QueryServiceConfig2A, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, 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_svcctl_QueryServiceConfig2A(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_svcctl_QueryServiceConfig2W(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceConfig2W r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceConfig2W"); + struct svcctl_QueryServiceConfig2W *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIG2W]; + + r = talloc(NULL, struct svcctl_QueryServiceConfig2W); + 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_svcctl_QueryServiceConfig2W(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(svcctl_QueryServiceConfig2W, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, r); - ZERO_STRUCT(r.out); - r.out.buffer = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.buffer == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.buffer == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_QueryServiceConfig2W(p, &r); + r->out.result = _svcctl_QueryServiceConfig2W(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(svcctl_QueryServiceConfig2W, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, 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_svcctl_QueryServiceConfig2W(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_svcctl_QueryServiceStatusEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_QueryServiceStatusEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_QueryServiceStatusEx"); + struct svcctl_QueryServiceStatusEx *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICESTATUSEX]; + + r = talloc(NULL, struct svcctl_QueryServiceStatusEx); + 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_svcctl_QueryServiceStatusEx(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(svcctl_QueryServiceStatusEx, &r); + NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, r); - ZERO_STRUCT(r.out); - r.out.buffer = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.buffer == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.buffer == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.result = _svcctl_QueryServiceStatusEx(p, &r); + r->out.result = _svcctl_QueryServiceStatusEx(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(svcctl_QueryServiceStatusEx, &r); + NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, 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_svcctl_QueryServiceStatusEx(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_EnumServicesStatusExA(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct EnumServicesStatusExA r; - TALLOC_CTX *mem_ctx = talloc_init("api_EnumServicesStatusExA"); + struct EnumServicesStatusExA *r; + + call = &ndr_table_svcctl.calls[NDR_ENUMSERVICESSTATUSEXA]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct EnumServicesStatusExA); + 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_EnumServicesStatusExA(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(EnumServicesStatusExA, &r); + NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, r); - ZERO_STRUCT(r.out); - r.out.services = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.services == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.services = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.services == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.service_returned = talloc_zero(mem_ctx, uint32_t); - if (r.out.service_returned == NULL) { - talloc_free(mem_ctx); + r->out.service_returned = talloc_zero(r, uint32_t); + if (r->out.service_returned == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.group_name = talloc_zero(mem_ctx, const char *); - if (r.out.group_name == NULL) { - talloc_free(mem_ctx); + r->out.resume_handle = r->in.resume_handle; + r->out.group_name = talloc_zero(r, const char *); + if (r->out.group_name == NULL) { + talloc_free(r); return False; } - r.out.result = _EnumServicesStatusExA(p, &r); + r->out.result = _EnumServicesStatusExA(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(EnumServicesStatusExA, &r); + NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, 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_EnumServicesStatusExA(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_EnumServicesStatusExW(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct EnumServicesStatusExW r; - TALLOC_CTX *mem_ctx = talloc_init("api_EnumServicesStatusExW"); + struct EnumServicesStatusExW *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_svcctl.calls[NDR_ENUMSERVICESSTATUSEXW]; + + r = talloc(NULL, struct EnumServicesStatusExW); + 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_EnumServicesStatusExW(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(EnumServicesStatusExW, &r); + NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, r); - ZERO_STRUCT(r.out); - r.out.services = talloc_zero_array(mem_ctx, uint8_t, r.in.buf_size); - if (r.out.services == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.services = talloc_zero_array(r, uint8_t, r->in.buf_size); + if (r->out.services == NULL) { + talloc_free(r); return False; } - r.out.bytes_needed = talloc_zero(mem_ctx, uint32_t); - if (r.out.bytes_needed == NULL) { - talloc_free(mem_ctx); + r->out.bytes_needed = talloc_zero(r, uint32_t); + if (r->out.bytes_needed == NULL) { + talloc_free(r); return False; } - r.out.service_returned = talloc_zero(mem_ctx, uint32_t); - if (r.out.service_returned == NULL) { - talloc_free(mem_ctx); + r->out.service_returned = talloc_zero(r, uint32_t); + if (r->out.service_returned == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.group_name = talloc_zero(mem_ctx, const char *); - if (r.out.group_name == NULL) { - talloc_free(mem_ctx); + r->out.resume_handle = r->in.resume_handle; + r->out.group_name = talloc_zero(r, const char *); + if (r->out.group_name == NULL) { + talloc_free(r); return False; } - r.out.result = _EnumServicesStatusExW(p, &r); + r->out.result = _EnumServicesStatusExW(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(EnumServicesStatusExW, &r); + NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, 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_EnumServicesStatusExW(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_svcctl_SCSendTSMessage(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct svcctl_SCSendTSMessage r; - TALLOC_CTX *mem_ctx = talloc_init("api_svcctl_SCSendTSMessage"); + struct svcctl_SCSendTSMessage *r; + + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSENDTSMESSAGE]; + + r = talloc(NULL, struct svcctl_SCSendTSMessage); + 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_svcctl_SCSendTSMessage(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(svcctl_SCSendTSMessage, &r); + NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, r); - r.out.result = _svcctl_SCSendTSMessage(p, &r); + r->out.result = _svcctl_SCSendTSMessage(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(svcctl_SCSendTSMessage, &r); + NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, 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_svcctl_SCSendTSMessage(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; } diff --git a/source3/librpc/gen_ndr/srv_unixinfo.c b/source3/librpc/gen_ndr/srv_unixinfo.c index d5e3bdeaee..6566ff35e4 100644 --- a/source3/librpc/gen_ndr/srv_unixinfo.c +++ b/source3/librpc/gen_ndr/srv_unixinfo.c @@ -8,356 +8,391 @@ static BOOL api_unixinfo_SidToUid(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct unixinfo_SidToUid r; - TALLOC_CTX *mem_ctx = talloc_init("api_unixinfo_SidToUid"); + struct unixinfo_SidToUid *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_SIDTOUID]; + + r = talloc(NULL, struct unixinfo_SidToUid); + 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_unixinfo_SidToUid(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(unixinfo_SidToUid, &r); + NDR_PRINT_IN_DEBUG(unixinfo_SidToUid, r); - ZERO_STRUCT(r.out); - r.out.uid = talloc_zero(mem_ctx, uint64_t); - if (r.out.uid == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.uid = talloc_zero(r, uint64_t); + if (r->out.uid == NULL) { + talloc_free(r); return False; } - r.out.result = _unixinfo_SidToUid(p, &r); + r->out.result = _unixinfo_SidToUid(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(unixinfo_SidToUid, &r); + NDR_PRINT_OUT_DEBUG(unixinfo_SidToUid, 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_unixinfo_SidToUid(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_unixinfo_UidToSid(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct unixinfo_UidToSid r; - TALLOC_CTX *mem_ctx = talloc_init("api_unixinfo_UidToSid"); + struct unixinfo_UidToSid *r; + + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_UIDTOSID]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct unixinfo_UidToSid); + 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_unixinfo_UidToSid(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(unixinfo_UidToSid, &r); + NDR_PRINT_IN_DEBUG(unixinfo_UidToSid, r); - ZERO_STRUCT(r.out); - r.out.sid = talloc_zero(mem_ctx, struct dom_sid); - if (r.out.sid == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.sid = talloc_zero(r, struct dom_sid); + if (r->out.sid == NULL) { + talloc_free(r); return False; } - r.out.result = _unixinfo_UidToSid(p, &r); + r->out.result = _unixinfo_UidToSid(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(unixinfo_UidToSid, &r); + NDR_PRINT_OUT_DEBUG(unixinfo_UidToSid, 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_unixinfo_UidToSid(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_unixinfo_SidToGid(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct unixinfo_SidToGid r; - TALLOC_CTX *mem_ctx = talloc_init("api_unixinfo_SidToGid"); + struct unixinfo_SidToGid *r; + + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_SIDTOGID]; + + r = talloc(NULL, struct unixinfo_SidToGid); + 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_unixinfo_SidToGid(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(unixinfo_SidToGid, &r); + NDR_PRINT_IN_DEBUG(unixinfo_SidToGid, r); - ZERO_STRUCT(r.out); - r.out.gid = talloc_zero(mem_ctx, uint64_t); - if (r.out.gid == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.gid = talloc_zero(r, uint64_t); + if (r->out.gid == NULL) { + talloc_free(r); return False; } - r.out.result = _unixinfo_SidToGid(p, &r); + r->out.result = _unixinfo_SidToGid(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(unixinfo_SidToGid, &r); + NDR_PRINT_OUT_DEBUG(unixinfo_SidToGid, 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_unixinfo_SidToGid(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_unixinfo_GidToSid(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct unixinfo_GidToSid r; - TALLOC_CTX *mem_ctx = talloc_init("api_unixinfo_GidToSid"); + struct unixinfo_GidToSid *r; + + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_GIDTOSID]; + + r = talloc(NULL, struct unixinfo_GidToSid); + 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_unixinfo_GidToSid(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(unixinfo_GidToSid, &r); + NDR_PRINT_IN_DEBUG(unixinfo_GidToSid, r); - ZERO_STRUCT(r.out); - r.out.sid = talloc_zero(mem_ctx, struct dom_sid); - if (r.out.sid == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.sid = talloc_zero(r, struct dom_sid); + if (r->out.sid == NULL) { + talloc_free(r); return False; } - r.out.result = _unixinfo_GidToSid(p, &r); + r->out.result = _unixinfo_GidToSid(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(unixinfo_GidToSid, &r); + NDR_PRINT_OUT_DEBUG(unixinfo_GidToSid, 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_unixinfo_GidToSid(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_unixinfo_GetPWUid(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct unixinfo_GetPWUid r; - TALLOC_CTX *mem_ctx = talloc_init("api_unixinfo_GetPWUid"); + struct unixinfo_GetPWUid *r; + + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_GETPWUID]; + + r = talloc(NULL, struct unixinfo_GetPWUid); + 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_unixinfo_GetPWUid(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(unixinfo_GetPWUid, &r); + NDR_PRINT_IN_DEBUG(unixinfo_GetPWUid, r); - ZERO_STRUCT(r.out); - r.out.count = r.in.count; - r.out.infos = talloc_zero_array(mem_ctx, struct unixinfo_GetPWUidInfo, *r.out.count); - if (r.out.infos == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.count = r->in.count; + r->out.infos = talloc_zero_array(r, struct unixinfo_GetPWUidInfo, *r->out.count); + if (r->out.infos == NULL) { + talloc_free(r); return False; } - r.out.result = _unixinfo_GetPWUid(p, &r); + r->out.result = _unixinfo_GetPWUid(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(unixinfo_GetPWUid, &r); + NDR_PRINT_OUT_DEBUG(unixinfo_GetPWUid, 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_unixinfo_GetPWUid(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; } diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c index 6384f65f04..c947de4837 100644 --- a/source3/librpc/gen_ndr/srv_winreg.c +++ b/source3/librpc/gen_ndr/srv_winreg.c @@ -8,2398 +8,2643 @@ static BOOL api_winreg_OpenHKCR(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKCR r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCR"); + struct winreg_OpenHKCR *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCR]; + + r = talloc(NULL, struct winreg_OpenHKCR); + 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_winreg_OpenHKCR(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(winreg_OpenHKCR, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, 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 = _winreg_OpenHKCR(p, &r); + r->out.result = _winreg_OpenHKCR(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(winreg_OpenHKCR, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, 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_winreg_OpenHKCR(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_winreg_OpenHKCU(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKCU r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCU"); + struct winreg_OpenHKCU *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCU]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_OpenHKCU); + 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_winreg_OpenHKCU(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(winreg_OpenHKCU, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, 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 = _winreg_OpenHKCU(p, &r); + r->out.result = _winreg_OpenHKCU(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(winreg_OpenHKCU, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, 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_winreg_OpenHKCU(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_winreg_OpenHKLM(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKLM r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKLM"); + struct winreg_OpenHKLM *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKLM]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_OpenHKLM); + 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_winreg_OpenHKLM(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(winreg_OpenHKLM, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, 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 = _winreg_OpenHKLM(p, &r); + r->out.result = _winreg_OpenHKLM(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(winreg_OpenHKLM, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, 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_winreg_OpenHKLM(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_winreg_OpenHKPD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKPD r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPD"); + struct winreg_OpenHKPD *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPD]; + + r = talloc(NULL, struct winreg_OpenHKPD); + 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_winreg_OpenHKPD(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(winreg_OpenHKPD, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, 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 = _winreg_OpenHKPD(p, &r); + r->out.result = _winreg_OpenHKPD(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(winreg_OpenHKPD, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, 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_winreg_OpenHKPD(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_winreg_OpenHKU(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKU r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKU"); + struct winreg_OpenHKU *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKU]; + + r = talloc(NULL, struct winreg_OpenHKU); + 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_winreg_OpenHKU(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(winreg_OpenHKU, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKU, 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 = _winreg_OpenHKU(p, &r); + r->out.result = _winreg_OpenHKU(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(winreg_OpenHKU, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, 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_winreg_OpenHKU(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_winreg_CloseKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_CloseKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_CloseKey"); + struct winreg_CloseKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_CLOSEKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_CloseKey); + 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_winreg_CloseKey(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(winreg_CloseKey, &r); + NDR_PRINT_IN_DEBUG(winreg_CloseKey, r); - ZERO_STRUCT(r.out); - r.out.handle = r.in.handle; - r.out.result = _winreg_CloseKey(p, &r); + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _winreg_CloseKey(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(winreg_CloseKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_CloseKey, 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_winreg_CloseKey(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_winreg_CreateKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_CreateKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_CreateKey"); + struct winreg_CreateKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_CREATEKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_CreateKey); + 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_winreg_CreateKey(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(winreg_CreateKey, &r); + NDR_PRINT_IN_DEBUG(winreg_CreateKey, r); - ZERO_STRUCT(r.out); - r.out.new_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.new_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.new_handle = talloc_zero(r, struct policy_handle); + if (r->out.new_handle == NULL) { + talloc_free(r); return False; } - r.out.action_taken = r.in.action_taken; - r.out.result = _winreg_CreateKey(p, &r); + r->out.action_taken = r->in.action_taken; + r->out.result = _winreg_CreateKey(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(winreg_CreateKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_CreateKey, 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_winreg_CreateKey(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_winreg_DeleteKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_DeleteKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_DeleteKey"); + struct winreg_DeleteKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_DELETEKEY]; + + r = talloc(NULL, struct winreg_DeleteKey); + 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_winreg_DeleteKey(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(winreg_DeleteKey, &r); + NDR_PRINT_IN_DEBUG(winreg_DeleteKey, r); - r.out.result = _winreg_DeleteKey(p, &r); + r->out.result = _winreg_DeleteKey(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(winreg_DeleteKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, 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_winreg_DeleteKey(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_winreg_DeleteValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_DeleteValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_DeleteValue"); + struct winreg_DeleteValue *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_DELETEVALUE]; + + r = talloc(NULL, struct winreg_DeleteValue); + 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_winreg_DeleteValue(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(winreg_DeleteValue, &r); + NDR_PRINT_IN_DEBUG(winreg_DeleteValue, r); - r.out.result = _winreg_DeleteValue(p, &r); + r->out.result = _winreg_DeleteValue(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(winreg_DeleteValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, 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_winreg_DeleteValue(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_winreg_EnumKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_EnumKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_EnumKey"); + struct winreg_EnumKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_ENUMKEY]; + + r = talloc(NULL, struct winreg_EnumKey); + 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_winreg_EnumKey(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(winreg_EnumKey, &r); + NDR_PRINT_IN_DEBUG(winreg_EnumKey, r); - ZERO_STRUCT(r.out); - r.out.name = r.in.name; - r.out.keyclass = r.in.keyclass; - r.out.last_changed_time = r.in.last_changed_time; - r.out.result = _winreg_EnumKey(p, &r); + ZERO_STRUCT(r->out); + r->out.name = r->in.name; + r->out.keyclass = r->in.keyclass; + r->out.last_changed_time = r->in.last_changed_time; + r->out.result = _winreg_EnumKey(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(winreg_EnumKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_EnumKey, 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_winreg_EnumKey(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_winreg_EnumValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_EnumValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_EnumValue"); + struct winreg_EnumValue *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_ENUMVALUE]; + + r = talloc(NULL, struct winreg_EnumValue); + 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_winreg_EnumValue(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(winreg_EnumValue, &r); + NDR_PRINT_IN_DEBUG(winreg_EnumValue, r); - ZERO_STRUCT(r.out); - r.out.name = r.in.name; - r.out.type = r.in.type; - r.out.value = r.in.value; - r.out.size = r.in.size; - r.out.length = r.in.length; - r.out.result = _winreg_EnumValue(p, &r); + ZERO_STRUCT(r->out); + r->out.name = r->in.name; + r->out.type = r->in.type; + r->out.value = r->in.value; + r->out.size = r->in.size; + r->out.length = r->in.length; + r->out.result = _winreg_EnumValue(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(winreg_EnumValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_EnumValue, 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_winreg_EnumValue(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_winreg_FlushKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_FlushKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_FlushKey"); + struct winreg_FlushKey *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_FLUSHKEY]; + + r = talloc(NULL, struct winreg_FlushKey); + 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_winreg_FlushKey(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(winreg_FlushKey, &r); + NDR_PRINT_IN_DEBUG(winreg_FlushKey, r); - r.out.result = _winreg_FlushKey(p, &r); + r->out.result = _winreg_FlushKey(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(winreg_FlushKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_FlushKey, 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_winreg_FlushKey(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_winreg_GetKeySecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_GetKeySecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_GetKeySecurity"); + struct winreg_GetKeySecurity *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_GETKEYSECURITY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_GetKeySecurity); + 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_winreg_GetKeySecurity(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(winreg_GetKeySecurity, &r); + NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, r); - ZERO_STRUCT(r.out); - r.out.sd = r.in.sd; - r.out.result = _winreg_GetKeySecurity(p, &r); + ZERO_STRUCT(r->out); + r->out.sd = r->in.sd; + r->out.result = _winreg_GetKeySecurity(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(winreg_GetKeySecurity, &r); + NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, 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_winreg_GetKeySecurity(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_winreg_LoadKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_LoadKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_LoadKey"); + struct winreg_LoadKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_LOADKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_LoadKey); + 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_winreg_LoadKey(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(winreg_LoadKey, &r); + NDR_PRINT_IN_DEBUG(winreg_LoadKey, r); - r.out.result = _winreg_LoadKey(p, &r); + r->out.result = _winreg_LoadKey(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(winreg_LoadKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_LoadKey, 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_winreg_LoadKey(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_winreg_NotifyChangeKeyValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_NotifyChangeKeyValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_NotifyChangeKeyValue"); + struct winreg_NotifyChangeKeyValue *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_NOTIFYCHANGEKEYVALUE]; + + r = talloc(NULL, struct winreg_NotifyChangeKeyValue); + 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_winreg_NotifyChangeKeyValue(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(winreg_NotifyChangeKeyValue, &r); + NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, r); - r.out.result = _winreg_NotifyChangeKeyValue(p, &r); + r->out.result = _winreg_NotifyChangeKeyValue(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(winreg_NotifyChangeKeyValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, 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_winreg_NotifyChangeKeyValue(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_winreg_OpenKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenKey"); + struct winreg_OpenKey *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENKEY]; + + r = talloc(NULL, struct winreg_OpenKey); + 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_winreg_OpenKey(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(winreg_OpenKey, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenKey, 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 = _winreg_OpenKey(p, &r); + r->out.result = _winreg_OpenKey(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(winreg_OpenKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenKey, 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_winreg_OpenKey(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_winreg_QueryInfoKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_QueryInfoKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryInfoKey"); + struct winreg_QueryInfoKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYINFOKEY]; + + r = talloc(NULL, struct winreg_QueryInfoKey); + 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_winreg_QueryInfoKey(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(winreg_QueryInfoKey, &r); + NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, r); - ZERO_STRUCT(r.out); - r.out.classname = r.in.classname; - r.out.num_subkeys = talloc_zero(mem_ctx, uint32_t); - if (r.out.num_subkeys == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.classname = r->in.classname; + r->out.num_subkeys = talloc_zero(r, uint32_t); + if (r->out.num_subkeys == NULL) { + talloc_free(r); return False; } - r.out.max_subkeylen = talloc_zero(mem_ctx, uint32_t); - if (r.out.max_subkeylen == NULL) { - talloc_free(mem_ctx); + r->out.max_subkeylen = talloc_zero(r, uint32_t); + if (r->out.max_subkeylen == NULL) { + talloc_free(r); return False; } - r.out.max_classlen = talloc_zero(mem_ctx, uint32_t); - if (r.out.max_classlen == NULL) { - talloc_free(mem_ctx); + r->out.max_classlen = talloc_zero(r, uint32_t); + if (r->out.max_classlen == NULL) { + talloc_free(r); return False; } - r.out.num_values = talloc_zero(mem_ctx, uint32_t); - if (r.out.num_values == NULL) { - talloc_free(mem_ctx); + r->out.num_values = talloc_zero(r, uint32_t); + if (r->out.num_values == NULL) { + talloc_free(r); return False; } - r.out.max_valnamelen = talloc_zero(mem_ctx, uint32_t); - if (r.out.max_valnamelen == NULL) { - talloc_free(mem_ctx); + r->out.max_valnamelen = talloc_zero(r, uint32_t); + if (r->out.max_valnamelen == NULL) { + talloc_free(r); return False; } - r.out.max_valbufsize = talloc_zero(mem_ctx, uint32_t); - if (r.out.max_valbufsize == NULL) { - talloc_free(mem_ctx); + r->out.max_valbufsize = talloc_zero(r, uint32_t); + if (r->out.max_valbufsize == NULL) { + talloc_free(r); return False; } - r.out.secdescsize = talloc_zero(mem_ctx, uint32_t); - if (r.out.secdescsize == NULL) { - talloc_free(mem_ctx); + r->out.secdescsize = talloc_zero(r, uint32_t); + if (r->out.secdescsize == NULL) { + talloc_free(r); return False; } - r.out.last_changed_time = talloc_zero(mem_ctx, NTTIME); - if (r.out.last_changed_time == NULL) { - talloc_free(mem_ctx); + r->out.last_changed_time = talloc_zero(r, NTTIME); + if (r->out.last_changed_time == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_QueryInfoKey(p, &r); + r->out.result = _winreg_QueryInfoKey(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(winreg_QueryInfoKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, 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_winreg_QueryInfoKey(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_winreg_QueryValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_QueryValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryValue"); + struct winreg_QueryValue *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYVALUE]; + + r = talloc(NULL, struct winreg_QueryValue); + 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_winreg_QueryValue(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(winreg_QueryValue, &r); + NDR_PRINT_IN_DEBUG(winreg_QueryValue, r); - ZERO_STRUCT(r.out); - r.out.type = r.in.type; - r.out.data = r.in.data; - r.out.data_size = r.in.data_size; - r.out.value_length = r.in.value_length; - r.out.result = _winreg_QueryValue(p, &r); + ZERO_STRUCT(r->out); + r->out.type = r->in.type; + r->out.data = r->in.data; + r->out.data_size = r->in.data_size; + r->out.value_length = r->in.value_length; + r->out.result = _winreg_QueryValue(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(winreg_QueryValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_QueryValue, 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_winreg_QueryValue(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_winreg_ReplaceKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_ReplaceKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_ReplaceKey"); + struct winreg_ReplaceKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_REPLACEKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_ReplaceKey); + 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_winreg_ReplaceKey(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(winreg_ReplaceKey, &r); + NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, r); - r.out.result = _winreg_ReplaceKey(p, &r); + r->out.result = _winreg_ReplaceKey(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(winreg_ReplaceKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, 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_winreg_ReplaceKey(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_winreg_RestoreKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_RestoreKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_RestoreKey"); + struct winreg_RestoreKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_RESTOREKEY]; + + r = talloc(NULL, struct winreg_RestoreKey); + 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_winreg_RestoreKey(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(winreg_RestoreKey, &r); + NDR_PRINT_IN_DEBUG(winreg_RestoreKey, r); - r.out.result = _winreg_RestoreKey(p, &r); + r->out.result = _winreg_RestoreKey(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(winreg_RestoreKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, 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_winreg_RestoreKey(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_winreg_SaveKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_SaveKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SaveKey"); + struct winreg_SaveKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_SAVEKEY]; + + r = talloc(NULL, struct winreg_SaveKey); + 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_winreg_SaveKey(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(winreg_SaveKey, &r); + NDR_PRINT_IN_DEBUG(winreg_SaveKey, r); - r.out.result = _winreg_SaveKey(p, &r); + r->out.result = _winreg_SaveKey(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(winreg_SaveKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_SaveKey, 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_winreg_SaveKey(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_winreg_SetKeySecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_SetKeySecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SetKeySecurity"); + struct winreg_SetKeySecurity *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_SETKEYSECURITY]; + + r = talloc(NULL, struct winreg_SetKeySecurity); + 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_winreg_SetKeySecurity(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(winreg_SetKeySecurity, &r); + NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, r); - r.out.result = _winreg_SetKeySecurity(p, &r); + r->out.result = _winreg_SetKeySecurity(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(winreg_SetKeySecurity, &r); + NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, 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_winreg_SetKeySecurity(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_winreg_SetValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_SetValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SetValue"); + struct winreg_SetValue *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_SETVALUE]; + + r = talloc(NULL, struct winreg_SetValue); + 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_winreg_SetValue(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(winreg_SetValue, &r); + NDR_PRINT_IN_DEBUG(winreg_SetValue, r); - r.out.result = _winreg_SetValue(p, &r); + r->out.result = _winreg_SetValue(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(winreg_SetValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_SetValue, 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_winreg_SetValue(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_winreg_UnLoadKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_UnLoadKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_UnLoadKey"); + struct winreg_UnLoadKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_UNLOADKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_UnLoadKey); + 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_winreg_UnLoadKey(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(winreg_UnLoadKey, &r); + NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, r); - r.out.result = _winreg_UnLoadKey(p, &r); + r->out.result = _winreg_UnLoadKey(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(winreg_UnLoadKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, 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_winreg_UnLoadKey(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_winreg_InitiateSystemShutdown(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_InitiateSystemShutdown r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_InitiateSystemShutdown"); + struct winreg_InitiateSystemShutdown *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_INITIATESYSTEMSHUTDOWN]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_InitiateSystemShutdown); + 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_winreg_InitiateSystemShutdown(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(winreg_InitiateSystemShutdown, &r); + NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, r); - r.out.result = _winreg_InitiateSystemShutdown(p, &r); + r->out.result = _winreg_InitiateSystemShutdown(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(winreg_InitiateSystemShutdown, &r); + NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, 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_winreg_InitiateSystemShutdown(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_winreg_AbortSystemShutdown(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_AbortSystemShutdown r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_AbortSystemShutdown"); + struct winreg_AbortSystemShutdown *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_ABORTSYSTEMSHUTDOWN]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_AbortSystemShutdown); + 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_winreg_AbortSystemShutdown(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(winreg_AbortSystemShutdown, &r); + NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, r); - r.out.result = _winreg_AbortSystemShutdown(p, &r); + r->out.result = _winreg_AbortSystemShutdown(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(winreg_AbortSystemShutdown, &r); + NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, 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_winreg_AbortSystemShutdown(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_winreg_GetVersion(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_GetVersion r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_GetVersion"); + struct winreg_GetVersion *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_GETVERSION]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_GetVersion); + 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_winreg_GetVersion(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(winreg_GetVersion, &r); + NDR_PRINT_IN_DEBUG(winreg_GetVersion, r); - ZERO_STRUCT(r.out); - r.out.version = talloc_zero(mem_ctx, uint32_t); - if (r.out.version == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.version = talloc_zero(r, uint32_t); + if (r->out.version == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_GetVersion(p, &r); + r->out.result = _winreg_GetVersion(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(winreg_GetVersion, &r); + NDR_PRINT_OUT_DEBUG(winreg_GetVersion, 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_winreg_GetVersion(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_winreg_OpenHKCC(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKCC r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCC"); + struct winreg_OpenHKCC *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCC]; + + r = talloc(NULL, struct winreg_OpenHKCC); + 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_winreg_OpenHKCC(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(winreg_OpenHKCC, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, 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 = _winreg_OpenHKCC(p, &r); + r->out.result = _winreg_OpenHKCC(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(winreg_OpenHKCC, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, 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_winreg_OpenHKCC(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_winreg_OpenHKDD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKDD r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKDD"); + struct winreg_OpenHKDD *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKDD]; + + r = talloc(NULL, struct winreg_OpenHKDD); + 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_winreg_OpenHKDD(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(winreg_OpenHKDD, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, 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 = _winreg_OpenHKDD(p, &r); + r->out.result = _winreg_OpenHKDD(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(winreg_OpenHKDD, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, 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_winreg_OpenHKDD(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_winreg_QueryMultipleValues(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_QueryMultipleValues r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryMultipleValues"); + struct winreg_QueryMultipleValues *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYMULTIPLEVALUES]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_QueryMultipleValues); + 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_winreg_QueryMultipleValues(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(winreg_QueryMultipleValues, &r); + NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, r); - ZERO_STRUCT(r.out); - r.out.values = r.in.values; - r.out.buffer = r.in.buffer; - r.out.buffer_size = r.in.buffer_size; - r.out.result = _winreg_QueryMultipleValues(p, &r); + ZERO_STRUCT(r->out); + r->out.values = r->in.values; + r->out.buffer = r->in.buffer; + r->out.buffer_size = r->in.buffer_size; + r->out.result = _winreg_QueryMultipleValues(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(winreg_QueryMultipleValues, &r); + NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, 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_winreg_QueryMultipleValues(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_winreg_InitiateSystemShutdownEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_InitiateSystemShutdownEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_InitiateSystemShutdownEx"); + struct winreg_InitiateSystemShutdownEx *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_INITIATESYSTEMSHUTDOWNEX]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_InitiateSystemShutdownEx); + 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_winreg_InitiateSystemShutdownEx(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(winreg_InitiateSystemShutdownEx, &r); + NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, r); - r.out.result = _winreg_InitiateSystemShutdownEx(p, &r); + r->out.result = _winreg_InitiateSystemShutdownEx(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(winreg_InitiateSystemShutdownEx, &r); + NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, 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_winreg_InitiateSystemShutdownEx(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_winreg_SaveKeyEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_SaveKeyEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SaveKeyEx"); + struct winreg_SaveKeyEx *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_SAVEKEYEX]; + + r = talloc(NULL, struct winreg_SaveKeyEx); + 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_winreg_SaveKeyEx(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(winreg_SaveKeyEx, &r); + NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, r); - r.out.result = _winreg_SaveKeyEx(p, &r); + r->out.result = _winreg_SaveKeyEx(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(winreg_SaveKeyEx, &r); + NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, 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_winreg_SaveKeyEx(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_winreg_OpenHKPT(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKPT r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPT"); + struct winreg_OpenHKPT *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPT]; + + r = talloc(NULL, struct winreg_OpenHKPT); + 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_winreg_OpenHKPT(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(winreg_OpenHKPT, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, 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 = _winreg_OpenHKPT(p, &r); + r->out.result = _winreg_OpenHKPT(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(winreg_OpenHKPT, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, 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_winreg_OpenHKPT(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_winreg_OpenHKPN(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKPN r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPN"); + struct winreg_OpenHKPN *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPN]; + + r = talloc(NULL, struct winreg_OpenHKPN); + 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_winreg_OpenHKPN(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(winreg_OpenHKPN, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, 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 = _winreg_OpenHKPN(p, &r); + r->out.result = _winreg_OpenHKPN(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(winreg_OpenHKPN, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, 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_winreg_OpenHKPN(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_winreg_QueryMultipleValues2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_QueryMultipleValues2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryMultipleValues2"); + struct winreg_QueryMultipleValues2 *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYMULTIPLEVALUES2]; + + r = talloc(NULL, struct winreg_QueryMultipleValues2); + 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_winreg_QueryMultipleValues2(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(winreg_QueryMultipleValues2, &r); + NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, r); - r.out.result = _winreg_QueryMultipleValues2(p, &r); + r->out.result = _winreg_QueryMultipleValues2(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(winreg_QueryMultipleValues2, &r); + NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, 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_winreg_QueryMultipleValues2(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; } diff --git a/source3/librpc/gen_ndr/srv_wkssvc.c b/source3/librpc/gen_ndr/srv_wkssvc.c index 2f3673d4a4..a542aee7f0 100644 --- a/source3/librpc/gen_ndr/srv_wkssvc.c +++ b/source3/librpc/gen_ndr/srv_wkssvc.c @@ -8,2018 +8,2235 @@ static BOOL api_wkssvc_NetWkstaGetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetWkstaGetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetWkstaGetInfo"); + struct wkssvc_NetWkstaGetInfo *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTAGETINFO]; + + r = talloc(NULL, struct wkssvc_NetWkstaGetInfo); + 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_wkssvc_NetWkstaGetInfo(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(wkssvc_NetWkstaGetInfo, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaGetInfo, r); - ZERO_STRUCT(r.out); - r.out.info = talloc_zero(mem_ctx, union wkssvc_NetWkstaInfo); - if (r.out.info == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union wkssvc_NetWkstaInfo); + if (r->out.info == NULL) { + talloc_free(r); return False; } - r.out.result = _wkssvc_NetWkstaGetInfo(p, &r); + r->out.result = _wkssvc_NetWkstaGetInfo(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(wkssvc_NetWkstaGetInfo, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaGetInfo, 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_wkssvc_NetWkstaGetInfo(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_wkssvc_NetWkstaSetInfo(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetWkstaSetInfo r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetWkstaSetInfo"); + struct wkssvc_NetWkstaSetInfo *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTASETINFO]; + + r = talloc(NULL, struct wkssvc_NetWkstaSetInfo); + 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_wkssvc_NetWkstaSetInfo(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(wkssvc_NetWkstaSetInfo, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaSetInfo, r); - ZERO_STRUCT(r.out); - r.out.parm_error = r.in.parm_error; - r.out.result = _wkssvc_NetWkstaSetInfo(p, &r); + ZERO_STRUCT(r->out); + r->out.parm_error = r->in.parm_error; + r->out.result = _wkssvc_NetWkstaSetInfo(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(wkssvc_NetWkstaSetInfo, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaSetInfo, 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_wkssvc_NetWkstaSetInfo(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_wkssvc_NetWkstaEnumUsers(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetWkstaEnumUsers r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetWkstaEnumUsers"); + struct wkssvc_NetWkstaEnumUsers *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTAENUMUSERS]; + + r = talloc(NULL, struct wkssvc_NetWkstaEnumUsers); + 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_wkssvc_NetWkstaEnumUsers(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(wkssvc_NetWkstaEnumUsers, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaEnumUsers, r); - ZERO_STRUCT(r.out); - r.out.users = r.in.users; - r.out.entriesread = talloc_zero(mem_ctx, uint32_t); - if (r.out.entriesread == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.users = r->in.users; + r->out.entriesread = talloc_zero(r, uint32_t); + if (r->out.entriesread == NULL) { + talloc_free(r); return False; } - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resumehandle = r.in.resumehandle; - r.out.result = _wkssvc_NetWkstaEnumUsers(p, &r); + r->out.resumehandle = r->in.resumehandle; + r->out.result = _wkssvc_NetWkstaEnumUsers(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(wkssvc_NetWkstaEnumUsers, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaEnumUsers, 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_wkssvc_NetWkstaEnumUsers(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_WKSSVC_NETRWKSTAUSERGETINFO(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRWKSTAUSERGETINFO r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRWKSTAUSERGETINFO"); + struct WKSSVC_NETRWKSTAUSERGETINFO *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTAUSERGETINFO]; + + r = talloc(NULL, struct WKSSVC_NETRWKSTAUSERGETINFO); + 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_WKSSVC_NETRWKSTAUSERGETINFO(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(WKSSVC_NETRWKSTAUSERGETINFO, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRWKSTAUSERGETINFO, r); - r.out.result = _WKSSVC_NETRWKSTAUSERGETINFO(p, &r); + r->out.result = _WKSSVC_NETRWKSTAUSERGETINFO(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(WKSSVC_NETRWKSTAUSERGETINFO, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRWKSTAUSERGETINFO, 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_WKSSVC_NETRWKSTAUSERGETINFO(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_WKSSVC_NETRWKSTAUSERSETINFO(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRWKSTAUSERSETINFO r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRWKSTAUSERSETINFO"); + struct WKSSVC_NETRWKSTAUSERSETINFO *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTAUSERSETINFO]; + + r = talloc(NULL, struct WKSSVC_NETRWKSTAUSERSETINFO); + 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_WKSSVC_NETRWKSTAUSERSETINFO(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(WKSSVC_NETRWKSTAUSERSETINFO, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRWKSTAUSERSETINFO, r); - r.out.result = _WKSSVC_NETRWKSTAUSERSETINFO(p, &r); + r->out.result = _WKSSVC_NETRWKSTAUSERSETINFO(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(WKSSVC_NETRWKSTAUSERSETINFO, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRWKSTAUSERSETINFO, 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_WKSSVC_NETRWKSTAUSERSETINFO(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_wkssvc_NetWkstaTransportEnum(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetWkstaTransportEnum r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetWkstaTransportEnum"); + struct wkssvc_NetWkstaTransportEnum *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTATRANSPORTENUM]; + + r = talloc(NULL, struct wkssvc_NetWkstaTransportEnum); + 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_wkssvc_NetWkstaTransportEnum(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(wkssvc_NetWkstaTransportEnum, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaTransportEnum, r); - ZERO_STRUCT(r.out); - r.out.level = r.in.level; - r.out.ctr = r.in.ctr; - r.out.totalentries = talloc_zero(mem_ctx, uint32_t); - if (r.out.totalentries == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.level = r->in.level; + r->out.ctr = r->in.ctr; + r->out.totalentries = talloc_zero(r, uint32_t); + if (r->out.totalentries == NULL) { + talloc_free(r); return False; } - r.out.resume_handle = r.in.resume_handle; - r.out.result = _wkssvc_NetWkstaTransportEnum(p, &r); + r->out.resume_handle = r->in.resume_handle; + r->out.result = _wkssvc_NetWkstaTransportEnum(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(wkssvc_NetWkstaTransportEnum, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaTransportEnum, 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_wkssvc_NetWkstaTransportEnum(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_WKSSVC_NETRWKSTATRANSPORTADD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRWKSTATRANSPORTADD r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRWKSTATRANSPORTADD"); + struct WKSSVC_NETRWKSTATRANSPORTADD *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTATRANSPORTADD]; + + r = talloc(NULL, struct WKSSVC_NETRWKSTATRANSPORTADD); + 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_WKSSVC_NETRWKSTATRANSPORTADD(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(WKSSVC_NETRWKSTATRANSPORTADD, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRWKSTATRANSPORTADD, r); - r.out.result = _WKSSVC_NETRWKSTATRANSPORTADD(p, &r); + r->out.result = _WKSSVC_NETRWKSTATRANSPORTADD(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(WKSSVC_NETRWKSTATRANSPORTADD, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRWKSTATRANSPORTADD, 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_WKSSVC_NETRWKSTATRANSPORTADD(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_WKSSVC_NETRWKSTATRANSPORTDEL(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRWKSTATRANSPORTDEL r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRWKSTATRANSPORTDEL"); + struct WKSSVC_NETRWKSTATRANSPORTDEL *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTATRANSPORTDEL]; + + r = talloc(NULL, struct WKSSVC_NETRWKSTATRANSPORTDEL); + 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_WKSSVC_NETRWKSTATRANSPORTDEL(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(WKSSVC_NETRWKSTATRANSPORTDEL, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRWKSTATRANSPORTDEL, r); - r.out.result = _WKSSVC_NETRWKSTATRANSPORTDEL(p, &r); + r->out.result = _WKSSVC_NETRWKSTATRANSPORTDEL(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(WKSSVC_NETRWKSTATRANSPORTDEL, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRWKSTATRANSPORTDEL, 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_WKSSVC_NETRWKSTATRANSPORTDEL(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_WKSSVC_NETRUSEADD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRUSEADD r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRUSEADD"); + struct WKSSVC_NETRUSEADD *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEADD]; + + r = talloc(NULL, struct WKSSVC_NETRUSEADD); + 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_WKSSVC_NETRUSEADD(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(WKSSVC_NETRUSEADD, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRUSEADD, r); - r.out.result = _WKSSVC_NETRUSEADD(p, &r); + r->out.result = _WKSSVC_NETRUSEADD(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(WKSSVC_NETRUSEADD, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRUSEADD, 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_WKSSVC_NETRUSEADD(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_WKSSVC_NETRUSEGETINFO(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRUSEGETINFO r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRUSEGETINFO"); + struct WKSSVC_NETRUSEGETINFO *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEGETINFO]; + + r = talloc(NULL, struct WKSSVC_NETRUSEGETINFO); + 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_WKSSVC_NETRUSEGETINFO(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(WKSSVC_NETRUSEGETINFO, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRUSEGETINFO, r); - r.out.result = _WKSSVC_NETRUSEGETINFO(p, &r); + r->out.result = _WKSSVC_NETRUSEGETINFO(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(WKSSVC_NETRUSEGETINFO, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRUSEGETINFO, 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_WKSSVC_NETRUSEGETINFO(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_WKSSVC_NETRUSEDEL(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRUSEDEL r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRUSEDEL"); + struct WKSSVC_NETRUSEDEL *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEDEL]; + + r = talloc(NULL, struct WKSSVC_NETRUSEDEL); + 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_WKSSVC_NETRUSEDEL(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(WKSSVC_NETRUSEDEL, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRUSEDEL, r); - r.out.result = _WKSSVC_NETRUSEDEL(p, &r); + r->out.result = _WKSSVC_NETRUSEDEL(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(WKSSVC_NETRUSEDEL, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRUSEDEL, 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_WKSSVC_NETRUSEDEL(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_WKSSVC_NETRUSEENUM(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRUSEENUM r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRUSEENUM"); + struct WKSSVC_NETRUSEENUM *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEENUM]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct WKSSVC_NETRUSEENUM); + 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_WKSSVC_NETRUSEENUM(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(WKSSVC_NETRUSEENUM, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRUSEENUM, r); - r.out.result = _WKSSVC_NETRUSEENUM(p, &r); + r->out.result = _WKSSVC_NETRUSEENUM(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(WKSSVC_NETRUSEENUM, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRUSEENUM, 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_WKSSVC_NETRUSEENUM(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_WKSSVC_NETRMESSAGEBUFFERSEND(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRMESSAGEBUFFERSEND r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRMESSAGEBUFFERSEND"); + struct WKSSVC_NETRMESSAGEBUFFERSEND *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRMESSAGEBUFFERSEND]; + + r = talloc(NULL, struct WKSSVC_NETRMESSAGEBUFFERSEND); + 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_WKSSVC_NETRMESSAGEBUFFERSEND(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(WKSSVC_NETRMESSAGEBUFFERSEND, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRMESSAGEBUFFERSEND, r); - r.out.result = _WKSSVC_NETRMESSAGEBUFFERSEND(p, &r); + r->out.result = _WKSSVC_NETRMESSAGEBUFFERSEND(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(WKSSVC_NETRMESSAGEBUFFERSEND, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRMESSAGEBUFFERSEND, 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_WKSSVC_NETRMESSAGEBUFFERSEND(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_WKSSVC_NETRWORKSTATIONSTATISTICSGET(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRWORKSTATIONSTATISTICSGET r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRWORKSTATIONSTATISTICSGET"); + struct WKSSVC_NETRWORKSTATIONSTATISTICSGET *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct WKSSVC_NETRWORKSTATIONSTATISTICSGET); + 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_WKSSVC_NETRWORKSTATIONSTATISTICSGET(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(WKSSVC_NETRWORKSTATIONSTATISTICSGET, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRWORKSTATIONSTATISTICSGET, r); - r.out.result = _WKSSVC_NETRWORKSTATIONSTATISTICSGET(p, &r); + r->out.result = _WKSSVC_NETRWORKSTATIONSTATISTICSGET(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(WKSSVC_NETRWORKSTATIONSTATISTICSGET, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRWORKSTATIONSTATISTICSGET, 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_WKSSVC_NETRWORKSTATIONSTATISTICSGET(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_WKSSVC_NETRLOGONDOMAINNAMEADD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRLOGONDOMAINNAMEADD r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRLOGONDOMAINNAMEADD"); + struct WKSSVC_NETRLOGONDOMAINNAMEADD *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRLOGONDOMAINNAMEADD]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct WKSSVC_NETRLOGONDOMAINNAMEADD); + 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_WKSSVC_NETRLOGONDOMAINNAMEADD(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(WKSSVC_NETRLOGONDOMAINNAMEADD, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRLOGONDOMAINNAMEADD, r); - r.out.result = _WKSSVC_NETRLOGONDOMAINNAMEADD(p, &r); + r->out.result = _WKSSVC_NETRLOGONDOMAINNAMEADD(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(WKSSVC_NETRLOGONDOMAINNAMEADD, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRLOGONDOMAINNAMEADD, 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_WKSSVC_NETRLOGONDOMAINNAMEADD(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_WKSSVC_NETRLOGONDOMAINNAMEDEL(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRLOGONDOMAINNAMEDEL r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRLOGONDOMAINNAMEDEL"); + struct WKSSVC_NETRLOGONDOMAINNAMEDEL *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL]; + + r = talloc(NULL, struct WKSSVC_NETRLOGONDOMAINNAMEDEL); + 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_WKSSVC_NETRLOGONDOMAINNAMEDEL(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(WKSSVC_NETRLOGONDOMAINNAMEDEL, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRLOGONDOMAINNAMEDEL, r); - r.out.result = _WKSSVC_NETRLOGONDOMAINNAMEDEL(p, &r); + r->out.result = _WKSSVC_NETRLOGONDOMAINNAMEDEL(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(WKSSVC_NETRLOGONDOMAINNAMEDEL, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRLOGONDOMAINNAMEDEL, 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_WKSSVC_NETRLOGONDOMAINNAMEDEL(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_WKSSVC_NETRJOINDOMAIN(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRJOINDOMAIN r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRJOINDOMAIN"); + struct WKSSVC_NETRJOINDOMAIN *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRJOINDOMAIN]; + + r = talloc(NULL, struct WKSSVC_NETRJOINDOMAIN); + 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_WKSSVC_NETRJOINDOMAIN(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(WKSSVC_NETRJOINDOMAIN, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRJOINDOMAIN, r); - r.out.result = _WKSSVC_NETRJOINDOMAIN(p, &r); + r->out.result = _WKSSVC_NETRJOINDOMAIN(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(WKSSVC_NETRJOINDOMAIN, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRJOINDOMAIN, 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_WKSSVC_NETRJOINDOMAIN(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_WKSSVC_NETRUNJOINDOMAIN(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRUNJOINDOMAIN r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRUNJOINDOMAIN"); + struct WKSSVC_NETRUNJOINDOMAIN *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUNJOINDOMAIN]; + + r = talloc(NULL, struct WKSSVC_NETRUNJOINDOMAIN); + 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_WKSSVC_NETRUNJOINDOMAIN(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(WKSSVC_NETRUNJOINDOMAIN, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRUNJOINDOMAIN, r); - r.out.result = _WKSSVC_NETRUNJOINDOMAIN(p, &r); + r->out.result = _WKSSVC_NETRUNJOINDOMAIN(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(WKSSVC_NETRUNJOINDOMAIN, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRUNJOINDOMAIN, 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_WKSSVC_NETRUNJOINDOMAIN(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_WKSSVC_NETRRENAMEMACHINEINDOMAIN(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRRENAMEMACHINEINDOMAIN r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRRENAMEMACHINEINDOMAIN"); + struct WKSSVC_NETRRENAMEMACHINEINDOMAIN *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN]; + + r = talloc(NULL, struct WKSSVC_NETRRENAMEMACHINEINDOMAIN); + 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_WKSSVC_NETRRENAMEMACHINEINDOMAIN(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(WKSSVC_NETRRENAMEMACHINEINDOMAIN, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRRENAMEMACHINEINDOMAIN, r); - r.out.result = _WKSSVC_NETRRENAMEMACHINEINDOMAIN(p, &r); + r->out.result = _WKSSVC_NETRRENAMEMACHINEINDOMAIN(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(WKSSVC_NETRRENAMEMACHINEINDOMAIN, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRRENAMEMACHINEINDOMAIN, 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_WKSSVC_NETRRENAMEMACHINEINDOMAIN(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_WKSSVC_NETRVALIDATENAME(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRVALIDATENAME r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRVALIDATENAME"); + struct WKSSVC_NETRVALIDATENAME *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRVALIDATENAME]; + + r = talloc(NULL, struct WKSSVC_NETRVALIDATENAME); + 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_WKSSVC_NETRVALIDATENAME(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(WKSSVC_NETRVALIDATENAME, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRVALIDATENAME, r); - r.out.result = _WKSSVC_NETRVALIDATENAME(p, &r); + r->out.result = _WKSSVC_NETRVALIDATENAME(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(WKSSVC_NETRVALIDATENAME, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRVALIDATENAME, 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_WKSSVC_NETRVALIDATENAME(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_WKSSVC_NETRGETJOININFORMATION(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRGETJOININFORMATION r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRGETJOININFORMATION"); + struct WKSSVC_NETRGETJOININFORMATION *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOININFORMATION]; + + r = talloc(NULL, struct WKSSVC_NETRGETJOININFORMATION); + 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_WKSSVC_NETRGETJOININFORMATION(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(WKSSVC_NETRGETJOININFORMATION, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRGETJOININFORMATION, r); - r.out.result = _WKSSVC_NETRGETJOININFORMATION(p, &r); + r->out.result = _WKSSVC_NETRGETJOININFORMATION(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(WKSSVC_NETRGETJOININFORMATION, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRGETJOININFORMATION, 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_WKSSVC_NETRGETJOININFORMATION(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_WKSSVC_NETRGETJOINABLEOUS(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRGETJOINABLEOUS r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRGETJOINABLEOUS"); + struct WKSSVC_NETRGETJOINABLEOUS *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOINABLEOUS]; + + r = talloc(NULL, struct WKSSVC_NETRGETJOINABLEOUS); + 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_WKSSVC_NETRGETJOINABLEOUS(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(WKSSVC_NETRGETJOINABLEOUS, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRGETJOINABLEOUS, r); - r.out.result = _WKSSVC_NETRGETJOINABLEOUS(p, &r); + r->out.result = _WKSSVC_NETRGETJOINABLEOUS(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(WKSSVC_NETRGETJOINABLEOUS, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRGETJOINABLEOUS, 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_WKSSVC_NETRGETJOINABLEOUS(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_wkssvc_NetrJoinDomain2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetrJoinDomain2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetrJoinDomain2"); + struct wkssvc_NetrJoinDomain2 *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRJOINDOMAIN2]; + + r = talloc(NULL, struct wkssvc_NetrJoinDomain2); + 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_wkssvc_NetrJoinDomain2(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(wkssvc_NetrJoinDomain2, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain2, r); - r.out.result = _wkssvc_NetrJoinDomain2(p, &r); + r->out.result = _wkssvc_NetrJoinDomain2(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(wkssvc_NetrJoinDomain2, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain2, 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_wkssvc_NetrJoinDomain2(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_wkssvc_NetrUnjoinDomain2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetrUnjoinDomain2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetrUnjoinDomain2"); + struct wkssvc_NetrUnjoinDomain2 *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUNJOINDOMAIN2]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct wkssvc_NetrUnjoinDomain2); + 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_wkssvc_NetrUnjoinDomain2(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(wkssvc_NetrUnjoinDomain2, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain2, r); - r.out.result = _wkssvc_NetrUnjoinDomain2(p, &r); + r->out.result = _wkssvc_NetrUnjoinDomain2(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(wkssvc_NetrUnjoinDomain2, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain2, 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_wkssvc_NetrUnjoinDomain2(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_wkssvc_NetrRenameMachineInDomain2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetrRenameMachineInDomain2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetrRenameMachineInDomain2"); + struct wkssvc_NetrRenameMachineInDomain2 *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct wkssvc_NetrRenameMachineInDomain2); + 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_wkssvc_NetrRenameMachineInDomain2(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(wkssvc_NetrRenameMachineInDomain2, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain2, r); - r.out.result = _wkssvc_NetrRenameMachineInDomain2(p, &r); + r->out.result = _wkssvc_NetrRenameMachineInDomain2(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(wkssvc_NetrRenameMachineInDomain2, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain2, 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_wkssvc_NetrRenameMachineInDomain2(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_WKSSVC_NETRVALIDATENAME2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRVALIDATENAME2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRVALIDATENAME2"); + struct WKSSVC_NETRVALIDATENAME2 *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRVALIDATENAME2]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct WKSSVC_NETRVALIDATENAME2); + 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_WKSSVC_NETRVALIDATENAME2(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(WKSSVC_NETRVALIDATENAME2, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRVALIDATENAME2, r); - r.out.result = _WKSSVC_NETRVALIDATENAME2(p, &r); + r->out.result = _WKSSVC_NETRVALIDATENAME2(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(WKSSVC_NETRVALIDATENAME2, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRVALIDATENAME2, 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_WKSSVC_NETRVALIDATENAME2(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_WKSSVC_NETRGETJOINABLEOUS2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRGETJOINABLEOUS2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRGETJOINABLEOUS2"); + struct WKSSVC_NETRGETJOINABLEOUS2 *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOINABLEOUS2]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct WKSSVC_NETRGETJOINABLEOUS2); + 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_WKSSVC_NETRGETJOINABLEOUS2(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(WKSSVC_NETRGETJOINABLEOUS2, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRGETJOINABLEOUS2, r); - r.out.result = _WKSSVC_NETRGETJOINABLEOUS2(p, &r); + r->out.result = _WKSSVC_NETRGETJOINABLEOUS2(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(WKSSVC_NETRGETJOINABLEOUS2, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRGETJOINABLEOUS2, 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_WKSSVC_NETRGETJOINABLEOUS2(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_wkssvc_NetrAddAlternateComputerName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetrAddAlternateComputerName r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetrAddAlternateComputerName"); + struct wkssvc_NetrAddAlternateComputerName *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct wkssvc_NetrAddAlternateComputerName); + 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_wkssvc_NetrAddAlternateComputerName(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(wkssvc_NetrAddAlternateComputerName, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetrAddAlternateComputerName, r); - r.out.result = _wkssvc_NetrAddAlternateComputerName(p, &r); + r->out.result = _wkssvc_NetrAddAlternateComputerName(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(wkssvc_NetrAddAlternateComputerName, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetrAddAlternateComputerName, 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_wkssvc_NetrAddAlternateComputerName(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_wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct wkssvc_NetrRemoveAlternateComputerName r; - TALLOC_CTX *mem_ctx = talloc_init("api_wkssvc_NetrRemoveAlternateComputerName"); + struct wkssvc_NetrRemoveAlternateComputerName *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct wkssvc_NetrRemoveAlternateComputerName); + 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_wkssvc_NetrRemoveAlternateComputerName(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(wkssvc_NetrRemoveAlternateComputerName, &r); + NDR_PRINT_IN_DEBUG(wkssvc_NetrRemoveAlternateComputerName, r); - r.out.result = _wkssvc_NetrRemoveAlternateComputerName(p, &r); + r->out.result = _wkssvc_NetrRemoveAlternateComputerName(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(wkssvc_NetrRemoveAlternateComputerName, &r); + NDR_PRINT_OUT_DEBUG(wkssvc_NetrRemoveAlternateComputerName, 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_wkssvc_NetrRemoveAlternateComputerName(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_WKSSVC_NETRSETPRIMARYCOMPUTERNAME(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRSETPRIMARYCOMPUTERNAME r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRSETPRIMARYCOMPUTERNAME"); + struct WKSSVC_NETRSETPRIMARYCOMPUTERNAME *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct WKSSVC_NETRSETPRIMARYCOMPUTERNAME); + 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_WKSSVC_NETRSETPRIMARYCOMPUTERNAME(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(WKSSVC_NETRSETPRIMARYCOMPUTERNAME, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRSETPRIMARYCOMPUTERNAME, r); - r.out.result = _WKSSVC_NETRSETPRIMARYCOMPUTERNAME(p, &r); + r->out.result = _WKSSVC_NETRSETPRIMARYCOMPUTERNAME(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(WKSSVC_NETRSETPRIMARYCOMPUTERNAME, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRSETPRIMARYCOMPUTERNAME, 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_WKSSVC_NETRSETPRIMARYCOMPUTERNAME(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_WKSSVC_NETRENUMERATECOMPUTERNAMES(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct WKSSVC_NETRENUMERATECOMPUTERNAMES r; - TALLOC_CTX *mem_ctx = talloc_init("api_WKSSVC_NETRENUMERATECOMPUTERNAMES"); + struct WKSSVC_NETRENUMERATECOMPUTERNAMES *r; + + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES]; + + r = talloc(NULL, struct WKSSVC_NETRENUMERATECOMPUTERNAMES); + 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_WKSSVC_NETRENUMERATECOMPUTERNAMES(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(WKSSVC_NETRENUMERATECOMPUTERNAMES, &r); + NDR_PRINT_IN_DEBUG(WKSSVC_NETRENUMERATECOMPUTERNAMES, r); - r.out.result = _WKSSVC_NETRENUMERATECOMPUTERNAMES(p, &r); + r->out.result = _WKSSVC_NETRENUMERATECOMPUTERNAMES(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(WKSSVC_NETRENUMERATECOMPUTERNAMES, &r); + NDR_PRINT_OUT_DEBUG(WKSSVC_NETRENUMERATECOMPUTERNAMES, 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_WKSSVC_NETRENUMERATECOMPUTERNAMES(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; } |