From: Stefan Metzmacher Date: Mon, 29 May 2017 07:32:12 +0000 (+0200) Subject: Revert "s4:librpc: simplify dcerpc_connect_timeout_handler() logic" X-Git-Tag: ldb-1.1.30~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27aacf9288aafefb2610adca262086b69be7c827;p=thirdparty%2Fsamba.git Revert "s4:librpc: simplify dcerpc_connect_timeout_handler() logic" This reverts commit 2c3e99d1697b83f7dd498596a274fe2e8e96116d. As the source4 backends for kerberos still use nested event loops, we need to restore this for now. We should reapply this once all backends are fully async. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index eaa3c627b74..3223948cf9d 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -136,6 +136,14 @@ struct dcerpc_pipe { /** timeout for individual rpc requests, in seconds */ uint32_t request_timeout; + /* + * Set for the timeout in dcerpc_pipe_connect_b_send(), to + * allow the timeout not to destory the stack during a nested + * event loop caused by gensec_update() + */ + bool inhibit_timeout_processing; + bool timed_out; + bool verified_pcontext; }; diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index 723e657c70a..8ed12578e21 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -1004,7 +1004,12 @@ static void dcerpc_connect_timeout_handler(struct tevent_context *ev, struct tev { struct composite_context *c = talloc_get_type_abort(private_data, struct composite_context); - composite_error(c, NT_STATUS_IO_TIMEOUT); + struct pipe_connect_state *s = talloc_get_type_abort(c->private_data, struct pipe_connect_state); + if (!s->pipe->inhibit_timeout_processing) { + composite_error(c, NT_STATUS_IO_TIMEOUT); + } else { + s->pipe->timed_out = true; + } } /* @@ -1048,6 +1053,9 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent s->credentials = credentials; s->lp_ctx = lp_ctx; + s->pipe->timed_out = false; + s->pipe->inhibit_timeout_processing = false; + tevent_add_timer(c->event_ctx, c, timeval_current_ofs(DCERPC_REQUEST_TIMEOUT, 0), dcerpc_connect_timeout_handler, c);