Skip to content

Commit

Permalink
Merge branch '3.1' into 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed Apr 20, 2022
2 parents bc94588 + 3ce51b0 commit 3ba4c4a
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 32 deletions.
1 change: 1 addition & 0 deletions cmake/CheckTypes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
CHECK_TYPE_SIZE(uchar SIZEOF_UCHAR)
CHECK_TYPE_SIZE(uint SIZEOF_UINT)
CHECK_TYPE_SIZE(uint SIZEOF_USHORT)
CHECK_TYPE_SIZE(ulong SIZEOF_ULONG)
CHECK_TYPE_SIZE(int8 SIZEOF_INT8)
CHECK_TYPE_SIZE(uint8 SIZEOF_UINT8)
Expand Down
5 changes: 5 additions & 0 deletions include/ma_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
# define HAVE_UINT 1
#endif

#cmakedefine SIZEOF_USHORT @SIZEOF_USHORT@
#if defined(SIZEOF_USHORT)
# define HAVE_USHORT 1
#endif

#cmakedefine SIZEOF_ULONG @SIZEOF_ULONG@
#if defined(SIZEOF_ULONG)
# define HAVE_ULONG 1
Expand Down
3 changes: 0 additions & 3 deletions include/ma_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ struct my_context {


#ifdef MY_CONTEXT_USE_UCONTEXT
#if defined(__APPLE__) && !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE 600
#endif
#include <ucontext.h>

struct my_context {
Expand Down
2 changes: 2 additions & 0 deletions include/ma_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@

#if defined(__EMX__) || !defined(HAVE_UINT)
typedef unsigned int uint;
#endif
#if defined(__EMX__) || !defined(HAVE_USHORT)
typedef unsigned short ushort;
#endif

Expand Down
4 changes: 4 additions & 0 deletions libmariadb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ ADD_DEFINITIONS(-D HAVE_COMPRESS)
ADD_DEFINITIONS(-D LIBMARIADB)
ADD_DEFINITIONS(-D THREAD)

IF(APPLE)
ADD_DEFINITIONS(-D _XOPEN_SOURCE)
ENDIF()

INCLUDE(${CC_SOURCE_DIR}/cmake/sign.cmake)

SET(MARIADB_LIB_SYMBOLS
Expand Down
15 changes: 11 additions & 4 deletions libmariadb/mariadb_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,16 @@ ma_net_safe_read(MYSQL *mysql)
if (len == packet_error || len == 0)
{
end_server(mysql);
my_set_error(mysql, net->last_errno == ER_NET_PACKET_TOO_LARGE ?
CR_NET_PACKET_TOO_LARGE:
CR_SERVER_LOST,
SQLSTATE_UNKNOWN, 0, errno);
#ifdef HAVE_TLS
/* don't overwrite possible tls protocol errors */
if (net->last_errno != CR_SSL_CONNECTION_ERROR)
#endif
{
my_set_error(mysql, net->last_errno == ER_NET_PACKET_TOO_LARGE ?
CR_NET_PACKET_TOO_LARGE:
CR_SERVER_LOST,
SQLSTATE_UNKNOWN, 0, errno);
}
return(packet_error);
}
if (net->read_pos[0] == 255)
Expand Down Expand Up @@ -1996,6 +2002,7 @@ static void mysql_close_options(MYSQL *mysql)
free(mysql->options.extension->tls_version);
free(mysql->options.extension->url);
free(mysql->options.extension->connection_handler);
free(mysql->options.extension->proxy_header);
if(ma_hashtbl_inited(&mysql->options.extension->connect_attrs))
ma_hashtbl_free(&mysql->options.extension->connect_attrs);
if (ma_hashtbl_inited(&mysql->options.extension->userdata))
Expand Down
14 changes: 14 additions & 0 deletions libmariadb/secure/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,14 @@ ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
{
int error= SSL_get_error((SSL *)ctls->ssl, rc);
if (error != SSL_ERROR_WANT_READ)
{
if (error == SSL_ERROR_SSL || errno == 0)
{
MYSQL *mysql= SSL_get_app_data(ctls->ssl);
ma_tls_set_error(mysql);
}
return rc;
}
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.read_timeout) < 1)
return rc;
}
Expand All @@ -607,7 +614,14 @@ ssize_t ma_tls_write(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
{
int error= SSL_get_error((SSL *)ctls->ssl, rc);
if (error != SSL_ERROR_WANT_WRITE)
{
if (error == SSL_ERROR_SSL || errno == 0)
{
MYSQL *mysql= SSL_get_app_data(ctls->ssl);
ma_tls_set_error(mysql);
}
return rc;
}
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.write_timeout) < 1)
return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/auth/ed25519.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extern BCRYPT_ALG_HANDLE Sha512Prov;
#endif

#include <ref10/api.h>
#include <ref10/common.h>
#include <ed25519_common.h>
#include <ma_crypt.h>

/* function prototypes */
Expand Down
26 changes: 26 additions & 0 deletions plugins/auth/ed25519_common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/************************************************************************************
Copyright (C) 2017-2022 MariaDB Corporation AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not see <http://www.gnu.org/licenses>
or write to the Free Software Foundation, Inc.,
51 Franklin St., Fifth Floor, Boston, MA 02110, USA
*************************************************************************************/

#include <mysql.h>
#include <string.h>

#include "ref10/api.h"
#include "crypto_sign.h"

#define NONCE_BYTES 32
23 changes: 0 additions & 23 deletions plugins/auth/ref10/common.h

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/pvio/pvio_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct st_ma_pvio_methods pvio_socket_methods= {
#ifndef PLUGIN_DYNAMIC
MARIADB_PVIO_PLUGIN pvio_socket_client_plugin=
#else
MARIADB_PVIO_PLUGIN _mysql_client_plugin_declaration_
MARIADB_PVIO_PLUGIN _mysql_client_plugin_declaration_=
#endif
{
MARIADB_CLIENT_PVIO_PLUGIN,
Expand Down

0 comments on commit 3ba4c4a

Please sign in to comment.