diff options
author | Volker Lendecke <vl@samba.org> | 2009-01-17 12:18:29 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-01-18 15:40:44 +0100 |
commit | 5e6f3eaae9435b1ab7b36726e7b898d4994fcebf (patch) | |
tree | 2bb36b1d262f8e834196d4ccd4d7eb6ea54c1a36 | |
parent | 5987c8269779ca2a7207c37a94b0e841a380d7d1 (diff) | |
download | samba-5e6f3eaae9435b1ab7b36726e7b898d4994fcebf.tar.gz samba-5e6f3eaae9435b1ab7b36726e7b898d4994fcebf.tar.bz2 samba-5e6f3eaae9435b1ab7b36726e7b898d4994fcebf.zip |
Move initialization of the reply prs_struct to rpc_api_pipe
-rw-r--r-- | source3/include/proto.h | 2 | ||||
-rw-r--r-- | source3/include/rpc_client.h | 3 | ||||
-rw-r--r-- | source3/librpc/rpc/dcerpc.c | 3 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 23 | ||||
-rw-r--r-- | source3/rpc_client/ndr.c | 4 |
5 files changed, 15 insertions, 20 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index d644b09a6a..9210a5cfe2 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5197,7 +5197,7 @@ NTSTATUS rpccli_netlogon_set_trust_password(struct rpc_pipe_client *cli, /* The following definitions come from rpc_client/cli_pipe.c */ -NTSTATUS rpc_api_pipe_req(struct rpc_pipe_client *cli, +NTSTATUS rpc_api_pipe_req(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, uint8 op_num, prs_struct *in_data, prs_struct *out_data); diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index 684044b871..61b861c3b4 100644 --- a/source3/include/rpc_client.h +++ b/source3/include/rpc_client.h @@ -49,9 +49,8 @@ if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \ return WERR_NOMEM;\ }\ - prs_init_empty( &r_ps, ctx, UNMARSHALL );\ if ( q_io_fn("", &q_in, &q_ps, 0) ) {\ - NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \ + NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(ctx, pcli, opnum, &q_ps, &r_ps); \ if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\ prs_mem_free( &q_ps );\ prs_mem_free( &r_ps );\ diff --git a/source3/librpc/rpc/dcerpc.c b/source3/librpc/rpc/dcerpc.c index 69bfc6f329..21a2004422 100644 --- a/source3/librpc/rpc/dcerpc.c +++ b/source3/librpc/rpc/dcerpc.c @@ -84,7 +84,8 @@ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req) prs_init_empty( &r_ps, req, UNMARSHALL ); - status = rpc_api_pipe_req(req->pipe->rpc_cli, req->opnum, &req->q_ps, &r_ps); + status = rpc_api_pipe_req(req, req->pipe->rpc_cli, req->opnum, + &req->q_ps, &r_ps); prs_mem_free( &req->q_ps ); diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index d6f18846b1..b93f6ed844 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -1265,7 +1265,7 @@ static NTSTATUS cli_api_pipe(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, ****************************************************************************/ -static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli, +static NTSTATUS rpc_api_pipe(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, prs_struct *data, /* Outgoing pdu fragment, already formatted for send. */ prs_struct *rbuf, /* Incoming reply - return as an NDR stream. */ uint8 expected_pkt_type) @@ -1284,7 +1284,7 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli, } /* Set up the current pdu parse struct. */ - prs_init_empty(¤t_pdu, prs_get_mem_context(rbuf), UNMARSHALL); + prs_init_empty(¤t_pdu, talloc_tos(), UNMARSHALL); DEBUG(5,("rpc_api_pipe: %s\n", rpccli_pipe_txt(debug_ctx(), cli))); @@ -1316,9 +1316,8 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli, } prs_give_memory(¤t_pdu, (char *)rdata_copy, rdata_len, true); - /* Ensure we can mess with the return prs_struct. */ - SMB_ASSERT(UNMARSHALLING(rbuf)); - SMB_ASSERT(prs_data_size(rbuf) == 0); + /* Initialize the incoming PDU */ + prs_init_empty(rbuf, mem_ctx, UNMARSHALL); /* Make rbuf dynamic with no memory. */ prs_give_memory(rbuf, 0, 0, True); @@ -1952,7 +1951,7 @@ static uint32 calculate_data_len_tosend(struct rpc_pipe_client *cli, and deals with signing/sealing details. ********************************************************************/ -NTSTATUS rpc_api_pipe_req(struct rpc_pipe_client *cli, +NTSTATUS rpc_api_pipe_req(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli, uint8 op_num, prs_struct *in_data, prs_struct *out_data) @@ -2055,7 +2054,8 @@ NTSTATUS rpc_api_pipe_req(struct rpc_pipe_client *cli, /* Actually send the packet. */ if (flags & RPC_FLG_LAST) { /* Last packet - send the data, get the reply and return. */ - ret = rpc_api_pipe(cli, &outgoing_pdu, out_data, RPC_RESPONSE); + ret = rpc_api_pipe(mem_ctx, cli, &outgoing_pdu, + out_data, RPC_RESPONSE); prs_mem_free(&outgoing_pdu); if ((DEBUGLEVEL >= 50) @@ -2481,9 +2481,9 @@ static NTSTATUS rpc_finish_spnego_ntlmssp_bind(struct rpc_pipe_client *cli, /* Initialize the returning data struct. */ prs_mem_free(rbuf); - prs_init_empty(rbuf, talloc_tos(), UNMARSHALL); - nt_status = rpc_api_pipe(cli, &rpc_out, rbuf, RPC_ALTCONTRESP); + nt_status = rpc_api_pipe(talloc_tos(), cli, &rpc_out, rbuf, + RPC_ALTCONTRESP); prs_mem_free(&rpc_out); if (!NT_STATUS_IS_OK(nt_status)) { return nt_status; @@ -2559,11 +2559,8 @@ NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, return status; } - /* Initialize the incoming data struct. */ - prs_init_empty(&rbuf, talloc_tos(), UNMARSHALL); - /* send data on \PIPE\. receive a response */ - status = rpc_api_pipe(cli, &rpc_out, &rbuf, RPC_BINDACK); + status = rpc_api_pipe(talloc_tos(), cli, &rpc_out, &rbuf, RPC_BINDACK); prs_mem_free(&rpc_out); if (!NT_STATUS_IS_OK(status)) { return status; diff --git a/source3/rpc_client/ndr.c b/source3/rpc_client/ndr.c index 9ada47a3f5..9c3205eca3 100644 --- a/source3/rpc_client/ndr.c +++ b/source3/rpc_client/ndr.c @@ -59,9 +59,7 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli, talloc_free(push); - prs_init_empty( &r_ps, mem_ctx, UNMARSHALL ); - - status = rpc_api_pipe_req(cli, opnum, &q_ps, &r_ps); + status = rpc_api_pipe_req(mem_ctx, cli, opnum, &q_ps, &r_ps); prs_mem_free( &q_ps ); |