librpc/rpc/binding_handle.c...
authorStefan Metzmacher <metze@samba.org>
Sat, 21 Sep 2013 06:10:59 +0000 (08:10 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 11:14:55 +0000 (13:14 +0200)
librpc/rpc/binding_handle.c

index f5f75aadd243bf60ccbc4f9e058963801b88a54e..d856bbdbfbacf46255b53676f49a4982458e7278 100644 (file)
@@ -1053,6 +1053,7 @@ struct dcerpc_binding_handle_call_params_pull_state {
        struct dcerpc_pipe_handle *p;
        void *chunk_mem;
        void *chunk_ptr;
+       bool is_last_chunk;
 };
 
 static int dcerpc_binding_handle_call_params_pull_state_destructor(
@@ -1061,15 +1062,14 @@ static int dcerpc_binding_handle_call_params_pull_state_destructor(
        struct dcerpc_binding_handle_call_params_pipe *pp =
                dcerpc_pipe_handle_data(state->p,
                struct dcerpc_binding_handle_call_params_pipe);
-       struct dcerpc_binding_handle_call_params_state *call_state =
-               tevent_req_data(pp->call_req,
-               struct dcerpc_binding_handle_call_params_state);
 
        pp->pull_req = NULL;
 
-       dcerpc_pipe_handle_connection_disconnect(call_state->pc);
-       call_state->pc = NULL;
-       call_state->call_pipe = NULL;
+       if (!state->is_last_chunk) {
+               return 0;
+       }
+
+       dcerpc_binding_handle_call_params_next_pipe(pp->call_req);
        return 0;
 }
 
@@ -1096,18 +1096,19 @@ static struct tevent_req *dcerpc_binding_handle_call_params_pull_send(TALLOC_CTX
        state->p = p;
        state->chunk_mem = chunk_mem;
        state->chunk_ptr = chunk_ptr;
+       state->is_last_chunk = true;
 
        tevent_req_defer_callback(req, state->ev);
 
+       talloc_set_destructor(state,
+                             dcerpc_binding_handle_call_params_pull_state_destructor);
+       pp->pull_req = req;
+
        dcerpc_binding_handle_call_params_pull_notify(req);
        if (!tevent_req_is_in_progress(req)) {
                return tevent_req_post(req, ev);
        }
 
-       talloc_set_destructor(state,
-                             dcerpc_binding_handle_call_params_pull_state_destructor);
-       pp->pull_req = req;
-
        return req;
 }
 
@@ -1179,9 +1180,6 @@ static void dcerpc_binding_handle_call_params_pull_notify(struct tevent_req *req
                return;
        }
 
-       pp->pull_req = NULL;
-       talloc_set_destructor(state, NULL);
-
        /*
         * Note: the first struct member is always
         * 'uint32_t count;'
@@ -1189,12 +1187,13 @@ static void dcerpc_binding_handle_call_params_pull_notify(struct tevent_req *req
        count = (const uint32_t *)state->chunk_ptr;
 
        if (*count != 0) {
+               state->is_last_chunk = false;
                tevent_req_done(req);
                return;
        }
 
+       state->is_last_chunk = true;
        tevent_req_done(req);
-       dcerpc_binding_handle_call_params_next_pipe(pp->call_req);
 
 }