From 0a0ef2dd451a5715739e86414a47752dc8c86143 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 25 Apr 2008 16:30:55 +0200 Subject: [PATCH] Revert "Introduce rpccli_pipe_txt(), describing a pipe for debug messages" This reverts commit 83892d51de0dcdaeae18bc34d03eefefc95ff601. --- source/rpc_client/cli_pipe.c | 155 +++++++++++++++++++++-------------- 1 file changed, 93 insertions(+), 62 deletions(-) diff --git a/source/rpc_client/cli_pipe.c b/source/rpc_client/cli_pipe.c index 642784c7659..748a000b479 100644 --- a/source/rpc_client/cli_pipe.c +++ b/source/rpc_client/cli_pipe.c @@ -57,19 +57,6 @@ static int map_pipe_auth_type_to_rpc_auth_type(enum pipe_auth_type auth_type) return -1; } -/******************************************************************** - Pipe description for a DEBUG - ********************************************************************/ -static char *rpccli_pipe_txt(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli) -{ - char *result; - result = talloc_asprintf(mem_ctx, "host %s, pipe %s, fnum 0x%x", - cli->desthost, cli->pipe_name, - (unsigned int)(cli->fnum)); - SMB_ASSERT(result != NULL); - return result; -} - /******************************************************************** Rpc pipe call id. ********************************************************************/ @@ -136,7 +123,7 @@ static NTSTATUS rpc_read(struct rpc_pipe_client *cli, DEBUG(0,("rpc_read: DOS Error %d/%u (%s) in cli_read on pipe %s\n", eclass, (unsigned int)ecode, cli_errstr(cli->cli), - rpccli_pipe_txt(debug_ctx(), cli))); + cli->pipe_name )); return dos_to_ntstatus(eclass, ecode); } } @@ -148,14 +135,14 @@ static NTSTATUS rpc_read(struct rpc_pipe_client *cli, if (!NT_STATUS_EQUAL(cli_nt_error(cli->cli), NT_STATUS_BUFFER_TOO_SMALL)) { DEBUG(0,("rpc_read: Error (%s) in cli_read on pipe %s\n", nt_errstr(cli_nt_error(cli->cli)), - rpccli_pipe_txt(debug_ctx(), cli))); + cli->pipe_name )); return cli_nt_error(cli->cli); } } if (num_read == -1) { DEBUG(0,("rpc_read: Error - cli_read on pipe %s returned -1\n", - rpccli_pipe_txt(debug_ctx(), cli))); + cli->pipe_name )); return cli_get_nt_error(cli->cli); } @@ -291,8 +278,11 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr &auth_blob); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("cli_pipe_verify_ntlmssp: failed to unseal " - "packet from %s. Error was %s.\n", - rpccli_pipe_txt(debug_ctx(), cli), + "packet from remote machine %s on pipe %s " + "fnum 0x%x. Error was %s.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum, nt_errstr(status) )); return status; } @@ -306,8 +296,11 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr &auth_blob); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("cli_pipe_verify_ntlmssp: check signing failed on " - "packet from %s. Error was %s.\n", - rpccli_pipe_txt(debug_ctx(), cli), + "packet from remote machine %s on pipe %s " + "fnum 0x%x. Error was %s.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum, nt_errstr(status) )); return status; } @@ -408,8 +401,11 @@ static NTSTATUS cli_pipe_verify_schannel(struct rpc_pipe_client *cli, RPC_HDR *p prs_data_p(current_pdu)+RPC_HEADER_LEN+RPC_HDR_RESP_LEN, data_len)) { DEBUG(3,("cli_pipe_verify_schannel: failed to decode PDU " - "Connection to %s.\n", - rpccli_pipe_txt(debug_ctx(), cli))); + "Connection to remote machine %s " + "pipe %s fnum 0x%x.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum )); return NT_STATUS_INVALID_PARAMETER; } @@ -466,10 +462,11 @@ static NTSTATUS cli_pipe_validate_rpc_response(struct rpc_pipe_client *cli, RPC_ switch(cli->auth->auth_type) { case PIPE_AUTH_TYPE_NONE: if (prhdr->auth_len) { - DEBUG(3, ("cli_pipe_validate_rpc_response: " - "Connection to %s - got non-zero " - "auth len %u.\n", - rpccli_pipe_txt(debug_ctx(), cli), + DEBUG(3, ("cli_pipe_validate_rpc_response: Connection to remote machine %s " + "pipe %s fnum 0x%x - got non-zero auth len %u.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum, (unsigned int)prhdr->auth_len )); return NT_STATUS_INVALID_PARAMETER; } @@ -494,8 +491,10 @@ static NTSTATUS cli_pipe_validate_rpc_response(struct rpc_pipe_client *cli, RPC_ case PIPE_AUTH_TYPE_SPNEGO_KRB5: default: DEBUG(3, ("cli_pipe_validate_rpc_response: Connection " - "to %s - unknown internal auth type %u.\n", - rpccli_pipe_txt(debug_ctx(), cli), + "to remote machine %s pipe %s fnum %x - " + "unknown internal auth type %u.\n", + cli->desthost, cli->pipe_name, + (unsigned int)cli->fnum, cli->auth->auth_type )); return NT_STATUS_INVALID_INFO_CLASS; } @@ -597,9 +596,11 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H } case RPC_BINDNACK: - DEBUG(1, ("cli_pipe_validate_current_pdu: Bind NACK " - "received from %s!\n", - rpccli_pipe_txt(debug_ctx(), cli))); + DEBUG(1, ("cli_pipe_validate_current_pdu: Bind NACK received from remote machine %s " + "pipe %s fnum 0x%x!\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum)); /* Use this for now... */ return NT_STATUS_NETWORK_ACCESS_DENIED; @@ -618,10 +619,12 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H return NT_STATUS_BUFFER_TOO_SMALL; } - DEBUG(1, ("cli_pipe_validate_current_pdu: RPC fault " - "code %s received from %s!\n", + DEBUG(1, ("cli_pipe_validate_current_pdu: RPC fault code %s received from remote machine %s " + "pipe %s fnum 0x%x!\n", dcerpc_errstr(NT_STATUS_V(fault_resp.status)), - rpccli_pipe_txt(debug_ctx(), cli))); + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum)); if (NT_STATUS_IS_OK(fault_resp.status)) { return NT_STATUS_UNSUCCESSFUL; } else { @@ -631,16 +634,21 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H default: DEBUG(0, ("cli_pipe_validate_current_pdu: unknown packet type %u received " - "from %s!\n", + "from remote machine %s pipe %s fnum 0x%x!\n", (unsigned int)prhdr->pkt_type, - rpccli_pipe_txt(debug_ctx(), cli))); + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum)); return NT_STATUS_INVALID_INFO_CLASS; } if (prhdr->pkt_type != expected_pkt_type) { - DEBUG(3, ("cli_pipe_validate_current_pdu: Connection to %s " - "got an unexpected RPC packet type - %u, not %u\n", - rpccli_pipe_txt(debug_ctx(), cli), + DEBUG(3, ("cli_pipe_validate_current_pdu: Connection to remote machine %s " + "pipe %s fnum %x got an unexpected RPC packet " + "type - %u, not %u\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum, prhdr->pkt_type, expected_pkt_type)); return NT_STATUS_INVALID_INFO_CLASS; @@ -757,7 +765,10 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli, setup[0] = TRANSACT_DCERPCCMD; setup[1] = cli->fnum; /* Pipe file handle. */ - DEBUG(5,("rpc_api_pipe: %s\n", rpccli_pipe_txt(debug_ctx(), cli))); + DEBUG(5,("rpc_api_pipe: Remote machine %s pipe %s fnum 0x%x\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum )); /* * Send the last (or only) fragment of an RPC request. For small @@ -772,9 +783,12 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli, &rparam, &rparam_len, /* return params, len */ &prdata, &rdata_len)) /* return data, len */ { - DEBUG(0, ("rpc_api_pipe: %s returned critical error. Error " - "was %s\n", rpccli_pipe_txt(debug_ctx(), cli), - cli_errstr(cli->cli))); + DEBUG(0, ("rpc_api_pipe: Remote machine %s pipe %s fnum 0x%x " + "returned critical error. Error was %s\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum, + cli_errstr(cli->cli))); ret = cli_get_nt_error(cli->cli); SAFE_FREE(rparam); SAFE_FREE(prdata); @@ -786,8 +800,11 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli, SAFE_FREE(rparam); if (prdata == NULL) { - DEBUG(3,("rpc_api_pipe: %s failed to return data.\n", - rpccli_pipe_txt(debug_ctx(), cli))); + DEBUG(3,("rpc_api_pipe: Remote machine %s pipe %s " + "fnum 0x%x failed to return data.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum)); /* Yes - some calls can truely return no data... */ prs_mem_free(¤t_pdu); return NT_STATUS_OK; @@ -833,9 +850,11 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli, if ((rhdr.flags & RPC_FLG_FIRST)) { if (rhdr.pack_type[0] == 0) { /* Set the data type correctly for big-endian data on the first packet. */ - DEBUG(10,("rpc_api_pipe: On %s " + DEBUG(10,("rpc_api_pipe: On machine %s pipe %s fnum 0x%x " "PDU data format is big-endian.\n", - rpccli_pipe_txt(debug_ctx(), cli))); + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum)); prs_set_endian_data(rbuf, RPC_BIG_ENDIAN); } else { @@ -869,8 +888,10 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli, } } - DEBUG(10,("rpc_api_pipe: %s returned %u bytes.\n", - rpccli_pipe_txt(debug_ctx(), cli), + DEBUG(10,("rpc_api_pipe: Remote machine %s pipe %s fnum 0x%x returned %u bytes.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum, (unsigned int)prs_data_size(rbuf) )); prs_mem_free(¤t_pdu); @@ -1781,8 +1802,11 @@ static NTSTATUS rpc_finish_auth3_bind(struct rpc_pipe_client *cli, return cli_get_nt_error(cli->cli); } - DEBUG(5,("rpc_send_auth_auth3: %s sent auth3 response ok.\n", - rpccli_pipe_txt(debug_ctx(), cli))); + DEBUG(5,("rpc_send_auth_auth3: Remote machine %s pipe %s " + "fnum 0x%x sent auth3 response ok.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum)); prs_mem_free(&rpc_out); data_blob_free(&client_reply); @@ -1957,7 +1981,10 @@ static NTSTATUS rpc_finish_spnego_ntlmssp_bind(struct rpc_pipe_client *cli, data_blob_free(&tmp_blob); DEBUG(5,("rpc_finish_spnego_ntlmssp_bind: alter context request to " - "%s.\n", rpccli_pipe_txt(debug_ctx(), cli))); + "remote machine %s pipe %s fnum 0x%x.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum)); return NT_STATUS_OK; } @@ -1976,8 +2003,9 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, uint32 rpc_call_id; NTSTATUS status; - DEBUG(5,("Bind RPC Pipe: %s auth_type %u, auth_level %u\n", - rpccli_pipe_txt(debug_ctx(), cli), + DEBUG(5,("Bind RPC Pipe[%x]: %s auth_type %u, auth_level %u\n", + (unsigned int)cli->fnum, + cli->pipe_name, (unsigned int)auth->auth_type, (unsigned int)auth->auth_level )); @@ -2011,8 +2039,11 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, prs_mem_free(&rpc_out); - DEBUG(3,("rpc_pipe_bind: %s bind request returned ok.\n", - rpccli_pipe_txt(debug_ctx(), cli))); + DEBUG(3,("rpc_pipe_bind: Remote machine %s pipe %s " + "fnum 0x%x bind request returned ok.\n", + cli->desthost, + cli->pipe_name, + (unsigned int)cli->fnum)); /* Unmarshall the RPC header */ if(!smb_io_rpc_hdr("hdr" , &hdr, &rbuf, 0)) { @@ -2135,14 +2166,14 @@ static int rpc_pipe_destructor(struct rpc_pipe_client *p) ret = cli_close(p->cli, p->fnum); if (!ret) { - DEBUG(1, ("rpc_pipe_destructor: cli_close failed on pipe %s. " - "Error was %s\n", - rpccli_pipe_txt(debug_ctx(), p), - cli_errstr(p->cli))); + DEBUG(1, ("rpc_pipe_destructor: cli_close failed on pipe %s, " + "fnum 0x%x to machine %s. Error was %s\n", + p->pipe_name, (int) p->fnum, + p->desthost, cli_errstr(p->cli))); } - DEBUG(10, ("rpc_pipe_destructor: closed %s\n", - rpccli_pipe_txt(debug_ctx(), p))); + DEBUG(10, ("rpc_pipe_destructor: closed pipe %s to machine %s\n", + p->pipe_name, p->desthost )); DLIST_REMOVE(p->cli->pipe_list, p); -- 2.47.3