summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpc_client/cli_pipe.c196
1 files changed, 0 insertions, 196 deletions
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index c924436faa..3a5932297f 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -521,35 +521,6 @@ static NTSTATUS get_complete_frag_recv(struct async_req *req)
return async_req_simple_recv(req);
}
-static NTSTATUS get_complete_pdu(struct rpc_pipe_client *cli,
- struct rpc_hdr_info *prhdr,
- prs_struct *pdu)
-{
- TALLOC_CTX *frame = talloc_stackframe();
- struct event_context *ev;
- struct async_req *req;
- NTSTATUS status = NT_STATUS_NO_MEMORY;
-
- ev = event_context_init(frame);
- if (ev == NULL) {
- goto fail;
- }
-
- req = get_complete_frag_send(frame, ev, cli, prhdr, pdu);
- if (req == NULL) {
- goto fail;
- }
-
- while (req->state < ASYNC_REQ_DONE) {
- event_loop_once(ev);
- }
-
- status = get_complete_frag_recv(req);
- fail:
- TALLOC_FREE(frame);
- return status;
-}
-
/****************************************************************************
NTLMSSP specific sign/seal.
Virtually identical to rpc_server/srv_pipe.c:api_pipe_ntlmssp_auth_process.
@@ -1209,36 +1180,6 @@ static NTSTATUS cli_api_pipe_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
-static NTSTATUS cli_api_pipe(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli,
- uint8_t *data, uint32_t data_len,
- uint32_t max_rdata_len,
- uint8_t **prdata, uint32_t *prdata_len)
-{
- TALLOC_CTX *frame = talloc_stackframe();
- struct event_context *ev;
- struct async_req *req;
- NTSTATUS status = NT_STATUS_NO_MEMORY;
-
- ev = event_context_init(frame);
- if (ev == NULL) {
- goto fail;
- }
-
- req = cli_api_pipe_send(frame, ev, cli, data, data_len, max_rdata_len);
- if (req == NULL) {
- goto fail;
- }
-
- while (req->state < ASYNC_REQ_DONE) {
- event_loop_once(ev);
- }
-
- status = cli_api_pipe_recv(req, mem_ctx, prdata, prdata_len);
- fail:
- TALLOC_FREE(frame);
- return status;
-}
-
/****************************************************************************
Send data on an rpc pipe via trans. The prs_struct data must be the last
pdu fragment of an NDR data stream.
@@ -1265,143 +1206,6 @@ static NTSTATUS cli_api_pipe(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli,
****************************************************************************/
-#if 0
-
-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)
-{
- NTSTATUS ret;
- uint32 data_len = prs_offset(data);
- uint8_t *rdata = NULL;
- uint8_t *rdata_copy;
- uint32_t rdata_len = 0;
- uint32 current_rbuf_offset = 0;
- prs_struct current_pdu;
-
- if (data_len > cli->max_xmit_frag) {
- /* Ensure we're not sending too much. */
- return NT_STATUS_INVALID_PARAMETER;
- }
-
- /* Set up the current pdu parse struct. */
- prs_init_empty(&current_pdu, talloc_tos(), UNMARSHALL);
-
- DEBUG(5,("rpc_api_pipe: %s\n", rpccli_pipe_txt(debug_ctx(), cli)));
-
- ret = cli_api_pipe(talloc_tos(), cli,
- (uint8_t *)prs_data_p(data), prs_offset(data),
- cli->max_recv_frag, &rdata, &rdata_len);
- if (!NT_STATUS_IS_OK(ret)) {
- DEBUG(5, ("cli_api_pipe failed: %s\n", nt_errstr(ret)));
- return ret;
- }
-
- if (rdata == NULL) {
- DEBUG(3,("rpc_api_pipe: %s failed to return data.\n",
- rpccli_pipe_txt(debug_ctx(), cli)));
- /* Yes - some calls can truely return no data... */
- prs_mem_free(&current_pdu);
- return NT_STATUS_OK;
- }
-
- /*
- * Give this memory as dynamic to the current pdu. Duplicating it
- * sucks, but prs_struct doesn't know about talloc :-(
- */
- rdata_copy = (uint8_t *)memdup(rdata, rdata_len);
- TALLOC_FREE(rdata);
- if (rdata_copy == NULL) {
- prs_mem_free(&current_pdu);
- return NT_STATUS_NO_MEMORY;
- }
- prs_give_memory(&current_pdu, (char *)rdata_copy, rdata_len, true);
-
- /* Initialize the incoming PDU */
- prs_init_empty(rbuf, mem_ctx, UNMARSHALL);
-
- /* Make rbuf dynamic with no memory. */
- prs_give_memory(rbuf, 0, 0, True);
-
- while(1) {
- RPC_HDR rhdr;
- char *ret_data = NULL;
- uint32 ret_data_len = 0;
-
- /* Ensure we have enough data for a pdu. */
- ret = get_complete_pdu(cli, &rhdr, &current_pdu);
- if (!NT_STATUS_IS_OK(ret)) {
- goto err;
- }
-
- /* We pass in rbuf here so if the alloc hint is set correctly
- we can set the output size and avoid reallocs. */
-
- ret = cli_pipe_validate_current_pdu(cli, &rhdr, &current_pdu, expected_pkt_type,
- &ret_data, &ret_data_len, rbuf);
-
- DEBUG(10,("rpc_api_pipe: got PDU len of %u at offset %u\n",
- prs_data_size(&current_pdu), current_rbuf_offset ));
-
- if (!NT_STATUS_IS_OK(ret)) {
- goto err;
- }
-
- 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 "
- "PDU data format is big-endian.\n",
- rpccli_pipe_txt(debug_ctx(), cli)));
-
- prs_set_endian_data(rbuf, RPC_BIG_ENDIAN);
- } else {
- /* Check endianness on subsequent packets. */
- if (current_pdu.bigendian_data != rbuf->bigendian_data) {
- DEBUG(0,("rpc_api_pipe: Error : Endianness changed from %s to %s\n",
- rbuf->bigendian_data ? "big" : "little",
- current_pdu.bigendian_data ? "big" : "little" ));
- ret = NT_STATUS_INVALID_PARAMETER;
- goto err;
- }
- }
- }
-
- /* Now copy the data portion out of the pdu into rbuf. */
- if (!prs_force_grow(rbuf, ret_data_len)) {
- ret = NT_STATUS_NO_MEMORY;
- goto err;
- }
- memcpy(prs_data_p(rbuf)+current_rbuf_offset, ret_data, (size_t)ret_data_len);
- current_rbuf_offset += ret_data_len;
-
- /* See if we've finished with all the data in current_pdu yet ? */
- ret = cli_pipe_reset_current_pdu(cli, &rhdr, &current_pdu);
- if (!NT_STATUS_IS_OK(ret)) {
- goto err;
- }
-
- if (rhdr.flags & RPC_FLG_LAST) {
- break; /* We're done. */
- }
- }
-
- DEBUG(10,("rpc_api_pipe: %s returned %u bytes.\n",
- rpccli_pipe_txt(debug_ctx(), cli),
- (unsigned int)prs_data_size(rbuf) ));
-
- prs_mem_free(&current_pdu);
- return NT_STATUS_OK;
-
- err:
-
- prs_mem_free(&current_pdu);
- prs_mem_free(rbuf);
- return ret;
-}
-#endif
-
struct rpc_api_pipe_state {
struct event_context *ev;
struct rpc_pipe_client *cli;