1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-10 01:02:57 +03:00
Commit Graph

170 Commits

Author SHA1 Message Date
Georg Richter
2000b06183 Replace SET_CLIENT_STMT_ERROR by stmt_set_error(). 2023-04-11 18:31:19 +02:00
Georg Richter
17d4f38403 Fix for CONC-642: Set CR_OUT_OF_MEMORY error
Set CR_OUT_OF_MEMORY error in mysql_use_result() api function
if allocation of memory failed.
2023-03-30 13:30:53 +02:00
Georg Richter
75439c0f39 CONC-632
When resetting the connection with mysql reset_connection(), the
server_status must be checked and any other resultsets that mayi
exist must be removed.
2023-02-08 11:46:39 +01:00
Georg Richter
d204e83104 Return correct client library version number instead of
server number in mysql_get_client_versio
2023-01-16 14:14:59 +01:00
Georg Richter
d712484dab Set MARIADB_PACKAGE_VERSION instead of
MARIADB_CLIENT_VERSION_STR for obtaining client_info.
2023-01-16 13:56:22 +01:00
Georg Richter
bf82b2d8cb Fix for CONC-624:
- ER() macro now checks if the error code is known, if not it will return
  "Unknown or undefined error code" (instead of crashing)
- SET_CLIENT_STMT_ERROR now maps to stmt_set_error and accepts variadic
  arguments
2023-01-15 14:11:54 +01:00
Georg Richter
9a572bc548 Fix for CONC-604 and CONC-605:
This patch fixes a crash when reconnectiong via TLS.
2022-07-18 11:41:46 +02:00
Georg Richter
ab7a81e79e Added new macro OPT_SET_EXTENDED_VALUE_BIN
OPT_SET_EXTENDED_VALUE_BIN can be used to set
binary values for options:
OPT_SET_EXTENDED_VALUE_BIN(options, key, key_len, val, len)
2022-04-30 05:37:31 +02:00
Georg Richter
f75a819efd Post fix for CONC-588
Instead to allocate procy header string the poiter was assigned
to extended options.
2022-04-29 16:30:27 +02:00
Georg Richter
3ce51b0b3e Fix for CONC-587:
Since alerts may happen after handshake (for example with described
test in CONC-587 using TLSv1.3 protocol or by renegotiation) the
tls error message needs to be retrieved if error is a protocol error
(SSL_ERROR_SSL) and/or if errno was not set.
2022-04-20 18:48:54 +02:00
Georg Richter
f192d3d1ba Fix for CONC-588:
Free proxy_header (allocated via MARIADB_OPT_PROXY_HEADER option)
when closing connection.
2022-04-19 06:27:32 +02:00
Sergei Golubchik
43b60edc92 use mariadb_connection() to detect whether the server is MariaDB 2021-12-25 17:23:38 +01:00
Georg Richter
f6b8fe10c3 Fix for CONC-568:
If multiple threads attempt to connect to a server using a
dynamically loaded authentication plugin the error
"plugin is already loaded" might occur. This is caused
by a race condition if one thread waits for a lock to
load the plugin, while another process which obtained the lock
already loaded the plugin.

The API function mysql_load_plugin_v() now returns
the plugin handle (instead of raising an error and returning
a NULL handle) even if the plugin was already loaded.
2021-10-08 10:20:23 +02:00
Georg Richter
d19c7c6926 Fix for CONC-543 (hash functions conflict with GnuTLS)
To allow static linking with GnuTLS hash lookup functions are now
prefixed with ma_hashtbl_. The files hash.c and hash.h were renamed
to ma_hashtbl.c and ma_hashtbl.h
2021-04-13 21:34:29 +02:00
Georg Richter
2ff01c121c Fix for CONC-518:
Check if mysql->options.extension was allocated before checking
async_context: this is handled by IS_MYSQL_ASYNC() macro now.
2020-11-27 18:33:06 +01:00
Georg Richter
820faff627 codespell fixes, removed MSDOS preprocessor macros 2020-11-26 09:07:17 +01:00
Georg Richter
b2966c05e4 Revert "MDEV-19237 - do not resend prepared statement metadata unnecessarily":
This reverts commit ed4d747510.
2020-10-20 14:57:22 +02:00
Vladislav Vaintroub
ed4d747510 MDEV-19237 - do not resend prepared statement metadata unnecessarily
fix warnings
2020-10-15 22:25:09 +02:00
Vladislav Vaintroub
c0837c3b8d MDEV-21612 Remove COM_MULTI.
The server command code 254 is now reserved,
as well as corresponding protocol flag.

