diff options
author | Stefan Metzmacher <metze@samba.org> | 2017-05-15 22:36:20 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-05-21 21:05:13 +0200 |
commit | 65655f24842b864f32136c7ffed446223d416512 (patch) | |
tree | 2ff68fd334c45f653e73938c3491836fccd102a5 /source4/librpc | |
parent | f31c55fd9b7d8358255aec11cfe5e9486c6f2483 (diff) | |
download | samba-65655f24842b864f32136c7ffed446223d416512.tar.gz |
s4:librpc: use gensec_update_send() in dcerpc_bind_auth_send()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/rpc/dcerpc_auth.c | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/source4/librpc/rpc/dcerpc_auth.c b/source4/librpc/rpc/dcerpc_auth.c index e790a9f51d2..ee13a6b094b 100644 --- a/source4/librpc/rpc/dcerpc_auth.c +++ b/source4/librpc/rpc/dcerpc_auth.c @@ -136,6 +136,8 @@ _PUBLIC_ NTSTATUS dcerpc_bind_auth_none(struct dcerpc_pipe *p, 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 @@ -289,6 +291,8 @@ static void bind_auth_recv_bindreply(struct tevent_req *subreq) } +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 @@ -313,7 +317,6 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx, 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 */ @@ -327,8 +330,8 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx, 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; @@ -420,22 +423,34 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx, * 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, @@ -443,7 +458,7 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx, 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)) { @@ -462,11 +477,11 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx, /* 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; } |