summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-02 00:26:04 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-02 00:26:04 +0100
commitdccf1b2c9f1b17f6ad12da11626110fcd86cd07e (patch)
tree5719ec2ff8af0e5d1d6b5a6dffa8b38cbe46c459
parentd9cbf2b0d9fdd1373ea0a0d021df3230637e21ac (diff)
downloadsamba-dccf1b2c9f1b17f6ad12da11626110fcd86cd07e.tar.gz
Remove another use of global_loadparm.
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm9
-rw-r--r--source4/librpc/rpc/dcerpc.c8
-rw-r--r--source4/librpc/rpc/dcerpc.h14
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c3
-rw-r--r--source4/librpc/rpc/dcerpc_secondary.c3
-rw-r--r--source4/librpc/rpc/dcerpc_util.c7
-rw-r--r--source4/rpc_server/remote/dcesrv_remote.c3
-rw-r--r--source4/torture/rpc/spoolss_notify.c6
8 files changed, 36 insertions, 17 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
index e30102b4e1f..484886bbfa5 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
@@ -120,7 +120,8 @@ static NTSTATUS $name\__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_C
/* unravel the NDR for the packet */
ndr_err = ndr_table_$name.calls[opnum].ndr_pull(pull, NDR_IN, *r);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- dcerpc_log_packet(&ndr_table_$name, opnum, NDR_IN,
+ dcerpc_log_packet(lp_lockdir(dce_call->conn->dce_ctx->lp_ctx),
+ &ndr_table_$name, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
dce_call->fault_code = DCERPC_FAULT_NDR;
return NT_STATUS_NET_WRITE_FAULT;
@@ -144,7 +145,8 @@ pidl "
}
if (dce_call->fault_code != 0) {
- dcerpc_log_packet(&ndr_table_$name, opnum, NDR_IN,
+ dcerpc_log_packet(lp_lockdir(dce_call->conn->dce_ctx->lp_ctx),
+ &ndr_table_$name, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
return NT_STATUS_NET_WRITE_FAULT;
}
@@ -167,7 +169,8 @@ pidl "
}
if (dce_call->fault_code != 0) {
- dcerpc_log_packet(&ndr_table_$name, opnum, NDR_IN,
+ dcerpc_log_packet(lp_lockdir(dce_call->conn->dce_ctx->lp_ctx),
+ &ndr_table_$name, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
return NT_STATUS_NET_WRITE_FAULT;
}
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index bd8e60d4bde..042745d74d6 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -1457,8 +1457,9 @@ _PUBLIC_ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req)
ndr_err = call->ndr_pull(pull, NDR_OUT, r);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
- dcerpc_log_packet(table, opnum, NDR_OUT,
- &response);
+ dcerpc_log_packet(p->conn->packet_log_dir,
+ table, opnum, NDR_OUT,
+ &response);
return status;
}
@@ -1467,7 +1468,8 @@ _PUBLIC_ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req)
call->ndr_push, call->ndr_pull,
call->ndr_print);
if (!NT_STATUS_IS_OK(status)) {
- dcerpc_log_packet(table, opnum, NDR_OUT,
+ dcerpc_log_packet(p->conn->packet_log_dir,
+ table, opnum, NDR_OUT,
&response);
return status;
}
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index cc8d3d14297..2f0a34d88d3 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -61,6 +61,9 @@ struct dcerpc_connection {
struct event_context *event_ctx;
struct smb_iconv_convenience *iconv_convenience;
+ /** Directory in which to save ndrdump-parseable files */
+ const char *packet_log_dir;
+
bool dead;
bool free_skipped;
@@ -109,10 +112,10 @@ struct dcerpc_pipe {
struct dcerpc_connection *conn;
struct dcerpc_binding *binding;
- /* the last fault code from a DCERPC fault */
+ /** the last fault code from a DCERPC fault */
uint32_t last_fault_code;
- /* timeout for individual rpc requests, in seconds */
+ /** timeout for individual rpc requests, in seconds */
uint32_t request_timeout;
};
@@ -345,9 +348,10 @@ NTSTATUS dcerpc_secondary_auth_connection_recv(struct composite_context *c,
struct composite_context* dcerpc_secondary_connection_send(struct dcerpc_pipe *p,
struct dcerpc_binding *b);
-void dcerpc_log_packet(const struct ndr_interface_table *ndr,
- uint32_t opnum, uint32_t flags,
- DATA_BLOB *pkt);
+void dcerpc_log_packet(const char *lockdir,
+ const struct ndr_interface_table *ndr,
+ uint32_t opnum, uint32_t flags,
+ DATA_BLOB *pkt);
NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower);
NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax);
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index 0ec17295cba..cdfbb31c4ad 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -744,6 +744,9 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent
s->pipe = dcerpc_pipe_init(c, ev, lp_iconv_convenience(lp_ctx));
if (composite_nomem(s->pipe, c)) return c;
+ if (DEBUGLEVEL >= 10)
+ s->pipe->conn->packet_log_dir = lp_lockdir(lp_ctx);
+
/* store parameters in state structure */
s->binding = binding;
s->table = table;
diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c
index b4d5d05b617..8ac235c67c2 100644
--- a/source4/librpc/rpc/dcerpc_secondary.c
+++ b/source4/librpc/rpc/dcerpc_secondary.c
@@ -75,6 +75,9 @@ _PUBLIC_ struct composite_context* dcerpc_secondary_connection_send(struct dcerp
s->pipe2 = dcerpc_pipe_init(c, s->pipe->conn->event_ctx, s->pipe->conn->iconv_convenience);
if (composite_nomem(s->pipe2, c)) return c;
+ if (DEBUGLEVEL >= 10)
+ s->pipe2->conn->packet_log_dir = s->pipe->conn->packet_log_dir;
+
/* open second dcerpc pipe using the same transport as for primary pipe */
switch (s->pipe->conn->transport.transport) {
case NCACN_NP:
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 32646e85b0e..ca6a785834b 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -671,19 +671,20 @@ _PUBLIC_ NTSTATUS dcerpc_fetch_session_key(struct dcerpc_pipe *p,
this triggers on a debug level of >= 10
*/
-_PUBLIC_ void dcerpc_log_packet(const struct ndr_interface_table *ndr,
+_PUBLIC_ void dcerpc_log_packet(const char *lockdir,
+ const struct ndr_interface_table *ndr,
uint32_t opnum, uint32_t flags,
DATA_BLOB *pkt)
{
const int num_examples = 20;
int i;
- if (DEBUGLEVEL < 10) return;
+ if (lockdir == NULL) return;
for (i=0;i<num_examples;i++) {
char *name=NULL;
asprintf(&name, "%s/rpclog/%s-%u.%d.%s",
- lp_lockdir(global_loadparm), ndr->name, opnum, i,
+ lockdir, ndr->name, opnum, i,
(flags&NDR_IN)?"in":"out");
if (name == NULL) {
return;
diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c
index 3cf8fbe8fb0..227405defbd 100644
--- a/source4/rpc_server/remote/dcesrv_remote.c
+++ b/source4/rpc_server/remote/dcesrv_remote.c
@@ -144,7 +144,8 @@ static NTSTATUS remote_op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CT
/* unravel the NDR for the packet */
ndr_err = table->calls[opnum].ndr_pull(pull, NDR_IN, *r);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- dcerpc_log_packet(table, opnum, NDR_IN,
+ dcerpc_log_packet(lp_lockdir(dce_call->conn->dce_ctx->lp_ctx),
+ table, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
dce_call->fault_code = DCERPC_FAULT_NDR;
return NT_STATUS_NET_WRITE_FAULT;
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index dc2a82414be..71fdffa216a 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -60,7 +60,8 @@ static NTSTATUS spoolss__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_
/* unravel the NDR for the packet */
ndr_err = ndr_table_spoolss.calls[opnum].ndr_pull(pull, NDR_IN, *r);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- dcerpc_log_packet(&ndr_table_spoolss, opnum, NDR_IN,
+ dcerpc_log_packet(lp_lockdir(dce_call->conn->dce_ctx->lp_ctx),
+ &ndr_table_spoolss, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
dce_call->fault_code = DCERPC_FAULT_NDR;
return NT_STATUS_NET_WRITE_FAULT;
@@ -102,7 +103,8 @@ static NTSTATUS spoolss__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_
}
if (dce_call->fault_code != 0) {
- dcerpc_log_packet(&ndr_table_spoolss, opnum, NDR_IN,
+ dcerpc_log_packet(lp_lockdir(dce_call->conn->dce_ctx->lp_ctx),
+ &ndr_table_spoolss, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
return NT_STATUS_NET_WRITE_FAULT;
}