Revert "s3:messages: allow messaging_filtered_read_send() to use wrapper tevent_context"
authorRalph Boehme <slow@samba.org>
Thu, 27 Dec 2018 11:45:15 +0000 (12:45 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 Jan 2019 22:11:16 +0000 (23:11 +0100)
This reverts commit 2b05f1098187e00166649c8ea7c63e6901b9d242.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/lib/messages.c

index aa89914..864d758 100644 (file)
@@ -206,7 +206,7 @@ static bool messaging_register_event_context(struct messaging_context *ctx,
                        continue;
                }
 
-               if (tevent_context_same_loop(reg->ev, ev)) {
+               if (reg->ev == ev) {
                        reg->refcount += 1;
                        return true;
                }
@@ -255,7 +255,7 @@ static bool messaging_deregister_event_context(struct messaging_context *ctx,
                        continue;
                }
 
-               if (tevent_context_same_loop(reg->ev, ev)) {
+               if (reg->ev == ev) {
                        reg->refcount -= 1;
 
                        if (reg->refcount == 0) {
@@ -1025,9 +1025,7 @@ struct tevent_req *messaging_filtered_read_send(
        state->filter = filter;
        state->private_data = private_data;
 
-       if (tevent_context_is_wrapper(ev) &&
-           !tevent_context_same_loop(ev, msg_ctx->event_ctx))
-       {
+       if (tevent_context_is_wrapper(ev)) {
                /* This is really a programmer error! */
                DBG_ERR("Wrapper tevent context doesn't use main context.\n");
                tevent_req_error(req, EINVAL);
@@ -1036,11 +1034,7 @@ struct tevent_req *messaging_filtered_read_send(
 
        /*
         * We have to defer the callback here, as we might be called from
-        * within a different tevent_context than state->ev.
-        *
-        * This is important for two cases:
-        * 1. nested event contexts, used by blocking ctdb calls
-        * 2. possible impersonation using wrapper tevent contexts.
+        * within a different tevent_context than state->ev
         */
        tevent_req_defer_callback(req, state->ev);
 
@@ -1336,7 +1330,7 @@ static bool messaging_dispatch_waiters(struct messaging_context *msg_ctx,
 
                state = tevent_req_data(
                        req, struct messaging_filtered_read_state);
-               if (tevent_context_same_loop(ev, state->ev) &&
+               if ((ev == state->ev) &&
                    state->filter(rec, state->private_data)) {
                        messaging_filtered_read_done(req, rec);
                        return true;