STEP03c: rpccli_bh_raw_call_send => dcerpc_do_request_send
authorStefan Metzmacher <metze@samba.org>
Thu, 9 Jan 2014 19:45:34 +0000 (20:45 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 10:45:39 +0000 (12:45 +0200)
source3/rpc_client/cli_pipe.c

index 2c7766035ba89d29d17ea2bcea277e1aa21df114..e3f963346f553f9e70ddcb12b7c98433427e9424 100644 (file)
@@ -2244,6 +2244,7 @@ static void rpccli_bh_auth_info(struct dcerpc_binding_handle *h,
 }
 
 struct rpccli_bh_raw_call_state {
+       struct dcerpc_call *call;
        DATA_BLOB in_data;
        DATA_BLOB out_data;
        uint32_t out_flags;
@@ -2266,6 +2267,7 @@ static struct tevent_req *rpccli_bh_raw_call_send(TALLOC_CTX *mem_ctx,
        struct rpccli_bh_raw_call_state *state;
        bool ok;
        struct tevent_req *subreq;
+       bool bigendian = false;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct rpccli_bh_raw_call_state);
@@ -2281,8 +2283,20 @@ static struct tevent_req *rpccli_bh_raw_call_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       subreq = rpc_api_pipe_req_send(state, ev, hs->rpc_cli,
-                                      opnum, object, &state->in_data);
+       state->call = dcerpc_call_allocate(state,
+                                          hs->rpc_cli->assoc,
+                                          hs->rpc_cli->sec,
+                                          hs->rpc_cli->pres);
+
+       if (in_flags & LIBNDR_FLAG_BIGENDIAN) {
+               bigendian = true;
+       }
+
+       subreq = dcerpc_do_request_send(state, ev, hs->rpc_cli->conn,
+                                       state->call, object, opnum,
+                                       &state->in_data, bigendian);
+//     subreq = rpc_api_pipe_req_send(state, ev, hs->rpc_cli,
+//                                    opnum, &state->in_data);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -2300,18 +2314,25 @@ static void rpccli_bh_raw_call_done(struct tevent_req *subreq)
                tevent_req_data(req,
                struct rpccli_bh_raw_call_state);
        NTSTATUS status;
+       bool bigendian = false;
 
        state->out_flags = 0;
 
        /* TODO: support bigendian responses */
 
-       status = rpc_api_pipe_req_recv(subreq, state, &state->out_data);
+       status = dcerpc_do_request_recv(subreq, state, &state->out_data,
+                                       &bigendian);
+       //status = rpc_api_pipe_req_recv(subreq, state, &state->out_data);
        TALLOC_FREE(subreq);
        if (!NT_STATUS_IS_OK(status)) {
                tevent_req_nterror(req, status);
                return;
        }
 
+       if (bigendian) {
+               state->out_flags |= LIBNDR_FLAG_BIGENDIAN;
+       }
+
        tevent_req_done(req);
 }