summaryrefslogtreecommitdiff
path: root/source4/rpc_server/remote
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-12-07 09:26:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:25 -0500
commit9b50dba87e7c668aac4aa7ba7b72ed20a50a95bc (patch)
treedb2f7dfda733acd364cd4c83934d06dbd1c16c63 /source4/rpc_server/remote
parentcdeadf87ac767b8b60f08f62dc8c5efb4f4b609b (diff)
downloadsamba-9b50dba87e7c668aac4aa7ba7b72ed20a50a95bc.tar.gz
samba-9b50dba87e7c668aac4aa7ba7b72ed20a50a95bc.tar.bz2
samba-9b50dba87e7c668aac4aa7ba7b72ed20a50a95bc.zip
r4086: - make dcerpc_ndr_request_table_send() the default and rename it to just
dcerpc_ndr_request_send() - this allows us to call dcerpc_log_packet() when we receive a packet we can't parse correctly metze (This used to be commit a7a6cea112a180a28188997ca99f30d8dd286bb8)
Diffstat (limited to 'source4/rpc_server/remote')
-rw-r--r--source4/rpc_server/remote/dcesrv_remote.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c
index 1ea6c1e4ea..ab09920b99 100644
--- a/source4/rpc_server/remote/dcesrv_remote.c
+++ b/source4/rpc_server/remote/dcesrv_remote.c
@@ -65,33 +65,37 @@ static void remote_op_unbind(struct dcesrv_connection *dce_conn, const struct dc
static NTSTATUS remote_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
{
struct dcesrv_remote_private *private = dce_call->conn->private;
- NTSTATUS status;
uint16_t opnum = dce_call->pkt.u.request.opnum;
- const char *name = dce_call->conn->iface->ndr->calls[opnum].name;
- ndr_push_flags_fn_t ndr_push_fn = dce_call->conn->iface->ndr->calls[opnum].ndr_push;
- ndr_pull_flags_fn_t ndr_pull_fn = dce_call->conn->iface->ndr->calls[opnum].ndr_pull;
- ndr_print_function_t ndr_print_fn = dce_call->conn->iface->ndr->calls[opnum].ndr_print;
- size_t struct_size = dce_call->conn->iface->ndr->calls[opnum].struct_size;
+ const struct dcerpc_interface_call *call;
+ const char *name;
+
+ if (opnum >= dce_call->conn->iface->ndr->num_calls) {
+ dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
+ return NT_STATUS_NET_WRITE_FAULT;
+ }
+
+ name = dce_call->conn->iface->ndr->calls[opnum].name;
+ call = &dce_call->conn->iface->ndr->calls[opnum];
if (private->c_pipe->flags & DCERPC_DEBUG_PRINT_IN) {
- ndr_print_function_debug(ndr_print_fn, name, NDR_IN | NDR_SET_VALUES, r);
+ ndr_print_function_debug(call->ndr_print, name, NDR_IN | NDR_SET_VALUES, r);
}
- status = dcerpc_ndr_request(private->c_pipe, NULL, opnum, mem_ctx,
- (ndr_push_flags_fn_t) ndr_push_fn,
- (ndr_pull_flags_fn_t) ndr_pull_fn,
- r, struct_size);
+ /* we didn't use the return code of this function as we only check the last_fault_code */
+ dcerpc_ndr_request(private->c_pipe, NULL, dce_call->conn->iface->ndr,
+ opnum, mem_ctx,r);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("dcesrv_remote: call[%s] failed with: %s!\n",name, nt_errstr(status)));
- return status;
+ dce_call->fault_code = private->c_pipe->last_fault_code;
+ if (dce_call->fault_code != 0) {
+ DEBUG(0,("dcesrv_remote: call[%s] failed with: %s!\n",name, dcerpc_errstr(mem_ctx, dce_call->fault_code)));
+ return NT_STATUS_NET_WRITE_FAULT;
}
- if (NT_STATUS_IS_OK(status) && (private->c_pipe->flags & DCERPC_DEBUG_PRINT_OUT)) {
- ndr_print_function_debug(ndr_print_fn, name, NDR_OUT, r);
+ if ((dce_call->fault_code == 0) && (private->c_pipe->flags & DCERPC_DEBUG_PRINT_OUT)) {
+ ndr_print_function_debug(call->ndr_print, name, NDR_OUT, r);
}
- return status;
+ return NT_STATUS_OK;
}
static NTSTATUS remote_register_one_iface(struct dcesrv_context *dce_ctx, const struct dcesrv_interface *iface)