mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3:lib/tls: we need to call tstream_tls_retry_handshake/disconnect() until all buffers are flushed
Before the handshare or disconnect is over we need to wait until we delivered the lowlevel messages to the transport/kernel socket. Otherwise we'll have a problem if another tevent_context is used after the handshake. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15621 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
5844ef27aa
commit
6688945fa0
@ -70,6 +70,10 @@ struct tstream_tls {
|
||||
|
||||
struct tevent_immediate *retry_im;
|
||||
|
||||
struct {
|
||||
struct tevent_req *mgmt_req;
|
||||
} waiting_flush;
|
||||
|
||||
struct {
|
||||
uint8_t *buf;
|
||||
off_t ofs;
|
||||
@ -121,6 +125,17 @@ static void tstream_tls_retry(struct tstream_context *stream, bool deferred)
|
||||
tstream_context_data(stream,
|
||||
struct tstream_tls);
|
||||
|
||||
if (tlss->push.subreq == NULL && tlss->pull.subreq == NULL) {
|
||||
if (tlss->waiting_flush.mgmt_req != NULL) {
|
||||
struct tevent_req *req = tlss->waiting_flush.mgmt_req;
|
||||
|
||||
tlss->waiting_flush.mgmt_req = NULL;
|
||||
|
||||
tevent_req_done(req);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (tlss->disconnect.req) {
|
||||
tstream_tls_retry_disconnect(stream);
|
||||
return;
|
||||
@ -785,6 +800,11 @@ static void tstream_tls_retry_disconnect(struct tstream_context *stream)
|
||||
return;
|
||||
}
|
||||
|
||||
if (tlss->push.subreq != NULL || tlss->pull.subreq != NULL) {
|
||||
tlss->waiting_flush.mgmt_req = req;
|
||||
return;
|
||||
}
|
||||
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
@ -1477,6 +1497,11 @@ static void tstream_tls_retry_handshake(struct tstream_context *stream)
|
||||
}
|
||||
}
|
||||
|
||||
if (tlss->push.subreq != NULL || tlss->pull.subreq != NULL) {
|
||||
tlss->waiting_flush.mgmt_req = req;
|
||||
return;
|
||||
}
|
||||
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user