1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Merge branch '3.2' into 3.3

This commit is contained in:
Georg Richter
2022-04-20 18:55:58 +02:00
11 changed files with 65 additions and 32 deletions

View File

@@ -21,6 +21,7 @@ SET(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T)
SET(CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
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)

View File

@@ -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

View File

@@ -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 {

View File

@@ -254,6 +254,8 @@
#if defined(__EMX__) || !defined(HAVE_UINT)
typedef unsigned int uint;
#endif
#if defined(__EMX__) || !defined(HAVE_USHORT)
typedef unsigned short ushort;
#endif

View File

@@ -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

View File

@@ -205,10 +205,16 @@ restart:
if (len == packet_error || len == 0)
{
end_server(mysql);
#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)
@@ -2256,6 +2262,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))

View File

@@ -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;
}
@@ -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;
}

View File

@@ -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 */

View File

@@ -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

View File

@@ -1,23 +0,0 @@
/*
Copyright (c) 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <mysql.h>
#include <string.h>
#include "ref10/api.h"
#include "crypto_sign.h"
#define NONCE_BYTES 32

View File

@@ -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,