s4:librpc: make use of gensec_update_send() in bind_auth_next_step()
authorStefan Metzmacher <metze@samba.org>
Mon, 15 May 2017 20:46:39 +0000 (22:46 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 21 May 2017 19:05:13 +0000 (21:05 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/librpc/rpc/dcerpc_auth.c

index ee13a6b094b79ce4e701b6c184db824c4333a2d1..a2d1418ea14471c54529ac08b67d29670b2027ed 100644 (file)
@@ -144,6 +144,7 @@ struct bind_auth_state {
                                 * first bind itself received? */
 };
 
+static void bind_auth_next_gensec_done(struct tevent_req *subreq);
 static void bind_auth_recv_alter(struct tevent_req *subreq);
 
 static void bind_auth_next_step(struct composite_context *c)
@@ -151,7 +152,6 @@ static void bind_auth_next_step(struct composite_context *c)
        struct bind_auth_state *state;
        struct dcecli_security *sec;
        struct tevent_req *subreq;
-       bool more_processing = false;
 
        state = talloc_get_type(c->private_data, struct bind_auth_state);
        sec = &state->pipe->conn->security_state;
@@ -187,18 +187,29 @@ static void bind_auth_next_step(struct composite_context *c)
         * it doesn't like that either
         */
 
-       state->pipe->inhibit_timeout_processing = true;
-       state->pipe->timed_out = false;
+       subreq = gensec_update_send(state,
+                                   state->pipe->conn->event_ctx,
+                                   sec->generic_state,
+                                   state->in_auth_info.credentials);
+       if (composite_nomem(subreq, c)) return;
+       tevent_req_set_callback(subreq, bind_auth_next_gensec_done, c);
+}
 
-       c->status = gensec_update_ev(sec->generic_state, state,
-                                 state->pipe->conn->event_ctx,
-                                 state->in_auth_info.credentials,
-                                 &state->out_auth_info.credentials);
-       if (state->pipe->timed_out) {
-               composite_error(c, NT_STATUS_IO_TIMEOUT);
-               return;
-       }
-       state->pipe->inhibit_timeout_processing = false;
+static void bind_auth_next_gensec_done(struct tevent_req *subreq)
+{
+       struct composite_context *c =
+               tevent_req_callback_data(subreq,
+               struct composite_context);
+       struct bind_auth_state *state =
+               talloc_get_type_abort(c->private_data,
+               struct bind_auth_state);
+       struct dcerpc_pipe *p = state->pipe;
+       struct dcecli_security *sec = &p->conn->security_state;
+       bool more_processing = false;
+
+       c->status = gensec_update_recv(subreq, state,
+                                      &state->out_auth_info.credentials);
+       TALLOC_FREE(subreq);
 
        if (NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
                more_processing = true;