summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-02-03 14:56:07 +0000
committerStefan Metzmacher <metze@samba.org>2004-02-03 14:56:07 +0000
commit0b4da9d7e069a5e32d9706ee12cde7fe7625270d (patch)
tree4ec8e4be06f9da201b324008db320e84f741efd6 /source4
parentf848aff0c28fcbacb4290e67b7c217b1aaa0fade (diff)
downloadsamba-0b4da9d7e069a5e32d9706ee12cde7fe7625270d.tar.gz
samba-0b4da9d7e069a5e32d9706ee12cde7fe7625270d.tar.bz2
samba-0b4da9d7e069a5e32d9706ee12cde7fe7625270d.zip
- 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)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/ndr/ndr.c4
-rw-r--r--source4/librpc/rpc/dcerpc_util.c1
-rw-r--r--source4/rpc_server/remote/dcesrv_remote.c20
-rw-r--r--source4/torture/rpc/atsvc.c2
-rw-r--r--source4/torture/rpc/dfs.c2
-rw-r--r--source4/torture/rpc/echo.c2
-rw-r--r--source4/torture/rpc/epmapper.c2
-rw-r--r--source4/torture/rpc/eventlog.c2
-rw-r--r--source4/torture/rpc/lsa.c2
-rw-r--r--source4/torture/rpc/netlogon.c2
-rw-r--r--source4/torture/rpc/samr.c2
-rw-r--r--source4/torture/rpc/spoolss.c2
-rw-r--r--source4/torture/rpc/srvsvc.c2
-rw-r--r--source4/torture/rpc/winreg.c2
-rw-r--r--source4/torture/rpc/wkssvc.c2
15 files changed, 16 insertions, 33 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 2af63c7676..b44bf11c15 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -347,10 +347,6 @@ void ndr_print_function_debug(void (*fn)(struct ndr_print *, const char *, int ,
{
struct ndr_print ndr;
- if (!DEBUGLVL(2)) {
- return;
- }
-
ndr.mem_ctx = talloc_init("ndr_print_function");
if (!ndr.mem_ctx) return;
ndr.print = ndr_print_debug_helper;
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 1ef776125f..96f0b959e7 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -276,6 +276,7 @@ static const struct {
{"sign", DCERPC_SIGN},
{"seal", DCERPC_SEAL},
{"validate", DCERPC_DEBUG_VALIDATE_BOTH},
+ {"print", DCERPC_DEBUG_PRINT_BOTH},
{"bigendian", DCERPC_PUSH_BIGENDIAN}
};
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;
}
diff --git a/source4/torture/rpc/atsvc.c b/source4/torture/rpc/atsvc.c
index 7d0ac42fa4..bd605d7c4f 100644
--- a/source4/torture/rpc/atsvc.c
+++ b/source4/torture/rpc/atsvc.c
@@ -148,8 +148,6 @@ BOOL torture_rpc_atsvc(int dummy)
if (!NT_STATUS_IS_OK(status)) {
return False;
}
-
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
if (!test_JobEnum(p, mem_ctx)) {
return False;
diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c
index 7b20e044bb..940a42a947 100644
--- a/source4/torture/rpc/dfs.c
+++ b/source4/torture/rpc/dfs.c
@@ -180,8 +180,6 @@ BOOL torture_rpc_dfs(int dummy)
return False;
}
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
-
if (!test_Exist(p, mem_ctx)) {
ret = False;
}
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index be70939de1..cdae51393d 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -242,8 +242,6 @@ BOOL torture_rpc_echo(int dummy)
}
#endif
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
-
if (!test_testcall(p, mem_ctx)) {
ret = False;
}
diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c
index 2b704659d6..24395e064c 100644
--- a/source4/torture/rpc/epmapper.c
+++ b/source4/torture/rpc/epmapper.c
@@ -242,8 +242,6 @@ BOOL torture_rpc_epmapper(int dummy)
if (!NT_STATUS_IS_OK(status)) {
return False;
}
-
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
if (!test_Lookup(p, mem_ctx)) {
ret = False;
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c
index 8ad1469919..1a3eb986ec 100644
--- a/source4/torture/rpc/eventlog.c
+++ b/source4/torture/rpc/eventlog.c
@@ -95,8 +95,6 @@ BOOL torture_rpc_eventlog(int dummy)
if (!NT_STATUS_IS_OK(status)) {
return False;
}
-
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
if (!test_OpenEventLog(p, mem_ctx)) {
return False;
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 84b29281e5..feb7a32140 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -533,8 +533,6 @@ BOOL torture_rpc_lsa(int dummy)
if (!NT_STATUS_IS_OK(status)) {
return False;
}
-
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
if (!test_OpenPolicy(p, mem_ctx)) {
ret = False;
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 682e28320d..12a8c8a023 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -793,8 +793,6 @@ BOOL torture_rpc_netlogon(int dummy)
if (!NT_STATUS_IS_OK(status)) {
return False;
}
-
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
if (!test_LogonUasLogon(p, mem_ctx)) {
ret = False;
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 2f72cfe7be..fccae8412c 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -1394,8 +1394,6 @@ BOOL torture_rpc_samr(int dummy)
if (!NT_STATUS_IS_OK(status)) {
return False;
}
-
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
if (!test_Connect(p, mem_ctx, &handle)) {
ret = False;
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 08c486f45a..e416c18f90 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -972,8 +972,6 @@ BOOL torture_rpc_spoolss(int dummy)
return False;
}
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
-
if (!test_EnumPrinters(p, mem_ctx)) {
ret = False;
}
diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c
index 42a53f8567..d7f9a7004b 100644
--- a/source4/torture/rpc/srvsvc.c
+++ b/source4/torture/rpc/srvsvc.c
@@ -258,8 +258,6 @@ BOOL torture_rpc_srvsvc(int dummy)
return False;
}
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
-
if (!test_NetConnEnum(p, mem_ctx)) {
ret = False;
}
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 2660fce426..e074296531 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -441,8 +441,6 @@ BOOL torture_rpc_winreg(int dummy)
if (!NT_STATUS_IS_OK(status)) {
return False;
}
-
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
for (i = 0; i < ARRAY_SIZE(open_fns); i++) {
if (!test_Open(p, mem_ctx, open_fns[i]))
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index 92d1063f3b..8362c02e3e 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -100,8 +100,6 @@ BOOL torture_rpc_wkssvc(int dummy)
return False;
}
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
-
if (!test_NetWkstaGetInfo(p, mem_ctx)) {
ret = False;
}