Import Debian changes 4.92-8+deb10u6
[hcoop/debian/exim4.git] / debian / patches / 80_03-GnuTLS-Do-not-care-about-corked-data-when-uncorking.patch
1 From 3afb07f2c63fb6dc3983b28e7cdaf11fceb741d1 Mon Sep 17 00:00:00 2001
2 From: "Heiko Schlittermann (HS12-RIPE)" <hs@schlittermann.de>
3 Date: Mon, 2 Mar 2020 22:56:32 +0100
4 Subject: [PATCH 6/6] GnuTLS: Do not care about corked data when uncorking
5
6 (cherry picked from commit d8d7e3a4162b52382daf8319f221c085c76c5b8f)
7 ---
8 src/tls-gnu.c | 31 +++++++++++++++----------------
9 1 file changed, 15 insertions(+), 16 deletions(-)
10
11 diff --git a/src/tls-gnu.c b/src/tls-gnu.c
12 index 94a718673..2091e44db 100644
13 --- a/src/tls-gnu.c
14 +++ b/src/tls-gnu.c
15 @@ -2887,22 +2887,21 @@ if (len > INT_MAX)
16 if (!more && state->corked)
17 {
18 DEBUG(D_tls) debug_printf("gnutls_record_uncork(session=%p)\n", state->session);
19 - do {
20 - do
21 - /* We can't use GNUTLS_RECORD_WAIT here, as it retries on
22 - GNUTLS_E_AGAIN || GNUTLS_E_INTR, which would break our timeout set by alarm().
23 - The GNUTLS_E_AGAIN should not happen ever, as our sockets are blocking anyway.
24 - But who knows. (That all relies on the fact that GNUTLS_E_INTR and GNUTLS_E_AGAIN
25 - match the EINTR and EAGAIN errno values.) */
26 - outbytes = gnutls_record_uncork(state->session, 0);
27 - while (outbytes == GNUTLS_E_AGAIN);
28 -
29 - if (outbytes < 0)
30 - {
31 - record_io_error(state, len, US"uncork", NULL);
32 - return -1;
33 - }
34 - } while (gnutls_record_check_corked(state->session) > 0);
35 + do
36 + /* We can't use GNUTLS_RECORD_WAIT here, as it retries on
37 + GNUTLS_E_AGAIN || GNUTLS_E_INTR, which would break our timeout set by alarm().
38 + The GNUTLS_E_AGAIN should not happen ever, as our sockets are blocking anyway.
39 + But who knows. (That all relies on the fact that GNUTLS_E_INTR and GNUTLS_E_AGAIN
40 + match the EINTR and EAGAIN errno values.) */
41 + outbytes = gnutls_record_uncork(state->session, 0);
42 + while (outbytes == GNUTLS_E_AGAIN);
43 +
44 + if (outbytes < 0)
45 + {
46 + record_io_error(state, len, US"uncork", NULL);
47 + return -1;
48 + }
49 +
50 state->corked = FALSE;
51 }
52 #endif
53 --
54 2.28.0
55