]> TLD Linux GIT Repositories - packages/mysql.git/blob - ssl-errors.patch
- Percona 5.7 is no longer available, MySQL 5.7 from PLD
[packages/mysql.git] / ssl-errors.patch
1 diff -urp mysql-5.7.36.org/vio/viossl.c mysql-5.7.36/vio/viossl.c
2 --- mysql-5.7.36.org/vio/viossl.c       2021-09-07 07:26:47.000000000 +0200
3 +++ mysql-5.7.36/vio/viossl.c   2021-11-29 10:34:20.106597290 +0100
4 @@ -137,7 +137,7 @@ static my_bool ssl_should_retry(Vio *vio
5                                  enum enum_vio_io_event *event,
6                                  unsigned long *ssl_errno_holder)
7  {
8 -  int ssl_error;
9 +  int ssl_error, err_error;
10    SSL *ssl= vio->ssl_arg;
11    my_bool should_retry= TRUE;
12  
13 @@ -148,12 +148,23 @@ static my_bool ssl_should_retry(Vio *vio
14    switch (ssl_error)
15    {
16    case SSL_ERROR_WANT_READ:
17 +    err_error = ssl_error;  // for backward compatibility.
18      *event= VIO_IO_EVENT_READ;
19      break;
20    case SSL_ERROR_WANT_WRITE:
21 +    err_error = ssl_error;  // for backward compatibility.
22      *event= VIO_IO_EVENT_WRITE;
23      break;
24    default:
25 +    /* first save the top ERR error */
26 +#ifdef HAVE_WOLFSSL
27 +    /* TODO: when wolfSSL issue 4240 is fixed (see bug 27855668) remove the
28 +     * "if" branch */
29 +    err_error = ssl_error;
30 +#else
31 +    err_error = ERR_get_error();
32 +#endif
33 +    /* now report all remaining errors on and/or clear the error stack */
34  #ifndef NDEBUG  /* Debug build */
35      /* Note: the OpenSSL error queue gets cleared in report_errors(). */
36      report_errors(ssl);
37 @@ -166,7 +177,7 @@ static my_bool ssl_should_retry(Vio *vio
38      break;
39    }
40  
41 -  *ssl_errno_holder= ssl_error;
42 +  *ssl_errno_holder= err_error;
43  
44    return should_retry;
45  }