Revert "s4:librpc: simplify dcerpc_connect_timeout_handler() logic"
authorStefan Metzmacher <metze@samba.org>
Mon, 29 May 2017 07:32:12 +0000 (09:32 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 30 May 2017 06:06:07 +0000 (08:06 +0200)
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 <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/librpc/rpc/dcerpc.h
source4/librpc/rpc/dcerpc_connect.c

index eaa3c627b74894fd98145d5961fe89799b073d1d..3223948cf9d312f3cc839e943e621b9d1c54fdc4 100644 (file)
@@ -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;
 };
 
index 723e657c70ac7c40bfe97be5bda5f6144c9c32f5..8ed12578e212f37425ad8bb870052a303ef41197 100644 (file)
@@ -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);