1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

Remove another use of global_loadparm.

This commit is contained in:
Jelmer Vernooij 2008-11-02 00:26:04 +01:00
parent d9cbf2b0d9
commit dccf1b2c9f
8 changed files with 36 additions and 17 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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;
}