Do not reuse them.
2020-09-22 17:26:04 +02:00
xantares
9d7c233e8d Fix include on case-sensitive fs
shlwapi is lowercase on case-sensitive file-systems
2020-09-12 14:29:56 +02:00
Georg Richter
29a3396456 CONC-302: Added support for SESSION_TRACK_GTIDS (MySQL server) 2020-09-12 10:58:33 +02:00
Georg Richter
3e699a1738 CONC-496: Added support for SESSION_TRACK_TRANSACTION_STATE in ok packet 2020-09-10 14:03:00 +02:00
Dianne Skoll
73dfd1ee48 Clear out free'd pointers for safety. 2020-08-13 14:16:29 -04:00
Sergei Golubchik
2759b87d72 sanity checks for client-supplied OK packet content
reported by Matthias Kaiser, Apple Information Security
2020-05-07 15:06:32 +02:00
Sergei Golubchik
ca8f94f727 BUG#29597896 - NULL POINTER DEREFERENCE IN LIBMYSQL
CONC version of server commit e8e67bd4a4c
2020-05-04 09:14:45 +02:00
Marko Mäkelä
7a2c052ffc MemorySanitizer: Avoid calling uninstrumented getservbyname() 2020-03-28 20:12:43 +02:00
Georg Richter
8c773db1fb Fix for CONC-441:
Instead of getlogin() we first try to determine the current user of the process
by calling getpwuid(). If for some reaon getpwuid() will fail, we will use getlogin() instead.
2020-03-12 18:09:40 +01:00
Georg Richter
f9a50468cd Merge pull request #129 from ottok/3.1-fix-spelling
Fix typo in output string: inital -> initial
2020-03-11 08:25:59 +01:00
Alexander Barkov
6632cb69d7 MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY 2020-03-10 17:02:59 +04:00
Georg Richter
d4f75481f6 Fix for CONC-458:
Fixed crash in mysql_get_timeout and mysql_get_timeout_ms functions,
which happened when no asynchronous context was set before.
2020-03-05 09:50:12 +01:00
Otto Kekäläinen
c0d5d7d15b Fix typo in output string: inital -> initial 2020-03-04 20:05:56 +02:00
Georg Richter
6a0c8ff2e5 Fix for CONC-457:
mysql_list_processlists was marked as deprecated in MySQL 4.0 and not
updated anymore. It exists still in latest MySQL and MariaDB connectors.
It now supports the 4.1 protocol, using 7 instead of 5 fields.

