struct bind_auth_state {
struct dcerpc_pipe *pipe;
+ struct ndr_syntax_id syntax;
+ struct ndr_syntax_id transfer_syntax;
struct dcerpc_auth out_auth_info;
struct dcerpc_auth in_auth_info;
bool more_processing; /* Is there anything more to do after the
}
+static void dcerpc_bind_auth_gensec_done(struct tevent_req *subreq);
+
/**
Bind to a DCE/RPC pipe, send async request
@param mem_ctx TALLOC_CTX for the allocation of the composite_context
struct bind_auth_state *state;
struct dcecli_security *sec;
struct tevent_req *subreq;
- struct ndr_syntax_id syntax, transfer_syntax;
const char *target_principal = NULL;
/* composite context allocation and setup */
state->pipe = p;
c->status = dcerpc_init_syntaxes(p, table,
- &syntax,
- &transfer_syntax);
+ &state->syntax,
+ &state->transfer_syntax);
if (!composite_is_ok(c)) return c;
sec = &p->conn->security_state;
* it doesn't like that either
*/
- state->pipe->inhibit_timeout_processing = true;
- state->pipe->timed_out = false;
- c->status = gensec_update_ev(sec->generic_state, state,
- p->conn->event_ctx,
- data_blob_null,
- &state->out_auth_info.credentials);
- if (state->pipe->timed_out) {
- composite_error(c, NT_STATUS_IO_TIMEOUT);
- return c;
- }
- state->pipe->inhibit_timeout_processing = false;
+ subreq = gensec_update_send(state,
+ p->conn->event_ctx,
+ sec->generic_state,
+ data_blob_null);
+ if (composite_nomem(subreq, c)) return c;
+ tevent_req_set_callback(subreq, dcerpc_bind_auth_gensec_done, c);
+ return c;
+}
+
+static void dcerpc_bind_auth_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;
+
+ c->status = gensec_update_recv(subreq, state,
+ &state->out_auth_info.credentials);
+ TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(c->status) &&
!NT_STATUS_EQUAL(c->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
composite_error(c, c->status);
- return c;
+ return;
}
state->more_processing = NT_STATUS_EQUAL(c->status,
if (state->out_auth_info.credentials.length == 0) {
composite_done(c);
- return c;
+ return;
}
if (gensec_have_feature(sec->generic_state, GENSEC_FEATURE_SIGN_PKT_HEADER)) {
/* The first request always is a dcerpc_bind. The subsequent ones
* depend on gensec results */
subreq = dcerpc_bind_send(state, p->conn->event_ctx, p,
- &syntax, &transfer_syntax);
- if (composite_nomem(subreq, c)) return c;
+ &state->syntax, &state->transfer_syntax);
+ if (composite_nomem(subreq, c)) return;
tevent_req_set_callback(subreq, bind_auth_recv_bindreply, c);
- return c;
+ return;
}