From 0b4da9d7e069a5e32d9706ee12cde7fe7625270d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 3 Feb 2004 14:56:07 +0000 Subject: - add 'print' to the DCERPC binding strings e.g. ncacn_np:myserver:[samr,sign,print] will now enable the packet debugging and the debugging is not bound anymore to the debuglevel >= 2 in the torture tests - also the dcesrv_remote module now supports debugging of the packets use the 'dcerpc_remote:binding' smb.conf parameter. metze (This used to be commit 40abf3c584efed7f977ddd688ea064540e5a5b13) --- source4/rpc_server/remote/dcesrv_remote.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'source4/rpc_server') diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c index 2ca7fe326f..710c2f514a 100644 --- a/source4/rpc_server/remote/dcesrv_remote.c +++ b/source4/rpc_server/remote/dcesrv_remote.c @@ -31,7 +31,6 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct NTSTATUS status; struct dcesrv_remote_private *private; const char *binding = lp_parm_string(-1, "dcerpc_remote", "binding"); - const char *print_debug = lp_parm_string(-1, "dcerpc_remote", "print_debug"); if (!binding) { printf("You must specify a ncacn binding string\n"); @@ -48,10 +47,6 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct lp_parm_string(-1, "dcerpc_remote", "username"), lp_parm_string(-1, "dcerpc_remote", "password")); - if (print_debug && strcasecmp("yes",print_debug) == 0) { - private->c_pipe->flags |= DCERPC_DEBUG_PRINT_BOTH; - } - dce_call->conn->private = private; return NT_STATUS_OK; @@ -71,15 +66,30 @@ static NTSTATUS remote_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CT struct dcesrv_remote_private *private = dce_call->conn->private; NTSTATUS status; uint16 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; + if (private->c_pipe->flags & DCERPC_DEBUG_PRINT_IN) { + ndr_print_function_debug(ndr_print_fn, name, NDR_IN | NDR_SET_VALUES, r); + } + status = dcerpc_ndr_request(private->c_pipe, opnum, mem_ctx, (ndr_push_flags_fn_t) ndr_push_fn, (ndr_pull_flags_fn_t) ndr_pull_fn, r, struct_size); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("dcesrv_remote: call[%s] failed with: %s!\n",name, nt_errstr(status))); + return status; + } + + 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); + } + return status; } -- cgit