The following functions are now marked deprecated in source:
* mysql_list_dbs
* mysql_list_tables
* mysql_list_processes
2020-02-28 12:56:37 +01:00
Georg Richter
1218ffac1a Fix for CONC-452 and CONC-453:
Various coverity scan fixes, including CONC-452 and CONC-453.
Special thanks to Lukas Javorsky for fixing numerous covscan
issues (This patch includes part of his pull request #126).

Coverity scan build was using the following cmake parameters:
-WITH_EXTERNAL_ZLIB=ON -DWITH_UNIT_TESTS=OFF.

CWE-416 (use after free) in dtoa.c (from netlib) is still open.
2020-02-14 09:52:21 +01:00
Georg Richter
17ba6affa9 Fix for mysql_set_character_set:
Give a more detailled error information, in case SET NAMES failed.
2020-02-06 10:08:32 +01:00
Georg Richter
a1283d0b10 cleanup (patch provided by Alexander Barkov)
move function prototypes used in mariadb_lib.c and mariadb_stmt.c
to include/ma_priv.h
2020-01-20 17:44:49 +01:00
Oleksandr Byelkin
42be9e67d8 Bug#29630767 - USE OF UNINITIALIZED VALUE IN LIBMYSQL (CLIENT.CC FUNCTION RUN_PLUGIN_AUTH) 2020-01-20 11:14:21 +01:00
Oleksandr Byelkin
980f2dbea6 Typo fixed 2019-10-31 06:06:39 +01:00
Georg Richter
a0cbee900b Schannel fix for 9ba8e32f6d
When we try to reconnect we need to set CLIENT_REMEMBER_OPTIONS otherwise
new connection will not be secure.
2019-10-11 16:39:01 +02:00
Georg Richter
0235aa6adc Fixed gcc warning (missing const qualifier) 2019-10-08 14:18:01 +02:00
Georg Richter
de04c2e01f Workaround for CONC-417, MDEV-13492
At irregular intervals older windows versions (prior Windows 10) fail to establish a secure (TLS)
connection and return errors SEC_E_INVALID_TOKEN, SEC_E_BUFFER_TOO_SMALL or SEC_E_MESSAGE_ALTERED.
This is a bug in windows schannel library and was only fixed in recent versions, also OpenSSL provided
a workaround (see https://github.com/openssl/openssl/pull/1350).
Since we are unable to fix this, we introduced a workaround for this problem. In case of an error
during TLS handshake we check the errorcode and try to reconnect up to three times if the error code
was SEC_E_INVALID_TOKEN, SEC_E_BUFFER_TOO_SMALL or SEC_E_MESSAGE_ALTERED.
2019-09-19 08:50:55 +02:00
zhangk143
9cb1322de0 fix bug CONC-400 error with sizeof("commit") in function mysql_commit 2019-06-19 10:12:00 +08:00
Georg Richter
2fdaf1d447 Fix for CONC-402: Replace underscores with dashes in conf_key values in mariadb_defaults array 2019-04-19 12:23:32 +02:00
Georg Richter
ad385b954a CONC-394: Some TLS related options are not settable in configuration file
The following options are now supported in configuration files:
* ssl_enforce (bool)
* ssl_crl (string)
* ssl_crlpath (string)
2019-04-06 11:42:24 +02:00
Georg Richter
a8bec1c68a CONC-395: Dashes and underscores are not interchangeable in options in my.cnf 2019-03-26 16:48:21 +01:00
Georg Richter
af47d1beab Merge branch '3.0' into 3.1 2019-03-03 14:03:20 +01:00
Georg Richter
68d05007bb Fix for CONC-392:
Fixed crash when server sent session tracking information with session type
SESSION_TRACK_STATE_CHANGE. In this special case the packet doesn't contain
the overall length. (see https://mariadb.com/kb/en/library/ok_packet/).
2019-03-02 07:54:06 +01:00
Georg Richter
31ae1278aa Fix for MDEV-18721 (Host option in configuration file is ignored.)
We need to check the passed host variable after the configuration file was read.
Thanks to Peter Penchev and Corey Hickey for providing patches.
2019-02-24 20:00:02 +01:00
Sergei Golubchik
4aad20db15 Merge tag 'v3.0.9' into 3.1 2019-02-18 20:16:23 +01:00
Sergei Golubchik
2c5aebb3bc auto_local_infile is not an user-settable option
it's an internal state variable, should be in st_mariadb_extension.

In particular, treating it like an option, caused mysql->options
to be allocated in mysql_init(), which caused failed reconnects
to leak memory:

Direct leak of 10824 byte(s) in 33 object(s) allocated from:
    #0 0x7f00db5ba79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x55eb1b1d545e in mysql_init /home/buildbot/mariadb-10.2-build24320/libmariadb/libmariadb/mariadb_lib.c:1021
    #2 0x55eb1b1e342e in mariadb_reconnect /home/buildbot/mariadb-10.2-build24320/libmariadb/libmariadb/mariadb_lib.c:1621
    ...
2019-02-08 16:36:35 +01:00
Georg Richter
70f2964dc4 Fix for CONC-384:
fixed length calculation for connection attributes. We now call mysql_net_store_length passing the size of the connection attribute and substract the offset of the passed buffer to determine the correct size.
2019-02-07 04:14:55 +01:00