From ac4bca77039cbc31323fb10b3706ed959a0cbbcd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 26 Jan 2024 15:30:09 +0100 Subject: [PATCH] s4:lib/tls: assert that event contexts are not mixed BUG: https://bugzilla.samba.org/show_bug.cgi?id=15621 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- source4/lib/tls/tls_tstream.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source4/lib/tls/tls_tstream.c b/source4/lib/tls/tls_tstream.c index 364bb421078..347c47ed48e 100644 --- a/source4/lib/tls/tls_tstream.c +++ b/source4/lib/tls/tls_tstream.c @@ -414,6 +414,12 @@ static struct tevent_req *tstream_tls_readv_send(TALLOC_CTX *mem_ctx, struct tstream_tls_readv_state *state; tlss->read.req = NULL; + + if (tlss->current_ev != ev) { + SMB_ASSERT(tlss->push.subreq == NULL); + SMB_ASSERT(tlss->pull.subreq == NULL); + } + tlss->current_ev = ev; req = tevent_req_create(mem_ctx, &state, @@ -578,6 +584,12 @@ static struct tevent_req *tstream_tls_writev_send(TALLOC_CTX *mem_ctx, struct tstream_tls_writev_state *state; tlss->write.req = NULL; + + if (tlss->current_ev != ev) { + SMB_ASSERT(tlss->push.subreq == NULL); + SMB_ASSERT(tlss->pull.subreq == NULL); + } + tlss->current_ev = ev; req = tevent_req_create(mem_ctx, &state, @@ -744,6 +756,12 @@ static struct tevent_req *tstream_tls_disconnect_send(TALLOC_CTX *mem_ctx, struct tstream_tls_disconnect_state *state; tlss->disconnect.req = NULL; + + if (tlss->current_ev != ev) { + SMB_ASSERT(tlss->push.subreq == NULL); + SMB_ASSERT(tlss->pull.subreq == NULL); + } + tlss->current_ev = ev; req = tevent_req_create(mem_ctx, &state,