s3-dcerpc: Use DATA_BLOB instead of prs_struct for req_data
authorSimo Sorce <idra@samba.org>
Thu, 15 Jul 2010 12:48:51 +0000 (08:48 -0400)
committerGünther Deschner <gd@samba.org>
Thu, 15 Jul 2010 23:51:18 +0000 (01:51 +0200)
Signed-off-by: Günther Deschner <gd@samba.org>
source3/include/proto.h
source3/rpc_client/cli_pipe.c
source3/rpc_client/ndr.c

index a7d8782497ac3859d183bd35dc1dc483a7c4efa2..cb01c38a308a0818f41fc68f11079951f7d5f1c2 100644 (file)
@@ -4849,7 +4849,7 @@ struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
                                         struct event_context *ev,
                                         struct rpc_pipe_client *cli,
                                         uint8_t op_num,
-                                        prs_struct *req_data);
+                                        DATA_BLOB *req_data);
 NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                               DATA_BLOB *reply_pdu);
 struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
index 73aa3dc7a350cf1588442f52a3844f5ca1ae1f9b..bda152c505dca8db5cceb97a257c2fccfcccf2c5 100644 (file)
@@ -2033,7 +2033,7 @@ struct rpc_api_pipe_req_state {
        struct rpc_pipe_client *cli;
        uint8_t op_num;
        uint32_t call_id;
-       prs_struct *req_data;
+       DATA_BLOB *req_data;
        uint32_t req_data_sent;
        DATA_BLOB rpc_out;
        DATA_BLOB reply_pdu;
@@ -2048,7 +2048,7 @@ struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
                                         struct event_context *ev,
                                         struct rpc_pipe_client *cli,
                                         uint8_t op_num,
-                                        prs_struct *req_data)
+                                        DATA_BLOB *req_data)
 {
        struct tevent_req *req, *subreq;
        struct rpc_api_pipe_req_state *state;
@@ -2122,7 +2122,7 @@ static NTSTATUS prepare_next_frag(struct rpc_api_pipe_req_state *state,
        NTSTATUS status;
        union dcerpc_payload u;
 
-       data_left = prs_offset(state->req_data) - state->req_data_sent;
+       data_left = state->req_data->length - state->req_data_sent;
 
        data_sent_thistime = calculate_data_len_tosend(
                state->cli, data_left, &frag_len, &auth_len, &ss_padding);
@@ -2139,7 +2139,7 @@ static NTSTATUS prepare_next_frag(struct rpc_api_pipe_req_state *state,
 
        ZERO_STRUCT(u.request);
 
-       u.request.alloc_hint    = prs_offset(state->req_data);
+       u.request.alloc_hint    = state->req_data->length;
        u.request.context_id    = 0;
        u.request.opnum         = state->op_num;
 
@@ -2160,8 +2160,7 @@ static NTSTATUS prepare_next_frag(struct rpc_api_pipe_req_state *state,
 
        /* Copy in the data, plus any ss padding. */
        if (!data_blob_append(NULL, &state->rpc_out,
-                               prs_data_p(state->req_data)
-                                       + state->req_data_sent,
+                               state->req_data->data + state->req_data_sent,
                                data_sent_thistime)) {
                return NT_STATUS_NO_MEMORY;
        }
index 2fb96552077a7bd3d6ac291e036877a16b633104..a1642c03ff3adf7ff22d18943e1706c7856a5cc3 100644 (file)
@@ -24,7 +24,7 @@
 
 struct cli_do_rpc_ndr_state {
        const struct ndr_interface_call *call;
-       prs_struct q_ps;
+       DATA_BLOB q_pdu;
        DATA_BLOB r_pdu;
        void *r;
 };
@@ -41,9 +41,7 @@ struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req, *subreq;
        struct cli_do_rpc_ndr_state *state;
        struct ndr_push *push;
-       DATA_BLOB blob;
        enum ndr_err_code ndr_err;
-       bool ret;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct cli_do_rpc_ndr_state);
@@ -65,7 +63,7 @@ struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx,
                                         state->call->name, NDR_IN, r);
        }
 
-       push = ndr_push_init_ctx(talloc_tos());
+       push = ndr_push_init_ctx(state);
        if (tevent_req_nomem(push, req)) {
                return tevent_req_post(req, ev);
        }
@@ -77,16 +75,11 @@ struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       blob = ndr_push_blob(push);
-       ret = prs_init_data_blob(&state->q_ps, &blob, state);
+       state->q_pdu = ndr_push_blob(push);
+       talloc_steal(mem_ctx, state->q_pdu.data);
        TALLOC_FREE(push);
 
-       if (!ret) {
-               tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
-               return tevent_req_post(req, ev);
-       }
-
-       subreq = rpc_api_pipe_req_send(state, ev, cli, opnum, &state->q_ps);
+       subreq = rpc_api_pipe_req_send(state, ev, cli, opnum, &state->q_pdu);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }