From: Stefan Metzmacher Date: Fri, 26 Jan 2024 14:30:09 +0000 (+0100) Subject: s4:lib/tls: assert that event contexts are not mixed X-Git-Tag: tdb-1.4.11~989 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac4bca77039cbc31323fb10b3706ed959a0cbbcd;p=thirdparty%2Fsamba.git 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 --- 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,